#include // cout using namespace std; // my implementation of selection template class eoMySelect: public eoSelect { public: // redefine virtual void operator()(const eoPop& _source, eoPop& _dest) { // discard the individuals with worse fitnesses vector fitnesses; fitnesses.resize( _source.size() ); double mean = 0; for (unsigned i=0; i& _fit,double total) { double rnd = rng.uniform(total); unsigned i=0; while (i<_fit.size() && _fit[i]<=rnd) { rnd -= _fit[i]; i++; } if (i<_fit.size()) return i; else throw std::runtime_error("select_on: total fitness not valid"); } };