MATLAB Answers

Initial population in genetic algorithm

29 views (last 30 days)
djedoui Nassim
djedoui Nassim on 5 Apr 2021
Commented: djedoui Nassim on 6 Apr 2021 at 14:37
I am trying to use GA and other algorithms to minimize my problem. For a faire comparison, the initial population will be chosen the same for all the algorithms. A randomly generated population is then generated and called for each algorithm.
So far, the idea works well except for GA where different result (starting objective) is obtained.
Following the options used for the GA, anyone can help me with this?
options = optimoptions(@ga,'Generations',Max_iteration,'OutputFcns',@outputfunction,'PopulationSize',50,'InitialPopulationMatrix',initialX,'TolFun',1e-10);

Accepted Answer

Alan Weiss
Alan Weiss on 5 Apr 2021 at 20:45
To get reproducible results, set the random number generator before you call ga. For example,
rng default
% or rng(1) or whatever you like
% Then call ga
Alan Weiss
MATLAB mathematical toolbox documentation
djedoui Nassim
djedoui Nassim on 6 Apr 2021 at 14:37
I tried your suggested solution and it works
Many thanks

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!