Genetic Algorithm Drifting to Worse Solutions With Each Generation

3 views (last 30 days)
Hello all, So I am using a genetic algorithm for parameter estimation, and in the past 10 or so attempts a situation such as in the attached picture has been occurring. In that picture, the following was my code:
options = optimoptions('ga','PlotFcn',@gaplotbestf,'PopulationSize',600,'UseParallel',true,'Elitecount', 20,'Generations',50,'SelectionFcn',{@selectiontournament,2},'Display','iter'...
,'InitialPopulationMatrix',Sturt);
[x,fval,exitflag] = ga(@RED_vecfit1,Nvars,[],[],[],[],LB,UB,@RED_nonlinconstraint,options)
My number of variables is 692, and I have no linear constraints, and only an upper bound and lower bound (the first 690 variables are between 0 and 10, and the final two are just -Inf to Inf). My suspicion is that the feasible starting point I fed the algorithm was just located in a bad spot, so the algorithm drifted to a worse solution, because my nonlinear constraint is returning the the results I expect. However even when I do not start with an initial population, the algorithm always jumps up quickly in the beginning and levels off quickly, like an inverse of what it should be doing.
If anyone can tell me if I just chose the worst possible set of parameters for such a high-dimensional problem that would be great.
Also bonus thanks if someone can tell me why that same call (minus the ga options) would cause patternsearch to just shut my computer down? I've been wanting to try patternsearch but it either will run until forever or immediately kick back a barely changed solution set from my initial.
Much thanks! Jacob

Answers (1)

Star Strider
Star Strider on 29 Mar 2018
Assuming that you wrote your fitness function correctly, you are optimising 692 parameters, and you have only let it run for 50 generations. You have a 'PopulationSize' of 600, and if you began with a random population (my preference), you simply need to let it run, perhaps to several hundred or even several thousand generations, since it’s going to take time to optimise all those parameters. In my experience, constraints, including parameter limits, slow the convergence.
Genetic algorithms are quite tolerant of less than wonderful initial parameter choices, the reason I always begin with a random population.
  2 Comments
Jacob Tracy
Jacob Tracy on 30 Mar 2018
I am trying the approach now, and I'm also upping the percentage of Elitecount. Thanks for the advice! Even on parallel my computer runs very slow and I haven't hooked up to the distributed server yet so once I get results I'll share. I appreciate your time.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!