Problem setting population sorting on MSVC (and bugs?)
Fredric V. Echols
rwf at gpcom.net
Tue Dec 10 17:07:09 EST 2002
Hello everyone,
I am using a system in which a genetic algorithm is being used to
produce signals, and the fitness function works by determining signal error
using Mean Squared Error. Obviously, the lower the error, the better the
genome is. Anyway, when I try to set the population to use the "lower is
better" mode, I get this from MSVC 6.0:
"error C2663: 'order' : 2 overloads have no legal conversion for 'this'
pointer"
Here is the relevant code:
---
// Genome type
#define GenomeT unsigned char
#define GAGenomeT GA1DArrayAlleleGenome<GenomeT>
// Allele set
GAAlleleSet<GenomeT> Allele(0, 255);
// Genome
GAGenomeT genome(2, Allele, Objective);
// Set up genome
genome.initializer(Initializer);
// GA
GASimpleGA ga(genome);
// Set sort order
ga.population().order(GAPopulation::LOW_IS_BEST);
---
The last line is where the problem lies, according to the compiler.
There is also another problem... I manually set the sort order to
LOW_IS_BEST in GAPopulation.cpp and recompiled the library, which worked to
a certain extent. However, when running in this mode, elitism does not seem
to work correctly, and the best individual in the population (using
GASimpleGA) will vary from step to step in the evolution. Here's an example
output of my test program showing the vacillation:
---
1
19
1
19
19
1
19
19
19
1
---
Why would it keep "bouncing" between values like this? Is elitism broken
for LOW_IS_BEST ordering, or is something wrong with my code?
Thanks for your time!
-Fredric Echols
More information about the galib
mailing list