EvolvingObjects
|
00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- 00002 00003 //----------------------------------------------------------------------------- 00004 // ga.h 00005 // (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001 00006 /* 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 00021 Contact: todos@geneura.ugr.es, http://geneura.ugr.es 00022 Marc.Schoenauer@polytechnique.fr 00023 mkeijzer@dhi.dk 00024 */ 00025 //----------------------------------------------------------------------------- 00026 00038 #ifndef ga_h 00039 #define ga_h 00040 00041 #include <eoAlgo.h> 00042 #include <eoScalarFitness.h> 00043 #include <utils/eoParser.h> 00044 #include <eoEvalFuncCounter.h> 00045 #include <utils/eoCheckPoint.h> 00046 #include <eoGenOp.h> 00047 #include <eoPop.h> 00048 #include <utils/eoDistance.h> 00049 00050 #include <ga/eoBit.h> 00051 00052 //Representation dependent - rewrite everything anew for each representation 00054 00059 // the genotypes 00060 eoInit<eoBit<double> > & make_genotype(eoParser& _parser, eoState& _state, eoBit<double> _eo, float _bias=0.5); 00061 eoInit<eoBit<eoMinimizingFitness> > & make_genotype(eoParser& _parser, eoState& _state, eoBit<eoMinimizingFitness> _eo, float _bias=0.5); 00062 00063 // the operators 00064 eoGenOp<eoBit<double> >& make_op(eoParser& _parser, eoState& _state, eoInit<eoBit<double> >& _init); 00065 eoGenOp<eoBit<eoMinimizingFitness> >& make_op(eoParser& _parser, eoState& _state, eoInit<eoBit<eoMinimizingFitness> >& _init); 00066 00067 //Representation INdependent 00069 // if you use your own representation, simply change the types of templates 00070 00071 // init pop 00072 eoPop<eoBit<double> >& make_pop(eoParser& _parser, eoState& _state, eoInit<eoBit<double> >&); 00073 eoPop<eoBit<eoMinimizingFitness> >& make_pop(eoParser& _parser, eoState& _state, eoInit<eoBit<eoMinimizingFitness> >&); 00074 00075 // the continue's 00076 eoContinue<eoBit<double> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoBit<double> > & _eval); 00077 eoContinue<eoBit<eoMinimizingFitness> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoBit<eoMinimizingFitness> > & _eval); 00078 00079 // the checkpoint 00080 eoCheckPoint<eoBit<double> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoBit<double> >& _eval, eoContinue<eoBit<double> >& _continue); 00081 eoCheckPoint<eoBit<eoMinimizingFitness> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoBit<eoMinimizingFitness> >& _eval, eoContinue<eoBit<eoMinimizingFitness> >& _continue); 00082 00083 00084 // the algo 00085 eoAlgo<eoBit<double> >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<eoBit<double> >& _eval, eoContinue<eoBit<double> >& _ccontinue, eoGenOp<eoBit<double> >& _op, eoDistance<eoBit<double> >* _dist = NULL); 00086 00087 eoAlgo<eoBit<eoMinimizingFitness> >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<eoBit<eoMinimizingFitness> >& _eval, eoContinue<eoBit<eoMinimizingFitness> >& _ccontinue, eoGenOp<eoBit<eoMinimizingFitness> >& _op, eoDistance<eoBit<eoMinimizingFitness> >* _dist = NULL); 00088 00089 // run 00090 void run_ea(eoAlgo<eoBit<double> >& _ga, eoPop<eoBit<double> >& _pop); 00091 void run_ea(eoAlgo<eoBit<eoMinimizingFitness> >& _ga, eoPop<eoBit<eoMinimizingFitness> >& _pop); 00092 00093 // end of parameter input (+ .status + help) 00094 // that one is not templatized 00095 // Because of that, the source is in src/utils dir 00096 void make_help(eoParser & _parser); 00097 00099 #endif