Problem with setPreservFittestIndividual

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with setPreservFittestIndividual

Oscar Miguel Alonso M
Hello!!

I had problems with the option setPreservFittestIndividual() of the
Configuration class. Although I set it to true, sometimes the fitness
of the fittest individual decreases from one generation to the next
one. I browsed the source code and I think that there is a bug in the
class GABreeder, in line 45.

It is

fittest = pop.determineFittestChromosome(0, originalPopSize - 1);

and I think it should be

fittest = pop.determineFittestChromosome(0, pop.size() - 1);

because the fittest individual is added by the breeder at the end of
the population, and the current population size may be greater than
the one defined in the configuration.

Manually adding the fittest individual at the beginning of the
population solved my problem. Please tell me if I am right or if there
is a better way of ensuring that the best individual is preserved for
the next generation.

Best regards,
Oscar M

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with setPreservFittestIndividual

Klaus Meffert-5
Oscar,

Thanx a lot for your detailled report and your helpful guess about the
source of error!
It seems that it is as you wrote. I will soon check in the changes to
GABreeder as you propose.

Best

Klaus
www.klaus-meffert.com

 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf
> Of Oscar Miguel Alonso M
> Sent: Thursday, January 10, 2008 8:18 PM
> To: [hidden email]
> Subject: [jgap-users] Problem with setPreservFittestIndividual
>
> Hello!!
>
> I had problems with the option setPreservFittestIndividual()
> of the Configuration class. Although I set it to true,
> sometimes the fitness of the fittest individual decreases
> from one generation to the next one. I browsed the source
> code and I think that there is a bug in the class GABreeder,
> in line 45.
>
> It is
>
> fittest = pop.determineFittestChromosome(0, originalPopSize - 1);
>
> and I think it should be
>
> fittest = pop.determineFittestChromosome(0, pop.size() - 1);
>
> because the fittest individual is added by the breeder at the
> end of the population, and the current population size may be
> greater than the one defined in the configuration.
>
> Manually adding the fittest individual at the beginning of
> the population solved my problem. Please tell me if I am
> right or if there is a better way of ensuring that the best
> individual is preserved for the next generation.
>
> Best regards,
> Oscar M


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
jgap-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jgap-users