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
65
branches/rc2.0/eo/tutorial/Templates/evalFunc.tmpl
Normal file
65
branches/rc2.0/eo/tutorial/Templates/evalFunc.tmpl
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
|
||||
|
||||
The above line is usefulin Emacs-like editors
|
||||
*/
|
||||
|
||||
/*
|
||||
Template for evaluator in EO, a functor that computes the fitness of an EO
|
||||
==========================================================================
|
||||
*/
|
||||
|
||||
#ifndef _eoMyStructEvalFunc_h
|
||||
#define _eoMyStructEvalFunc_h
|
||||
|
||||
// include whatever general include you need
|
||||
#include <stdexcept>
|
||||
#include <fstream>
|
||||
|
||||
// include the base definition of eoEvalFunc
|
||||
#include "eoEvalFunc.h"
|
||||
|
||||
/**
|
||||
Always write a comment in this format before class definition
|
||||
if you want the class to be documented by Doxygen
|
||||
*/
|
||||
template <class EOT>
|
||||
class eoMyStructEvalFunc : public eoEvalFunc<EOT>
|
||||
{
|
||||
public:
|
||||
/// Ctor - no requirement
|
||||
// START eventually add or modify the anyVariable argument
|
||||
eoMyStructEvalFunc()
|
||||
// eoMyStructEvalFunc( 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
|
||||
}
|
||||
|
||||
/** Actually compute the fitness
|
||||
*
|
||||
* @param EOT & _eo the EO object to evaluate
|
||||
* it should stay templatized to be usable
|
||||
* with any fitness type
|
||||
*/
|
||||
void operator()(EOT & _eo)
|
||||
{
|
||||
// test for invalid to avoid recomputing fitness of unmodified individuals
|
||||
if (_eo.invalid())
|
||||
{
|
||||
double fit; // to hold fitness value
|
||||
// START Code of computation of fitness of the eoMyStruct object
|
||||
// fit = blablabla
|
||||
// END Code of computation of fitness of the eoMyStruct object
|
||||
_eo.fitness(fit);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// START Private data of an eoMyStructEvalFunc object
|
||||
// varType anyVariable; // for example ...
|
||||
// END Private data of an eoMyStructEvalFunc object
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue