The new libga

Apart from big changes in the src/ga dir, and the addition of the src/do dir
it also generated a few changes here and there, e.g. some include file still
missing. Also removed some warning from some test files.
This commit is contained in:
evomarc 2001-04-24 04:52:04 +00:00
commit 56c9464306
32 changed files with 1679 additions and 158 deletions

View file

@ -6,7 +6,14 @@
INCLUDES = -I$(top_builddir)/src
lib_LIBRARIES = libga.a
libga_a_SOURCES = ga.cpp
libga_a_SOURCES = make_algo_scalar_ga.cpp \
make_checkpoint_ga.cpp \
make_continue_ga.cpp \
make_genotype_ga.cpp \
make_help.cpp \
make_op_ga.cpp \
make_pop_ga.cpp \
make_run_ga.cpp
CPPFLAGS = -O2 -Wall

21
eo/src/ga/Readme Normal file
View file

@ -0,0 +1,21 @@
This directory contains:
- some standard EO source files, named eoXXXXX, that define objects
for the eoBit<FitT> representation (bitstrings).
- some make_XXX.cpp files that are instanciations for EO bitstrings
(eoBit<double> AND eoBit<eoMinimizingFitness>) of the tempatized code
that is defined in the EO src/do dir.
This MK's trick allows to actually compile all these bits in a library
(eolibga.a) and to only recompile the bits you need for your own
(bitstring!) application.
@see src/do/make_XXX.h files, and test/t-eoGA.cpp for an example use.
Note:
Also are *defined* here two representation dependent make_XXX.h files
(together with their instanciations in make_XXX.cpp), namely the ones
that constructs the EOType initializer (make_genotype.h) and the one
that buils up the operators (make_op.h).
MS, April 23, 2001CVS

View file

@ -1,91 +0,0 @@
#include <eo>
#include <ga/ga.h>
eoValueParam<float> xoverRate(0.6f, "xoverrate", "The crossover rate", 'x');
eoValueParam<float> mutRate(1.0f, "mutationrate", "The mutation rate", 'm');
eoValueParam<unsigned> chromSize(unsigned(10), "chromosomeSize", "The length of the bitstrings", 'n');
eoValueParam<unsigned> popSize(unsigned(20), "PopSize", "Population Size", 'P');
template <class FitT>
eoAlgo<eoBit<FitT> >& do_make_ga(eoParameterLoader& _parser, eoEvalFunc<eoBit<FitT> >& _eval, eoCheckPoint<eoBit<FitT> >& _checkpoint, eoState& _state)
{
typedef eoBit<FitT> EOT;
_parser.processParam(xoverRate, "genetics");
_parser.processParam(mutRate, "genetics");
_parser.processParam(chromSize, "initialization");
eoBitMutation<EOT>* mutOp = new eoBitMutation<EOT>(1. / float(chromSize.value()));
_state.storeFunctor(mutOp);
eo1PtBitXover<EOT>* crossOp = new eo1PtBitXover<EOT>;
_state.storeFunctor(crossOp);
eoSelectOne<EOT>* select = new eoDetTournamentSelect<EOT>(2);
_state.storeFunctor(select);
eoSGA<eoBit<FitT> >* sga = new eoSGA<EOT>(*select, *crossOp, xoverRate.value(), *mutOp, mutRate.value(), _eval, _checkpoint);
_state.storeFunctor(sga);
return *sga;
}
template <class FitT>
eoPop<eoBit<FitT> >& do_init_ga(eoParameterLoader& _parser, eoState& _state, FitT)
{
typedef eoBit<FitT> EOT;
_parser.processParam(chromSize, "initialization");
_parser.processParam(popSize, "initialization");
eoBooleanGenerator gen;
eoInitFixedLength<EOT> init(chromSize.value(), gen);
// Let the state handle the memory
eoPop<EOT>& pop = _state.takeOwnership(eoPop<EOT>());
_state.registerObject(pop);
// initialize the population
pop.append(popSize.value(), init);
return pop;
}
template <class FitT>
void do_run_ga(eoAlgo<eoBit<FitT> >& _ga, eoPop<eoBit<FitT> >& _pop)
{
_ga(_pop);
}
/// The following function merely call the templatized do_* functions above
eoAlgo<eoBit<double> >& make_ga(eoParameterLoader& _parser, eoEvalFunc<eoBit<double> >& _eval, eoCheckPoint<eoBit<double> >& _checkpoint, eoState& _state)
{
return do_make_ga(_parser, _eval, _checkpoint, _state);
}
eoAlgo<eoBit<eoMinimizingFitness> >& make_ga(eoParameterLoader& _parser, eoEvalFunc<eoBit<eoMinimizingFitness> >& _eval, eoCheckPoint<eoBit<eoMinimizingFitness> >& _checkpoint, eoState& _state)
{
return do_make_ga(_parser, _eval, _checkpoint, _state);
}
eoPop<eoBit<double> >& init_ga(eoParameterLoader& _parser, eoState& _state, double _d)
{
return do_init_ga(_parser, _state, _d);
}
eoPop<eoBit<eoMinimizingFitness> >& init_ga(eoParameterLoader& _parser, eoState& _state, eoMinimizingFitness _d)
{
return do_init_ga(_parser, _state, _d);
}
void run_ga(eoAlgo<eoBit<double> >& _ga, eoPop<eoBit<double> >& _pop)
{
do_run_ga(_ga, _pop);
}
void run_ga(eoAlgo<eoBit<eoMinimizingFitness> >& _ga, eoPop<eoBit<eoMinimizingFitness> >& _pop)
{
do_run_ga(_ga, _pop);
}

