From 91342e7080ecaea80ca8c00cf5ed483942f3bfd0 Mon Sep 17 00:00:00 2001 From: evomarc Date: Mon, 21 May 2001 04:14:36 +0000 Subject: [PATCH] Modifs in es (crossover added in make_op_es). Added a dummy selector in eoReandomSelect that does work even with invalid EOs --- eo/src/eoRandomSelect.h | 26 ++++++++++++++++++++++++++ eo/src/es.h | 5 +---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/eo/src/eoRandomSelect.h b/eo/src/eoRandomSelect.h index c73c6dd8..ada1ac53 100644 --- a/eo/src/eoRandomSelect.h +++ b/eo/src/eoRandomSelect.h @@ -112,5 +112,31 @@ private: vector eoPters; }; +//----------------------------------------------------------------------------- +/** eoNoSelect: returns all individual in order WITHOUT USING FITNESS!!! + * looping back to the beginning when exhasuted + * + */ +//----------------------------------------------------------------------------- + +template class eoNoSelect: public eoSelectOne +{ + public: + /** Ctor + */ + eoNoSelect(): current(0) {} + + virtual const EOT& operator()(const eoPop& _pop) + { + if (current >= _pop.size()) + current=0; + + current++; + return _pop[current-1] ; + } +private: + unsigned current; +}; + #endif eoRandomSelect_h diff --git a/eo/src/es.h b/eo/src/es.h index e4b25a09..360f48e7 100644 --- a/eo/src/es.h +++ b/eo/src/es.h @@ -49,15 +49,12 @@ #include #include // for generic operators #include // Global ES Xover -#include // Local ES Xover +#include // 2-parents ES Xover // the ES-mutations #include #include -// the crossover - to be continued -#include - #endif _es_h // Local Variables: