% Exemplo do algoritmo de Karmarkar
% Edgar & Himmelblau, 1988
% 
%  min c'x 
%      A x = b
%       x >= 0

c0=[8.1; 10.8];
A0=[0.8   0.44
    0.05  0.1
    0.1   0.36];
b=[24000; 2000; 6000];
x0=[10000; 3000];

% incluindo as variaveis de folga:
x0=[x0; b-A0*x0];
c=[-c0; zeros(3,1)];
A=[A0 eye(3)];

[xo,Ot,nS,lambda]=karmarkar(c,x0,A,b)

xo=xo(1:2)
Ot=c0'*xo
