How to manually change MaxFunctionEvaluations in fmincon
Ältere Kommentare anzeigen
I would like to manually change the number of evaluations from 3000 to something bigger. Is it possible that with more evaluations I could increase the chance of finding global minimum of given function fun? How can I change this in script?
Thank you for your help:)
Akzeptierte Antwort
Weitere Antworten (2)
John D'Errico
am 25 Okt. 2016
2 Stimmen
No. Increasing the maximum number of function evaluations is NOT how you will ensure finding the global minimum. In fact, if the optimization has terminated happily in the first instance, then changing that limit will not do a thing.
Fmincon is not a global optimizer anyway. It will find a solution that is as best as it can, but different start points can yield different solutions. An increase in the function evals allowed will not change a thing.
You may want to try a global optimizer. There is a toolbox for that. Or you may want to try a stochastic optimizer such as a genetic algorithm. Again, a toolbox for that. Or simulated annealing, or particle swarm tools, etc. Or just better starting values.
Walter Roberson
am 25 Okt. 2016
0 Stimmen
Changing the maximum function evaluations can help find the local minima, in some cases where the function is complicated enough mathematically that a lot of evaluations are needed to predict the right directions to search, or if you want the position of the minima to high tolerance.
There are functions where relative movements on the order of 1E-10 or less make a big difference in the minima, when the local minima sits in a very narrow slot within a larger valley, so sometimes increasing the function evaluations can greatly affect the outcome.
Every once in a while the local minima turns out to be the global minima, but if you are searching in the wrong local minima, no matter how many function evaluations you permit, you are not going to find the global minima with fmincon. fmincon is mostly unable to escape from sufficiently deep local minima.
3 Kommentare
Walter Roberson
am 26 Okt. 2016
options = struct('MaxFunctionEvaluations', 10000);
[x, fval] = fmincon(objective_function, A, b, Aeq, beq, lb, ub, nonlcon, options);
If you have no value for any of the above such as Aeq, beq, then put [] in their place.
Fares Bettahar
am 11 Jan. 2023
Bearbeitet: Walter Roberson
am 12 Jan. 2023
hello sir ,can you help me please
I have this problem in Matlab
Solver stopped prematurely.
fsolve stopped because it exceeded the function evaluation limit,
options.MaxFunctionEvaluations = 5.000000e+02.
X =
18.7410 6.6035 138.6942 16.4586 9.6161
FVAL =
16.1142 6.6468 5.1229 22.6175 -21.6852
also When used
f
un = @tp1000;
X0 = [11 5 135 13 10];
% MaxFunEvals=1000;0
% options = optimoptions('levenberg-marquardt');
% oldoptions = optimoptions(@lsqnonlin,'Algorithm','levenberg-marquardt',...
% 'MaxFunctionEvaluations',1000)
options = struct('MaxFunctionEvaluations',1000)
[X,FVAL]= fsolve(fun,X0)
i dont know how do "MaxFunctionEvaluations" =1000
Alan Weiss
am 11 Jan. 2023
I suggest that you ask your question in a new question, not attached to one already answered.
Alan Weiss
MATLAB mathematical toolbox documentation
Kategorien
Mehr zu Surrogate Optimization finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!