# make_OneMax.cpp

    00001
    00006 /*
    00007 Template for creating a new representation in EO
    00008 ================================================
    00009
    00010 This is the template file that llows 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 (eoOneMax.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 "eoOneMax.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_OneMax.h"
    00043 // eoInit<eoOneMax<double>> & make_genotype(eoParser& _parser, eoState&_state, eoOneMax<double> _eo)
    00044 // {
    00045 //   return do_make_genotype(_parser, _state, _eo);
    00046 // }
    00047
    00048 // eoInit<eoOneMax<eoMinimizingFitness>> & make_genotype(eoParser& _parser, eoState&_state, eoOneMax<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_OneMax.h"
    00056 // eoGenOp<eoOneMax<double>>&  make_op(eoParser& _parser, eoState& _state, eoInit<eoOneMax<double>>& _init)
    00057 // {
    00058 //   return do_make_op(_parser, _state, _init);
    00059 // }
    00060
    00061 // eoGenOp<eoOneMax<eoMinimizingFitness>>&  make_op(eoParser& _parser, eoState& _state, eoInit<eoOneMax<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<eoOneMax<double> >&  make_pop(eoParser& _parser, eoState& _state, eoInit<eoOneMax<double> > & _init)
    00072 {
    00073   return do_make_pop(_parser, _state, _init);
    00074 }
    00075
    00076 eoPop<eoOneMax<eoMinimizingFitness> >&  make_pop(eoParser& _parser, eoState& _state, eoInit<eoOneMax<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<eoOneMax<double> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoOneMax<double> > & _eval)
    00084 {
    00085   return do_make_continue(_parser, _state, _eval);
    00086 }
    00087
    00088 eoContinue<eoOneMax<eoMinimizingFitness> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoOneMax<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<eoOneMax<double> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoOneMax<double> >& _eval, eoContinue<eoOneMax<double> >& _continue)
    00096 {
    00097   return do_make_checkpoint(_parser, _state, _eval, _continue);
    00098 }
    00099
    00100 eoCheckPoint<eoOneMax<eoMinimizingFitness> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoOneMax<eoMinimizingFitness> >& _eval, eoContinue<eoOneMax<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<eoOneMax<double> >&  make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<eoOneMax<double> >& _eval, eoContinue<eoOneMax<double> >& _continue, eoGenOp<eoOneMax<double> >& _op)
    00108 {
    00109   return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
    00110 }
    00111
    00112 eoAlgo<eoOneMax<eoMinimizingFitness> >&  make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<eoOneMax<eoMinimizingFitness> >& _eval, eoContinue<eoOneMax<eoMinimizingFitness> >& _continue, eoGenOp<eoOneMax<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<eoOneMax<double> >& _ga, eoPop<eoOneMax<double> >& _pop)
    00121 {
    00122   do_run(_ga, _pop);
    00123 }
    00124
    00125 void run_ea(eoAlgo<eoOneMax<eoMinimizingFitness> >& _ga, eoPop<eoOneMax<eoMinimizingFitness> >& _pop)
    00126 {
    00127   do_run(_ga, _pop);
    00128 }
    00129