Empty keys error in using optimoptions

4 ビュー (過去 30 日間)
RUAN YY
RUAN YY 2020 年 8 月 11 日
コメント済み: RUAN YY 2020 年 8 月 14 日
Hey guys! I am working on Genetic algorithm recently. And I met some problems when using fmincon.
I got error when calling the following line of code.
options = optimoptions(@fmincon,'OutputFcn',@outfun,...
'Display','off','Algorithm','interior-point','MaxFunEvals',budget);
It said,
Empty keys are not allowed in this container.
Error in my_fmincon (line 24)
options =
optimoptions(@fmincon,'OutputFcn',@outfun,...
where budget is 10000, outfun is deined in this way:
function stop = outfun(x,optimValues,state)
stop = false;
switch state
case 'init'
%hold on
case 'iter'
% Concatenate current point and objective function
% value with history. x must be a row vector.
history.fval = [history.fval; optimValues.fval];
history.x = [history.x; x];
% Concatenate current search direction with
% searchdir.
% searchdir = [searchdir;...
% optimValues.searchdirection'];
% plot(x(1),x(2),'o');
% Label points with iteration number and add title.
% Add .15 to x(1) to separate label from plotted 'o'
% text(x(1)+.15,x(2),...
% num2str(optimValues.iteration));
% title('Sequence of Points Computed by fmincon');
case 'done'
%hold off
otherwise
end
end
Help! Thanks a lot!!

採用された回答

Aman Vyas
Aman Vyas 2020 年 8 月 14 日
Hi,
You can re run the installer and add "Global Optimization toolbox" in your installation procedure, as this solution resolved errors for many.
Also you can take look at this answer.
Hope it helps !
Aman
  1 件のコメント
RUAN YY
RUAN YY 2020 年 8 月 14 日
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by