View file

@ -1,24 +1,92 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// ga.h
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
/** This file contains all ***INSTANCIATED*** declarations of all components
* of the library for ***BISTRING*** evolution inside EO.
* It should be included in the file that calls any of the corresponding fns
*
* The corresponding ***INSTANCIATED*** definitions are contained in ga.cpp
* while the TEMPLATIZED code is define in the different makeXXX.h files
*
* Unlike most EO .h files, it does not (and should not) contain any code,
* just declarations
*/
#ifndef ga_h
#define ga_h
#include <eoAlgo.h>
#include <eoScalarFitness.h>
#include <utils/eoParser.h>
#include <eoEvalFunc.h>
#include <eoEvalFuncCounter.h>
#include <utils/eoCheckPoint.h>
#include <eoGenOp.h>
#include <eoPop.h>
#include <ga/eoBit.h>
#include <ga/eoBitOp.h>
//Representation dependent - rewrite everything anew for each representation
//////////////////////////
// the genotypes
eoInit<eoBit<double> > & make_genotype(eoParameterLoader& _parser, eoState& _state, double _d);
eoInit<eoBit<eoMinimizingFitness> > & make_genotype(eoParameterLoader& _parser, eoState& _state, eoMinimizingFitness _d);
// the operators
eoGenOp<eoBit<double> >& make_op(eoParameterLoader& _parser, eoState& _state, eoInit<eoBit<double> >& _init);
eoGenOp<eoBit<eoMinimizingFitness> >& make_op(eoParameterLoader& _parser, eoState& _state, eoInit<eoBit<eoMinimizingFitness> >& _init);
//Representation INdependent
////////////////////////////
// if you use your own representation, simply change the types of templates
// init pop
eoPop<eoBit<double> >& make_pop(eoParser& _parser, eoState& _state, eoInit<eoBit<double> >&);
eoPop<eoBit<eoMinimizingFitness> >& make_ga(eoParser& _parser, eoState& _state, eoInit<eoBit<eoMinimizingFitness> >&);
// the continue's
eoContinue<eoBit<double> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoBit<double> > & _eval);
eoContinue<eoBit<eoMinimizingFitness> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoBit<eoMinimizingFitness> > & _eval);
// the checkpoint
eoCheckPoint<eoBit<double> >& make_checkpoint(eoParameterLoader& _parser, eoState& _state, eoEvalFuncCounter<eoBit<double> >& _eval, eoContinue<eoBit<double> >& _continue);
eoCheckPoint<eoBit<eoMinimizingFitness> >& make_checkpoint(eoParameterLoader& _parser, eoState& _state, eoEvalFuncCounter<eoBit<eoMinimizingFitness> >& _eval, eoContinue<eoBit<eoMinimizingFitness> >& _continue);
eoAlgo<eoBit<double> >& make_ga(eoParameterLoader& _parser, eoEvalFunc<eoBit<double> >& _eval, eoCheckPoint<eoBit<double> >& _checkpoint, eoState& state);
eoAlgo<eoBit<eoMinimizingFitness> >& make_ga(eoParameterLoader& _parser, eoEvalFunc<eoBit<eoMinimizingFitness> >& _eval, eoCheckPoint<eoBit<eoMinimizingFitness> >& _checkpoint, eoState& state);
// the algo
eoAlgo<eoBit<double> >& make_algo_scalar(eoParameterLoader& _parser, eoState& _state, eoEvalFunc<eoBit<double> >& _eval, eoContinue<eoBit<double> >& _ccontinue, eoGenOp<eoBit<double> >& _op);
eoPop<eoBit<double> >& init_ga(eoParameterLoader& _parser, eoState& _state, double);
eoPop<eoBit<eoMinimizingFitness> >& init_ga(eoParameterLoader& _parser, eoState& _state, eoMinimizingFitness);
eoAlgo<eoBit<eoMinimizingFitness> >& make_algo_scalar(eoParameterLoader& _parser, eoState& _state, eoEvalFunc<eoBit<eoMinimizingFitness> >& _eval, eoContinue<eoBit<eoMinimizingFitness> >& _ccontinue, eoGenOp<eoBit<eoMinimizingFitness> >& _op);
void run_ga(eoAlgo<eoBit<double> >& _ga, eoPop<eoBit<double> >& _pop);
void run_ga(eoAlgo<eoBit<eoMinimizingFitness> >& _ga, eoPop<eoBit<eoMinimizingFitness> >& _pop);
// run
void run_ea(eoAlgo<eoBit<double> >& _ga, eoPop<eoBit<double> >& _pop);
void run_ea(eoAlgo<eoBit<eoMinimizingFitness> >& _ga, eoPop<eoBit<eoMinimizingFitness> >& _pop);
// end of parameter input (+ .status + help)
// that one is not templatized, but is here for the sake of completeness
void make_help(eoParser & _parser);
#endif

