From 0ff7bb2cf56e63fa84cce36538ba1aca415d010d Mon Sep 17 00:00:00 2001 From: verel Date: Tue, 27 Apr 2010 16:46:25 +0000 Subject: [PATCH] =?UTF-8?q?Code=20lesson1=5FsimpleHC.cpp=20modifi=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1748 331e1502-861f-0410-8da2-ba01fb791d7f --- .../tutorial/Lesson1/lesson1_simpleHC.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/trunk/paradiseo-mo/tutorial/Lesson1/lesson1_simpleHC.cpp b/trunk/paradiseo-mo/tutorial/Lesson1/lesson1_simpleHC.cpp index a728ed127..47514a83d 100644 --- a/trunk/paradiseo-mo/tutorial/Lesson1/lesson1_simpleHC.cpp +++ b/trunk/paradiseo-mo/tutorial/Lesson1/lesson1_simpleHC.cpp @@ -19,19 +19,23 @@ #include #include +// declaration of the namespace using namespace std; //----------------------------------------------------------------------------- -// representation of solutions, neighbor, and neighborhood -#include // bit string : see EO tutorial lesson 1: FirstBitGA.cpp +// representation of solutions, and neighbors +#include // bit string : see also EO tutorial lesson 1: FirstBitGA.cpp #include // neighbor of bit string -#include // neighborhood: all neighors in increasing order of bit index //----------------------------------------------------------------------------- // fitness function, and evaluation of neighbors #include -#include #include +#include + +//----------------------------------------------------------------------------- +// neighborhood description +#include // visit all neighbors in increasing order of bit index //----------------------------------------------------------------------------- // the simple Hill-Climbing local search @@ -108,7 +112,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - // a Indi random initializer + // a Indi random initializer: each bit is random // more information: see EO tutorial lesson 1 (FirstBitGA.cpp) eoUniformGenerator uGen; eoInitFixedLength random(vecSize, uGen); @@ -128,7 +132,7 @@ void main_function(int argc, char **argv) * * ========================================================= */ - // Use it if a neighbor is evaluated by the full evaluation of a solution + // Use it if there is no incremental evaluation: a neighbor is evaluated by the full evaluation of a solution // moFullEvalByModif neighborEval(fullEval); // Incremental evaluation of the neighbor: fitness is modified by +/- 1 @@ -154,7 +158,7 @@ void main_function(int argc, char **argv) /* ========================================================= * - * execute the local search from a random solution + * executes the local search from a random solution * * ========================================================= */