summaryrefslogtreecommitdiff
path: root/docal.sce~
blob: 290af1bf980b77e3b1326237c0e603e6a92a52be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
exec builder.sce
exec loader.sce

  	  function y=f(x)
  			y=-x(1)-x(2)/3;
  		endfunction
  		//Starting point, linear constraints and variable bounds  
  		x0=[0 , 0];
  		A=[1,1 ; 1,1/4 ; 1,-1 ; -1/4,-1 ; -1,-1 ; -1,1];
  		b=[2;1;2;1;-1;2];
  		Aeq=[1,1];
  	 	beq=[2];
  		lb=[];
  		ub=[];
  	    nlc=[];
  		//Gradient of objective function
  		function y= fGrad(x)
  			y= [-1,-1/3];
  	 	endfunction
  		//Hessian of lagrangian
  		function y= lHess(x,obj,lambda)
  			y= obj*[0,0;0,0] 
  	  endfunction
  		//Options
  		options=list("GradObj", fGrad, "Hessian", lHess);
  	    //Calling Ipopt
      [x,fval] =intfmincon(f, x0,[],A,b,Aeq,beq,lb,ub,nlc)