How can I change the 'MaxIterations' option in matlab 'createOpt​imProblem(​'fmincon',​..........​)'

52 ビュー (過去 30 日間)
Md. Hasan Rahman
Md. Hasan Rahman 2020 年 2 月 5 日
コメント済み: Matt J 2020 年 2 月 6 日
I am trying to solve a problem using the follwing code:
rng default
gs = GlobalSearch;
problem = createOptimProblem('fmincon','x0',x0,...
'objective',objective,'lb',lb,'ub',ub,'nonlcon',constfunc);
[res] = run(gs,problem);
But when I run this, this massage i get in command window:
'''''''''GlobalSearch stopped with one or more of the local solver runs stopping prematurely.
9 out of 9 local solver runs exceeded the iteration limit (problem.options.MaxIterations) or
the function evaluation limit (problem.options.MaxFunctionEvaluations).
None of the 9 local solver runs converged with a positive local solver exit flag"""""
I like to change the default option ""MaxIterations"". And ''MaxFunctionEvaluations''. I tried using the follwoing way but its not working,
rng default
gs = GlobalSearch;
problem = createOptimProblem('fmincon','x0',x0,...
'objective',objective,'lb',lb,'ub',ub,'nonlcon',constfunc,'MaxFunctionEvaluations',3000);
[res] = run(gs,problem);
It gives the following error:
"""""No field MaxFunctionEvaluations exists for PROBLEM structure."""""
How can I solve this problem? Thank you for your comment in advance.

採用された回答

Matt J
Matt J 2020 年 2 月 5 日
編集済み: Matt J 2020 年 2 月 5 日
You need to do this,
opts=optimoptions('fmincon', 'MaxFunctionEvaluations',3000);
problem = createOptimProblem('fmincon','x0',x0,...
'objective',objective,'lb',lb,'ub',ub,'nonlcon',constfunc,'options',opts);
  2 件のコメント
Md. Hasan Rahman
Md. Hasan Rahman 2020 年 2 月 6 日
Thank you. It worked.
Matt J
Matt J 2020 年 2 月 6 日
You're welcome, but since it did work, please Accept-click the answer.

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

その他の回答 (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