* mutation.tmpl, quadCrossover.tmpl, stat.tmpl: Initialize formerly
uninitialized variables. * README.tmpl: Hint to regular Templates/README for details. * README: Add documentation for adding new source-files. * Makefile.am.src-tmpl (noinst_HEADERS): Add (MyStruct_SOURCES): Move header files from here to the new noinst_HEADERS variable.
This commit is contained in:
parent
4a9c5127f8
commit
8acc9dcbce
7 changed files with 54 additions and 30 deletions
|
|
@ -1,3 +1,16 @@
|
||||||
|
2007-02-22 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
||||||
|
|
||||||
|
* mutation.tmpl, quadCrossover.tmpl, stat.tmpl: Initialize
|
||||||
|
formerly uninitialized variables.
|
||||||
|
|
||||||
|
* README.tmpl: Hint to regular Templates/README for details.
|
||||||
|
|
||||||
|
* README: Add documentation for adding new source-files.
|
||||||
|
|
||||||
|
* Makefile.am.src-tmpl (noinst_HEADERS): Add
|
||||||
|
(MyStruct_SOURCES): Move header files from here to the new
|
||||||
|
noinst_HEADERS variable.
|
||||||
|
|
||||||
2007-01-16 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
2007-01-16 Jochen Küpper <jochen@fhi-berlin.mpg.de>
|
||||||
|
|
||||||
* README: Add instructions for bash.
|
* README: Add instructions for bash.
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
bin_PROGRAMS = MyStruct
|
bin_PROGRAMS = MyStruct
|
||||||
|
|
||||||
MyStruct_SOURCES = MyStructEA.cpp \
|
noinst_HEADERS = eoMyStruct.h \
|
||||||
eoMyStruct.h \
|
|
||||||
eoMyStructEvalFunc.h \
|
eoMyStructEvalFunc.h \
|
||||||
eoMyStructInit.h \
|
eoMyStructInit.h \
|
||||||
eoMyStructMutation.h \
|
eoMyStructMutation.h \
|
||||||
eoMyStructQuadCrossover.h
|
eoMyStructQuadCrossover.h
|
||||||
|
|
||||||
|
MyStruct_SOURCES = MyStructEA.cpp
|
||||||
|
|
||||||
|
|
||||||
dnl Local Variables:
|
dnl Local Variables:
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,11 @@ a script createEOproject.sh to create a complete new EO project.
|
||||||
The template requires a complete installation of EO, that is, you must
|
The template requires a complete installation of EO, that is, you must
|
||||||
have run "make install" in the build-directory.
|
have run "make install" in the build-directory.
|
||||||
|
|
||||||
In particular, the C++ compiler must find the EO include files and the
|
In particular, the C++ compiler must also know how to find the EO
|
||||||
linker must find the EO libraries. Most probably, that means that you
|
include files and the linker must find the EO libraries. Most
|
||||||
have to set the variables CPLUS_INCLUDE_PATH and LIBRARY_PATH, i.e.
|
probably, that means that you have to set the variables
|
||||||
for a standard installation and using tcsh:
|
CPLUS_INCLUDE_PATH and LIBRARY_PATH, i.e. for a standard installation
|
||||||
|
and using tcsh:
|
||||||
setenv CPLUS_INCLUDE_PATH /usr/local/include/eo:"$CPLUS_INCLUDE_PATH"
|
setenv CPLUS_INCLUDE_PATH /usr/local/include/eo:"$CPLUS_INCLUDE_PATH"
|
||||||
setenv LIBRARY_PATH /usr/local/lib:"$LIBRARY_PATH"
|
setenv LIBRARY_PATH /usr/local/lib:"$LIBRARY_PATH"
|
||||||
|
|
||||||
|
|
@ -15,6 +16,7 @@ When running bash, use this:
|
||||||
export CPLUS_INCLUDE_PATH=/usr/local/include/eo:"$CPLUS_INCLUDE_PATH"
|
export CPLUS_INCLUDE_PATH=/usr/local/include/eo:"$CPLUS_INCLUDE_PATH"
|
||||||
export LIBRARY_PATH=/usr/local/lib:"$LIBRARY_PATH"
|
export LIBRARY_PATH=/usr/local/lib:"$LIBRARY_PATH"
|
||||||
|
|
||||||
|
|
||||||
You can freely move the created project around. However, whenever you
|
You can freely move the created project around. However, whenever you
|
||||||
change the location of the source- or build-directories, you need to
|
change the location of the source- or build-directories, you need to
|
||||||
run
|
run
|
||||||
|
|
@ -24,4 +26,9 @@ in the source-directory and
|
||||||
in the build-directory (which might or might not be the same for you).
|
in the build-directory (which might or might not be the same for you).
|
||||||
|
|
||||||
|
|
||||||
|
When you add additional source files to the project, simply add them
|
||||||
|
to the <myproj>_SOURCES variable in src/Makefile.am. Header files
|
||||||
|
should be added to noinst_HEADERS.
|
||||||
|
|
||||||
|
|
||||||
See README.manual for more details.
|
See README.manual for more details.
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,21 @@
|
||||||
This is an autogenerated EO project.
|
This is an autogenerated EO project. It was (most probably) generated
|
||||||
It was (most probably) generated using the createEOproject.sh
|
using the createEOproject.sh script in the
|
||||||
script in the ...eo-dir/tutorial/Templates directory.
|
<eo-dir>/tutorial/Templates directory.
|
||||||
|
|
||||||
The project has a complete build-infrastructure based on
|
The project has a complete build-infrastructure based on
|
||||||
automake/autoconf. You can simply run "make" in this directory to have
|
automake/autoconf. You can simply run "make" in this directory to have
|
||||||
the program compiled. The executable build will be in src/.
|
the program compiled. The executable build will be in src/. In case of
|
||||||
In case of problem during this step, please read the README file
|
problem during this step, please read the README file in the
|
||||||
in the ...eo-dir/tutorial/Templates directory.
|
...eo-dir/tutorial/Templates directory.
|
||||||
|
|
||||||
After creation, the project should compile nicely - but of course
|
After creation, the project should compile nicely - but of course the
|
||||||
the resulting program does noting at all but print a few silly lines.
|
resulting program does noting at all but print a few silly lines.
|
||||||
|
|
||||||
Fill in the marked code-snippets in the files in src/ and you have a
|
Fill in the marked code-snippets in the files in src/ and you have a
|
||||||
complete EA project (detailed explanations in EO Tutorial - Lesson 5).
|
complete EA project (detailed explanations in EO Tutorial - Lesson 5).
|
||||||
|
|
||||||
Enjoy!
|
Enjoy!
|
||||||
|
|
||||||
|
|
||||||
|
For details, for example on moving your project around or adding new
|
||||||
|
files, see <eo-dir>/tutorial/Templates/README.
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@ Template for simple mutation operators
|
||||||
|
|
||||||
#include <eoOp.h>
|
#include <eoOp.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Always write a comment in this format before class definition
|
* Always write a comment in this format before class definition
|
||||||
* if you want the class to be documented by Doxygen
|
* if you want the class to be documented by Doxygen
|
||||||
*
|
*
|
||||||
* THere is NO ASSUMPTION on the class GenoypeT.
|
* THere is NO ASSUMPTION on the class GenoypeT.
|
||||||
* In particular, it does not need to derive from EO
|
* In particular, it does not need to derive from EO
|
||||||
*/
|
*/
|
||||||
template<class GenotypeT>
|
template<class GenotypeT>
|
||||||
class eoMyStructMutation: public eoMonOp<GenotypeT>
|
class eoMyStructMutation: public eoMonOp<GenotypeT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -30,7 +30,7 @@ public:
|
||||||
*/
|
*/
|
||||||
// START eventually add or modify the anyVariable argument
|
// START eventually add or modify the anyVariable argument
|
||||||
eoMyStructMutation()
|
eoMyStructMutation()
|
||||||
// eoMyStructMutation( varType _anyVariable) : anyVariable(_anyVariable)
|
// eoMyStructMutation( varType _anyVariable) : anyVariable(_anyVariable)
|
||||||
// END eventually add or modify the anyVariable argument
|
// END eventually add or modify the anyVariable argument
|
||||||
{
|
{
|
||||||
// START Code of Ctor of an eoMyStructEvalFunc object
|
// START Code of Ctor of an eoMyStructEvalFunc object
|
||||||
|
|
@ -44,9 +44,9 @@ public:
|
||||||
* modifies the parent
|
* modifies the parent
|
||||||
* @param _genotype The parent genotype (will be modified)
|
* @param _genotype The parent genotype (will be modified)
|
||||||
*/
|
*/
|
||||||
bool operator()(GenotypeT & _genotype)
|
bool operator()(GenotypeT & _genotype)
|
||||||
{
|
{
|
||||||
bool isModified;
|
bool isModified(true);
|
||||||
// START code for mutation of the _genotype object
|
// START code for mutation of the _genotype object
|
||||||
|
|
||||||
/** Requirement
|
/** Requirement
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ Quadratic crossover operators modify the both genotypes
|
||||||
|
|
||||||
#include <eoOp.h>
|
#include <eoOp.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Always write a comment in this format before class definition
|
* Always write a comment in this format before class definition
|
||||||
* if you want the class to be documented by Doxygen
|
* if you want the class to be documented by Doxygen
|
||||||
*
|
*
|
||||||
* THere is NO ASSUMPTION on the class GenoypeT.
|
* THere is NO ASSUMPTION on the class GenoypeT.
|
||||||
* In particular, it does not need to derive from EO
|
* In particular, it does not need to derive from EO
|
||||||
*/
|
*/
|
||||||
template<class GenotypeT>
|
template<class GenotypeT>
|
||||||
class eoMyStructQuadCrossover: public eoQuadOp<GenotypeT>
|
class eoMyStructQuadCrossover: public eoQuadOp<GenotypeT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -31,7 +31,7 @@ public:
|
||||||
*/
|
*/
|
||||||
// START eventually add or modify the anyVariable argument
|
// START eventually add or modify the anyVariable argument
|
||||||
eoMyStructQuadCrossover()
|
eoMyStructQuadCrossover()
|
||||||
// eoMyStructQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable)
|
// eoMyStructQuadCrossover( varType _anyVariable) : anyVariable(_anyVariable)
|
||||||
// END eventually add or modify the anyVariable argument
|
// END eventually add or modify the anyVariable argument
|
||||||
{
|
{
|
||||||
// START Code of Ctor of an eoMyStructEvalFunc object
|
// START Code of Ctor of an eoMyStructEvalFunc object
|
||||||
|
|
@ -47,9 +47,9 @@ public:
|
||||||
* @param _genotype1 The first parent
|
* @param _genotype1 The first parent
|
||||||
* @param _genotype2 The second parent
|
* @param _genotype2 The second parent
|
||||||
*/
|
*/
|
||||||
bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2)
|
bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2)
|
||||||
{
|
{
|
||||||
bool oneAtLeastIsModified;
|
bool oneAtLeastIsModified(true);
|
||||||
// START code for crossover of _genotype1 and _genotype2 objects
|
// START code for crossover of _genotype1 and _genotype2 objects
|
||||||
|
|
||||||
/** Requirement
|
/** Requirement
|
||||||
|
|
|
||||||
|
|
@ -14,15 +14,15 @@ Template for computing statistics on eoPop
|
||||||
// include the base definition of eoInit
|
// include the base definition of eoInit
|
||||||
#include <utils/eoStat.h>
|
#include <utils/eoStat.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Always write a comment in this format before class definition
|
* Always write a comment in this format before class definition
|
||||||
* if you want the class to be documented by Doxygen
|
* if you want the class to be documented by Doxygen
|
||||||
*
|
*
|
||||||
* ASSUMPTION on the class GenoypeT:
|
* ASSUMPTION on the class GenoypeT:
|
||||||
* it needs to derive from EO (i.e. has a Fitness).
|
* it needs to derive from EO (i.e. has a Fitness).
|
||||||
*
|
*
|
||||||
* It is assumed that you want to compute a double.
|
* It is assumed that you want to compute a double.
|
||||||
* In case you want something else, then your stat should derive from
|
* In case you want something else, then your stat should derive from
|
||||||
* eoStat<GenotypeT, T>
|
* eoStat<GenotypeT, T>
|
||||||
* where class T is the class of the computed statistics
|
* where class T is the class of the computed statistics
|
||||||
*/
|
*/
|
||||||
|
|
@ -33,7 +33,7 @@ public :
|
||||||
typedef typename EOT::Fitness Fitness;
|
typedef typename EOT::Fitness Fitness;
|
||||||
|
|
||||||
// START eventually add or modify the anyVariable argument
|
// START eventually add or modify the anyVariable argument
|
||||||
/** Ctor - you change the default name of course.
|
/** Ctor - you change the default name of course.
|
||||||
* @param
|
* @param
|
||||||
* _description : inherited from eoValueParam (eoStat is an from eoVapueParam)
|
* _description : inherited from eoValueParam (eoStat is an from eoVapueParam)
|
||||||
*/
|
*/
|
||||||
|
|
@ -46,7 +46,7 @@ public :
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator()(const eoPop<EOT>& _pop){
|
void operator()(const eoPop<EOT>& _pop){
|
||||||
double tmpStat;
|
double tmpStat(0.);
|
||||||
// START Code for computing the statistics - in tmpStat
|
// START Code for computing the statistics - in tmpStat
|
||||||
// tmpStat = blablabla
|
// tmpStat = blablabla
|
||||||
// END Code for computing the statistics
|
// END Code for computing the statistics
|
||||||
|
|
|
||||||
Reference in a new issue