% min S(x) = (x1^2 + x2^2 + x3^2)/2
%  s.a. g1(x) = 3/2 - x1 - x2 <= 0
%       g2(x) = x1 - x3 -1 <= 0
%       g3(x) = x2 + x3 - 2/5 <= 0
%
%  x' = [0.833  0.633  -0.2] (melhor solucao inviavel, no sentido de minimos quadrados)
%  x1' = [0.7667  0.5833 -0.1833]
Q=[1 0 0;0 1 0;0 0 1]
c=[0; 0; 0]
A=[-1 -1  0
    1  0 -1
    0  1  1]
b=[-3/2; 1; 2/5]
Aeq=[]
beq=[]
lb=[]
ub=[]

[x,s,ex,out,lambda]=quadprog(Q,c,A,b,Aeq,beq,lb,ub)

b1=[-3/2*0.9; 1; 2/5]

[x1,s1,ex,out,lambda1]=quadprog(Q,c,A,b1,Aeq,beq,lb,ub)
