void operator()(eoPop<EOT>&
_pop)
{ eoPop<EOT> offspring; do { select(_pop, offspring); unsigned i; for (i=0; i<_pop.size()/2; i++) { // generates 2 offspring from two parents if ( rng.flip(crossoverRate) ) { cross(offspring[2*i], offspring[2*i+1]); } } for (i=0; i < _pop.size(); i++) { if (rng.flip(mutationRate) ) { mutate(offspring[i]); } } _pop.swap(offspring); apply<EOT>(eval, _pop); } while (cont(_pop)); } |
private :
eoContinue<EOT>& cont; eoMonOp<EOT>& mutate; float mutationRate; eoQuadraticOp<EOT>& cross; float crossoverRate; eoSelectPerc<EOT> select; eoEvalFunc<EOT>& eval; |
};
#endif |