%Longin Jan Latecki, latecki@temple.edu, March 2015
%Linear Programming (LP) example based on Ch. 7.1 p. 190 in book: Algorithms. Sanjoy
%Dasgupta, Christis Papadimitriou, Umesh Vazirani. McGraw-Hill
% see for LP in Matlab: http://www.mathworks.com/help/optim/ug/linprog.html

%objective function:  c'*x
%x=[x1; x2];
c=[-1; -6]; %since matlab minimizes

%constraints A*x =< b
A = [1 0; 0 1; 1 1];
b=[200; 300; 400];
lb = [0; 0];

%[x,fval,exitflag,output,lambda] = linprog(c,A,b,[],[],lb) %LP with %'interior-point' (default)


options = optimset('LargeScale','off','Simplex','on'); %LP with 'Simplex'
[x,fval,exitflag,output,lambda] = linprog(c,A,b,[],[],lb,[],[],options)



