2 %> \f[\min f(x)=2(x_1^2+x_2^2-1)-x_1\f] subject to \f[x_1^2+x_2^2=1 \f]
3 %> @author <a href="http://people.epfl.ch/michel.bierlaire">Michel Bierlaire</a>
4 %> @date Fri Mar 27 15:41:39 2015
8 %> @param x value of the variables
9 %> @param index If 0, the objective
function is evaluated. If not, the constraint number index is evaluated.
10 %> @
return f value of the
function 11 %> @
return g value of the gradient
12 %> @
return H value of the hessian
13 function [f,g,H] =
ex2003(x,index)
15 f = 2.0 * (x(1)*x(1) + x(2) * x(2) - 1) - x(1) ;
16 g = [ 4.0 * x(1) - 1.0 ; 4 * x(2) ];
17 H = [ 4.0 0.0 ; 0.0 4.0 ] ;
21 f = x(1) * x(1) + x(2) * x(2) - 1.0;
22 g = [ 2 * x(1) ; 2 * x(2) ] ;
26 error(
"There is only one constraint") ;
function ex2003(in x, in index)