How does global search handle negative exitflags of the local solver?

4 views (last 30 days)
Hi everybody,
I have a problem with the global search algorithm in combination with the local fmincon solver. As I use the output function of the local solver as stopping criteria, fmincon always delivers -1 as output flag. Although a negative exit flag means a "bad" result to MATLAB the result is correct for my prupose. Now I am not sure if my global search algorithm is working correctly, receiving negative exitflags of the local solver, as the current best point ist not updated during the process. At the moment I am using the output function of the global search function to write the local solutions to a backup variable, so that I can read and compare the results but I think the algorithm has some problems with the negative exitflags?!
Do you have any suggestions? Is it possible to manipulate the exitflag of the local solver?
Thanks in advance!
Alex
  6 Comments
Sean de Wolski
Sean de Wolski on 10 Oct 2013
@Alex, you could have your output function trigger the objective function to throw out a larger value than the previous iteration to trick the solver into thinking it found a local minimum.
This could be done using nested functions or object oriented programming.
Alex
Alex on 10 Oct 2013
Hi,
thanks for your reply.
Your approach is very close to what I meant with manipulating the exitflag in my first question but how can I extract values from the output function as the only output parameter is the stop flag. Sure I can add another output parameter to the function but how should I name it to communicate with the global search function? If I am right I can only read out values from optimValues and cannot change them actively, can I?
Best regards, Alex

Sign in to comment.

Answers (2)

Sean de Wolski
Sean de Wolski on 11 Oct 2013
Edited: Sean de Wolski on 11 Oct 2013
In reply to comments:
Yes, but GlobalSearch is evaluating your objective function on each iteration. All you can do is read these values out as you said in the plot function. But, from within the plot function you can change a flag, that when checked by the objective function, will cause your objective function to return a larger value than the previous iteration rather than doing the calculation.
If we had a small example, it would be easier to show how to do this. I think using a nested function as the plot function would likely be easiest. The nested function shares the workspace with the objective function so they can see and modify each other's variables. I thought there was an example on how to do this, but I can't find it now. Maybe Alan will chime in.
If you can provide a minimal working example, it would help.

Alex
Alex on 11 Oct 2013
Hi,
meanwhile I adapted my stopping criteria in an acceptable way so that I receive positive exit flags from the local solver (not a flag=1 but flag=2 which should be OK). At the moment I am trying to adjust the other parameters of the global search function to ensure that the global minimum is found. If this will work out the next days, I would be fine and the problem is solved. Otherwise I would like to come back to your idea with more details about my code.
Nevertheless, thanks for your help!
Best regards, Alex

Community Treasure Hunt

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

Start Hunting!