%% Typical Linear Programming Problem
% This example solves the typical linear programming problem
% \[\mathop {\min }\limits_x {f^T}x{\rm{\ such\ that }}\left\{ {\begin{array}{*{20}{c}}
% {A \cdot x \le b,}\\
% {Aeq \cdot x = beq,}\\
% {x \ge 0.}
% \end{array}} \right.\]
% 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))
disp(size(Aeq))

% 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);

% 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

% You can also find the objective function value and number of iterations in the iterative display.
% Copyright 2019 The MathWorks, Inc.