diff --git a/trunk/paradiseo-mo/src/algo/moFirstImprHC.h b/trunk/paradiseo-mo/src/algo/moFirstImprHC.h index 67030da6e..4793ef626 100644 --- a/trunk/paradiseo-mo/src/algo/moFirstImprHC.h +++ b/trunk/paradiseo-mo/src/algo/moFirstImprHC.h @@ -90,6 +90,14 @@ public: explorer(_neighborhood, _eval, _compN, _compSN) {} + /** + * to never stop the hill climbing + * + */ + virtual void alwaysContinue() { + explorer.alwaysContinue(); + } + /** * Return the class id. * @return the class name as a std::string diff --git a/trunk/paradiseo-mo/src/continuator/moTimeContinuator.h b/trunk/paradiseo-mo/src/continuator/moTimeContinuator.h index c393a07ec..2e4b4d686 100644 --- a/trunk/paradiseo-mo/src/continuator/moTimeContinuator.h +++ b/trunk/paradiseo-mo/src/continuator/moTimeContinuator.h @@ -44,7 +44,7 @@ public: /** * Constructor - * @param _max maximum running time + * @param _max maximum running time (in second) * @param _verbose verbose mode true/false -> on/off */ moTimeContinuator(time_t _max, bool _verbose = true): max(_max), verbose(_verbose) { diff --git a/trunk/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h b/trunk/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h index 4689ca9f0..16378e429 100644 --- a/trunk/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h +++ b/trunk/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h @@ -64,6 +64,7 @@ public: */ moFirstImprHCexplorer(Neighborhood& _neighborhood, moEval& _eval, moNeighborComparator& _neighborComparator, moSolNeighborComparator& _solNeighborComparator) : moNeighborhoodExplorer(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) { isAccept = false; + stop = true; } /** @@ -72,6 +73,14 @@ public: ~moFirstImprHCexplorer() { } + /** + * to never stop the hill climbing + * + */ + virtual void alwaysContinue() { + stop = false; + } + /** * initParam: NOTHING TO DO * @param _solution unused solution @@ -122,12 +131,15 @@ public: }; /** - * continue if a move is accepted + * continue if a move is accepted, or according to the flag 'stop' * @param _solution the solution * @return true if an ameliorated neighbor was found */ virtual bool isContinue(EOT & _solution) { + if (stop) return isAccept ; + else + return true; }; /** @@ -149,6 +161,10 @@ private: // true if the move is accepted bool isAccept ; + + // if true the HC stop when to improving solution is found + // if false : never stop, always continue (external continuator) + bool stop ; };