zapstart 发表于 2010-5-15 14:34

MatlAB非线性规划的小问题~~~~

function  =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=;
lb=';
ub=';
=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=;
lb=';
ub=';
为什么结果超过这个范围了?

  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:

hechaonan 发表于 2010-5-22 21:07

这个没运行出来啊~~~~~~没结果 不知道哪里错了 错误提示我也看不懂

zapstart 发表于 2010-5-23 20:46

因为这个方程错了。。。。。我改用Lingo一下就发现了
页: [1]
查看完整版本: MatlAB非线性规划的小问题~~~~