Thanks Robert for your reply.<br>In fact, I&#39;m using The java version of GALib. <br><br>        //Elitism--fittest chromosome automatically go on to next gen (in 2 offspring)<br><br>        this.chromNextGen[iCnt].copyChromGenes(this.chromosomes[this.bestFitnessChromIndex]);<br>
        iCnt++;<br><br>        this.chromNextGen[iCnt].copyChromGenes(this.chromosomes[this.bestFitnessChromIndex]);<br>        iCnt++;<br><br>And here I don&#39;t see any reason to put it twice especially since we don&#39;t allow any mutation on the best indiv.<br>
<br><br><div class="gmail_quote">On Tue, Mar 17, 2009 at 4:56 PM, Robert Burbidge <span dir="ltr">&lt;<a href="mailto:rvb@aber.ac.uk">rvb@aber.ac.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On 17 Mar 2009, at 15:35, Zyed Bouzarkouna wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I was wondering why to apply elitism, GALib choooses the fittest chromosome to go automatically to next gen in 2 offspring.<br>
I don&#39;t see why the fittest is put twice in the next generation?<br>
</blockquote>
<br></div>
Hi Zyed,<br>
<br>
I assume you are using a simple GA as elitism doesn&#39;t make sense for a steady state or incremental GA. The relevant code snippet is:<br>
<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
void<br>
GASimpleGA::step()<br>
{<br>
...<br>
// If we are supposed to be elitist, carry the best individual from the old<br>
// population into the current population.  Be sure to check whether we are<br>
// supposed to minimize or maximize.<br>
<br>
  if(minimaxi() == GAGeneticAlgorithm::MAXIMIZE) {<br>
    if(el &amp;&amp; oldPop-&gt;best().score() &gt; pop-&gt;best().score())<br>
      oldPop-&gt;replace(pop-&gt;replace(&amp;(oldPop-&gt;best()), GAPopulation::WORST),<br>
                      GAPopulation::BEST);<br>
  }<br>
  else {<br>
    if(el &amp;&amp; oldPop-&gt;best().score() &lt; pop-&gt;best().score())<br>
      oldPop-&gt;replace(pop-&gt;replace(&amp;(oldPop-&gt;best()), GAPopulation::WORST),<br>
                      GAPopulation::BEST);<br>
  }<br>
...<br>
}<br>
&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;<br>
<br>
We can see that the best individual from the old population replaces the worst individual in the current population, provided that it is better than the best individual in the current population. This only results in one copy of the best in the current population.<br>

<br>
It is of course possible to obtain more than one copy of the best through selection if it happens that it is not crossed over or mutated. Try running with pcross = 1.0 and you should only see (at most) one copy of the best in the next generation with elitism (except for the hopefully rare case where the crossover has no effect).<br>

<br>
Rgds,<br><font color="#888888">
Robert<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Zyed Bouzarkouna<br>         <br>          <br>