带有非线性约束的非线性方程优化 编出程序提示错误 求助。

目标函数
Function v=myfun(x)
v=0.25*3.14*x(1)^2*x(2);
约束
function [c,ceq]=mycon(x)
%约束条件
c(1)=24000-0.25*3.14*0.8*63.347*x(1)^(2/3)*x(2)-0.25*3.14*(0.8)^(1/3)*450*x(1)^(5/3);
c(2)=24000-3.14* 63.347 *x(1)*x(2)-0.25*3.14*(25000-25*x(1))*(x(1)^2);
c(3)=4*1/3.14*1/2000*24000*1/(x(1)^2)*x(2)+1/3.14*1/20000*24000*1/x(1)*1/x(2)-0.04 ;
ceq=[];
主程序
l=[0;0]; %下限
x0=[0;0]; %赋初值
[x,favl,exitflag]=fmincon(@myfun,x0,[],[],[],[],l,[],@mycon)
程序运行后提示如下截图

 采纳的回答

mevit
mevit 2022-11-23

0 个投票

改成内点算法
options=optimset('Algorithm','interior-point')
运算结果
x =
28.3645
0.4210
favl =
265.9167
exitflag =
1
output =
iterations: 27
funcCount: 96
constrviolation: 0
stepsize: 2.7113e-04
algorithm: 'interior-point'
firstorderopt: 2.3859e-04
cgiterations: 3
message: [1x777 char]

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Global or Multiple Starting Point Search 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!