Problem setting population sorting on MSVC (and bugs?)
Yossi Mossel
ymossel at hotmail.com
Thu Dec 12 10:35:26 EST 2002
regarding the first problem try using:
ga.minimize();
see example 23.
Yossi Mossel
----Original Message Follows----
From: "Fredric V. Echols" <rwf at gpcom.net>
Reply-To: galib at mit.edu
To: <galib at mit.edu>
Subject: Problem setting population sorting on MSVC (and bugs?)
Date: Tue, 10 Dec 2002 16:07:09 -0600
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
_______________________________________________
galib mailing list
galib at mit.edu
http://lancet.mit.edu/mailman/listinfo/gal
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
More information about the galib
mailing list