View file

@ -0,0 +1,59 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// make_algo_scalar_ga.cpp
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
/** This file contains all ***INSTANCIATED DEFINITIONS*** of operators
* of the library for ***BISTRING*** evolution inside EO.
* It should be included in the file that calls any of the corresponding fns
* Compiling this file allows one to generate part of the library (i.e. object
* files that you just need to link with your own main and fitness code).
*
* The corresponding ***INSTANCIATED DECLARATIONS*** are contained
* in make_algo_scalar_ga.h
* while the TEMPLATIZED code is define in make_algo_scalar.h in the do dir
*
* Unlike most EO .h files, it does not (and should not) contain any code,
* just declarations
*/
// The templatized code
#include <do/make_algo_scalar.h>
// the instanciating EOType
#include <ga/eoBit.h>
/// The following function merely call the templatized do_* functions above
// Algo
///////
eoAlgo<eoBit<double> >& make_algo_scalar(eoParameterLoader& _parser, eoState& _state, eoEvalFunc<eoBit<double> >& _eval, eoContinue<eoBit<double> >& _continue, eoGenOp<eoBit<double> >& _op)
{
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
}
eoAlgo<eoBit<eoMinimizingFitness> >& make_algo_scalar(eoParameterLoader& _parser, eoState& _state, eoEvalFunc<eoBit<eoMinimizingFitness> >& _eval, eoContinue<eoBit<eoMinimizingFitness> >& _continue, eoGenOp<eoBit<eoMinimizingFitness> >& _op)
{
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
}

View file

