From 6f6770e6de1ec97dda31633e6ccc7bcb04bdcfe1 Mon Sep 17 00:00:00 2001 From: verel Date: Tue, 6 Dec 2011 13:50:32 +0000 Subject: [PATCH] Add the notion of currentNeighbor in the moRandomWalkExplorer, and ILS git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2545 331e1502-861f-0410-8da2-ba01fb791d7f --- .../src/explorer/moRandomWalkExplorer.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h b/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h index 78c7cbe91..98fde320c 100644 --- a/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h @@ -57,6 +57,7 @@ public: using moNeighborhoodExplorer::neighborhood; using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::currentNeighbor; /** * Constructor @@ -65,7 +66,6 @@ public: */ moRandomWalkExplorer(Neighborhood& _neighborhood, moEval& _eval) : moNeighborhoodExplorer(_neighborhood, _eval) { isAccept = false; - current=new Neighbor(); if (!neighborhood.isRandom()) { std::cout << "moRandomWalkExplorer::Warning -> the neighborhood used is not random" << std::endl; } @@ -75,7 +75,6 @@ public: * Destructor */ ~moRandomWalkExplorer() { - delete current; } /** @@ -109,10 +108,10 @@ public: //Test if _solution has a Neighbor if (neighborhood.hasNeighbor(_solution)) { //init the first neighbor - neighborhood.init(_solution, (*current)); + neighborhood.init(_solution, currentNeighbor); //eval the _solution moved with the neighbor and stock the result in the neighbor - eval(_solution, (*current)); + eval(_solution, currentNeighbor); isAccept = true; } @@ -137,9 +136,9 @@ public: */ virtual void move(EOT & _solution) { //move the solution - (*current).move(_solution); + currentNeighbor.move(_solution); //update its fitness - _solution.fitness((*current).fitness()); + _solution.fitness(currentNeighbor.fitness()); }; /** @@ -154,9 +153,6 @@ public: }; private: - //Pointer on the best and the current neighbor - Neighbor* current; - // true if the move is accepted bool isAccept ; };