Competing genomes
Martin Burrow
mburrow at ntlworld.com
Mon Apr 7 20:22:55 EDT 2003
Hello everyone,
I've encountered a problem with a GA I've written - it's not learning
(gulp!). I've defined a function called versus which plays one genome
against another, both of which are given as parameters: -
float
Versus(const GAGenome& a, const GAGenome& b){
GA1DBinaryStringGenome &sis=(GA1DBinaryStringGenome &)a;
GA1DBinaryStringGenome &bro=(GA1DBinaryStringGenome &)b;
// calculate and return the score
}
the Versus function is implemented using the following code: -
int width = 70;
GA1DBinaryStringGenome genome(width);
int popsize = 20;
int ngen = 10;
float pmut = 0.001;
float pcross = 0.9;
GAIncrementalGA ga(genome);
GASharing compete(Versus); // HERE
ga.scaling(compete);
ga.populationSize(popsize);
ga.nGenerations(ngen);
ga.pMutation(pmut);
ga.pCrossover(pcross);
ga.evolve();
I have programmed the Versus method to maintain the score of an entire
generation, and outputs the total score at the end of each generation - the
score never increases which leads me to believe that it is not learning.
I've left this program running overnight and still no learning is exhibited.
Does anyone know why this might not be working?
Regards,
Martin
More information about the galib
mailing list