git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1650 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
jhumeau 2010-01-18 17:29:10 +00:00
commit 0f370ac9e1
14 changed files with 269 additions and 185 deletions

View file

@ -11,10 +11,14 @@ class moNeighborhoodExplorer : public eoUF<typename NH::EOT & , void>
public:
typedef NH Neighborhood ;
typedef typename Neighborhood::EOT EOT ;
typedef typename Neighborhood::Neighbor Neighbor ;
// empty constructor
moNeighborhoodExplorer() { } ;
// empty constructor
moNeighborhoodExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval):neighborhood(_neighborhood), eval(_eval) { } ;
virtual void initParam (EOT & solution) = 0 ;
virtual void updateParam (EOT & solution) = 0 ;
@ -31,8 +35,14 @@ public:
* @return the class name as a std::string
*/
virtual std::string className() const { return "moNeighborhoodExplorer"; }
protected:
Neighborhood & neighborhood;
moEval<Neighbor>& eval;
};
#endif

View file

@ -12,7 +12,7 @@ public:
typedef typename Neighborhood::Neighbor Neighbor ;
// empty constructor
moSimpleHCexplorer(Neighborhood & __neighborhood) : neighborhood(__neighborhood) {
moSimpleHCexplorer(Neighborhood & __neighborhood) : neighborhood(__neighborhood){
isAccept = false;
}
@ -27,20 +27,20 @@ public:
//est qu'on peut initializer
if(neighborhood.hasNeighbor(solution)){
neighborhood.init(solution, current);
neighborhood.init(solution, *current);
current.eval(solution);
(*current).eval(solution);
best = current;
best = &current;
while (neighborhood.cont(solution)) {
neighborhood.next(solution, current);
neighborhood.next(solution, *current);
current.eval(solution);
(*current).eval(solution);
if (current.betterThan(best)) {
best = current;
best = &current;
}
}
@ -72,9 +72,9 @@ private:
Neighborhood & neighborhood;
// attention il faut que le constructeur vide existe
Neighbor best ;
Neighbor* best;
Neighbor current ;
Neighbor* current;
// true if the move is accepted
bool isAccept ;