%
% S(x) = x(1)x(2)
% s.a. g(x) = x(1)^2+x(2)^2 - 25 < 0
%
% Linearização: S(x) = x2*x(1)+x1*x(2)
% s.a. 2*x1*x(1)+2*x2*x(2) = g(x1,x2)
% g'(x0)x<=g'(x0)*x0-g(x0)=b
maxit=100; tol=1e-4;
x0=[0.5;0.5];

for i=1:maxit
 c=[x0(2);x0(1)];
 A=2*[x0(1) x0(2)];
 b=x0(1)^2+x0(2)^2+25;
 lb=[-5;-5]; ub=[5;5];
 op=optimset('LargeScale','off');
 [x,S,flag,out,lambda]=linprog(c,A,b,[],[],lb,ub,[],op)
 
 if norm(x-x0) < tol
   break
 end
 
 x0=x;
end
