changed the moMonOpPerturb

This commit is contained in:
verel 2013-02-06 14:30:42 +01:00
commit fd4e20d54d

View file

@ -48,8 +48,9 @@ public:
* Constructor * Constructor
* @param _monOp an eoMonOp (pertubation operator) * @param _monOp an eoMonOp (pertubation operator)
* @param _fullEval a full evaluation function * @param _fullEval a full evaluation function
* @param _nbPertubation number of operator execution for perturbation
*/ */
moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval) {} moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval, unsigned int _nbPertubation = 1):monOp(_monOp), fullEval(_fullEval), nbPertubation(_nbPertubation) {}
/** /**
* Apply monOp on the solution * Apply monOp on the solution
@ -57,16 +58,22 @@ public:
* @return value of monOp * @return value of monOp
*/ */
bool operator()(EOT& _solution) { bool operator()(EOT& _solution) {
bool res = monOp(_solution); bool res = false;
_solution.invalidate();
fullEval(_solution); for(unsigned int i = 0; i < nbPerturbation; i++)
return res; res = res || monOp(_solution);
_solution.invalidate();
fullEval(_solution);
return res;
} }
private: private:
/** monOp */ /** monOp */
eoMonOp<EOT>& monOp; eoMonOp<EOT>& monOp;
eoEvalFunc<EOT>& fullEval; eoEvalFunc<EOT>& fullEval;
unsigned int nbPertubation;
}; };
#endif #endif