Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages | Search for

# make_MyStruct.cpp

    00001
    00006 /*
    00007 Template for creating a new representation in EO
    00008 ================================================
    00009
    00010 This is the template file that allows separate compilation of
    00011 everything that is representation independant (evolution engine and
    00012 general output) for an Evolutionary Algorithm with scalar fitness.
    00013
    00014 It includes of course the definition of the genotype (eoMyStruct.h) and
    00015 is written like the make_xxx.cpp files in dirs src/ga (for bitstrings)
    00016 and src/es (for real vectors).
    00017
    00018 */
    00019
    00020 // Miscilaneous include and declaration
    00021 #include <iostream>
    00022 using namespace std;
    00023
    00024 // eo general include
    00025 #include "eo"
    00026 // the real bounds (not yet in general eo include)
    00027 #include "utils/eoRealVectorBounds.h"
    00028
    00029 // include here whatever specific files for your representation
    00030 // Basically, this should include at least the following
    00031
    00035 #include "eoMyStruct.h"
    00036
    00037 // create an initializer: this is NOT representation-independent
    00038 // and will be done in the main file
    00039 // However, should you decide to freeze that part, you could use the
    00040 // following (and remove it from the main file, of course!!!)
    00041 //------------------------------------------------------------------
    00042 // #include "make_genotype_MyStruct.h"
    00043 // eoInit<eoMyStruct<double>> & make_genotype(eoParser& _parser, eoState&_state, eoMyStruct<double> _eo)
    00044 // {
    00045 //   return do_make_genotype(_parser, _state, _eo);
    00046 // }
    00047
    00048 // eoInit<eoMyStruct<eoMinimizingFitness>> & make_genotype(eoParser& _parser, eoState&_state, eoMyStruct<eoMinimizingFitness> _eo)
    00049 // {
    00050 //   return do_make_genotype(_parser, _state, _eo);
    00051 // }
    00052
    00053 // same thing for the variation operaotrs
    00054 //---------------------------------------
    00055 // #include "make_op_MyStruct.h"
    00056 // eoGenOp<eoMyStruct<double>>&  make_op(eoParser& _parser, eoState& _state, eoInit<eoMyStruct<double>>& _init)
    00057 // {
    00058 //   return do_make_op(_parser, _state, _init);
    00059 // }
    00060
    00061 // eoGenOp<eoMyStruct<eoMinimizingFitness>>&  make_op(eoParser& _parser, eoState& _state, eoInit<eoMyStruct<eoMinimizingFitness>>& _init)
    00062 // {
    00063 //   return do_make_op(_parser, _state, _init);
    00064 // }
    00065
    00066 // The following modules use ***representation independent*** routines
    00067
    00068 // how to initialize the population
    00069 // it IS representation independent if an eoInit is given
    00070 #include <do/make_pop.h>
    00071 eoPop<eoMyStruct<double> >&  make_pop(eoParser& _parser, eoState& _state, eoInit<eoMyStruct<double> > & _init)
    00072 {
    00073   return do_make_pop(_parser, _state, _init);
    00074 }
    00075
    00076 eoPop<eoMyStruct<eoMinimizingFitness> >&  make_pop(eoParser& _parser, eoState& _state, eoInit<eoMyStruct<eoMinimizingFitness> > & _init)
    00077 {
    00078   return do_make_pop(_parser, _state, _init);
    00079 }
    00080
    00081 // the stopping criterion
    00082 #include <do/make_continue.h>
    00083 eoContinue<eoMyStruct<double> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoMyStruct<double> > & _eval)
    00084 {
    00085   return do_make_continue(_parser, _state, _eval);
    00086 }
    00087
    00088 eoContinue<eoMyStruct<eoMinimizingFitness> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoMyStruct<eoMinimizingFitness> > & _eval)
    00089 {
    00090   return do_make_continue(_parser, _state, _eval);
    00091 }
    00092
    00093 // outputs (stats, population dumps, ...)
    00094 #include <do/make_checkpoint.h>
    00095 eoCheckPoint<eoMyStruct<double> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoMyStruct<double> >& _eval, eoContinue<eoMyStruct<double> >& _continue)
    00096 {
    00097   return do_make_checkpoint(_parser, _state, _eval, _continue);
    00098 }
    00099
    00100 eoCheckPoint<eoMyStruct<eoMinimizingFitness> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoMyStruct<eoMinimizingFitness> >& _eval, eoContinue<eoMyStruct<eoMinimizingFitness> >& _continue)
    00101 {
    00102   return do_make_checkpoint(_parser, _state, _eval, _continue);
    00103 }
    00104
    00105 // evolution engine (selection and replacement)
    00106 #include <do/make_algo_scalar.h>
    00107 eoAlgo<eoMyStruct<double> >&  make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<eoMyStruct<double> >& _eval, eoContinue<eoMyStruct<double> >& _continue, eoGenOp<eoMyStruct<double> >& _op)
    00108 {
    00109   return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
    00110 }
    00111
    00112 eoAlgo<eoMyStruct<eoMinimizingFitness> >&  make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<eoMyStruct<eoMinimizingFitness> >& _eval, eoContinue<eoMyStruct<eoMinimizingFitness> >& _continue, eoGenOp<eoMyStruct<eoMinimizingFitness> >& _op)
    00113 {
    00114   return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
    00115 }
    00116
    00117 // simple call to the algo. stays there for consistency reasons
    00118 // no template for that one
    00119 #include <do/make_run.h>
    00120 void run_ea(eoAlgo<eoMyStruct<double> >& _ga, eoPop<eoMyStruct<double> >& _pop)
    00121 {
    00122   do_run(_ga, _pop);
    00123 }
    00124
    00125 void run_ea(eoAlgo<eoMyStruct<eoMinimizingFitness> >& _ga, eoPop<eoMyStruct<eoMinimizingFitness> >& _pop)
    00126 {
    00127   do_run(_ga, _pop);
    00128 }
    00129