本人利用matlab里的fmincon函数求解一个优化问题,主函数:
clc
clear all
lb=[3 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1];
ub=[3 5 5 4 5 5 4 5 5 4 5 5 4 5 5 4];
x0=[3 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2];
options=optimset('display','off','Algorithm','sqp');
[x,fval]=fmincon(@fitness,x0,[],[],[],[],lb,ub,@cony,options);
运行错误提示:
未定义函数或变量 "G"。
出错 extraction (line 35)
q=[G,V3,F,f1,f2];
出错 fitness (line 9)
q=extraction(wx);
出错 finDiffEvalAndChkErr (line 25)
出错 finitedifferences (line 127)
出错 computeFinDiffGradAndJac (line 23)
出错 sqpLineSearch (line 120)
出错 fmincon (line 859)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = sqpLineSearch(funfcn,X,full(A),full(B),full(Aeq),full(Beq), ...
出错 SQP (line 9)
[x,fval]=