From 5881cab5388c65eda12e24d242604b29f896e463 Mon Sep 17 00:00:00 2001 From: evomarc Date: Wed, 6 Mar 2002 06:28:27 +0000 Subject: [PATCH] Added the tags to generate html nice output --- eo/tutorial/Lesson4/BitEA.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/eo/tutorial/Lesson4/BitEA.cpp b/eo/tutorial/Lesson4/BitEA.cpp index 31a22ae3c..961856561 100644 --- a/eo/tutorial/Lesson4/BitEA.cpp +++ b/eo/tutorial/Lesson4/BitEA.cpp @@ -1,9 +1,12 @@ #include #include -#include "binary_value.h" #include +// EVAL +#include "binary_value.h" + +// GENERAL using namespace std; int main(int argc, char* argv[]) @@ -11,25 +14,34 @@ int main(int argc, char* argv[]) try { +// REPRESENTATION +//----------------------------------------------------------------------------- +// define your genotype and fitness types typedef eoBit EOT; +// PARAMETRES eoParser parser(argc, argv); // for user-parameter reading +// GENERAL eoState state; // keeps all things allocated ///// FIRST, problem or representation dependent stuff ////////////////////////////////////////////////////// +// EVAL // The evaluation fn - encapsulated into an eval counter for output eoEvalFuncPtr mainEval( binary_value ); eoEvalFuncCounter eval(mainEval); +// REPRESENTATION // the genotype - through a genotype initializer eoInit& init = make_genotype(parser, state, EOT()); +// OPERATORS // Build the variation operator (any seq/prop construct) eoGenOp& op = make_op(parser, state, init); +// GENERAL //// Now the representation-independent things ////////////////////////////////////////////// @@ -37,32 +49,40 @@ int main(int argc, char* argv[]) // yes, this is representation indepedent once you have an eoInit eoPop& pop = make_pop(parser, state, init); +// STOP // stopping criteria eoContinue & term = make_continue(parser, state, eval); // output eoCheckPoint & checkpoint = make_checkpoint(parser, state, eval, term); +// GENERATION // algorithm (need the operator!) eoAlgo& ga = make_algo_scalar(parser, state, eval, checkpoint, op); ///// End of construction of the algorith ///////////////////////////////////////// +// PARAMETRES // to be called AFTER all parameters have been read!!! make_help(parser); //// GO /////// +// EVAL // evaluate intial population AFTER help and status in case it takes time apply(eval, pop); - // print it out +// STOP + // print it out (sort witout modifying) cout << "Initial Population\n"; pop.sortedPrintOn(cout); cout << endl; +// GENERATION run_ea(ga, pop); // run the ga - +// STOP + // print it out (sort witout modifying) cout << "Final Population\n"; pop.sortedPrintOn(cout); cout << endl; +// GENERAL } catch(exception& e) {