theta=33; R=[cos(theta),-sin(theta);sin(theta),cos(theta)]; R1=R' function [f,g,ind]=cost(x,ind) f=1/2* (R*x+1)'*(R*x+1) g = R'*R*x +R'*[1;1] endfunction [f,xopt]=optim(cost,[5;5]) // fixons une contrainte // R1* x >=0 function [f,g,ind]=cost1(x,ind) f=1/2* (R*x+1)'*(R*x+1) + lambda'*R1*x g = R'*R*x +R'*[1;1] + (lambda'*R1)' endfunction // Itérations lambda = [0;0]; xopt=[5;5] rho=0.2 //res=[] for i=1:100 [f,xopt]=optim(cost1,xopt) lambda =max( lambda + rho*R1*xopt,0) //res=[res,xopt] end