From 2a0a3e074d826dd5dfcb19aaaa404de2ebbe597c Mon Sep 17 00:00:00 2001 From: evomarc Date: Fri, 27 Oct 2000 04:07:21 +0000 Subject: [PATCH] Added the member function append( unsigned _popSize, eoInit& _chromInit ) who appends _popSize members to the population using an eoInit --- eo/src/eoPop.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/eo/src/eoPop.h b/eo/src/eoPop.h index bd8c54fa..d09d940b 100644 --- a/eo/src/eoPop.h +++ b/eo/src/eoPop.h @@ -67,7 +67,7 @@ class eoPop: public vector, public eoObject, public eoPersistent /** Ctor for the initialization of chromosomes @param _popSize total population size - @param _chromRnd Initialization routine, produces EO's, needs to be an eoInit + @param _chromInit Initialization routine, produces EO's, needs to be an eoInit */ eoPop( unsigned _popSize, eoInit& _chromInit ) :vector() @@ -79,7 +79,21 @@ class eoPop: public vector, public eoObject, public eoPersistent } }; - + /** SAME Initialization task than init. ctor, but is NOT a constructor + + @param _popSize total population size + @param _chromInit Initialization routine, produces EO's, needs to be an eoInit + */ + void append( unsigned _popSize, eoInit& _chromInit ) + { + resize(size()+_popSize); // adjust the size + for ( unsigned i = 0; i < _popSize; i++ ) + { + _chromInit(operator[](i)); + } + }; + + /** Ctor from an istream; reads the population from a stream, each element should be in different lines @param _is the stream