| 查看: 2081 | 回复: 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来求解优化问题,所很多地方不懂,请多多指教,谢谢各位大神了。 |
» 猜你喜欢
全日制(定向)博士
已经有5人回复
假如你的研究生提出不合理要求
已经有10人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
实验室接单子
已经有4人回复
对氯苯硼酸纯化
已经有3人回复
求助:我三月中下旬出站,青基依托单位怎么办?
已经有12人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复
2楼2018-05-23 02:25:44
3楼2018-05-23 14:25:12












回复此楼