繁体   English   中英

MATLAB:fmincon找不到最小值

[英]MATLAB: fmincon can't find a minimum value

跑:

function test()

Aeq = ones(1,4); beq = 1;
a0 = [.2,.2,.2,.1];
[a,f] = fmincon(@ttest,a0,[],[],Aeq,beq);

结果:

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
  In test at 6

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>

我已经测试过“ ttest”,它可以正常工作.....不太了解警告信息~~为什么不起作用?

您的本地最小化成功: Local minimum found that satisfies the constraints. 检查af值。

所有警告都告诉您,默认算法不适用于您正在处理的问题,因此它将为您选择另一种算法。 请参阅底部附近的fmincon文档,以了解它可以使用的不同算法。 您可以通过明确告知要使用哪种算法来摆脱此警告:

Aeq = ones(1,4); beq = 1;
a0 = [.2,.2,.2,.1];
options = optimset('Display', 'iter', ...
                   'Algorithm', 'active-set');
[a,f] = fmincon(@ttest,a0,[],[],Aeq,beq,[],[],[],options);

我还告诉它显示其迭代,这在调试阶段一直很有用。 有关可用的各种选项,请参见此处

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM