非线性约束规划 我编制了 目标函数和约束函数 为什么在matlab中还是出错 求大神看看这不给力的function f=myfun(x)f=0.192457*le-4*(x(2)+2)*x(1)^2*x(3);function [c,cep]=mycon(x)c(1)=350-163*x(1)^(-2.86)*x(3)^0.86;c(2)=1
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 23:16:28
非线性约束规划 我编制了 目标函数和约束函数 为什么在matlab中还是出错 求大神看看这不给力的function f=myfun(x)f=0.192457*le-4*(x(2)+2)*x(1)^2*x(3);function [c,cep]=mycon(x)c(1)=350-163*x(1)^(-2.86)*x(3)^0.86;c(2)=1
非线性约束规划 我编制了 目标函数和约束函数 为什么在matlab中还是出错 求大神看看这不给力的
function f=myfun(x)
f=0.192457*le-4*(x(2)+2)*x(1)^2*x(3);
function [c,cep]=mycon(x)
c(1)=350-163*x(1)^(-2.86)*x(3)^0.86;
c(2)=10-0.14*0.01*x(1)^-4*x(2)*x(3)^3;
c(3)=(x(2)+1.5)*x(1)+0.44*0.01*x(1)^(-4)*x(2)*x(3)^3-3.7*x(3);
c(4)=375-0.356*le6*x(1)*x(2)^(-1)*x(3)^(-2);
c(5)=4-x(3)/x(1);
A=[-1 0 0
1 0 0
0 -1 0
0 1 0
0 0 -1
0 0 1];
b=[-1;4;-4.5;50;-10;30];
x0=[2.0;5.0;25.0];
lb=zeros(3,1);
[x,fval,exitflag,output,lambda]=fmincon(@opt17_70,xo,A,b,[],[],lb,[],@opt17_7c)
在matlab中调试了好久还不行 求大神
非线性约束规划 我编制了 目标函数和约束函数 为什么在matlab中还是出错 求大神看看这不给力的function f=myfun(x)f=0.192457*le-4*(x(2)+2)*x(1)^2*x(3);function [c,cep]=mycon(x)c(1)=350-163*x(1)^(-2.86)*x(3)^0.86;c(2)=1
function f=myfun(x)
f=0.192457*10^(-4)*(x(2)+2)*x(1)^2*x(3);
function [c,cep]=mycon(x)
c(1)=350-163*x(1)^(-2.86)*x(3)^0.86;
c(2)=10-0.14*0.01*x(1)^-4*x(2)*x(3)^3;
c(3)=(x(2)+1.5)*x(1)+0.44*0.01*x(1)^(-4)*x(2)*x(3)^3-3.7*x(3);
c(4)=375-0.356*10^6*x(1)*x(2)^(-1)*x(3)^(-2);
c(5)=4-x(3)/x(1);
cep=[];
-----------------------------------
A=[-1 0 0
1 0 0
0 -1 0
0 1 0
0 0 -1
0 0 1];
b=[-1;4;-4.5;50;-10;30];
x0=[2.0;5.0;25.0];
lb=zeros(3,1);
[x,fval,exitflag,output,lambda]=fmincon(@myfun,x0,A,b,[],[],lb,[],@mycon)
Warning:Trust-region-reflective method does not currently solve this type
of problem,
using active-set (line search) instead.
> In fmincon at 439
Local minimum possible.Constraints satisfied.
fmincon stopped because the size of the current search direction is less than
twice the default value of the step size tolerance and constraints were
satisfied to within the default value of the constraint tolerance.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
1
3
x =
1.0000
4.5000
11.7155
fval =
0.0015
exitflag =
4
output =
iterations:5
funcCount:20
lssteplength:1
stepsize:6.1230e-007
algorithm:'medium-scale:SQP,Quasi-Newton,line-search'
firstorderopt:1.2510e-004
constrviolation:0
message:[1x817 char]
lambda =
lower:[3x1 double]
upper:[3x1 double]
eqlin:[0x1 double]
eqnonlin:[0x1 double]
ineqlin:[6x1 double]
ineqnonlin:[5x1 double]