[galib] some strangeness with reevaluating a population

david wallin david.wallin at ul.ie
Fri Nov 28 11:11:00 EST 2003


Hi,

Some problems with GAlib v.2.4.5. I can send test code if necessary.

Using GA1DBinaryStringGenome and GASimpleGA on a dynamic problem. I.e., 
the fitness changes at a certain generation N.


1) If I have a loop like the following run at a certain generation over 
the entire population reevaluating the entire population. Should all 
the individuals be reevaluated then? If so, there seems to be a bug in 
GAlib since the best individual keeps its old fitness even if the 
fitness function tells it otherwise.

        for(int i=0; i<ga.population().size(); i++){
  	genome = ga.population().individual(i);
  	genome.evaluate(gaTrue);
        }

I specifically had to get the best individual, evaluate its fitness to 
make it change its score.


2)  Replacing the above loop with this call to the GAPopulation:

ga.population().evaluate(gaTrue);

results in a compiler error :

sga_cauchy.cc: In function `int main(int, char**)':
sga_cauchy.cc:105: passing `const GAPopulation' as `this' argument of 
`void
    GAPopulation::evaluate(_GABoolean = gaFalse)' discards qualifiers



cheers,

--david.






More information about the galib mailing list