From 492899bfb2d278932e5ad5209aeb9f45a1bc9a3c Mon Sep 17 00:00:00 2001 From: maartenkeijzer Date: Mon, 12 Mar 2001 14:27:31 +0000 Subject: [PATCH] invalidating supported now --- eo/src/eoSGA.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/eo/src/eoSGA.h b/eo/src/eoSGA.h index 3cd90fd0..95980068 100644 --- a/eo/src/eoSGA.h +++ b/eo/src/eoSGA.h @@ -78,18 +78,23 @@ public : for (i=0; i<_pop.size()/2; i++) { if ( rng.flip(crossoverRate) ) - { - // this crossover generates 2 offspring from two parents - cross(offspring[2*i], offspring[2*i+1]); - } + { + // this crossover generates 2 offspring from two parents + if (cross(offspring[2*i], offspring[2*i+1])) + { + offspring[2*i].invalidate(); + offspring[2*i+1].invalidate(); + } + } } for (i=0; i < _pop.size(); i++) { if (rng.flip(mutationRate) ) - { - mutate(offspring[i]); - } + { + if (mutate(offspring[i])) + offspring[i].invalidate(); + } } _pop.swap(offspring);