@ -0,0 +1,59 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// make_checkpoint_ga.cpp
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
/** This file contains all ***INSTANCIATED DEFINITIONS*** of operators
* of the library for ***BISTRING*** evolution inside EO.
* It should be included in the file that calls any of the corresponding fns
* Compiling this file allows one to generate part of the library (i.e. object
* files that you just need to link with your own main and fitness code).
*
* The corresponding ***INSTANCIATED DECLARATIONS*** are contained
* in make_checkpoint_ga.h
* while the TEMPLATIZED code is define in make_checkpoint.h in the do dir
*
* Unlike most EO .h files, it does not (and should not) contain any code,
* just declarations
*/
// The templatized code
#include <do/make_checkpoint.h>
// the instanciating EOType
#include <ga/eoBit.h>
/// The following function merely call the templatized do_* functions
// checkpoint
/////////////
eoCheckPoint<eoBit<double> >& make_checkpoint(eoParameterLoader& _parser, eoState& _state, eoEvalFuncCounter<eoBit<double> >& _eval, eoContinue<eoBit<double> >& _continue)
{
return do_make_checkpoint(_parser, _state, _eval, _continue);
}
eoCheckPoint<eoBit<eoMinimizingFitness> >& make_checkpoint(eoParameterLoader& _parser, eoState& _state, eoEvalFuncCounter<eoBit<eoMinimizingFitness> >& _eval, eoContinue<eoBit<eoMinimizingFitness> >& _continue)
{
return do_make_checkpoint(_parser, _state, _eval, _continue);
}

View file

@ -0,0 +1,59 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// make_continue_ga.cpp
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
/** This file contains all ***INSTANCIATED DEFINITIONS*** of operators
* of the library for ***BISTRING*** evolution inside EO.
* It should be included in the file that calls any of the corresponding fns
* Compiling this file allows one to generate part of the library (i.e. object
* files that you just need to link with your own main and fitness code).
*
* The corresponding ***INSTANCIATED DECLARATIONS*** are contained
* in make_continue_ga.h
* while the TEMPLATIZED code is define in make_contninue.h in the do dir
*
* Unlike most EO .h files, it does not (and should not) contain any code,
* just declarations
*/
// The templatized code
#include <do/make_continue.h>
// the instanciating EOType
#include <ga/eoBit.h>
/// The following function merely call the templatized do_* functions above
// continue
///////////
eoContinue<eoBit<double> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoBit<double> > & _eval)
{
return do_make_continue(_parser, _state, _eval);
}
eoContinue<eoBit<eoMinimizingFitness> >& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoBit<eoMinimizingFitness> > & _eval)
{
return do_make_continue(_parser, _state, _eval);
}

View file

@ -0,0 +1,53 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// make_genotype_ga.cpp
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
/** This file contains all ***INSTANCIATED DEFINITIONS*** of operators
* of the library for ***BISTRING*** evolution inside EO.
* It should be included in the file that calls any of the corresponding fns
* Compiling this file allows one to generate part of the library (i.e. object
* files that you just need to link with your own main and fitness code).
*
* The corresponding ***INSTANCIATED DECLARATIONS*** are contained
* in make_genotype_ga.h
* while the TEMPLATIZED code is define in make_genotype.h in the ga dir
*
* Unlike most EO .h files, it does not (and should not) contain any code,
* just declarations
*/
// the templatized code
#include <ga/make_genotype.h>
/// The following function merely call the templatized do_* functions above
eoInit<eoBit<double> > & make_genotype(eoParameterLoader& _parser, eoState& _state, double _d)
{
return do_make_genotype(_parser, _state, _d);
}
eoInit<eoBit<eoMinimizingFitness> > & make_genotype(eoParameterLoader& _parser, eoState& _state, eoMinimizingFitness _d)
{
return do_make_genotype(_parser, _state, _d);
}

54
eo/src/ga/make_help.cpp Normal file
View file

@ -0,0 +1,54 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// make_help.h
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
#include <utils/eoParser.h>
#include <fstream.h>
/** Generation of the status file, and output of the help message if needed
*
* MUST be called after ALL parameters have been read in order to list them
*
* Warning: this is a plain .cpp file and shoudl NOT be included anywhere,
* but compiled separately and stored in a library.
*/
void make_help(eoParser & _parser)
{
// name of the "status" file where all actual parameter values will be saved
string str_status = _parser.ProgramName() + ".status"; // default value
eoValueParam<string>& statusParam = _parser.createParam(str_status, "status","Status file",'\0', "Persistence" );
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
// i.e. in case you need parameters somewhere else, postpone these
if (_parser.userNeedsHelp())
{
_parser.printHelp(cout);
exit(1);
}
if (statusParam.value() != "")
{
ofstream os(statusParam.value().c_str());
os << _parser; // and you can use that file as parameter file
}
}

57
eo/src/ga/make_op_ga.cpp Normal file
View file

@ -0,0 +1,57 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// make_op_ga.cpp
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
/** This file contains all ***INSTANCIATED DEFINITIONS*** of operators
* of the library for ***BISTRING*** evolution inside EO.
* It should be included in the file that calls any of the corresponding fns
* Compiling this file allows one to generate part of the library (i.e. object
* files that you just need to link with your own main and fitness code).
*
* The corresponding ***INSTANCIATED DECLARATIONS*** are contained
* in make_op_ga.h
* while the TEMPLATIZED code is define in make_op.h in the ga dir
*
* Unlike most EO .h files, it does not (and should not) contain any code,
* just declarations
*/
// Templatized code
#include <ga/make_op.h>
/// The following function merely call the templatized do_* functions above
// oeprators
////////////
eoGenOp<eoBit<double> >& make_op(eoParameterLoader& _parser, eoState& _state, eoInit<eoBit<double> >& _init)
{
return do_make_op(_parser, _state, _init);
}
eoGenOp<eoBit<eoMinimizingFitness> >& make_op(eoParameterLoader& _parser, eoState& _state, eoInit<eoBit<eoMinimizingFitness> >& _init)
{
return do_make_op(_parser, _state, _init);
}

60
eo/src/ga/make_pop_ga.cpp Normal file
View file

@ -0,0 +1,60 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// make_pop_ga.cpp
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
/** This file contains all ***INSTANCIATED DEFINITIONS*** of operators
* of the library for ***BISTRING*** evolution inside EO.
* It should be included in the file that calls any of the corresponding fns
* Compiling this file allows one to generate part of the library (i.e. object
* files that you just need to link with your own main and fitness code).
*
* The corresponding ***INSTANCIATED DECLARATIONS*** are contained
* in make_pop_ga.h
* while the TEMPLATIZED code is define in make_pop.h in the do dir
*
* Unlike most EO .h files, it does not (and should not) contain any code,
* just declarations
*/
// The templatized code
#include <do/make_pop.h>
// the instanciating EOType
#include <ga/eoBit.h>
/// The following function merely call the templatized do_* functions above
// Init POP
///////////
eoPop<eoBit<double> >& make_pop(eoParser& _parser, eoState& _state, eoInit<eoBit<double> > & _init)
{
return do_make_pop(_parser, _state, _init);
}
eoPop<eoBit<eoMinimizingFitness> >& make_pop(eoParser& _parser, eoState& _state, eoInit<eoBit<eoMinimizingFitness> > & _init)
{
return do_make_pop(_parser, _state, _init);
}

61
eo/src/ga/make_run_ga.cpp Normal file
View file

@ -0,0 +1,61 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// make_run_ga.cpp
// (c) Maarten Keijzer, Marc Schoenauer and GeNeura Team, 2001
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
/** This file contains all ***INSTANCIATED DEFINITIONS*** of operators
* of the library for ***BISTRING*** evolution inside EO.
* It should be included in the file that calls any of the corresponding fns
* Compiling this file allows one to generate part of the library (i.e. object
* files that you just need to link with your own main and fitness code).
*
* The corresponding ***INSTANCIATED DECLARATIONS*** are contained
* in make_run_ga.h
* while the TEMPLATIZED code is define in make_run.h in the do dir
*
* Unlike most EO .h files, it does not (and should not) contain any code,
* just declarations
*/
// The templatized code
#include <do/make_run.h>
// the instanciating EOType
#include <ga/eoBit.h>
// the instanciating fitnesses
#include <eoScalarFitness.h>
/// The following function merely call the templatized do_* functions above
// run
/////////
void run_ea(eoAlgo<eoBit<double> >& _ga, eoPop<eoBit<double> >& _pop)
{
do_run(_ga, _pop);
}
void run_ea(eoAlgo<eoBit<eoMinimizingFitness> >& _ga, eoPop<eoBit<eoMinimizingFitness> >& _pop)
{
do_run(_ga, _pop);
}