* EO.tpl, MyStructEA.cpp, MyStructSEA.cpp, make_MyStruct.cpp: Use

correct names for includes.

* README.manual: This is a copy of the old README.

* README: Describe the new way and setup of creating a new EO project.

* createEOproject.sh, Makefile.am.src-tmpl, Makefile.am.top-tmpl:
* configure.ac.tmpl: New files to create a standalone EO project from
templates.
This commit is contained in:
kuepper 2006-12-16 21:55:03 +00:00
commit 301e29ac02
12 changed files with 445 additions and 265 deletions

View file

@ -3,20 +3,20 @@
// (The above line is useful in Emacs-like editors)
//
//*************************************
//
//
// EASEA.cpp
//
//
// C++ file generated by AESAE-EO v0.7
//
//
//*************************************
//
//
// Main file for creating a new representation in EO
// =================================================
//
//
// This main file includes all other files that have been generated by the
// script create.sh, so it is the only file to compile.
//
//
// In case you want to build up a separate library for your new Evolving Object,
// you'll need some work - follow what's done in the src/ga dir, used in the
// main file BitEA in tutorial/Lesson4 dir.
@ -49,12 +49,12 @@ inline float random(float b1=0, float b2=1){
\ANALYSE_PARAMETERS
\INSERT_USER_DECLARATIONS
\INSERT_INITIALISATION_FUNCTION
\INSERT_INITIALISATION_FUNCTION
// include here whatever specific files for your representation
// Basically, this should include at least the following
/** definition of representation:
/** definition of representation:
* class EASEAGenome MUST derive from EO<FitT> for some fitness
*/
#include "EASEAGenome.h"
@ -64,23 +64,23 @@ inline float random(float b1=0, float b2=1){
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// START fitness type: double or eoMaximizingFitness if you are maximizing
// eoMinimizingFitness if you are minimizing
typedef \MINIMAXI MyFitT ; // type of fitness
typedef \MINIMAXI MyFitT ; // type of fitness
// END fitness type
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
// Then define your EO objects using that fitness type
typedef EASEAGenome<MyFitT> Indi; // ***MUST*** derive from EO
typedef EASEAGenome<MyFitT> Indi; // ***MUST*** derive from EO
\INSERT_USER_FUNCTIONS
/** definition of evaluation:
/** definition of evaluation:
* class EASEAEvalFunc MUST derive from eoEvalFunc<EASEAGenome>
* and should test for validity before doing any computation
* see tutorial/Templates/evalFunc.tmpl
*/
#include "EASEAEvalFunc.h"
/** definition of initialization:
/** definition of initialization:
* class EASEAGenomeInit MUST derive from eoInit<EASEAGenome>
*/
#include "EASEAInit.h"
@ -93,34 +93,34 @@ typedef EASEAGenome<MyFitT> Indi; // ***MUST*** derive from EO
// 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>
#include <make_pop.h>
eoPop<Indi >& make_pop(eoParser& _parser, eoState& _state, eoInit<Indi> & _init){
return do_make_pop(_parser, _state, _init);
}
// the stopping criterion
#include "do/make_continue.h"
#include "make_continue.h"
eoContinue<Indi>& make_continue(eoParser& _parser, eoState& _state, eoEvalFuncCounter<Indi> & _eval){
return do_make_continue(_parser, _state, _eval);
}
// outputs (stats, population dumps, ...)
#include <do/make_checkpoint.h>
#include <make_checkpoint.h>
eoCheckPoint<Indi>& make_checkpoint(eoParser& _parser, eoState& _state, eoEvalFuncCounter<Indi>& _eval, eoContinue<Indi>& _continue) {
return do_make_checkpoint(_parser, _state, _eval, _continue);
}
// evolution engine (selection and replacement)
#include <do/make_algo_easea.h>
#include <make_algo_easea.h>
eoAlgo<Indi>& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<Indi>& _eval, eoContinue<Indi>& _continue, eoGenOp<Indi>& _op){
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>
#include <make_run.h>
// the instanciating fitnesses
#include <eoScalarFitness.h>
void run_ea(eoAlgo<Indi>& _ga, eoPop<Indi>& _pop){
@ -149,12 +149,12 @@ try {
// a genotype initializer
EASEAInit<Indi> init;
// or, if you need some parameters, you might as well
// or, if you need some parameters, you might as well
// - write a constructor of the eoMyStructInit that uses a parser
// - call it from here:
// eoEASEAInit<Indi> init(parser);
// Build the variation operator (any seq/prop construct)
// here, a simple example with only 1 crossover (2->2, a QuadOp) and
// one mutation, is given.
@ -162,7 +162,7 @@ try {
// A (first) crossover (possibly use the parser in its Ctor)
EASEAQuadCrossover<Indi> cross /* (eoParser parser) */;
// IF MORE THAN ONE:
// read its relative rate in the combination
@ -176,9 +176,9 @@ try {
// 2- include that file here together with eoEASEAQuadCrossover above
// 3- uncomment and duplicate the following lines:
//
// eoEASEASecondCrossover<Indi> cross2(eoParser parser);
// double cross2Rate = parser.createParam(1.0, "cross2Rate", "Relative rate for crossover 2", '2', "Variation Operators").value();
// cross.add(cross2, cross2Rate);
// eoEASEASecondCrossover<Indi> cross2(eoParser parser);
// double cross2Rate = parser.createParam(1.0, "cross2Rate", "Relative rate for crossover 2", '2', "Variation Operators").value();
// cross.add(cross2, cross2Rate);
// NOTE: if you want some gentle output, the last one shoudl be like
// cross.add(cross, crossXXXRate, true);
@ -201,9 +201,9 @@ try {
// 2- include that file here together with eoEASEAMutation above
// 3- uncomment and duplicate the following lines:
//
// eoEASEASecondMutation<Indi> mut2(eoParser parser);
// double mut2Rate = parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value();
// mut.add(mut2, mut2Rate);
// eoEASEASecondMutation<Indi> mut2(eoParser parser);
// double mut2Rate = parser.createParam(1.0, "mut2Rate", "Relative rate for mutation 2", '2', "Variation Operators").value();
// mut.add(mut2, mut2Rate);
// NOTE: if you want some gentle output, the last one shoudl be like
// mut.add(mut, mutXXXRate, true);
@ -227,7 +227,7 @@ try {
//// 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
@ -279,18 +279,18 @@ try {
// (The above line is useful in Emacs-like editors)
//
//*************************************
//
//
// EASEAGenome.h
//
//
// C++ file generated by AESAE-EO v0.7
//
//
//*************************************
//
#ifndef _EASEAGenome_h
#define _EASEAGenome_h
/**
/**
* Always write a comment in this format before class definition
* if you want the class to be documented by Doxygen
@ -299,7 +299,7 @@ try {
* 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
*
@ -313,41 +313,41 @@ template< class FitT>
class EASEAGenome: 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
*/
EASEAGenome() : EO<FitT>()
{
{
// START Code of default Ctor of an EASEAGenome object
\GENOME_CTOR
\GENOME_CTOR
// END Code of default Ctor of an EASEAGenome object
}
EASEAGenome(const EASEAGenome & arg) : EO<FitT>()
{
{
\GENOME_CTOR
copy(arg);
copy(arg);
}
virtual ~EASEAGenome()
{
// START Code of Destructor of an EASEAGenome object
\GENOME_DTOR
\GENOME_DTOR
// END Code of Destructor of an EASEAGenome object
}
virtual string className() const { return "EASEAGenome"; }
EASEAGenome& operator=(const EASEAGenome & arg) {
copy(arg);
EASEAGenome& operator=(const EASEAGenome & arg) {
copy(arg);
return *this;
}
void copy(const EASEAGenome& genome)
void copy(const EASEAGenome& genome)
{
if(&genome != this){
\GENOME_DTOR
\COPY_CTOR
\COPY_CTOR
if (genome.invalid()) { // copying an invalid genome
fitness(FitT()); // put a valid value (i.e. non NAN)
invalidate(); // but INVALIDATE the genome
@ -356,8 +356,8 @@ public:
fitness(genome.fitness());
}
}
bool operator==(const EASEAGenome & genome) const {
bool operator==(const EASEAGenome & genome) const {
\EQUAL
return true;
}
@ -372,7 +372,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
@ -383,7 +383,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)
@ -412,11 +412,11 @@ public:
// (The above line is useful in Emacs-like editors)
//
//*************************************
//
//
// EASEAEvalFunc.h
//
//
// C++ file generated by AESAE-EO v0.7
//
//
//*************************************
//
@ -424,7 +424,7 @@ public:
Evaluator in EO: a functor that computes the fitness of an EO
=============================================================
*/
#ifndef _EASEAEvalFunc_h
#define _EASEAEvalFunc_h
@ -435,7 +435,7 @@ 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
*/
@ -446,7 +446,7 @@ public:
/// Ctor - no requirement
// START eventually add or modify the anyVariable argument
EASEAEvalFunc()
// EASEAEvalFunc( varType _anyVariable) : anyVariable(_anyVariable)
// EASEAEvalFunc( varType _anyVariable) : anyVariable(_anyVariable)
// END eventually add or modify the anyVariable argument
{
// START Code of Ctor of an EASEAEvalFunc object
@ -456,7 +456,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 & genome)
@ -484,11 +484,11 @@ private:
// (The above line is useful in Emacs-like editors)
//
//*************************************
//
//
// EASEAInit.h
//
//
// C++ file generated by AESAE-EO v0.7
//
//
//*************************************
//
@ -503,12 +503,12 @@ 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>
@ -517,7 +517,7 @@ public:
/// Ctor - no requirement
// START eventually add or modify the anyVariable argument
EASEAInit()
// EASEAInit( varType & _anyVariable) : anyVariable(_anyVariable)
// EASEAInit( varType & _anyVariable) : anyVariable(_anyVariable)
// END eventually add or modify the anyVariable argument
{
// START Code of Ctor of an EASEAInit object
@ -552,11 +552,11 @@ private:
// (The above line is useful in Emacs-like editors)
//
//*************************************
//
//
// EASEAMutation.h
//
//
// C++ file generated by AESAE-EO v0.7
//
//
//*************************************
//
@ -571,14 +571,14 @@ simple mutation operators
#include <eoOp.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
*/
template<class GenotypeT>
template<class GenotypeT>
class EASEAMutation: public eoMonOp<GenotypeT>
{
public:
@ -587,7 +587,7 @@ public:
*/
// START eventually add or modify the anyVariable argument
EASEAMutation()
// EASEAMutation( varType _anyVariable) : anyVariable(_anyVariable)
// EASEAMutation( varType _anyVariable) : anyVariable(_anyVariable)
// END eventually add or modify the anyVariable argument
{
// START Code of Ctor of an EASEAMutation object
@ -601,7 +601,7 @@ public:
* modifies the parent
* @param _genotype The parent genotype (will be modified)
*/
bool operator()(GenotypeT & _genotype)
bool operator()(GenotypeT & _genotype)
{
// START code for mutation of the _genotype object
\INSERT_MUTATOR
@ -620,11 +620,11 @@ private:
// (The above line is useful in Emacs-like editors)
//
//*************************************
//
//
// EASEAQuadCrossover.h
//
//
// C++ file generated by AESAE-EO v0.7
//
//
//*************************************
//
@ -640,14 +640,14 @@ Quadratic crossover operators modify both genotypes
#include <eoOp.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
*/
template<class GenotypeT>
template<class GenotypeT>
class EASEAQuadCrossover: public eoQuadOp<GenotypeT>
{
public:
@ -656,7 +656,7 @@ public:
*/
// START eventually add or modify the anyVariable argument
EASEAQuadCrossover()
// EASEAQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable)
// EASEAQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable)
// END eventually add or modify the anyVariable argument
{
// START Code of Ctor of an EASEAQuadCrossover object
@ -669,11 +669,11 @@ public:
/**
* eoQuad crossover - modifies both genotypes
*/
bool operator()(GenotypeT& child1, GenotypeT & child2)
bool operator()(GenotypeT& child1, GenotypeT & child2)
{
GenotypeT parent1(child1);
GenotypeT parent2(child2);
// START code for crossover of child1 and child2 objects
\INSERT_CROSSOVER
return (parent1!=child1)||(parent2!=child2);
@ -693,11 +693,11 @@ private:
// (The above line is useful in Emacs-like editors)
//
//*************************************
//
//
// EASEA_make_continue.h
//
//
// C++ file generated by AESAE-EO v0.7
//
//
//*************************************
//
@ -838,11 +838,11 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
#endif
\START_EO_PARAM_TPL#*************************************
#
#
# EASEA.prm
#
#
# Parameter file generated by AESAE-EO v0.7
#
#
#*************************************
###### General ######
# --help=0 # -h : Prints this message
@ -901,11 +901,11 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
--pMut=\MUT_PROB # -M : Probability of Mutation
\START_EO_MAKEFILE_TPL#*************************************
#
#
# EASEA.mak
#
#
# Makefile generated by AESAE-EO v0.7
#
#
#*************************************
# sample makefile for building an EA evolving a new genotype
@ -929,7 +929,7 @@ SOURCES = EASEA.cpp \
ALL = EASEA
EASEA : $(SOURCES)
c++ -g -I. -I$(DIR_EO)/src -o $@ EASEA.cpp $(LIB_EO) -lm
c++ -g -I. -I$(DIR_EO)/src -o $@ EASEA.cpp $(LIB_EO) -lm
all : $(ALL)