adding eoGeneration

This commit is contained in:
gustavo 1999-02-15 17:47:30 +00:00
commit c1cddf3236
5 changed files with 91 additions and 100 deletions

49
eo/src/eoGeneration.h Normal file
View file

@ -0,0 +1,49 @@
//-----------------------------------------------------------------------------
// eoGeneration.h
//-----------------------------------------------------------------------------
#ifndef eoGeneration_h
#define eoGeneration_h
//-----------------------------------------------------------------------------
#include <eoPop.h> // eoPop
#include <eoPopOps.h> // eoSelect, eoTranform, eoMerge
//-----------------------------------------------------------------------------
// eoGeneration
//-----------------------------------------------------------------------------
template<class Chrom> class eoGeneration: public eoTransform<Chrom>
{
public:
/// Constructor.
eoGeneration(eoSelect& _select,
eoTranform& _transform,
eoMerge& _replace):
eoTransform<Chrom>() {}
/**
*
*/
void operator()(eoPop& pop)
{
eoPop breeders;
select(pop, breeders);
transform(breeders);
replace(breeders, pop);
}
/// Class name.
string className() const { return "eoGeneration"; }
private:
eoSelect& select;
eoTranform& transform;
eoMerge& replace;
};
//-----------------------------------------------------------------------------
#endif eoGeneration_h