diff --git a/eo/src/eoRandomSelect.h b/eo/src/eoRandomSelect.h index 651174e8..4265cc9d 100644 --- a/eo/src/eoRandomSelect.h +++ b/eo/src/eoRandomSelect.h @@ -40,20 +40,21 @@ * eoRandomSelect: an selection operator, which selects randomly a percentage of the initial population. */ -template class eoRandomSelect: public eoSelect +template class eoRandomSelect: public eoBinPopOp { public: /// - eoRandomSelect(const float& _percent = 0.4): eoSelect(), rate(_percent) {}; + eoRandomSelect(const float& _percent = 0.4): + eoBinPopOp(), repRate(_percent) {}; /// virtual ~eoRandomSelect() {}; /// Takes a percentage of the population randomly, and transfers it to siblings - virtual void operator() ( const eoPop& _parents, eoPop& _siblings ) const { + virtual void operator() ( eoPop& _parents, eoPop& _siblings ) { // generates random numbers eoUniform uniform(0, _parents.size()-1); - unsigned num_chroms = (unsigned)(rate * _parents.size()); + unsigned num_chroms = (unsigned)(repRate * _parents.size()); // selection of chromosomes do { @@ -69,7 +70,7 @@ template class eoRandomSelect: public eoSelect * @param _s A istream. */ virtual void readFrom(istream& _s) { - _s >> rate; + _s >> repRate; } /** Print itself: inherited from eoObject implementation. Declared virtual so that @@ -77,7 +78,7 @@ template class eoRandomSelect: public eoSelect base classes, so you donīt have to worry about, for instance, fitness. @param _s the ostream in which things are written*/ virtual void printOn( ostream& _s ) const{ - _s << rate; + _s << repRate; } /** Inherited from eoObject @@ -89,7 +90,7 @@ template class eoRandomSelect: public eoSelect private: - float rate; + float repRate; }; //----------------------------------------------------------------------------- diff --git a/eo/src/eoTournament.h b/eo/src/eoTournament.h index c71e16ad..dad95654 100644 --- a/eo/src/eoTournament.h +++ b/eo/src/eoTournament.h @@ -38,12 +38,12 @@ @author JJ Merelo, 1998 */ template -class eoTournament:public eoSelect{ +class eoTournament:public eoBinPopOp{ public: /// Proportion of guys that are going to be eliminated - eoTournament( float _perc, unsigned _tSize): eoSelect(), - perc( _perc), repTournamentSize(_tSize){}; + eoTournament( float _perc, unsigned _tSize): + eoBinPopOp(), perc( _perc), repTournamentSize(_tSize){}; /// Virtual dtor ~eoTournament(){}; @@ -55,7 +55,7 @@ public: * Selects from the initial pop using tournament selection, and copies it * to the other population. */ - virtual void operator() ( const eoPop& _vEO, eoPop& _aVEO) const { + virtual void operator() ( eoPop& _vEO, eoPop& _aVEO) { unsigned thisSize = _vEO.size();