Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: optimization result not right
Replies: 11   Last Post: Jun 18, 2012 10:51 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
xueqi

Posts: 8
Registered: 6/18/12
optimization result not right
Posted: Jun 17, 2012 2:03 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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),



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.