24小时热门版块排行榜    

查看: 2116  |  回复: 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的回帖
相关版块跳转 我要订阅楼主 椋木迪 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 286分人工智能专业请求调剂愿意跨考! +4 lemonzzn 2026-03-17 8/400 2026-03-21 22:49 by lemonzzn
[考研] 资源与环境 调剂申请(333分) +5 holy J 2026-03-21 5/250 2026-03-21 22:42 by Catalysis25
[考研] 材料求调剂 +5 @taotao 2026-03-21 5/250 2026-03-21 20:55 by lbsjt
[考研] 求调剂 +5 十三加油 2026-03-21 5/250 2026-03-21 18:48 by 学员8dgXkO
[考研] 材料工程专硕 348分求调剂 +3 冬辞. 2026-03-17 5/250 2026-03-21 18:47 by 学员8dgXkO
[考研] 一志愿南大,0703化学,分数336,求调剂 +3 收到VS 2026-03-21 3/150 2026-03-21 18:42 by 学员8dgXkO
[考研] 一志愿重庆大学085700资源与环境总分308求调剂 +7 墨墨漠 2026-03-20 7/350 2026-03-21 16:36 by barlinike
[考研] 求调剂 +3 .m.. 2026-03-21 4/200 2026-03-21 16:25 by barlinike
[考研] 0856材料专硕353求调剂 +3 NIFFFfff 2026-03-20 3/150 2026-03-21 10:23 by luoyongfeng
[考研] 材料学学硕080502 337求调剂-一志愿华中科技大学 +4 顺顺顺mr 2026-03-18 5/250 2026-03-21 10:22 by luoyongfeng
[考研] 346求调剂[0856] +4 WayneLim327 2026-03-16 7/350 2026-03-21 04:02 by JourneyLucky
[考研] 一志愿武理材料305分求调剂 +6 想上岸的鲤鱼 2026-03-18 7/350 2026-03-21 01:03 by JourneyLucky
[考研] 求调剂一志愿南京航空航天大学289分 +3 @taotao 2026-03-19 3/150 2026-03-20 21:34 by JourneyLucky
[考研] 289求调剂 +6 怀瑾握瑜l 2026-03-20 6/300 2026-03-20 20:30 by 学员8dgXkO
[考研] 261求B区调剂,科研经历丰富 +3 牛奶很忙 2026-03-20 4/200 2026-03-20 19:34 by JourneyLucky
[考研] 一志愿南理工085701环境302求调剂院校 +3 葵梓卫队 2026-03-20 3/150 2026-03-20 19:28 by zhukairuo
[考研] 298-一志愿中国农业大学-求调剂 +9 手机用户 2026-03-17 9/450 2026-03-20 14:24 by 无懈可击111
[考研] 求调剂 +3 暗涌afhb 2026-03-16 3/150 2026-03-20 00:28 by 河南大学校友
[考研] 0703化学调剂 +3 妮妮ninicgb 2026-03-17 3/150 2026-03-18 10:29 by macy2011
[考研] 085601求调剂 +4 Du.11 2026-03-16 4/200 2026-03-17 17:08 by ruiyingmiao
信息提示
请填处理意见