From 2a6b4b9e9d2aac07dafd95c17e2556cb4e7e7269 Mon Sep 17 00:00:00 2001 From: verel Date: Wed, 13 Oct 2010 09:33:16 +0000 Subject: [PATCH] Modification of continuator/moBestNoImproveContinuator.h to have strictly improvement git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1955 331e1502-861f-0410-8da2-ba01fb791d7f --- .../src/continuator/moBestNoImproveContinuator.h | 9 ++++++++- trunk/paradiseo-mo/src/continuator/moIterContinuator.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/trunk/paradiseo-mo/src/continuator/moBestNoImproveContinuator.h b/trunk/paradiseo-mo/src/continuator/moBestNoImproveContinuator.h index c5c126f05..6ea6e3ff3 100644 --- a/trunk/paradiseo-mo/src/continuator/moBestNoImproveContinuator.h +++ b/trunk/paradiseo-mo/src/continuator/moBestNoImproveContinuator.h @@ -45,6 +45,8 @@ public: typedef typename Neighbor::EOT EOT ; /** + * Constructor + * * @param _bestSol the best solution * @param _maxNoImprove number maximum of iterations * @param _solComparator a comparator between solutions @@ -56,6 +58,8 @@ public: bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(_solComparator), verbose(_verbose) {} /** + * Constructor where the comparator of solutions is the default comparator + * * @param _bestSol the best solution * @param _maxNoImprove number maximum of iterations * @param _verbose true/false : verbose mode on/off @@ -65,11 +69,14 @@ public: bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(defaultSolComp), verbose(_verbose) {} /** + * Count and test the number of non improvement of the best solution + * improvement: if the current solution is STRICTLY better than the current best solution + * *@param _solution a solution *@return true if counter < maxNoImprove */ virtual bool operator()(EOT & _solution) { - if (solComparator(_solution, bestSol)) + if (solComparator(_solution, bestSol) || solComparator.equals(_solution, bestSol)) cpt++; bool res = (cpt < maxNoImprove); diff --git a/trunk/paradiseo-mo/src/continuator/moIterContinuator.h b/trunk/paradiseo-mo/src/continuator/moIterContinuator.h index 1df9da7bf..f10db39f5 100644 --- a/trunk/paradiseo-mo/src/continuator/moIterContinuator.h +++ b/trunk/paradiseo-mo/src/continuator/moIterContinuator.h @@ -66,7 +66,7 @@ public: * @param _solution a solution */ virtual void init(EOT & _solution) { - cpt = 0; + cpt = 0; } /**