Search code examples
matlabgenetic-algorithm

Genetic algorithm selection method stuck at local minimum after few generations


I am trying to write a code for GA to minimize the cost of a system, the problem is that the solution converges towards a local minimum and it gets stuck in it so I can't improve my solution anymore.

it might be my selection method that is causing the problem here is what I have:

%----------------------------selection (fittest half) ----------------

probability=ones(1,population/2);
[,IX]=sort(cost(1:population))
dd=sum(1:population);
probability(1:(population/2))=[1:population/2];
probability=fliplr(probability)/dd;


Indexx=IX(1:population/2);

then I use Indexx for crossover etc, can anybody suggest a solution ?


Solution

  • In general, optimization solving algorithms converge to a local minimum. To get out of this local minimum in a Genetic Algorithm, you can use mutations. Mutations are applied to some individuals of a generation. Usually, mutations will be bad and make the result worse and they will not be selected for the next generation, but sometimes, a mutation causes an individual to get close to a different (and sometimes better) local minimum. The higher the mutation rate is, the more 'space' will be searched and the higher the chance that the global minimum is found. There is a catch though; If the mutation rate is too high, the algorithm won't converge anymore.

    I hope this was helpful for your problem.