xueqi
Posts:
8
Registered:
6/18/12
|
|
optimization result not right
Posted:
Jun 17, 2012 2:03 PM
|
|
Hi All,
I want to optimize a function using femincon. But the result shown is not right and changed with the initial point. Could you tell me how to deal with it? Really appreciate:) Here is my code.
function f = eu(x) f=0.4*exp(-(1.2*x(1)+0.8*x(2)+200-x(1)-x(2))*0.091)+... 0.3*exp(-(0.6*x(1)+1.3*x(2)+200-x(1)-x(2))*0.091)+... 0.3*exp(-(1.6*x(1)+1.8*x(2)+200-x(1)-x(2))*0.091);
options = optimset('Algorithm','interior-point','Display','iter','MaxIter',10000,'MaxFunEvals',300000,'TolFun',1e-10,'TolX',1e-10,'TolCon',1e-10); A=[1,1]; b=200; lb = zeros(2,1); [x,fval,exitflag,output] = fmincon(@eu,[100,100],A,b,[],[],lb,[],[],options);
The result is
x =
33.1890 33.1891
fval =
1.0102e-008
But I use maple to do the same thing and clearly it give a merrier answer with x = 16.1114055242944 25.7712836854408
-9.51154566365912526*10^(-9),
|
|