Typical Linear Programming Problem

This example solves the typical linear programming problem

minxfTxsuchthat{Axb,Aeqx=beq,x0.

Load the sc50b.mat file, which contains the matrices and vectors A, Aeq, b, beq, f, and the lower bounds lb.

load sc50b

The problem has 48 variables, 30 inequalities, and 20 equalities.

disp(size(A))
    30    48
disp(size(Aeq))
    20    48

Set options to use the dual-simplex algorithm and the iterative display.

options = optimoptions(@linprog,'Algorithm','dual-simplex','Display','iter');

The problem has no upper bound, so set ub to [].

ub = [];

Solve the problem by calling linprog.

[x,fval,exitflag,output] = ...
    linprog(f,A,b,Aeq,beq,lb,ub,options);
LP preprocessing removed 2 inequalities, 16 equalities,
16 variables, and 26 non-zero elements.

 Iter      Time            Fval  Primal Infeas    Dual Infeas  
    0     0.017    0.000000e+00   0.000000e+00   1.305013e+00  
    8     0.035   -1.587073e+02   3.760622e+02   0.000000e+00  
   33     0.038   -7.000000e+01   0.000000e+00   0.000000e+00  

Optimal solution found.

Examine the exit flag, objective function value at the solution, and number of iterations used by linprog to solve the problem.

exitflag,fval,output.iterations
exitflag = 1
fval = -70
ans = 33

You can also find the objective function value and number of iterations in the iterative display.