paradiseo/trunk/paradiseo-peo/src/peoEvalFuncPSO.h
canape 984c076bf5 completed doc
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@671 331e1502-861f-0410-8da2-ba01fb791d7f
2007-10-08 12:42:41 +00:00

39 lines
856 B
C++

/* "peoEvalFuncPSO.h"
*
*
* (c) OPAC Team, October 2007
*
* Contact: clive.canape@inria.fr
*/
#ifndef PEOEVALFUNCPSO_H
#define PEOEVALFUNCPSO_H
#include <eoEvalFunc.h>
//! peoEvalFuncPSO: This class
//! takes an existing function pointer and converts it into a evaluation
//! function class.
#ifdef _MSC_VER
template< class POT, class FitT = POT::Fitness, class FunctionArg = const POT& >
#else
template< class POT, class FitT = typename POT::Fitness, class FunctionArg = const POT& >
#endif
struct peoEvalFuncPSO: public eoEvalFunc<POT> {
peoEvalFuncPSO( FitT (* _eval)( FunctionArg ) )
: eoEvalFunc<POT>(), evalFunc( _eval ) {};
//!Applies the evaluation function to a PEO
virtual void operator() ( POT & _peo )
{
_peo.fitness((*evalFunc)( _peo ));
};
private:
FitT (* evalFunc )( FunctionArg );
};
#endif