git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1981 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
585454f7b5
commit
5d9433896e
1 changed files with 112 additions and 104 deletions
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _moOrderNeighborhood_h
|
#ifndef _moOrderNeighborhood_h
|
||||||
#define _moOrderNeighborhood_h
|
#define _moOrderNeighborhood_h
|
||||||
|
|
@ -40,9 +40,8 @@
|
||||||
/**
|
/**
|
||||||
* An ordered Neighborhood
|
* An ordered Neighborhood
|
||||||
*/
|
*/
|
||||||
template< class Neighbor >
|
template<class Neighbor>
|
||||||
class moOrderNeighborhood : public moIndexNeighborhood<Neighbor>
|
class moOrderNeighborhood: public moIndexNeighborhood<Neighbor> {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -56,7 +55,9 @@ public:
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param _neighborhoodSize the size of the neighborhood
|
* @param _neighborhoodSize the size of the neighborhood
|
||||||
*/
|
*/
|
||||||
moOrderNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize), currentIndex(0) {}
|
moOrderNeighborhood(unsigned int _neighborhoodSize) :
|
||||||
|
moIndexNeighborhood<Neighbor> (_neighborhoodSize), currentIndex(0) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if a neighbor exists
|
* Test if a neighbor exists
|
||||||
|
|
@ -73,8 +74,8 @@ public:
|
||||||
* @param _neighbor the first neighbor
|
* @param _neighbor the first neighbor
|
||||||
*/
|
*/
|
||||||
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||||
currentIndex = 0 ;
|
currentIndex = 0;
|
||||||
_neighbor.index(currentIndex) ;
|
_neighbor.index(currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -83,7 +84,7 @@ public:
|
||||||
* @param _neighbor the next neighbor
|
* @param _neighbor the next neighbor
|
||||||
*/
|
*/
|
||||||
virtual void next(EOT & _solution, Neighbor & _neighbor) {
|
virtual void next(EOT & _solution, Neighbor & _neighbor) {
|
||||||
currentIndex++ ;
|
currentIndex++;
|
||||||
_neighbor.index(currentIndex);
|
_neighbor.index(currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,7 +96,7 @@ public:
|
||||||
* @return true if there is again a neighbor to explore
|
* @return true if there is again a neighbor to explore
|
||||||
*/
|
*/
|
||||||
virtual bool cont(EOT & _solution) {
|
virtual bool cont(EOT & _solution) {
|
||||||
return (currentIndex < neighborhoodSize - 1) ;
|
return (currentIndex < neighborhoodSize - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -106,6 +107,13 @@ public:
|
||||||
return currentIndex;
|
return currentIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter the position in the Neighborhood
|
||||||
|
*/
|
||||||
|
unsigned int setPosition(unsigned int _currentIndex) {
|
||||||
|
currentIndex=_currentIndex;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the class Name
|
* Return the class Name
|
||||||
* @return the class name as a std::string
|
* @return the class name as a std::string
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue