What is the meaning of -10 exit flag in optimization toolbox?

3 views (last 30 days)
I am doing some optimization using the global optimization toolbox and am getting a lot of -10 exit flags from the local runs of MultiStart. While, the documentation says that this means an error in the user supplied functions, this does not help me much in trying to figure out what is going on.
Could this be a result of the fact that my problem might not be guaranteed to be smooth? I do get a solution in at least 1 of the local runs that terminates with a flag of 1.
I am currently using MultiStart and fmincon, should I change to patternsearch instead?
Any help is appreciated.

Accepted Answer

Walter Roberson
Walter Roberson on 6 Apr 2012
An error in the user defined function could mean that your function went complex, inf, or NaN. If you had been using fzero() instead of fmincon() then it could indicate the supplied endpoints did not have different signs when evaluated for the function.
Other possibilities include that your user function generated an error, such as if you made an assumption about vector sizes that turned out not to be true under some conditions (a horzcat or vertcat error), or if you accidentally coded matrix multiplication or matrix division or matrix power where you wanted element-by-element calculations.
  3 Comments
Walter Roberson
Walter Roberson on 7 Apr 2012
An error does get thrown in that case, but fmincon() is catching the error and smoothly returning an error flag result that the multistart routine is turning into its own error flag result.
If your quest at this point is to find out what error is being generated, use
dbstop if caught error
You might also want to try
dbstop if naninf
Stefan
Stefan on 8 Jun 2012
Sorry for the late reply, thanks for the advice, I managed to clear things up!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!