* whitespace cleanup

This commit is contained in:
Caner Candan 2011-05-05 17:15:10 +02:00
commit 70e60a50d2
195 changed files with 1763 additions and 1873 deletions

View file

@ -9,22 +9,22 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
### 2) Specify where CMake can find the libraries
######################################################################################
IF(NOT WIN32 OR CYGWIN)
IF(NOT WIN32 OR CYGWIN)
LINK_DIRECTORIES(${EO_BINARY_DIR}/lib)
ENDIF(NOT WIN32 OR CYGWIN)
# especially for Visual Studio
IF(WIN32 AND NOT CYGWIN)
IF(WIN32 AND NOT CYGWIN)
LINK_DIRECTORIES(${EO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE})
ENDIF(WIN32 AND NOT CYGWIN)
ENDIF(WIN32 AND NOT CYGWIN)
######################################################################################
### 3) Define your targets
######################################################################################
# no matter what is the OS, hopefully
ADD_EXECUTABLE(OneMaxEA OneMaxEA.cpp)
ADD_EXECUTABLE(OneMaxLibEA OneMaxLibEA.cpp make_OneMax.cpp)
ADD_EXECUTABLE(OneMaxEA OneMaxEA.cpp)
ADD_EXECUTABLE(OneMaxLibEA OneMaxLibEA.cpp make_OneMax.cpp)
ADD_DEPENDENCIES(OneMaxEA es ga eo eoutils)
ADD_DEPENDENCIES(OneMaxLibEA es ga eo eoutils)

View file

@ -1,5 +1,5 @@
### This Makefile is part of the tutorial of the EO library
# Unlike other Makefiles in EO, it is not using the automake/autoconf
# Unlike other Makefiles in EO, it is not using the automake/autoconf
# so that it stays easy to understant (you are in the tutorial, remember!)
# MS, Oct. 2002
@ -10,11 +10,11 @@ DIR_EO = ../../src
.SUFFIXES: .cpp
# Warning: $(CXX) in Linux (RedHat and Mandrake at least) is g++
# However, if you are using this Makefile within xemacs,
# However, if you are using this Makefile within xemacs,
# and have problems with the interpretation of the output (and its colors)
# then you should use c++ instead (make CXX=c++ will do)
.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a
.cpp: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -o $@ $*.cpp $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a
.cpp.o: ; $(CXX) -DPACKAGE=\"eo\" -DVERSION=\"0.9.3\" -I. -I$(DIR_EO) -Wall -g -c $*.cpp
@ -39,7 +39,7 @@ LIB_EO = $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a
ALL = OneMaxEA OneMaxLibEA
OneMaxEA : OneMaxEA.o
$(CXX) -g -o $@ OneMaxEA.o $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a -lm
$(CXX) -g -o $@ OneMaxEA.o $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a -lm
OneMaxLibEA : OneMaxLibEA.o make_OneMax.o
$(CXX) -g -o $@ OneMaxLibEA.o make_OneMax.o $(DIR_EO)/utils/libeoutils.a $(DIR_EO)/libeo.a -lm
@ -53,4 +53,4 @@ clean : ; /bin/rm *.o $(ALL)
########## local dependencies
OneMaxEA.o : $(COMMON_SOURCES) OneMaxEA.cpp
OneMaxLibEA.o : $(COMMON_SOURCES) OneMaxLibEA.cpp
make_OneMax.o : make_OneMax.cpp eoOneMax.h
make_OneMax.o : make_OneMax.cpp eoOneMax.h

View file

