GA generates duplicate initial populations

I am using Genetic Algorithms for inverse problems (a large number of variables, i.e. more than 1000). I use the supercomputers provided by my university to run my models. In order to check how efficient my GA model is, I need to run one model a couple of times (e.g. 10 times) and see how many times it converges to an acceptable solution. The problem is that for all the trials of a specific model, Matlab generates exactly the same set of initial populations. This rsults in exactly the same answers for all the trials. I manually generated initial populations to overcome this issue, however, the model did not converge to a solution since it was very complicated and manually generated initial populations did not lead to convergence. In the model, I have upper and lower bounds without any constraint. Is it possible for Matlab to generate timely randomised initial populations (automatically by Matlab through options maybe, not by manually defining initial populations)? This will help with generating different initial populations for different runs of the same model. Your help is much appreciated.

2 Comments

Twana Haji
Twana Haji on 20 Jun 2019
Edited: Twana Haji on 21 Jun 2019
Hi,
Many thanks for your reply. The command rng('shuffle') works perfectly. Thank you very much.

Sign in to comment.

 Accepted Answer

Twana Haji
Twana Haji on 21 Jun 2019
Edited: Twana Haji on 21 Jun 2019
The issue is related to the random number generation of MATLAB. Before writing GA sentences (e.g. options, ga() function, etc), the command rng('shuffle') has to be added to the code so that each time the code is run, a new initial population is randomly generated. For more information, visit the follwoing link. Trung VO DUY wrote this in comments for me - thank you Trung VO DUY.

More Answers (0)

Asked:

on 20 Jun 2019

Edited:

on 21 Jun 2019

Community Treasure Hunt

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

Start Hunting!