From: SACHIN DEVASSY on
Hi
I used GA solver along with non linear constraint. The GA gets terminated after 5 generations and gives exitflag 4. When I didnt use non linear constraint the exitflag was 1 and terminated after 50 generations. Could some one tell me the reason. Also which one would be a better answer, the one with exit flag 4 or exit flag 1.

Thanks
From: Alan Weiss on
SACHIN DEVASSY wrote:
> Hi
> I used GA solver along with non linear constraint. The GA gets
> terminated after 5 generations and gives exitflag 4. When I didnt use
> non linear constraint the exitflag was 1 and terminated after 50
> generations. Could some one tell me the reason. Also which one would be
> a better answer, the one with exit flag 4 or exit flag 1.
>
> Thanks

As described here:
http://www.mathworks.com/access/helpdesk/help/toolbox/gads/ga.html
exit flag 4 means "Magnitude of step smaller than machine precision and
constraint violation less than options.TolCon."

If you want to check whether your answer is indeed a local minimum, I
suggest you try patternsearch. Use the final point from ga as the
initial point for patternsearch.

Alan Weiss
MATLAB mathematical toolbox documentation
From: SACHIN DEVASSY on
Sir
Thanks for the reply, indeed when i used the point obtained with ga as initial point in direct search, the function was further minimized. But then why would ga stop at that point. Also i am not clear what is meaning, of the exit flag 4 and 1 because the answer obtained in both conditions of exit flag could be minimized further using direct search.

which exit flag condition would give more guarantee in the solution. Thanks.
From: Alan Weiss on
SACHIN DEVASSY wrote:
> Sir
> Thanks for the reply, indeed when i used the point obtained with ga as
> initial point in direct search, the function was further minimized. But
> then why would ga stop at that point. Also i am not clear what is
> meaning, of the exit flag 4 and 1 because the answer obtained in both
> conditions of exit flag could be minimized further using direct search.
>
> which exit flag condition would give more guarantee in the solution.
> Thanks.

I suggest you consult the documentation for "Choosing Between Solvers
for Nonsmooth Problems":
http://www.mathworks.com/access/helpdesk/help/toolbox/gads/bsa_e70.html#bsbjg7m
and Solver Characteristics:
http://www.mathworks.com/access/helpdesk/help/toolbox/gads/bsa_e70.html#bsa_e88

There are no guarantees with ga. patternsearch provably reaches a local
minimum (with some mild conditions on the objective function). The exit
flag is not an infallible guide to the quality of a solution for ga. In
other words, if you want to make sure you reached a minimum, you cannot
use ga alone.

Alan Weiss
MATLAB mathematical toolbox documentation