数学建模社区-数学中国

标题: MatlAB非线性规划的小问题~~~~ [打印本页]

作者: zapstart    时间: 2010-5-15 14:34
标题: MatlAB非线性规划的小问题~~~~
function  [c,ceq]=mycon(x)
c=1-0.7*x(2)+2.1/x(1)-x(2)*x(3);
ceq=[];

fun='4*x(1)^2*0.5*(x(2)*(1-x(2))*(1-x(3))+1/2*(1-x(2)^2)+(1-x(2)*x(3))*(3/x(1)+(1-x(2)*x(3))/1.4)+x(3)*x(2)*((1-x(2)*x(3))/0.7)+3/x(1)+x(2)*x(3)/1.4)';
X0=[10 1 3];
lb=[0 0 0]';
ub=[200 1 1]';
[x,fval]=fmincon(fun,X0,[],[],[],[],lb,ub,@mycon);

Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. You could also try the interior-point or sqp algorithms: set the Algorithm
option to 'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the documentation.
> In fmincon at 472
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints were satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Active inequalities (to within options.TolCon = 1e-006):
  lower      upper     ineqlin   ineqnonlin
    1          2                     
               3
作者: 安树庭    时间: 2010-5-15 14:49
有什么问题吗???????????????????????????
作者: zapstart    时间: 2010-5-15 14:54
这个没运行出来啊~~~~~~没结果 不知道哪里错了 错误提示我也看不懂
作者: guleidizhui    时间: 2010-5-15 15:56
???好像没有问题啊。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
作者: 少幻    时间: 2010-5-15 16:32
我也正在能这个问题,楼主说说啊。。。
作者: zapstart    时间: 2010-5-15 17:20
我改了下,
X0=[0.1 0 0];
lb=[0 0 0]';
ub=[150 0.25 1]';
为什么结果超过这个范围了?

  x =150.1603    0.4103    1.1603


fval =

  5.8621e+004


exitflag =

     0


output =

         iterations: 18
          funcCount: 203
       lssteplength: 0.5000
           stepsize: 0.0114
          algorithm: 'medium-scale: SQP, Quasi-Newton, line-search'
      firstorderopt: 1.8044e+004
    constrviolation: 0.2655
            message: [1x143 char]
作者: hechaonan    时间: 2010-5-22 21:07
这个没运行出来啊~~~~~~没结果 不知道哪里错了 错误提示我也看不懂
作者: zapstart    时间: 2010-5-23 20:46
因为这个方程错了。。。。。我改用Lingo一下就发现了




欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5