MaxFunEvals fmincon default option

조회 수: 13 (최근 30일)
Alessandra Costa
Alessandra Costa 2019년 6월 17일
댓글: Alessandra Costa 2019년 6월 19일
Good evening to everyone, I would like to know how I can chang the MaxFunEvals number using fmincon. Before calling the optimization algorithm I use:
options= optimoptions(@fmincon,'Display','final','MaxIter',1000,'MaxfunEvals',5000,'TolFun',1e-4,'TolCon',1e-6,'TolX',1e-6);
and then in fmincon I use options, but when I run the code I get the following message:
fmincon stopped because it exceeded the function evaluation limit,
options.MaxFunctionEvaluations = 3000 (the default value).
Thank you so much,
Alesandra
  댓글 수: 2
Star Strider
Star Strider 2019년 6월 17일
When I run the line you posted, it definitely shows that 'MaxFunctionEvaluations' has been set to 5000.
We would have to see the rest of your code (or at least the relevant parts of it) to see if we can detect tthe problem.
Alessandra Costa
Alessandra Costa 2019년 6월 18일
Thank you for the answer. What do you mean with "the relavant parts of it"?

댓글을 달려면 로그인하십시오.

채택된 답변

Steven Lord
Steven Lord 2019년 6월 18일
Your code that creates the optimoptions object looks correct though if you're using release R2016a or later you may want to switch to the current names listed on this documentation page. [That documentation page states that the optimoptions function accepts either legacy or current names.] In particular, 'MaxFunEvals' was changed to 'MaxFunctionEvaluations'.
options= optimoptions(@fmincon,'Display','final','MaxIter',1000,...
'MaxfunEvals',5000,'TolFun',1e-4,'TolCon',1e-6,'TolX',1e-6);
Can you show you call to fmincon? I suspect you're not passing the options into fmincon correctly (or at all.) The optimoptions function creates an object specifying the options, it does not change the options globally for all fmincon calls in the future. [I've seen a number of cases in the past where users held that belief, which is why I mention it.]
  댓글 수: 1
Alessandra Costa
Alessandra Costa 2019년 6월 19일
Sorry for the late, I passed the options in this way:
[pars,log_lik,exit,output]=fmincon('f',pars,A,B1,[],[],LB,UB,[],options,data,1);
I solved by re-starting Matlab and now it seems right.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver 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