@ -17,7 +17,7 @@ main file BitEA in tutorial/Lesson4 dir.
Or you can wait until we do it :-)
*/
// Miscilaneous include and declaration
// Miscilaneous include and declaration
#include <iostream>
using namespace std;
@ -29,17 +29,17 @@ using namespace std;
// include here whatever specific files for your representation
// Basically, this should include at least the following
/** definition of representation:
/** definition of representation:
* class eoOneMax MUST derive from EO<FitT> for some fitness
*/
#include "eoOneMax.h"
/** definition of initilizqtion:
/** definition of initilizqtion:
* class eoOneMaxInit MUST derive from eoInit<eoOneMax>
*/
#include "eoOneMaxInit.h"
/** definition of evaluation:
/** definition of evaluation:
* class eoOneMaxEvalFunc MUST derive from eoEvalFunc<eoOneMax>
* and should test for validity before doing any computation
* see tutorial/Templates/evalFunc.tmpl
@ -51,19 +51,19 @@ using namespace std;
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// START fitness type: double or eoMaximizingFitness if you are maximizing
// eoMinimizingFitness if you are minimizing
typedef eoMaximizingFitness MyFitT ; // type of fitness
typedef eoMaximizingFitness MyFitT ; // type of fitness
// END fitness type
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// Then define your EO objects using that fitness type
typedef eoOneMax<MyFitT> Indi; // ***MUST*** derive from EO
typedef eoOneMax<MyFitT> Indi; // ***MUST*** derive from EO
// create an initializer
#include "make_genotype_OneMax.h"
eoInit<Indi> & make_genotype(eoParser& _parser, eoState&_state, Indi _eo)
{
return do_make_genotype(_parser, _state, _eo);
}
}
// and the variation operaotrs
#include "make_op_OneMax.h"
@ -75,7 +75,7 @@ eoGenOp<Indi>& make_op(eoParser& _parser, eoState& _state, eoInit<Indi>& _init)
// Use existing modules to define representation independent routines
// These are parser-based definitions of objects
// how to initialize the population
// how to initialize the population
// it IS representation independent if an eoInit is given
#include <do/make_pop.h>
eoPop<Indi >& make_pop(eoParser& _parser, eoState& _state, eoInit<Indi> & _init)
@ -92,7 +92,7 @@ eoContinue<Indi>& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCo
// outputs (stats, population dumps, ...)
#include <do/make_checkpoint.h>
eoCheckPoint<Indi>& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<Indi>& _eval, eoContinue<Indi>& _continue)
eoCheckPoint<Indi>& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<Indi>& _eval, eoContinue<Indi>& _continue)
{
return do_make_checkpoint(_parser, _state, _eval, _continue);
}
@ -104,7 +104,7 @@ eoAlgo<Indi>& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<I
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
}
// simple call to the algo. stays there for consistency reasons
// simple call to the algo. stays there for consistency reasons
// no template for that one
#include <do/make_run.h>
// the instanciating fitnesses
@ -141,7 +141,7 @@ int main(int argc, char* argv[])
eoGenOp<Indi>& op = make_op(parser, state, init);
//// Now the representation-independent things
//// Now the representation-independent things
//
// YOU SHOULD NOT NEED TO MODIFY ANYTHING BEYOND THIS POINT
// unless you want to add specific statistics to the checkpoint

View file

@ -8,11 +8,11 @@ Template for creating a new representation in EO
================================================
This is the template main file for compiling after creating a
library.
library.
See make_OneMax.cpp file.
*/
// Miscilaneous include and declaration
// Miscilaneous include and declaration
#include <iostream>
using namespace std;
@ -24,17 +24,17 @@ using namespace std;
// include here whatever specific files for your representation
// Basically, this should include at least the following
/** definition of representation:
/** definition of representation:
* class eoOneMax MUST derive from EO<FitT> for some fitness
*/
#include "eoOneMax.h"
/** definition of initilizqtion:
/** definition of initilizqtion:
* class eoOneMaxInit MUST derive from eoInit<eoOneMax>
*/
#include "eoOneMaxInit.h"
/** definition of evaluation:
/** definition of evaluation:
* class eoOneMaxEvalFunc MUST derive from eoEvalFunc<eoOneMax>
* and should test for validity before doing any computation
* see tutorial/Templates/evalFunc.tmpl
@ -46,12 +46,12 @@ using namespace std;
//
// START fitness type: double or eoMaximizingFitness if you are maximizing
// eoMinimizingFitness if you are minimizing
typedef eoMinimizingFitness MyFitT ; // type of fitness
typedef eoMinimizingFitness MyFitT ; // type of fitness
// END fitness type
//
// Then define your EO objects using that fitness type
typedef eoOneMax<MyFitT> Indi; // ***MUST*** derive from EO
typedef eoOneMax<MyFitT> Indi; // ***MUST*** derive from EO
// create an initializer - done here and NOT in make_OneMax.cpp
// because it is NOT representation independent
@ -59,7 +59,7 @@ typedef eoOneMax<MyFitT> Indi; // ***MUST*** derive from EO
eoInit<Indi> & make_genotype(eoParser& _parser, eoState&_state, Indi _eo)
{
return do_make_genotype(_parser, _state, _eo);
}
}
// same thing for the variation operaotrs
#include "make_op_OneMax.h"
@ -70,7 +70,7 @@ eoGenOp<Indi>& make_op(eoParser& _parser, eoState& _state, eoInit<Indi>& _init)
// The representation independent routines are simply declared here
// how to initialize the population
// how to initialize the population
// it IS representation independent if an eoInit is given
eoPop<Indi >& make_pop(eoParser& _parser, eoState& _state, eoInit<Indi> & _init);
@ -83,7 +83,7 @@ eoCheckPoint<Indi>& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFu
// evolution engine (selection and replacement)
eoAlgo<Indi>& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<Indi>& _eval, eoContinue<Indi>& _continue, eoGenOp<Indi>& _op);
// simple call to the algo. stays there for consistency reasons
// simple call to the algo. stays there for consistency reasons
// no template for that one
void run_ea(eoAlgo<Indi>& _ga, eoPop<Indi>& _pop);
@ -115,7 +115,7 @@ int main(int argc, char* argv[])
eoGenOp<Indi>& op = make_op(parser, state, init);
//// Now the representation-independent things
//// Now the representation-independent things
//
// YOU SHOULD NOT NEED TO MODIFY ANYTHING BEYOND THIS POINT
// unless you want to add specific statistics to the checkpoint

View file

@ -11,7 +11,7 @@ Template for creating a new representation in EO
#ifndef _eoOneMax_h
#define _eoOneMax_h
/**
/**
* Always write a comment in this format before class definition
* if you want the class to be documented by Doxygen
@ -20,7 +20,7 @@ Template for creating a new representation in EO
* like eoVector for instance, if you handle a vector of something....
* If you create a structure from scratch,
* the only thing you need to provide are
* the only thing you need to provide are
* a default constructor
* IO routines printOn and readFrom
*
@ -31,11 +31,11 @@ template< class FitT>
class eoOneMax: public EO<FitT> {
public:
/** Ctor: you MUST provide a default ctor.
* though such individuals will generally be processed
* though such individuals will generally be processed
* by some eoInit object
*/
eoOneMax()
{
eoOneMax()
{
// START Code of default Ctor of an eoOneMax object
// END Code of default Ctor of an eoOneMax object
}
@ -54,7 +54,7 @@ public:
// First write the fitness
EO<FitT>::printOn(_os);
_os << ' ';
// START Code of default output
// START Code of default output
/** HINTS
* in EO we systematically write the sizes of things before the things
@ -66,7 +66,7 @@ public:
// END Code of default output
}
/** reading...
/** reading...
* of course, your readFrom must be able to read what printOn writes!!!
*/
void readFrom(istream& _is)
@ -87,7 +87,7 @@ public:
bool bTmp;
_is >> bTmp;
b[i] = bTmp;
}
}
// END Code of input
}
@ -108,4 +108,3 @@ private: // put all data here
};
#endif

