Modified the tempaltes to take into account
- the last modifications of the eopopulator class - the include files (were totally missing in the old templates) - JJ's demand for one class - one file :-)
This commit is contained in:
parent
d634d95838
commit
7ec7a856e5
6 changed files with 301 additions and 7 deletions
45
eo/tutorial/Templates/binCrossover.tmpl
Normal file
45
eo/tutorial/Templates/binCrossover.tmpl
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
Template for simple binary crossover operators
|
||||
==============================================
|
||||
|
||||
Binary crossover operators modify the first parent only,
|
||||
based on the second
|
||||
*/
|
||||
|
||||
#ifndef eoMyDerivedBinOp_H
|
||||
#define eoMyDerivedBinOp_H
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
template<class Indi>
|
||||
class eoMyDerivedBinOp: public eoBinOp<Indi>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* (Default) Constructor.
|
||||
*/
|
||||
eoMyDerivedBinOp(paramType _anyParameter) :
|
||||
anyParameter(_anyParameter) {}
|
||||
|
||||
/// The class name. Used to display statistics
|
||||
string className() const { return "eoMyDerivedBinOp"; }
|
||||
|
||||
/**
|
||||
* eoBin crossover - modifies first parent only
|
||||
* @param Indi1 The first parent
|
||||
* @param Indi2 The second parent - const
|
||||
*/
|
||||
bool operator()(Indi& Indi1, const Indi& Indi2)
|
||||
{
|
||||
// do whatever needs to be done
|
||||
// if Indi1 has been modified
|
||||
return true;
|
||||
// otherwise
|
||||
// return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
paramType anyParameter
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in a new issue