% Problema de blending e producao de uma refinaria
% Edgar & Himmelblau, 1988
% 
%  max c'x = min -c'x
%      A x <= b
%        x >= 0

c=[8.1; 10.8];
A=[0.8   0.44
    0.05  0.1
    0.1   0.36];
b=[24000; 2000; 6000];
lb=zeros(2,1);
ub=[];
x0=[0; 0];

v = version;
% active set: simplex
if v(1) < '8'
  op=optimset('LargeScale','off','Display','final');
else
  op=optimoptions('linprog','Algorithm','dual-simplex','Display','final');
end
[x,S,eflag,out,lambda]=linprog(-c,A,b,[],[],lb,ub,x0,op)

% interior point: S. Mehrotra, 1992
if v(1) < '8'
  op=optimset('LargeScale','on','Display','iter','MaxIter',100,'TolFun',1e-4);
else
  op=optimoptions('linprog','Algorithm','interior-point','Display','final'); 
end

[xi,Si,eflagi,outi,lambdai]=linprog(-c,A,b,[],[],lb,ub,[],op)
