[galib] GADemeGA changing gene to a value not in alleleset

Fei Peng fpeng at cs.cmu.edu
Fri Feb 21 17:34:12 EST 2014


Hi!

I've been trying various things within galib for almost a week now, 
basically I have a GA1DArrayAlleleGenome<int> that's fixed in size, for 
each gene there's an alleleset that contains the possible values for 
that gene. I'm using a custom initializer and objective function.

The algorithm runs well without any problem under simpleGA and 
steadystateGA, however I got this strange behavior when running 
GADemeGA: one of the genes gets assigned a value that's not in its 
alleleset. And this happens not during the initialization phase (I have 
tested for that). Is it possible that this is brought in during a 
crossover/mutation? the following are the options I used. Please let me 
know if you might know why this is happening.

Thanks!
Fei


GA1DArrayAlleleGenome<int> genome(alleles, Objective, this);
genome.crossover(GA1DArrayGenome<int>::TwoPointCrossover);
genome.initializer(OmInitializer);

unsigned int seed = rand();

int popsize = 400;	// GA parameters
double pRep = 0.1;
int ngen = 2000;
float pmut = 0.01;	// prob of mutation
float pcross = 0.8;
int npop = 5;
double pmig = 0.05;
int nmig = max(1,(int)ceil(popsize*pmig));
unsigned int nReplace = max(1,(int)ceil(popsize*pRep));

GADemeGA ga(genome);	// multiple pop with migration,
ga.nPopulations(npop);
for (int i = 0; i < npop; i++)
	ga.nReplacement(i, nReplace);	// using GADemeGA:ALL doesn't work
ga.nMigration(nmig);

ga.populationSize(popsize);
ga.nGenerations(ngen);
ga.pMutation(pmut);
ga.pCrossover(pcross);
ga.evolve(seed);


More information about the galib mailing list