フィルターのクリア

What is the repeatability like in matlabs genetic algorithm?

4 ビュー (過去 30 日間)
Emily Senay
Emily Senay 2015 年 6 月 19 日
コメント済み: Emily Senay 2015 年 6 月 22 日
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

採用された回答

Mukul Rao
Mukul Rao 2015 年 6 月 22 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by