diff --git a/eo/tutorial/Templates/ChangeLog b/eo/tutorial/Templates/ChangeLog index e0294f39..ffecdd09 100644 --- a/eo/tutorial/Templates/ChangeLog +++ b/eo/tutorial/Templates/ChangeLog @@ -1,3 +1,16 @@ +2007-02-22 Jochen Küpper + + * mutation.tmpl, quadCrossover.tmpl, stat.tmpl: Initialize + formerly uninitialized variables. + + * README.tmpl: Hint to regular Templates/README for details. + + * README: Add documentation for adding new source-files. + + * Makefile.am.src-tmpl (noinst_HEADERS): Add + (MyStruct_SOURCES): Move header files from here to the new + noinst_HEADERS variable. + 2007-01-16 Jochen Küpper * README: Add instructions for bash. diff --git a/eo/tutorial/Templates/Makefile.am.src-tmpl b/eo/tutorial/Templates/Makefile.am.src-tmpl index c24faa64..579f1895 100644 --- a/eo/tutorial/Templates/Makefile.am.src-tmpl +++ b/eo/tutorial/Templates/Makefile.am.src-tmpl @@ -1,12 +1,12 @@ bin_PROGRAMS = MyStruct -MyStruct_SOURCES = MyStructEA.cpp \ - eoMyStruct.h \ +noinst_HEADERS = eoMyStruct.h \ eoMyStructEvalFunc.h \ eoMyStructInit.h \ eoMyStructMutation.h \ eoMyStructQuadCrossover.h +MyStruct_SOURCES = MyStructEA.cpp dnl Local Variables: diff --git a/eo/tutorial/Templates/README b/eo/tutorial/Templates/README index 9ae9650f..9ab2d6a7 100644 --- a/eo/tutorial/Templates/README +++ b/eo/tutorial/Templates/README @@ -4,10 +4,11 @@ a script createEOproject.sh to create a complete new EO project. The template requires a complete installation of EO, that is, you must have run "make install" in the build-directory. -In particular, the C++ compiler must find the EO include files and the -linker must find the EO libraries. Most probably, that means that you -have to set the variables CPLUS_INCLUDE_PATH and LIBRARY_PATH, i.e. -for a standard installation and using tcsh: +In particular, the C++ compiler must also know how to find the EO +include files and the linker must find the EO libraries. Most +probably, that means that you have to set the variables +CPLUS_INCLUDE_PATH and LIBRARY_PATH, i.e. for a standard installation +and using tcsh: setenv CPLUS_INCLUDE_PATH /usr/local/include/eo:"$CPLUS_INCLUDE_PATH" setenv LIBRARY_PATH /usr/local/lib:"$LIBRARY_PATH" @@ -15,6 +16,7 @@ When running bash, use this: export CPLUS_INCLUDE_PATH=/usr/local/include/eo:"$CPLUS_INCLUDE_PATH" export LIBRARY_PATH=/usr/local/lib:"$LIBRARY_PATH" + You can freely move the created project around. However, whenever you change the location of the source- or build-directories, you need to run @@ -24,4 +26,9 @@ in the source-directory and in the build-directory (which might or might not be the same for you). +When you add additional source files to the project, simply add them +to the _SOURCES variable in src/Makefile.am. Header files +should be added to noinst_HEADERS. + + See README.manual for more details. diff --git a/eo/tutorial/Templates/README.tmpl b/eo/tutorial/Templates/README.tmpl index 255a0f9c..b6441656 100644 --- a/eo/tutorial/Templates/README.tmpl +++ b/eo/tutorial/Templates/README.tmpl @@ -1,17 +1,21 @@ -This is an autogenerated EO project. -It was (most probably) generated using the createEOproject.sh -script in the ...eo-dir/tutorial/Templates directory. +This is an autogenerated EO project. It was (most probably) generated +using the createEOproject.sh script in the +/tutorial/Templates directory. The project has a complete build-infrastructure based on automake/autoconf. You can simply run "make" in this directory to have -the program compiled. The executable build will be in src/. -In case of problem during this step, please read the README file -in the ...eo-dir/tutorial/Templates directory. +the program compiled. The executable build will be in src/. In case of +problem during this step, please read the README file in the +...eo-dir/tutorial/Templates directory. -After creation, the project should compile nicely - but of course -the resulting program does noting at all but print a few silly lines. +After creation, the project should compile nicely - but of course the +resulting program does noting at all but print a few silly lines. Fill in the marked code-snippets in the files in src/ and you have a complete EA project (detailed explanations in EO Tutorial - Lesson 5). Enjoy! + + +For details, for example on moving your project around or adding new +files, see /tutorial/Templates/README. diff --git a/eo/tutorial/Templates/mutation.tmpl b/eo/tutorial/Templates/mutation.tmpl index befbcea9..48785313 100644 --- a/eo/tutorial/Templates/mutation.tmpl +++ b/eo/tutorial/Templates/mutation.tmpl @@ -14,14 +14,14 @@ Template for simple mutation operators #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * * THere is NO ASSUMPTION on the class GenoypeT. * In particular, it does not need to derive from EO */ -template +template class eoMyStructMutation: public eoMonOp { public: @@ -30,7 +30,7 @@ public: */ // START eventually add or modify the anyVariable argument eoMyStructMutation() - // eoMyStructMutation( varType _anyVariable) : anyVariable(_anyVariable) + // eoMyStructMutation( varType _anyVariable) : anyVariable(_anyVariable) // END eventually add or modify the anyVariable argument { // START Code of Ctor of an eoMyStructEvalFunc object @@ -44,9 +44,9 @@ public: * modifies the parent * @param _genotype The parent genotype (will be modified) */ - bool operator()(GenotypeT & _genotype) + bool operator()(GenotypeT & _genotype) { - bool isModified; + bool isModified(true); // START code for mutation of the _genotype object /** Requirement diff --git a/eo/tutorial/Templates/quadCrossover.tmpl b/eo/tutorial/Templates/quadCrossover.tmpl index c3b92ca5..93f104a0 100644 --- a/eo/tutorial/Templates/quadCrossover.tmpl +++ b/eo/tutorial/Templates/quadCrossover.tmpl @@ -15,14 +15,14 @@ Quadratic crossover operators modify the both genotypes #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * * THere is NO ASSUMPTION on the class GenoypeT. * In particular, it does not need to derive from EO */ -template +template class eoMyStructQuadCrossover: public eoQuadOp { public: @@ -31,7 +31,7 @@ public: */ // START eventually add or modify the anyVariable argument eoMyStructQuadCrossover() - // eoMyStructQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable) + // eoMyStructQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable) // END eventually add or modify the anyVariable argument { // START Code of Ctor of an eoMyStructEvalFunc object @@ -47,9 +47,9 @@ public: * @param _genotype1 The first parent * @param _genotype2 The second parent */ - bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2) + bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2) { - bool oneAtLeastIsModified; + bool oneAtLeastIsModified(true); // START code for crossover of _genotype1 and _genotype2 objects /** Requirement diff --git a/eo/tutorial/Templates/stat.tmpl b/eo/tutorial/Templates/stat.tmpl index 792c0573..c53602da 100644 --- a/eo/tutorial/Templates/stat.tmpl +++ b/eo/tutorial/Templates/stat.tmpl @@ -14,15 +14,15 @@ Template for computing statistics on eoPop // include the base definition of eoInit #include -/** +/** * Always write a comment in this format before class definition * if you want the class to be documented by Doxygen * - * ASSUMPTION on the class GenoypeT: + * ASSUMPTION on the class GenoypeT: * it needs to derive from EO (i.e. has a Fitness). * - * It is assumed that you want to compute a double. - * In case you want something else, then your stat should derive from + * It is assumed that you want to compute a double. + * In case you want something else, then your stat should derive from * eoStat * where class T is the class of the computed statistics */ @@ -33,7 +33,7 @@ public : typedef typename EOT::Fitness Fitness; // START eventually add or modify the anyVariable argument - /** Ctor - you change the default name of course. + /** Ctor - you change the default name of course. * @param * _description : inherited from eoValueParam (eoStat is an from eoVapueParam) */ @@ -46,7 +46,7 @@ public : } void operator()(const eoPop& _pop){ - double tmpStat; + double tmpStat(0.); // START Code for computing the statistics - in tmpStat // tmpStat = blablabla // END Code for computing the statistics