diff --git a/trunk/paradiseo-mo/src/explorer/moILSexplorer.h b/trunk/paradiseo-mo/src/explorer/moILSexplorer.h index bf917b1c2..761009005 100644 --- a/trunk/paradiseo-mo/src/explorer/moILSexplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moILSexplorer.h @@ -119,7 +119,6 @@ public: //perturb solution exept at the first iteration if (!firstIteration) { perturb(currentSol); - } else firstIteration=false; diff --git a/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h b/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h index 98fde320c..5f4de7eef 100644 --- a/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moRandomWalkExplorer.h @@ -58,6 +58,7 @@ public: using moNeighborhoodExplorer::neighborhood; using moNeighborhoodExplorer::eval; using moNeighborhoodExplorer::currentNeighbor; + using moNeighborhoodExplorer::selectedNeighbor; /** * Constructor @@ -108,10 +109,10 @@ public: //Test if _solution has a Neighbor if (neighborhood.hasNeighbor(_solution)) { //init the first neighbor - neighborhood.init(_solution, currentNeighbor); + neighborhood.init(_solution, selectedNeighbor); //eval the _solution moved with the neighbor and stock the result in the neighbor - eval(_solution, currentNeighbor); + eval(_solution, selectedNeighbor); isAccept = true; } @@ -130,17 +131,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 amelirated neighbor was be found * @param _solution the solution diff --git a/trunk/paradiseo-mo/src/explorer/moSAexplorer.h b/trunk/paradiseo-mo/src/explorer/moSAexplorer.h index b6cf63424..3d9f477ee 100644 --- a/trunk/paradiseo-mo/src/explorer/moSAexplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moSAexplorer.h @@ -154,7 +154,6 @@ public: isAccept = (rng.uniform() < alpha) ; } } - isAccept = true; return isAccept; }; diff --git a/trunk/paradiseo-mo/src/explorer/moTSexplorer.h b/trunk/paradiseo-mo/src/explorer/moTSexplorer.h index b62f3caaf..062af93cc 100644 --- a/trunk/paradiseo-mo/src/explorer/moTSexplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moTSexplorer.h @@ -54,6 +54,7 @@ public: typedef moNeighborhood Neighborhood ; using moNeighborhoodExplorer::currentNeighbor; + using moNeighborhoodExplorer::selectedNeighbor; /** * Constructor @@ -108,16 +109,16 @@ public: virtual void updateParam(EOT& _solution) { if ((*this).moveApplied()) { - tabuList.add(_solution, best); - intensification.add(_solution, best); - diversification.add(_solution, best); + tabuList.add(_solution, selectedNeighbor); + intensification.add(_solution, selectedNeighbor); + diversification.add(_solution, selectedNeighbor); if (_solution.fitness() > bestSoFar.fitness()) bestSoFar = _solution; } - tabuList.update(_solution, best); - intensification.update(_solution, best); - diversification.update(_solution, best); - aspiration.update(_solution, best); + tabuList.update(_solution, selectedNeighbor); + intensification.update(_solution, selectedNeighbor); + diversification.update(_solution, selectedNeighbor); + aspiration.update(_solution, selectedNeighbor); }; @@ -147,8 +148,8 @@ public: //Find the first non-tabu element if ( (!tabuList.check(_solution, currentNeighbor)) || aspiration(_solution, currentNeighbor) ) { - // set best - best = currentNeighbor; + // set selectedNeighbor + selectedNeighbor = currentNeighbor; found=true; } while (neighborhood.cont(_solution) && !found) { @@ -158,8 +159,8 @@ public: eval(_solution, currentNeighbor); if ( (!tabuList.check(_solution, currentNeighbor)) || aspiration(_solution, currentNeighbor) ) { - // set best - best = currentNeighbor; + // set selectedNeighbor + selectedNeighbor = currentNeighbor; found=true; } } @@ -172,9 +173,9 @@ public: //eval eval(_solution, currentNeighbor); //check if the current is better than the best and is not tabu or if it is aspirat (by the aspiration criteria of course) - if ( (!tabuList.check(_solution, currentNeighbor) || aspiration(_solution, currentNeighbor)) && neighborComparator(best, currentNeighbor)) { - // set best - best = currentNeighbor; + if ( (!tabuList.check(_solution, currentNeighbor) || aspiration(_solution, currentNeighbor)) && neighborComparator(selectedNeighbor, currentNeighbor)) { + // set selectedNeighbor + selectedNeighbor = currentNeighbor; } } } @@ -198,19 +199,6 @@ public: return true; }; - - /** - * move the solution with the best neighbor - * @param _solution the solution to move - */ - virtual void move(EOT & _solution) { - //move the solution - best.move(_solution); - //update its fitness - _solution.fitness(best.fitness()); - }; - - /** * accept test if an ameliorated neighbor was found * @param _solution the solution @@ -245,7 +233,7 @@ protected: moAspiration & aspiration; // Best neighbor - Neighbor best; + // Neighbor best; //Best so far Solution EOT bestSoFar;