[galib] Ellitism

Zyed Bouzarkouna bouzarkouna.zyed at gmail.com
Tue Mar 17 12:13:01 EDT 2009


Thanks Robert for your reply.
In fact, I'm using The java version of GALib.

        //Elitism--fittest chromosome automatically go on to next gen (in 2
offspring)


this.chromNextGen[iCnt].copyChromGenes(this.chromosomes[this.bestFitnessChromIndex]);
        iCnt++;


this.chromNextGen[iCnt].copyChromGenes(this.chromosomes[this.bestFitnessChromIndex]);
        iCnt++;

And here I don't see any reason to put it twice especially since we don't
allow any mutation on the best indiv.


On Tue, Mar 17, 2009 at 4:56 PM, Robert Burbidge <rvb at aber.ac.uk> wrote:

> On 17 Mar 2009, at 15:35, Zyed Bouzarkouna wrote:
>
>  I was wondering why to apply elitism, GALib choooses the fittest
>> chromosome to go automatically to next gen in 2 offspring.
>> I don't see why the fittest is put twice in the next generation?
>>
>
> Hi Zyed,
>
> I assume you are using a simple GA as elitism doesn't make sense for a
> steady state or incremental GA. The relevant code snippet is:
>
> >>>>>>>>
> void
> GASimpleGA::step()
> {
> ...
> // If we are supposed to be elitist, carry the best individual from the old
> // population into the current population.  Be sure to check whether we are
> // supposed to minimize or maximize.
>
>  if(minimaxi() == GAGeneticAlgorithm::MAXIMIZE) {
>    if(el && oldPop->best().score() > pop->best().score())
>      oldPop->replace(pop->replace(&(oldPop->best()), GAPopulation::WORST),
>                      GAPopulation::BEST);
>  }
>  else {
>    if(el && oldPop->best().score() < pop->best().score())
>      oldPop->replace(pop->replace(&(oldPop->best()), GAPopulation::WORST),
>                      GAPopulation::BEST);
>  }
> ...
> }
> <<<<<<<<<<
>
> 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.
>
> 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).
>
> Rgds,
> Robert
>



-- 
Zyed Bouzarkouna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20090317/d70e6573/attachment.htm


More information about the galib mailing list