From b03bd951e0c65d3b2434edc205a658f24ea58747 Mon Sep 17 00:00:00 2001 From: marc Date: Thu, 22 Jun 2000 03:23:15 +0000 Subject: [PATCH] The initial individuals were evaluated directly using binary_value This resulted in the fitness NOT being set, and some abort or segmentation fault later Only eoEvalFunc shouydl be used to evaluate individuals!!! --- eo/test/t-eoEasyEA.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/eo/test/t-eoEasyEA.cpp b/eo/test/t-eoEasyEA.cpp index 17ee52e1..160d0304 100644 --- a/eo/test/t-eoEasyEA.cpp +++ b/eo/test/t-eoEasyEA.cpp @@ -22,14 +22,19 @@ main() const unsigned POP_SIZE = 8, CHROM_SIZE = 16; unsigned i; +// a chromosome randomizer eoBinRandom random; +// the populations: eoPop pop; - + + // Evaluation + eoEvalFuncPtr eval( binary_value ); + for (i = 0; i < POP_SIZE; ++i) { Chrom chrom(CHROM_SIZE); random(chrom); - binary_value(chrom); + eval(chrom); pop.push_back(chrom); } @@ -52,9 +57,6 @@ main() // replacement eoInclusion inclusion; - // Evaluation - eoEvalFuncPtr eval( binary_value ); - // Terminators eoFitTerm term( pow(2.0, CHROM_SIZE), 1 );