title: Genetic algorithm selection method stuck at local minimum after few generations
body: <p>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.</p>
  
  <p>it might be my selection method that is causing the problem here is what I have:</p>
  
  <pre><code>%----------------------------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);
  </code></pre>
  
  <p>then I use Indexx for crossover etc, can anybody suggest a solution ?</p>