Failure in initial user-supplied objective function evaluation.
显示 更早的评论
in script :
function f = zdt1(x)
% jbods %
Pmax = 30;
Mmax = 6;
f(1) = x(1)/Pmax;
f(2) = log10(0.5)/log10(x(2));
f(3) = 1-log2(x(3))/log2(Mmax);
end
in main:
fitnfct = @zdt1;
nvar=3;
LB=[1,1,1];
UB=[60, 8 , 4];
opt = saoptimset('Display','iter',...
'reannealinterval',300,...
'PlotFcn',{@saplotbestf,@saplottemperature,@saplotf,@saplotstopping});
[xf,fval,exitflag] = simulannealbnd(fitnfct,[0 0],LB,UB,opt);
error:
Error in mainzdt3SA (line 8)
[xf,fval,exitflag] = simulannealbnd(fitnfct,[0 0],LB,UB,opt);
Caused by:
Failure in initial user-supplied objective function evaluation.
回答(1 个)
Torsten
2016-6-3
0 个投票
1. If you supply lower and upper bounds for three variables (LB=[1,1,1]; UB=[60, 8 , 4];), you also have to supply an initial guess for three variables ([ 0 0]).
2. fitnfct must return a single value, not a vector with three elements (f(1)=...,f(2)=...,f(3)=...).
Best wishes
Torsten.
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!