Can I manually set the exit criteria for the genetic mutation algorithm with an Objective Function?
1 view (last 30 days)
Show older comments
MathWorks Support Team
on 7 Aug 2017
Answered: MathWorks Support Team
on 8 Aug 2017
I do not fully understand how the solution tolerance is defined for "gamultiobj". I can set the tolerance property by setting the 'TolFun' option, but it is unclear exactly how the solver uses this value. In my case, I am working with two objective functions. When I execute the solver, it runs for 100 generations; however, it seems that convergence in the objective functions has been reached after about 20 generations. Is there any way I can tell the solver to stop after my own criteria for the objective functions convergence has been met?
Accepted Answer
MathWorks Support Team
on 7 Aug 2017
With multiple objectives, The “convergence” criterion for the function "gamultiobj" is related to the stalling in the 'spread' of the pareto set of solutions. The appropriate options to control this value are 'TolFun' (FunctionTolerance) and 'MaxStallGenerations'. See the description here:
If you are specifically interested in stopping the solver when a single objective value stalls, then you can implement your own test via a custom OutputFcn:
The general idea would be to measure the change in one or both objective function over a window of generations. The solver can be stopped by setting the StopFlag in the state structure:
This is an example of the syntax to pass a custom output function to the solver along with an arbitrary constant argument "TOLS":
TOLS = [.0005, .25];
options = gaoptimset(options,'OutputFcns',@(options,state,flag)trackObj12_fixed(options,state,flag,TOLS));
The following is one way to represent the current values of the objective functions from within the custom output function. "state.Rank" contains the rank of each member of the population and the members with Rank = 1 are the relevant members to look at. "state.Score" contains the values of the objective functions for each member. I take the mean as one way to represent the current objective function values as a single value for simplicity:
obj1 = mean(state.Score((state.Rank == 1),1));
obj2 = mean(state.Score((state.Rank == 1),2));
The above was one method that allows you to analyze convergence of individual objectives. However, in most cases, the tolerance for the convergence on the pareto front should be set using 'TolFun'.
To see how MATLAB computes the 'spread of the pareto solutions', which is used to compare to the 'TolFun' convergence criteria:
0 Comments
More Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!