Merge branch 'master' of git+ssh://canape@scm.gforge.inria.fr//gitroot/paradiseo/paradiseo.git

This commit is contained in:
canape 2013-02-07 07:47:27 +01:00
commit 1ceb9d6b7d
3 changed files with 34 additions and 11 deletions

View file

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

View file

@ -61,10 +61,10 @@ public:
int d;
int k;
unsigned i, j;
_neighbor.getIndices(n, i, j);
unsigned i = _neighbor.first();
unsigned j = _neighbor.second();
// _neighbor.getIndices(n, i, j);
d = (A[i][i]-A[j][j])*(B[_solution[j]][_solution[j]]-B[_solution[i]][_solution[i]]) +
(A[i][j]-A[j][i])*(B[_solution[j]][_solution[i]]-B[_solution[i]][_solution[j]]);

View file

@ -107,6 +107,22 @@ public:
index( _first + n * (n - 1) / 2 );
}
/**
* Getter of the firt location
* @return first indice
*/
unsigned int first() {
return indices.first;
}
/**
* Getter of the second location
* @return second indice
*/
unsigned int second() {
return indices.second;
}
private:
std::pair<unsigned int, unsigned int> indices;