MATLAB Answers

Save all the optimization results from MultiStart and Global Search

20 views (last 30 days)
Hello Matlab Community,
I have a questio about the Matlab Global Optimization features.
I would like to get, at the end of the optimization, all the solutions, also the ones with negative exit flags and respective parameters values.
I use the following syntax
[x,fval,exitflag,output,solutions] = run(...)
but I only get, in [solutions], the local minima with a positive exit flag, and I would like to check all the others as well.
Is there a way to accomplish what I need, that I have missed?
Many thanks and best regards.


Sign in to comment.

Accepted Answer

Alan Weiss
Alan Weiss on 14 Dec 2018
Sorry, no, GlobalSearch and MultiStart do not consider the points corresponding to negative local exit flags as being solutions, and so do not store them in the returned GlobalOptimSolution object.
Why do you want these points?
Alan Weiss
MATLAB mathematical toolbox documentation


Maria Angela Agizza
Maria Angela Agizza on 14 Dec 2018
Hello and thanks for the answers.
I need to have a look at those points because I have optimization routines with more than 30 parameters that take days to converge. Therefore, to speed up the process, I wrote an Output Function to stop the solver if the ObjectiveFunction is below a certain value and a certain iteration count has been exceeded. So I would like to get those solutions to check them myself, and judge whether they are ok for my case or not.
If it is not possible, then I could write in the output function itself to save the parameters vector before stopping, when the stopping criteria are met. Is that right?
Best regards.
Alan Weiss
Alan Weiss on 14 Dec 2018
Certainly, use your output function to save the point.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (1)

Kurt Stewart
Kurt Stewart on 20 Mar 2019
You can make your solutions as global variables that get saved into a matrix

  1 Comment

Maria Angela Agizza
Maria Angela Agizza on 20 Mar 2019
Hello, thanks for the advice.
I actually solved the problem with an output function, where I exploit the "state" of the optimization to get the parameters when the calculation reaches the maximum number of iterations (attached code).
switch state
case 'done'

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!