# Solving linear problem with fuzzy constraints by sampling beta with FuzzyLP in R In a previous post I demonstrated how to use crispLP to solve a simple linear optimization problem with well-defined objective function and constraints. I have also demonstrated how to solve a fuzzy linear optimization problem with uncertain constraints, i.e. fuzzy constraint values. For this I e.g. applied the FuzzyLP package with the function FCLP.classicObjective function, which for a problem such as the one below would try to estimate an maximum beta-value while ensuring a certain objective function value (in case of a maximization problem a objective value of at least z0 will be ensured):

After having used FCLP.classicObjective for solving above problem I applied FCLP.fixedBeta to solve a version of the problem with a fixed beta value (as proposed by FCLP.classicObjective), using standard simplex algorithm. In both cases, the optimal objective function result was approx. 7. A simple benchmark run with standard simplex, for a problem version with beta = 0, returned an optimal objective function value of 8.75, Hence, the solutions found with FCLP.classicObjective did not optimize the objective function value. As mentioned, FCLP.classicObjective will rather maximize beta while ensuring a lower limit of the objective function value.

In this post I will apply another function that helps sampling various values of beta, and solves the problem while fixing beta at these values. Before I do so let us convert the problem statement into vector-matrix syntax. For this, let us apply below template:

c is the coefficient vector of the objective function. x is the vector containing the optimization variables. A is the coefficient matrix of the linea constraints and b is the vector containing the constraint values. t are the maximum contraint violation values that might occur (this is why the problem is fuzzy).

I now solve the problem with FCLP.sampledBeta, a function belonging to the FuzzyLP package that solves the problem with sampled beta values, fixing beta for each sampled value and solving the problem with default simplex algorithm. I start with beta = 0, end with beta = 1 and sample wiht steps of size 0.05.

``````#install.packages("FuzzyLP")
library(FuzzyLP)``````
``````# define vectors and matrices that describe the problem at hand
c <- c(3,4)
A <- matrix(c(1,2,2,1,3,-1),nrow=3)
dir <- c("<=","<=","<=")
b <- c(1,1,1)
t <- c(4,5,3)

# solve the problem using FCLP.sampledBeta
solution <- as.data.frame(FCLP.sampledBeta(objective = c,
A = A,
dir = dir,
b = b,
t = t,
min = 0,
max = 1,
step = 0.05,
maximum=TRUE))

# visualize the result using ggplot2
library(ggplot2)
ggplot(solution) + geom_point(mapping = aes(x=beta,y=objective,color="red")) +
xlab("betas") +
ylab("optimal simplex outcome") +
ggtitle("Optimal objective function value with simplex, depending on beta")``````

FuzzyLP’s FCLP.sampledBeta suggests that the optimal solution is beta = 0. The optimal objective function value at that beta value can be obtained from the solution matrix returned (here converted into a dataframe):

``solution[solution\$beta==0.0,]``
``````##   beta   x1  x2 objective
## 1    0 2.25 0.5      8.75``````

Moreover, we can use the graph to verify the result returned by FCLP.classicObjective in my previous post: For objective function value of at least 7 the maximum beta value is approx 0.24.