diff --git a/eo/tutorial/Templates/Makefile.tmpl b/eo/tutorial/Templates/Makefile.tmpl index f91d2308..cfc87072 100644 --- a/eo/tutorial/Templates/Makefile.tmpl +++ b/eo/tutorial/Templates/Makefile.tmpl @@ -4,6 +4,17 @@ .cpp.o: ; c++ -DPACKAGE=\"eo\" -DVERSION=\"0.9.1\" -DF2C -I. -I../../src -I./util -Wall -g -c $*.cpp +# local sources +LOCAL_SOURCES = MyStructEA.cpp \ + eoMyStruct.h \ + eoMyStructEvalFunc.h \ + eoMyStructInit.h \ + eoMyStructMutation.h \ + eoMyStructQuadCrossover.h \ + make_genotype_MyStruct.h \ + make_op_MyStruct.h + + # START eventually modify the name of EO dir DIR_EO = ../../src @@ -22,4 +33,6 @@ all : $(ALL) clean : ; /bin/rm *.o $(ALL) +########## local dependencies +AppliEA.o : $(LOCAL_SOURCES) diff --git a/eo/tutorial/Templates/MyStructEA.cpp b/eo/tutorial/Templates/MyStructEA.cpp index 9d58f81d..9020d472 100644 --- a/eo/tutorial/Templates/MyStructEA.cpp +++ b/eo/tutorial/Templates/MyStructEA.cpp @@ -51,10 +51,13 @@ using namespace std; //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* // START fitness type: double or eoMaximizingFitness if you are maximizing // eoMinimizingFitness if you are minimizing -typedef eoMyStruct Indi; // ***MUST*** derive from EO +typedef eoMinimizingFitness MyFitT ; // type of fitness // END fitness type //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* +// Then define your EO objects using that fitness type +typedef eoMyStruct Indi; // ***MUST*** derive from EO + // create an initializer #include "make_genotype_MyStruct.h" eoInit & make_genotype(eoParameterLoader& _parser, eoState&_state, Indi _eo) diff --git a/eo/tutorial/Templates/README b/eo/tutorial/Templates/README index e1284acb..91c85d6a 100644 --- a/eo/tutorial/Templates/README +++ b/eo/tutorial/Templates/README @@ -30,18 +30,23 @@ First, let's choose a name: let's call the new EO class eoAppli. All newly created classes will be named eoAppliXXX (in the file eoAppliXXX) -1- choose a directory name for your application in the tutorial dir, -"parallel" to the LessonX dirs (though any name can do, of course, we -will suppose its full name, from the / root dir, is APPLICATION in -what follows) +1- cd to the tutorial dir -2- cd to the tutorial/Templates dir +2- create the directory for your application (let's assume you call it +APPLICATION): type in -3- run the helper script create.sh with the following arguments - create.sh Appli APPLICATION + mkdir APPLICATION -4- cd to the APPLICATION dir. You should see there the following -files: +3- go to the Templates dir + + cd Templates + +and run the helper script create.sh with the following arguments + + ./create.sh Appli ../APPLICATION + +4- cd to the APPLICATION dir (cd ../APPLICATION). +You should see there the following files: AppliEA.cpp the main file, includes all other, to be compiled Makefile with default target eoAppliEA eoAppli.h class eoAppli, FitT = template fitness diff --git a/eo/tutorial/Templates/eoMyStruct.tmpl b/eo/tutorial/Templates/eoMyStruct.tmpl index b33c30f3..f3687516 100644 --- a/eo/tutorial/Templates/eoMyStruct.tmpl +++ b/eo/tutorial/Templates/eoMyStruct.tmpl @@ -40,6 +40,7 @@ public: // END Code of default Ctor of an eoMyStruct object } + virtual string className() const { return "eoMyStruct"; } /** printing... */ void printOn(ostream& os) const