24小时热门版块排行榜    

Znn3bq.jpeg
查看: 2131  |  回复: 2

椋木迪

新虫 (小有名气)

[求助] fmincon函数求解非线性约束优化问题出错 已有1人参与

我用fmincon函数求解一个非线性约束优化问题总是算不出结果,不知道哪里出问题了,求大佬帮忙看看,一下是代码:
x0=[3.6;0.8;19;7.8;7.6;3.5;5.2];
A=[];b=[];
Aeq=[];beq=[];
lb=[2.6;0.7;17;7.3;7.3;2.9;5.0];ub=[3.6;0.8;28;8.3;8.3;3.9;5.5];
[x,fval,exitflag,output,lambda,grad,hessian]=fmincon(@myfun,x0,A,b,Aeq,beq,lb,ub,@mycon);

function [c,ceq] = mycon(x)
c(1)=27/(x(1)*x(2)^2*x(3))-1;
c(2)=397.5/(x(1)*x(2)^2*x(3)^2)-1;
c(3)=1.93*x(4)^3/(x(2)*x(3)*x(6)^4)-1;
c(4)=1.93*x(5)^3/(x(2)*x(3)*x(7)^4)-1;
c(5)= 10*x(6)^(-3)*sqrt((745*x(2)^(-1)*x(3)^(-1)*x(4))^2+1.69*10^7)-1100;
c(6)=10*x(7)^(-3)*sqrt((745*x(2)^(-1)*x(3)^(-1)*x(5))^2+1.575*10^8)-850;
c(7)=(1.5*x(6)+1.9)/x(4)-1;
c(8)=(1.1*x(7)+1.9)/x(5)-1;
c(9)=x(2)*x(3)-40;
c(10)=5-x(1)/x(2);
c(11)=x(1)/x(2)-12;
ceq = [];

function y = myfun(x)
y = 0.7854*x(1)*x(2)^2*(3.333*x(3)^2+14.9334*x(3)-43.0934)-1.5079*x(1)*(x(6)^2+x(7)^2)+7.477*(x(6)^3+x(7)^3)+0.7854*(x(4)*x(6)^2+x(5)*x(7)^2);

以下是MATLAB里的提示:
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 optimality tolerance,
and constraints are satisfied to within the default value of the constraint tolerance.

<stopping criteria details>


Optimization completed: The relative first-order optimality measure, 7.082717e-09,
is less than options.OptimalityTolerance = 1.000000e-06, and the relative maximum constraint
violation, 0.000000e+00, is less than options.ConstraintTolerance = 1.000000e-06.

Optimization Metric                                            Options
relative first-order optimality =   7.08e-09       OptimalityTolerance =   1e-06 (default)
relative max(constraint violation) =   0.00e+00    ConstraintTolerance =   1e-06 (default)
由于是第一次用MATLAB来求解优化问题,所很多地方不懂,请多多指教,谢谢各位大神了。
回复此楼

» 猜你喜欢

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

somomo91

专家顾问 (职业作家)

【答案】应助回帖

感谢参与,应助指数 +1
这个问题很常见,找不到全局最优,只有局部最优
可以试着
1. 改变初始值
2. 修改 fmincon 的参数,比如算法等等
2楼2018-05-23 02:25:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

椋木迪

新虫 (小有名气)

引用回帖:
2楼: Originally posted by somomo91 at 2018-05-23 02:25:44
这个问题很常见,找不到全局最优,只有局部最优
可以试着
1. 改变初始值
2. 修改 fmincon 的参数,比如算法等等

fmincon函数不返回局部最优解么?最后没有结果出来。另外初始值修改过了,还是不行,sqp和set-active算法也同样不行。还有其他办法吗
3楼2018-05-23 14:25:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 椋木迪 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 0854求调剂 +7 门路摸摸 2026-04-15 7/350 2026-04-15 19:40 by PengTangGeoE
[考研] 一志愿华中农业071010,320求调剂 +11 困困困困坤坤 2026-04-14 12/600 2026-04-15 18:58 by zhuwenxu
[考研] 生物学调剂 +9 纸扇zhishan 2026-04-13 9/450 2026-04-15 18:28 by AN流800
[考研] 0854调剂 +13 长弓傲 2026-04-12 16/800 2026-04-15 13:45 by fenglj492
[考研] 085801电气专硕272求调剂 +19 电气李 2026-04-13 21/1050 2026-04-15 13:37 by 黑科技矿业
[考研] 291求调剂 +4 关忆北. 2026-04-14 4/200 2026-04-15 10:49 by shenshen207
[考研] 一志愿沪9,326求生物学调剂 +10 刘墨墨 2026-04-13 10/500 2026-04-14 15:16 by zs92450
[考研] 305求调剂 +8 玛卡巴卡boom 2026-04-11 8/400 2026-04-14 09:04 by pengliang8036
[考研] 2026硕士调剂_能动_河南农业大学 +4 河南农业大学-能 2026-04-12 4/200 2026-04-13 22:01 by bljnqdcc
[考研] 电气工程专硕320求调剂 +5 小麻子111 2026-04-10 5/250 2026-04-12 10:47 by zhouyuwinner
[考研] 326求调剂 +6 Shansyn 2026-04-10 6/300 2026-04-12 09:46 by hammer3
[考研] 086003调剂求助 +21 苏弋万 2026-04-09 22/1100 2026-04-11 20:25 by dongdian1
[考研] 359求调剂 +5 胃痉挛累了 2026-04-11 5/250 2026-04-11 19:55 by lbsjt
[考研] 352 求调剂 +6 yzion 2026-04-11 8/400 2026-04-11 16:24 by 明月此时有
[考研] 0854调剂 +8 950824he@ 2026-04-09 8/400 2026-04-11 10:11 by zhq0425
[考研] 0854调剂 +4 长弓傲 2026-04-09 4/200 2026-04-11 09:18 by 猪会飞
[考研] 314求调剂 +18 xhhdjdjsjks 2026-04-09 19/950 2026-04-10 18:53 by HPUCZ
[考研] 一志愿矿大,材料工程专硕314分,0856可调都可以 +15 无懈可击的巨人 2026-04-09 15/750 2026-04-10 18:10 by hmn_wj
[考研] 一志愿沪9,326生物学求相关专业调剂 +4 刘墨墨 2026-04-09 4/200 2026-04-10 12:07 by pengliang8036
[考研] 调剂申请086000一志愿西北农林科技大学生物与医药320分-本科齐鲁工业大学 +3 美美女士 2026-04-09 3/150 2026-04-10 10:31 by liuhuiying09
信息提示
请填处理意见