楼主: engzh519
4143 2

[问答] 请教:fmincon约束条件不起作用 [推广有奖]

  • 0关注
  • 0粉丝

硕士生

1%

还不是VIP/贵宾

-

威望
0
论坛币
315 个
通用积分
0.7502
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
649 点
帖子
24
精华
0
在线时间
239 小时
注册时间
2007-11-29
最后登录
2025-10-15

楼主
engzh519 在职认证  发表于 2017-7-8 10:04:37 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
目标函数程序


function f = objfun(x,H)

f = -x*H*x';


约束条件程序
function [c,ceq] =confun(x)
% 非线性不等式约束
c = [];
% 非线性等式约束
ceq = x*x'-1;


x0是1*29行向量,已赋值;
l是1*29行向量,已赋值为0;
H 是29*29矩阵,已赋值;
调用fmincon函数
[x, fval] = fmincon(@(x)objfun(x,H),x0, [], [], [], [], l, [], @confun);

结果显示
Warning: The default trust-region-reflective algorithm does not solve problems
with the constraints you have specified. FMINCON will use the active-set
algorithm instead. For information on applicable algorithms, see Choosing the
Algorithm in the documentation.
> In fmincon at 500
Warning: Your current settings will run a different algorithm (interior-point) in
a future release.
> In fmincon at 505
Solver stopped prematurely.
fmincon stopped because it exceeded the function evaluation limit,
options.MaxFunEvals = 2900 (the default value).

迭代次数超限制,但结果显然不受条件约束,请教为何?

2.44538174517926e+16           2.53751686447813e+16        4.78432047182774e+16          7.28633632307613e+16        2.27625959789299e+16          1.2786571 0133476e+16        6.86918182864094e+16               3.18967767788137e+16。。。。。。。


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:fmincon 约束条件 Min FMI con

沙发
engzh519 在职认证  发表于 2017-7-8 11:40:51
请教!!!!!!!!

藤椅
haserui 发表于 2018-7-18 11:29:51
楼主求赐教
我的出现了这个
fmincon stopped because the size of the current step is less than
the default value of the step size tolerance and constraints are
satisfied to within the default value of the constraint tolerance.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-23 15:52