What is the repeatability like in matlabs genetic algorithm?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Emily Senay
le 19 Juin 2015
Commenté : Emily Senay
le 22 Juin 2015
If I run my code multiple times, everytime the number of generations that the program takes to converge are very different. Without changing anything, the generations are anywhere from 500 to 2700. I know that since the genetic algorithm runs randomly, the solution will be different everytime. But, shouldn't the number of generations be close and not so spread out? Thanks
0 commentaires
Réponse acceptée
Mukul Rao
le 22 Juin 2015
In my opinion this behavior is expected since the initial population is random. Each time the genetic algorithm (GA) is evoked, the initial population could be located in a part of the domain where the surface geometry could be completely different from the previous GA calls. In some calls, the starting population might be located in a "favorable" region in the sense that the nature of the fitness function surface may be conducive to the tolerances being met faster as the generations progress.
In fact, this behavior is also observed in the documented example "Minimize Rastrigin's Function" with the genetic algorithm.
options = gaoptimset(@ga);
options.Display = 'iter';
[x fval exitflag] = ga(@rastriginsfcn, 2,options)
In the above example, you will notice that the number of iterations required to meet the default tolerances ranges from 50 - 200 iterations.
It seems to me that repeatability can be controlled by changing the mode of random number generation. The documentation page on "Minimize Rastrigin's Function" , suggests changing the random generation to the 'twister' option to improve repeatibility:
The specific command of interest would be:
rng(1,'twister') % for reproducibility
I would also recommend modifying the solver options, such as the stopping criteria to see if it helps improve reproducibility.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Genetic Algorithm dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!