Example
In this example we solve the sample problem from MATLAB's documentation page on the linprog function.
The problem at hand is:
  minimize  -5·x1 - 4·x2 -6·x3
subject to x1 - x2 + x3 ≤ 20
3·x1 + 2·x2 + 4·x3 ≤ 42
3·x1 + 2·x2 ≤ 30
0 ≤ x1, 0 ≤ x2, 0 ≤ x3
 subject to x1 - x2 + x3 ≤ 20
3·x1 + 2·x2 + 4·x3 ≤ 42
3·x1 + 2·x2 ≤ 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 the Xpress linear programming function.
>> [x,fval,exitflag,output,lambda] = xprslp(f,A,b,'L',lb);
Entering x, lambda.lin, and lambda.lower returns the following results:
x =
     0.0000
    15.0000
     3.0000
lambda.lin =
     0
     1.5000
     0.5000
lambda.lower =
     1.0000
     0
     0  
