git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1650 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
jhumeau 2010-01-18 17:29:10 +00:00
commit 0f370ac9e1
14 changed files with 269 additions and 185 deletions

View file

@ -0,0 +1,45 @@
#ifndef moFullEvalByCopy_H
#define moFullEvalByCopy_H
#include <eoEvalFunc.h>
#include <moEval.h>
template<class Neighbor>
class moFullEvalByCopy : public moEval<Neighbor>
{
public:
using moEval<Neighbor>::EOT EOT;
using moEval<Neighbor>::Fitness Fitness;
/**
* Ctor
* @param _eval the full evaluation object
*/
moFullEvalByCopy(eoEvalFunc<EOT> & _eval) : eval(_eval) {}
/**
* Full evaluation of the neighbor by copy
* @param _sol current solution
* @param _neighbor the neighbor to be evaluated
*/
void operator()(EOT & _sol, Neighbor & _neighbor)
{
// tmp solution
EOT tmp(_sol);
// move tmp solution wrt _neighbor
_neighbor.(tmp);
// eval copy
tmp.invalidate();
eval(tmp);
// set the fitness value to the neighbor
_neighbor.fitness(tmp.fitness());
}
private:
/** the full evaluation object */
eoEvalFunc<EOT> & eval;
};
#endif