RC
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2710 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
6f384f4a59
commit
e3a610506b
1731 changed files with 105122 additions and 63920 deletions
71
branches/rc2.0/eo/tutorial/Templates/quadCrossover.tmpl
Normal file
71
branches/rc2.0/eo/tutorial/Templates/quadCrossover.tmpl
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
The above line is usefulin Emacs-like editors
|
||||
*/
|
||||
|
||||
/*
|
||||
Template for simple quadratic crossover operators
|
||||
=================================================
|
||||
|
||||
Quadratic crossover operators modify the both genotypes
|
||||
*/
|
||||
|
||||
#ifndef eoMyStructQuadCrossover_H
|
||||
#define eoMyStructQuadCrossover_H
|
||||
|
||||
#include <eoOp.h>
|
||||
|
||||
/**
|
||||
* Always write a comment in this format before class definition
|
||||
* if you want the class to be documented by Doxygen
|
||||
*
|
||||
* THere is NO ASSUMPTION on the class GenoypeT.
|
||||
* In particular, it does not need to derive from EO
|
||||
*/
|
||||
template<class GenotypeT>
|
||||
class eoMyStructQuadCrossover: public eoQuadOp<GenotypeT>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Ctor - no requirement
|
||||
*/
|
||||
// START eventually add or modify the anyVariable argument
|
||||
eoMyStructQuadCrossover()
|
||||
// eoMyStructQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable)
|
||||
// END eventually add or modify the anyVariable argument
|
||||
{
|
||||
// START Code of Ctor of an eoMyStructEvalFunc object
|
||||
// END Code of Ctor of an eoMyStructEvalFunc object
|
||||
}
|
||||
|
||||
/// The class name. Used to display statistics
|
||||
string className() const { return "eoMyStructQuadCrossover"; }
|
||||
|
||||
/**
|
||||
* eoQuad crossover - _genotype1 and _genotype2 are the (future)
|
||||
* offspring, i.e. _copies_ of the parents, to be modified
|
||||
* @param _genotype1 The first parent
|
||||
* @param _genotype2 The second parent
|
||||
*/
|
||||
bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2)
|
||||
{
|
||||
bool oneAtLeastIsModified(true);
|
||||
// START code for crossover of _genotype1 and _genotype2 objects
|
||||
|
||||
/** Requirement
|
||||
* if (at least one genotype has been modified) // no way to distinguish
|
||||
* oneAtLeastIsModified = true;
|
||||
* else
|
||||
* oneAtLeastIsModified = false;
|
||||
*/
|
||||
return oneAtLeastIsModified;
|
||||
// END code for crossover of _genotype1 and _genotype2 objects
|
||||
}
|
||||
|
||||
private:
|
||||
// START Private data of an eoMyStructQuadCrossover object
|
||||
// varType anyVariable; // for example ...
|
||||
// END Private data of an eoMyStructQuadCrossover object
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue