How to choose population and generations for GA?

22 views (last 30 days)
Hello everyone,
I would like to know if there is a method to properly define a good number of generations and population for running an optimization with GA? Is there any rule of thumb to choose the correct order of magnitude of those two parameters?
Thank you in advance

Accepted Answer

Star Strider
Star Strider on 23 Nov 2020
I use an optimoptions structure for this.
Example —
PopSz = 500;
Parms = 3;
opts = optimoptions('ga', 'PopulationSize',PopSz, 'InitialPopulationMatrix',randi(1E+4,PopSz,Parms).*[1E-3 1E-1 1E+2], 'MaxGenerations',2E3, 'PlotFcn',@gaplotbestf, 'PlotInterval',1);
It is then possible to scale the individual columns of the 'InitialPopulationMatrix' aas I do here, so that it is easier for ga to find an appropriate solution. Providing a relatively large number of rows (individuals) can slightly slow the function, however in my experience it decreases the number of generations required for ga to converge.
  6 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!