View file

@ -1,13 +1,13 @@
/** -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
The above line is usefulin Emacs-like editors
*/
/*
Template for evaluator in EO, a functor that computes the fitness of an EO
==========================================================================
*/
#ifndef _eoOneMaxEvalFunc_h
#define _eoOneMaxEvalFunc_h
@ -18,7 +18,7 @@ Template for evaluator in EO, a functor that computes the fitness of an EO
// include the base definition of eoEvalFunc
#include "eoEvalFunc.h"
/**
/**
Always write a comment in this format before class definition
if you want the class to be documented by Doxygen
*/
@ -29,7 +29,7 @@ public:
/// Ctor - no requirement
// START eventually add or modify the anyVariable argument
eoOneMaxEvalFunc()
// eoOneMaxEvalFunc( varType _anyVariable) : anyVariable(_anyVariable)
// eoOneMaxEvalFunc( varType _anyVariable) : anyVariable(_anyVariable)
// END eventually add or modify the anyVariable argument
{
// START Code of Ctor of an eoOneMaxEvalFunc object
@ -39,7 +39,7 @@ public:
/** Actually compute the fitness
*
* @param EOT & _eo the EO object to evaluate
* it should stay templatized to be usable
* it should stay templatized to be usable
* with any fitness type
*/
void operator()(EOT & _eo)

View file

@ -14,12 +14,12 @@ Template for EO objects initialization in EO
// include the base definition of eoInit
#include <eoInit.h>
/**
/**
* Always write a comment in this format before class definition
* if you want the class to be documented by Doxygen
*
* There is NO ASSUMPTION on the class GenoypeT.
* In particular, it does not need to derive from EO (e.g. to initialize
* In particular, it does not need to derive from EO (e.g. to initialize
* atoms of an eoVector you will need an eoInit<AtomType>)
*/
template <class GenotypeT>
@ -28,7 +28,7 @@ public:
/// Ctor - no requirement
// START eventually add or modify the anyVariable argument
// eoOneMaxInit()
eoOneMaxInit( unsigned _vecSize) : vecSize(_vecSize)
eoOneMaxInit( unsigned _vecSize) : vecSize(_vecSize)
// END eventually add or modify the anyVariable argument
{
// START Code of Ctor of an eoOneMaxInit object
@ -60,4 +60,3 @@ private:
};
#endif

View file

@ -32,10 +32,10 @@ public:
eoOneMaxMutation()
// eoOneMaxMutation( varType _anyVariable) : anyVariable(_anyVariable)
// END eventually add or modify the anyVariable argument
{
// START Code of Ctor of an eoOneMaxEvalFunc object
// END Code of Ctor of an eoOneMaxEvalFunc object
}
{
// START Code of Ctor of an eoOneMaxEvalFunc object
// END Code of Ctor of an eoOneMaxEvalFunc object
}
/// The class name. Used to display statistics
string className() const { return "eoOneMaxMutation"; }
@ -45,19 +45,19 @@ public:
* @param _genotype The parent genotype (will be modified)
*/
bool operator()(GenotypeT & _genotype)
{
bool isModified(true);
// START code for mutation of the _genotype object
{
bool isModified(true);
// START code for mutation of the _genotype object
/** Requirement
* if (_genotype has been modified)
* isModified = true;
* else
* isModified = false;
*/
return isModified;
// END code for mutation of the _genotype object
}
/** Requirement
* if (_genotype has been modified)
* isModified = true;
* else
* isModified = false;
*/
return isModified;
// END code for mutation of the _genotype object
}
private:
// START Private data of an eoOneMaxMutation object

View file

@ -33,10 +33,10 @@ public:
eoOneMaxQuadCrossover()
// eoOneMaxQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable)
// END eventually add or modify the anyVariable argument
{
// START Code of Ctor of an eoOneMaxEvalFunc object
// END Code of Ctor of an eoOneMaxEvalFunc object
}
{
// START Code of Ctor of an eoOneMaxEvalFunc object
// END Code of Ctor of an eoOneMaxEvalFunc object
}
/// The class name. Used to display statistics
string className() const { return "eoOneMaxQuadCrossover"; }
@ -47,19 +47,19 @@ public:
* @param _genotype2 The second parent
*/
bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2)
{
bool oneAtLeastIsModified(true);
// START code for crossover of _genotype1 and _genotype2 objects
{
bool oneAtLeastIsModified(true);
// START code for crossover of _genotype1 and _genotype2 objects
/** Requirement
* if (at least one genotype has been modified) // no way to distinguish
* oneAtLeastIsModified = true;
* else
* oneAtLeastIsModified = false;
*/
return oneAtLeastIsModified;
// END code for crossover of _genotype1 and _genotype2 objects
}
/** Requirement
* if (at least one genotype has been modified) // no way to distinguish
* oneAtLeastIsModified = true;
* else
* oneAtLeastIsModified = false;
*/
return oneAtLeastIsModified;
// END code for crossover of _genotype1 and _genotype2 objects
}
private:
// START Private data of an eoOneMaxQuadCrossover object

