From e06a16213d03a974bde10e13cb50c92c55546ed1 Mon Sep 17 00:00:00 2001 From: verel Date: Tue, 6 Dec 2011 10:55:36 +0000 Subject: [PATCH] Add the notion of currentNeighbor in the moSimpleHCexplorer git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2539 331e1502-861f-0410-8da2-ba01fb791d7f --- .../src/explorer/moFirstImprHCexplorer.h | 3 +-- .../src/explorer/moNeighborhoodExplorer.h | 2 +- .../src/explorer/moSimpleHCexplorer.h | 17 +++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/trunk/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h b/trunk/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h index 27bb83deb..922ad7351 100644 --- a/trunk/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h @@ -52,6 +52,7 @@ public: using moNeighborhoodExplorer::neighborhood; using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::currentNeighbor; /** * Constructor @@ -62,14 +63,12 @@ public: */ moFirstImprHCexplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { isAccept = false; - current=new Neighbor(); } /** * Destructor */ ~moFirstImprHCexplorer() { - delete current; } /** diff --git a/trunk/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h b/trunk/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h index 7f9781359..334210a53 100644 --- a/trunk/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moNeighborhoodExplorer.h @@ -134,7 +134,7 @@ protected: bool isMoved; // the current neighbor of the exploration : common features of algorithm - Neighbor currentNeighbor + Neighbor currentNeighbor; }; #endif diff --git a/trunk/paradiseo-mo/src/explorer/moSimpleHCexplorer.h b/trunk/paradiseo-mo/src/explorer/moSimpleHCexplorer.h index 40edfece5..edc319726 100644 --- a/trunk/paradiseo-mo/src/explorer/moSimpleHCexplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moSimpleHCexplorer.h @@ -52,6 +52,7 @@ public: using moNeighborhoodExplorer::neighborhood; using moNeighborhoodExplorer::eval; + using moNeighborhoodExplorer::currentNeighbor; /** * Constructor @@ -96,23 +97,23 @@ 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); //initialize the best neighbor - best = current; + best = currentNeighbor; //test all others neighbors while (neighborhood.cont(_solution)) { //next neighbor - neighborhood.next(_solution, current); + neighborhood.next(_solution, currentNeighbor); //eval - eval(_solution, current); + eval(_solution, currentNeighbor); //if we found a better neighbor, update the best - if (neighborComparator(best, current)) { - best = current; + if (neighborComparator(best, currentNeighbor)) { + best = currentNeighbor; } } @@ -172,7 +173,7 @@ private: // the best and the current neighbor Neighbor best; - Neighbor current; + // Neighbor current; // true if the move is accepted bool isAccept ;