Add the variable selectedNeighbor into the moNeighborhoodExplorer
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2557 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
5e35350068
commit
3bdbf98034
4 changed files with 44 additions and 59 deletions
|
|
@ -53,6 +53,7 @@ public:
|
|||
using moNeighborhoodExplorer<Neighbor>::neighborhood;
|
||||
using moNeighborhoodExplorer<Neighbor>::eval;
|
||||
using moNeighborhoodExplorer<Neighbor>::currentNeighbor;
|
||||
using moNeighborhoodExplorer<Neighbor>::selectedNeighbor;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
|
@ -110,6 +111,9 @@ public:
|
|||
//eval
|
||||
eval(_solution, currentNeighbor);
|
||||
}
|
||||
|
||||
// the selected neighbor
|
||||
selectedNeighbor = currentNeighbor;
|
||||
}
|
||||
else {
|
||||
//if _solution hasn't neighbor,
|
||||
|
|
@ -126,17 +130,6 @@ public:
|
|||
return isAccept ;
|
||||
};
|
||||
|
||||
/**
|
||||
* move the solution with the best neighbor
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
virtual void move(EOT & _solution) {
|
||||
//move the solution
|
||||
currentNeighbor.move(_solution);
|
||||
//update its fitness
|
||||
_solution.fitness(currentNeighbor.fitness());
|
||||
};
|
||||
|
||||
/**
|
||||
* accept test if an ameliorated neighbor was found
|
||||
* @param _solution the solution
|
||||
|
|
@ -144,7 +137,7 @@ public:
|
|||
*/
|
||||
virtual bool accept(EOT & _solution) {
|
||||
if (neighborhood.hasNeighbor(_solution)) {
|
||||
isAccept = solNeighborComparator(_solution, currentNeighbor) ;
|
||||
isAccept = solNeighborComparator(_solution, selectedNeighbor) ;
|
||||
}
|
||||
return isAccept;
|
||||
};
|
||||
|
|
@ -154,9 +147,6 @@ private:
|
|||
moNeighborComparator<Neighbor>& neighborComparator;
|
||||
moSolNeighborComparator<Neighbor>& solNeighborComparator;
|
||||
|
||||
//Pointer on the best and the current neighbor
|
||||
// Neighbor* current;
|
||||
|
||||
// true if the move is accepted
|
||||
bool isAccept ;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue