ga_options = gaoptimset(ga_options,'TolFun', 1e-10);
ga_options = gaoptimset(ga_options,'StallGenLimit', 20);
The ga stops after 6 generations with the message
Optimization terminated: average change in the fitness value less than options.TolFun and constraint violation is less than options.TolCon.
If I look at the last two generations, the objective function for the best element in generation 6 is equal to 21.8, and the objective function for the best element in generation 5 is equal to 22
Reading the help file for TolFun in the ga I find: Positive scalar. The algorithm runs until the cumulative change in the fitness function value over StallGenLimit is less than TolFun.
It does not seem what happened in my case. Does anyone have a hint?
Giovanni
The options you are using affects the sub-problem solution only. See how the nonlinear GA solver works:
http://www.mathworks.com/help/toolbox/gads/bqf8bdd.html
The solver took major 6 iterations to solve for the original constrained problem. The TolFun' option is used to terminate the outer iteration but the 'StallGenLimit' is used only for the inner iteration when solving a sub-problem. The outer iteration does not use this option.
I think the doc should explain this more clearly. Thanks for your question.
Rakesh