View file

@ -17,7 +17,7 @@ and src/es (for real vectors).
*/
// Miscilaneous include and declaration
// Miscilaneous include and declaration
#include <iostream>
using namespace std;
@ -29,7 +29,7 @@ using namespace std;
// include here whatever specific files for your representation
// Basically, this should include at least the following
/** definition of representation:
/** definition of representation:
* class eoOneMax MUST derive from EO<FitT> for some fitness
*/
#include "eoOneMax.h"
@ -43,12 +43,12 @@ using namespace std;
// eoInit<eoOneMax<double>> & make_genotype(eoParser& _parser, eoState&_state, eoOneMax<double> _eo)
// {
// return do_make_genotype(_parser, _state, _eo);
// }
// }
// eoInit<eoOneMax<eoMinimizingFitness>> & make_genotype(eoParser& _parser, eoState&_state, eoOneMax<eoMinimizingFitness> _eo)
// {
// return do_make_genotype(_parser, _state, _eo);
// }
// }
// same thing for the variation operaotrs
//---------------------------------------
@ -65,7 +65,7 @@ using namespace std;
// The following modules use ***representation independent*** routines
// how to initialize the population
// how to initialize the population
// it IS representation independent if an eoInit is given
#include <do/make_pop.h>
eoPop<eoOneMax<double> >& make_pop(eoParser& _parser, eoState& _state, eoInit<eoOneMax<double> > & _init)
@ -92,12 +92,12 @@ eoContinue<eoOneMax<eoMinimizingFitness> >& make_continue(eoParser& _parser, eoS
// outputs (stats, population dumps, ...)
#include <do/make_checkpoint.h>
eoCheckPoint<eoOneMax<double> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoOneMax<double> >& _eval, eoContinue<eoOneMax<double> >& _continue)
eoCheckPoint<eoOneMax<double> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoOneMax<double> >& _eval, eoContinue<eoOneMax<double> >& _continue)
{
return do_make_checkpoint(_parser, _state, _eval, _continue);
}
eoCheckPoint<eoOneMax<eoMinimizingFitness> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoOneMax<eoMinimizingFitness> >& _eval, eoContinue<eoOneMax<eoMinimizingFitness> >& _continue)
eoCheckPoint<eoOneMax<eoMinimizingFitness> >& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<eoOneMax<eoMinimizingFitness> >& _eval, eoContinue<eoOneMax<eoMinimizingFitness> >& _continue)
{
return do_make_checkpoint(_parser, _state, _eval, _continue);
}
@ -114,7 +114,7 @@ eoAlgo<eoOneMax<eoMinimizingFitness> >& make_algo_scalar(eoParser& _parser, eoS
return do_make_algo_scalar(_parser, _state, _eval, _continue, _op);
}
// simple call to the algo. stays there for consistency reasons
// simple call to the algo. stays there for consistency reasons
// no template for that one
#include <do/make_run.h>
void run_ea(eoAlgo<eoOneMax<double> >& _ga, eoPop<eoOneMax<double> >& _pop)
@ -126,4 +126,3 @@ void run_ea(eoAlgo<eoOneMax<eoMinimizingFitness> >& _ga, eoPop<eoOneMax<eoMinimi
{
do_run(_ga, _pop);
}

View file

@ -3,7 +3,7 @@
//-----------------------------------------------------------------------------
// make_genotype.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
@ -19,8 +19,8 @@
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
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
@ -37,27 +37,27 @@
/*
* This fuction does the create an eoInit<eoOneMax>
*
* It could be here tempatized only on the fitness, as it can be used
* It could be here tempatized only on the fitness, as it can be used
* to evolve structures with any fitness.
* However, for consistency reasons, it was finally chosen, as in
* the rest of EO, to templatize by the full EOT, as this eventually
* However, for consistency reasons, it was finally chosen, as in
* the rest of EO, to templatize by the full EOT, as this eventually
* allows to choose the type of genotype at run time (see in es dir)
*
* It returns an eoInit<EOT> that can later be used to initialize
* It returns an eoInit<EOT> that can later be used to initialize
* the population (see make_pop.h).
*
* It uses a parser (to get user parameters) and a state (to store the memory)
* the last argument is to disambiguate the call upon different instanciations.
*
* WARNING: that last argument will generally be the result of calling
* the default ctor of EOT, resulting in most cases in an EOT
* WARNING: that last argument will generally be the result of calling
* the default ctor of EOT, resulting in most cases in an EOT
* that is ***not properly initialized***
*/
template <class EOT>
eoInit<EOT> & do_make_genotype(eoParameterLoader& _parser, eoState& _state, EOT)
{
// read any useful parameter here from the parser
// read any useful parameter here from the parser
// the param itself will belong to the parser (as far as memory is concerned)
// paramType & param = _parser.createParam(deafultValue, "Keyword", "Comment to appear in help and status", 'c',"Section of status file").value();

View file

@ -3,7 +3,7 @@
//-----------------------------------------------------------------------------
// make_op_OneMax.h
// (c) Marc Schoenauer, Maarten Keijzer 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
@ -19,8 +19,8 @@
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
Marc.Schoenauer@polytechnique.fr
mkeijzer@dhi.dk
*/
//-----------------------------------------------------------------------------
@ -35,14 +35,14 @@
// combinations of simple eoOps (eoMonOp and eoQuadOp)
#include <eoProportionalCombinedOp.h>
/** definition of mutation:
/** definition of mutation:
* class eoOneMaxMonop MUST derive from eoMonOp<eoOneMax>
*/
#include "eoOneMaxMutation.h"
/** definition of crossover (either as eoBinOp (2->1) or eoQuadOp (2->2):
/** definition of crossover (either as eoBinOp (2->1) or eoQuadOp (2->2):
* class eoOneMaxBinCrossover MUST derive from eoBinOp<eoOneMax>
* OR
* OR
* class eoOneMaxQuadCrossover MUST derive from eoQuadOp<eoOneMax>
*/
// #include "eoOneMaxBinOp.h"
@ -61,9 +61,9 @@
* This function builds the operators that will be applied to the eoOneMax
*
* It uses a parser (to get user parameters), a state (to store the memory)
* the last parameter is an eoInit: if some operator needs some info
* the last parameter is an eoInit: if some operator needs some info
* about the genotypes, the init has it all (e.g. bounds, ...)
* Simply do
* Simply do
* EOT myEO;
* _init(myEO);
* and myEO is then an ACTUAL object
@ -85,7 +85,7 @@ eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EO
// Variation operators
////////////////////////////
// read crossover and mutations, combine each in a proportional Op
// and create the eoGenOp that calls crossover at rate pCross
// and create the eoGenOp that calls crossover at rate pCross
// then mutation with rate pMut
// the crossovers
@ -94,10 +94,10 @@ eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EO
// here we can have eoQuadOp (2->2) only - no time for the eoBinOp case
// you can have more than one - combined in a proportional way
// first, define the crossover objects and read their rates from the parser
// A first crossover
// A first crossover
eoQuadOp<Indi> *cross = new eoOneMaxQuadCrossover<Indi> /* (varType _anyVariable) */;
// store in the state
_state.storeFunctor(cross);
@ -106,21 +106,21 @@ eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EO
double cross1Rate = _parser.createParam(1.0, "cross1Rate", "Relative rate for crossover 1", '1', "Variation Operators").value();
// and create the combined operator with this one
eoPropCombinedQuadOp<Indi> *propXover =
eoPropCombinedQuadOp<Indi> *propXover =
new eoPropCombinedQuadOp<Indi>(*cross, cross1Rate);
// and of course stor it in the state
_state.storeFunctor(propXover);
// Optional: A second(and third, and ...) crossover
// Optional: A second(and third, and ...) crossover
// of course you must create the corresponding classes
// and all ***MUST*** derive from eoQuadOp<Indi>
/* Uncomment if necessary - and replicate as many time as you need
cross = new eoOneMaxSecondCrossover<Indi>(varType _anyVariable);
cross = new eoOneMaxSecondCrossover<Indi>(varType _anyVariable);
_state.storeFunctor(cross);
double cross2Rate = _parser.createParam(1.0, "cross2Rate", "Relative rate for crossover 2", '2', "Variation Operators").value();
propXover.add(*cross, cross2Rate);
double cross2Rate = _parser.createParam(1.0, "cross2Rate", "Relative rate for crossover 2", '2', "Variation Operators").value();
propXover.add(*cross, cross2Rate);
*/
// if you want some gentle output, the last one shoudl be like
// propXover.add(*cross, crossXXXRate, true);
@ -130,12 +130,12 @@ eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EO
////////////////
// you can have more than one - combined in a proportional way
// for each mutation,
// for each mutation,
// - define the mutator object
// - read its rate from the parser
// - add it to the proportional combination
// a first mutation
// a first mutation
eoMonOp<Indi> *mut = new eoOneMaxMutation<Indi>/* (varType _anyVariable) */;
_state.storeFunctor(mut);
// its relative rate in the combination
@ -151,8 +151,8 @@ eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EO
/* Uncomment if necessary - and replicate as many time as you need
mut = new eoOneMaxSecondMutation<Indi>(varType _anyVariable);
_state.storeFunctor(mut);
double mut2Rate = _parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value();
propMutation.add(*mut, mut2Rate);
double mut2Rate = _parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value();
propMutation.add(*mut, mut2Rate);
*/
// if you want some gentle output, the last one shoudl be like
// propMutation.add(*mut, mutXXXRate, true);
@ -170,7 +170,7 @@ eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EO
// to simulate SGA (crossover with proba pCross + mutation with proba pMut
// we must construct
// a sequential combination of
// with proba 1, a proportional combination of
// with proba 1, a proportional combination of
// a QuadCopy and our crossover
// with proba pMut, our mutation