0

I want to solve linear Programming by MATLAB . For this purpose , I am following the following link . Linear Programming .

Here , a sample problem is given :

Find x that minimizes

f(x) = –5x1 – 4x2 –6x3,

subject to

x1 – x2 + x3 ≤ 20 3x1 + 2x2 + 4x3 ≤ 42 3x1 + 2x2 ≤ 30 0 ≤ x1, 0 ≤ x2, 0 ≤ x3.

First, enter the coefficients

f = [-5; -4; -6]; A = [1 -1 1 3 2 4 3 2 0]; b = [20; 42; 30]; lb = zeros(3,1);

Next, call a linear programming routine.

[x,fval,exitflag,output,lambda] = linprog(f,A,b,[],[],lb);

My question is that what is meant by this line ?
lb = zeros(3,1); Without this line , all problems solvable by MATLAB is seen as infeasible . Can you help me in this purpose ?

1 Answer 1

1

This is not common to ALL linear problems. Here you deal with a problem where there are some constraints on the minimal values of the solution:

0 ≤ x1, 0 ≤ x2, 0 ≤ x3

You have to set up these constraints in the parameters of your problem. The way to do so is by specifying lower boundaries of the solution, which is the 5th argument.

Without this line, the domain on which you search for a solution is not bounded, and exitflag has the value -3 after calling the function, which is precisely the error code for unbounded problems.

Sign up to request clarification or add additional context in comments.

3 Comments

I have another basic fundamental problem in solving linear programming problem by matlab . Can you please help me ?
Post a new question on SO :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.