用MATLAB优化分析工具,计算约束非线性优化问题,得出的结果不在约束范围内,并且为负值,请指教

%约束非线性优化问题
%1、目标函数文件 lwfun.m
function f=lwfun(x)
W=0.2;Q=0.8
f(1)=0.25*W*pi*3000*(x(1)-0.5*x(3))^2+0.25*Q*pi*x(2)*(120^2-(x(1)-0.5*x(3))^2);
%2、非线性约束函数文件lwconfun.m
function[c,ceq]=lwconfun(x)
% 非线性不等式约束
c(1)=175000-20*(0.5*pi*x(2)*(x(1)-0.5*x(3)))
c(2)=atan(x(3)/(pi*(x(1)-0.5*x(3))))-3.5
c(3)=4*175000/(pi*(x(1)-x(3))^3)*sqrt((x(1)-x(3))^2+12*(tan(atan(x(3)/(pi*(x(1)-0.5*x(3))))+5)*(x(1)-0.5*x(3)))^2)-160
c(4)=175000/(0.5*pi*x(1)*x(2))-35
c(5)=3*175000/(0.5*pi*x(1)*x(2))-45
c(6)=0.8*175000/40-(x(1)-0.5*x(3))^2
ceq=[];
%3、三维约束非线性优化函数问题
x0=[80;120;10];
A=[];
b=[];
Aeq=[];beq=[];
lb=[50,60,8];
ub=[100,150,12];
[xopt,fopt,output]=fmincon(@lwfun,x0,A,b,Aeq,beq,lb,ub,@lwconfun)
[c]=lwconfun(xopt)

结果为110,120,-2,完全不在约束范围内,请教各位大师
我去掉了一个约束条件,
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 function tolerance,
and constraints were satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
3 3
5
6
xopt =
65.1608
113.9831
12.0000
fopt =
6.4736e+006
看来是C(3)约束条件不对。。。。。

可能是你的非线性规划问题自身没有可行解的原因,如果想得到可行解,建议修改参数;如果确定有可行解,建议检查模型是否输入正确。追问

我调整了一下,现在提示
fmincon stopped because the size of the current search direction is less than
twice the default value of the step size tolerance but constraints were not
satisfied to within the default value of the constraint tolerance.
是怎么回事?谢谢

追答

还是不可行,不过fmincon提前终止了。

追问

去掉了一个约束,得出一个有效解,但不是很理想。看来约束写错了

温馨提示:答案为网友推荐,仅供参考