主函数:
x0=[0.1 0.05 3.5];
lb=[0 0 3];
ub=[0.8 0.6 10];
a=[-1 1 0;-1 0 0;0 -1 0;0 0 -1];
b=[0 0 0 -3]';
options=optimset('tolcon',1e-8);
[x,fval]=fmincon(@cdz_f,x0,a,b,[],[],lb,ub,@cdz_v,options)
辅助函数(非线性约束)
function[c,ceq]=cdz_y(x);
c(1)=154.34*x(1)/(x(1)^4-x(2)^4)-((x(1)-x(2))/x(1))^(3/2);
ceq=[];
主函数(目标函数)
略
出现以下问题:
Warning: Trust-region-reflective method does not currently solve this type of problem,
using active-set (line search) instead.
> In fmincon at 439
In chuandongzhou at 7
??? Error using ==> feval
Undefined function or method 'cdz_v' for input arguments of type 'double'.
Error in ==> fmincon at 599
[ctmp,ceqtmp] = feval(confcn{3},X,varargin{:});
Error in ==> chuandongzhou at 7
[x,fval]=fmincon(@cdz_f,x0,a,b,[],[],lb,ub,@cdz_v,options)
Caused by:
Failure in initial user-supplied nonlinear constraint function evaluation. FMINCON
cannot continue.
慕桂英3389331