Misleading "relative change" wording for stopping criterion in particleswarm global optimization

1 view (last 30 days)
In the documentation and output, a stopping criterion for the particle swarm method is: "relative change in the objective value over the last OPTIONS.MaxStallIterations iterations is less than OPTIONS.FunctionTolerance." However, this clearly was not a relative change in my case. Looking at the code, it is actually sometimes relative, sometimes absolute:
funChange = abs(maxBestFvalsWindow-bestFval)/max(1,abs(bestFval));
Why the max(1, ...) ?? This makes it the absolute change if the function value is under 1 (which it always is in my case).
Is this a bug or intentional? If it's the latter, the documentation and output should be clarified when it's actually stopping because of the absolute change.
Do other (all?) optimisation methods behave this way?

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!