24小时热门版块排行榜    

查看: 401  |  回复: 2
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

zhangyang25

新虫 (初入文坛)

[求助] matlab工具箱能正常运行,但是跳出warning怎么回事

function f =myfun(x)
f =-x(1) * x(2) * x(3);
function [c , ceq] = mycon(x)
c=[];
ceq = x(2) *x(3) + x(3) *x(1) + x(1) * x(2)-75;
x0=[4;5;6];
   lb=zeros(3,1);
   [x,fval,exitflag,output,lambda]=fmincon(@myfun,x0,[],[],[],[],lb,[],@mycon)
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. You could also try the interior-point
algorithm: set the Algorithm option to 'interior-point' and rerun.
> In fmincon at 460

Local minimum possible. Constraints satisfied.

fmincon stopped because the size of the current search direction is less than
twice the default value of the step size tolerance and constraints were
satisfied to within the default value of the constraint tolerance.



No active inequalities.

x =

    5.0000
    5.0000
    5.0000


fval =

-125.0000


exitflag =

     4


output =

         iterations: 7
          funcCount: 30
       lssteplength: 1
           stepsize: 1.1815e-006
          algorithm: 'medium-scale: SQP, Quasi-Newton, line-search'
      firstorderopt: 2.4478e-006
    constrviolation: 8.4075e-007
            message: [1x770 char]


lambda =

         lower: [3x1 double]
         upper: [3x1 double]
         eqlin: [0x1 double]
      eqnonlin: 2.5000
       ineqlin: [0x1 double]
    ineqnonlin: [0x1 double]
为什么结果都出来了,还有一个warning,这事怎么回事啊?这个warning会影响我的优化结果吗?谁能把帮帮我。。。
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhangyang25

新虫 (初入文坛)

谢谢你的回答,可是还是不怎么明白,我再琢磨琢磨。。。
3楼2012-08-04 10:55:22
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 3 个回答

csgt0

荣誉版主 (著名写手)

彩色挂图

【答案】应助回帖

★ ★
感谢参与,应助指数 +1
xiegangmai: 金币+2, 谢谢参与! 2012-07-30 21:55:38
你可以看fmincon的帮助,主要是对不同的问题算法有点不一样,它会自动选择合适的,但你可以根据需要设置会更好的解决问题。至于优化结果,fmincon能获得一个极小值,与初始点位置有关系。结果是否正确还得需要自己判断。
showmethemoney
2楼2012-07-30 09:57:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
信息提示
请填处理意见