Update moMonOpPerturb
This commit is contained in:
parent
edefae4b28
commit
191aa1c872
1 changed files with 16 additions and 1 deletions
|
|
@ -50,7 +50,16 @@ public:
|
||||||
* @param _fullEval a full evaluation function
|
* @param _fullEval a full evaluation function
|
||||||
* @param _nbPerturbation number of operator executions for perturbation
|
* @param _nbPerturbation number of operator executions for perturbation
|
||||||
*/
|
*/
|
||||||
moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval, unsigned int _nbPerturbation = 1):monOp(_monOp), fullEval(_fullEval), nbPerturbation(_nbPerturbation) {}
|
moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval, unsigned int _nbPerturbation = 1):monOp(_monOp), fullEval(_fullEval), nbPerturbation(_nbPerturbation), rndPerturb(false) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor with random value at each iteration of the number of perturbation moves
|
||||||
|
* @param _monOp an eoMonOp (pertubation operator)
|
||||||
|
* @param _fullEval a full evaluation function
|
||||||
|
* @param _nbPerturbationMin minimum number of operator executions for perturbation
|
||||||
|
* @param _nbPerturbationMax maximum number of operator executions for perturbation
|
||||||
|
*/
|
||||||
|
moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval, unsigned int _nbPerturbationMin, unsigned int _nbPerturbationMax):monOp(_monOp), fullEval(_fullEval), nbPerturbationMin(_nbPerturbationMin), nbPerturbationMax(_nbPerturbationMax), rndPerturb(true) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply monOp on the solution
|
* Apply monOp on the solution
|
||||||
|
|
@ -60,6 +69,9 @@ public:
|
||||||
bool operator()(EOT& _solution) {
|
bool operator()(EOT& _solution) {
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
|
if (rndPerturb)
|
||||||
|
nbPerturbation = nbPerturbationMin + rng.random(nbPerturbationMax);
|
||||||
|
|
||||||
for(unsigned int i = 0; i < nbPerturbation; i++)
|
for(unsigned int i = 0; i < nbPerturbation; i++)
|
||||||
res = monOp(_solution) || res;
|
res = monOp(_solution) || res;
|
||||||
|
|
||||||
|
|
@ -74,6 +86,9 @@ private:
|
||||||
eoMonOp<EOT>& monOp;
|
eoMonOp<EOT>& monOp;
|
||||||
eoEvalFunc<EOT>& fullEval;
|
eoEvalFunc<EOT>& fullEval;
|
||||||
unsigned int nbPerturbation;
|
unsigned int nbPerturbation;
|
||||||
|
unsigned int nbPerturbationMin;
|
||||||
|
unsigned int nbPerturbationMax;
|
||||||
|
bool rndPerturb;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue