/** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- The above line is usefulin Emacs-like editors */ /* Template for creating a new representation in EO ================================================ This is the template file that allows separate compilation of everything that is representation independant (evolution engine and general output) for an Evolutionary Algorithm with scalar fitness. It includes of course the definition of the genotype (eoMyStruct.h) and is written like the make_xxx.cpp files in dirs src/ga (for bitstrings) and src/es (for real vectors). */ // Miscilaneous include and declaration #include using namespace std; // eo general include #include "eo" // the real bounds (not yet in general eo include) #include "utils/eoRealVectorBounds.h" // include here whatever specific files for your representation // Basically, this should include at least the following /** definition of representation: * class eoMyStruct MUST derive from EO for some fitness */ #include "eoMyStruct.h" // create an initializer: this is NOT representation-independent // and will be done in the main file // However, should you decide to freeze that part, you could use the // following (and remove it from the main file, of course!!!) //------------------------------------------------------------------ // #include "make_genotype_MyStruct.h" // eoInit> & make_genotype(eoParser& _parser, eoState&_state, eoMyStruct _eo) // { // return do_make_genotype(_parser, _state, _eo); // } // eoInit> & make_genotype(eoParser& _parser, eoState&_state, eoMyStruct _eo) // { // return do_make_genotype(_parser, _state, _eo); // } // same thing for the variation operaotrs //--------------------------------------- // #include "make_op_MyStruct.h" // eoGenOp>& make_op(eoParser& _parser, eoState& _state, eoInit>& _init) // { // return do_make_op(_parser, _state, _init); // } // eoGenOp>& make_op(eoParser& _parser, eoState& _state, eoInit>& _init) // { // return do_make_op(_parser, _state, _init); // } // The following modules use ***representation independent*** routines // how to initialize the population // it IS representation independent if an eoInit is given #include eoPop >& make_pop(eoParser& _parser, eoState& _state, eoInit > & _init) { return do_make_pop(_parser, _state, _init); } eoPop >& make_pop(eoParser& _parser, eoState& _state, eoInit > & _init) { return do_make_pop(_parser, _state, _init); } // the stopping criterion #include eoContinue >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter > & _eval) { return do_make_continue(_parser, _state, _eval); } eoContinue >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter > & _eval) { return do_make_continue(_parser, _state, _eval); } // outputs (stats, population dumps, ...) #include eoCheckPoint >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter >& _eval, eoContinue >& _continue) { return do_make_checkpoint(_parser, _state, _eval, _continue); } eoCheckPoint >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter >& _eval, eoContinue >& _continue) { return do_make_checkpoint(_parser, _state, _eval, _continue); } // evolution engine (selection and replacement) #include eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op) { return do_make_algo_scalar(_parser, _state, _eval, _continue, _op); } eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op) { return do_make_algo_scalar(_parser, _state, _eval, _continue, _op); } // simple call to the algo. stays there for consistency reasons // no template for that one #include void run_ea(eoAlgo >& _ga, eoPop >& _pop) { do_run(_ga, _pop); } void run_ea(eoAlgo >& _ga, eoPop >& _pop) { do_run(_ga, _pop); }