Merge branch 'master' of ssh://eodev.git.sourceforge.net/gitroot/eodev/eodev

This commit is contained in:
Caner Candan 2011-05-07 22:47:01 +02:00
commit f8202d238a
496 changed files with 8734 additions and 8186 deletions

View file

@ -1,6 +1,5 @@
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,5 +1,14 @@
############################################################################
##########
### 1) If you want to set your own variables in install.cmake and avoid the cmd line
######################################################################################
### 1) Set the application properties
INCLUDE(install.cmake OPTIONAL)
######################################################################################
######################################################################################
### 2) Project properties
######################################################################################
# Checks cmake version compatibility
@ -16,15 +25,12 @@ SET(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT
######################################################################################
### 2) Include useful features
### 3) Include useful features
######################################################################################
INCLUDE(FindDoxygen)
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(EO eo REQUIRED)
PKG_CHECK_MODULES(MO mo REQUIRED)
FIND_PACKAGE(Boost 1.33.0)
INCLUDE_DIRECTORIES(
@ -34,11 +40,16 @@ INCLUDE_DIRECTORIES(
# /Dev/ometah-0.3/common
)
LINK_DIRECTORIES(
${EO_LIBRARY_DIRS}
${MO_LIBRARY_DIRS}
)
######################################################################################
######################################################################################
### 3) Include header files path
### 4) Include header files path
######################################################################################
INCLUDE_DIRECTORIES(
@ -49,7 +60,7 @@ INCLUDE_DIRECTORIES(
######################################################################################
### 4) Set compiler definitions
### 5) Set compiler definitions
######################################################################################
IF(UNIX)
@ -63,7 +74,7 @@ ENDIF()
######################################################################################
### 5) Prepare some variables for CMAKE usage
### 6) Prepare some variables for CMAKE usage
######################################################################################
SET(SAMPLE_SRCS)
@ -72,7 +83,7 @@ SET(SAMPLE_SRCS)
######################################################################################
### 6) Now where we go ?
### 7) Now where we go ?
######################################################################################
ADD_SUBDIRECTORY(src)
@ -85,7 +96,7 @@ ADD_SUBDIRECTORY(doc)
######################################################################################
### 7) Create executable, link libraries and prepare target
### 8) Create executable, link libraries and prepare target
######################################################################################
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
@ -99,7 +110,7 @@ INSTALL(TARGETS edo ARCHIVE DESTINATION lib COMPONENT libraries)
######################################################################################
### 8) Install pkg-config config file for EO
### 9) Install pkg-config config file for EO
######################################################################################
INSTALL(FILES edo.pc DESTINATION lib/pkgconfig COMPONENT headers)
@ -108,7 +119,7 @@ INSTALL(FILES edo.pc DESTINATION lib/pkgconfig COMPONENT headers)
######################################################################################
### 9) Include packaging
### 10) Include packaging
######################################################################################
INCLUDE(Packaging.cmake)

View file

@ -1,5 +1,5 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -10,7 +10,7 @@
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@ -112,7 +112,7 @@ modification follow. Pay close attention to the difference between a
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
@ -455,9 +455,9 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that

View file

@ -10,6 +10,6 @@ FOREACH(file ${RESOURCES})
EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/${file}
${DO_BINARY_DIR}/${file}
${EDO_BINARY_DIR}/${file}
)
ENDFOREACH(file)

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

20
edo/install.cmake-dist Normal file
View file

@ -0,0 +1,20 @@
# Variables to set
# directory we need to build project
SET(EO_DIR "<<PATH_TO_EO>>" CACHE PATH "EO directory" FORCE)
SET(MO_DIR "<<PATH_TO_MO>>" CACHE PATH "MO directory" FORCE)
# automagically set parameters, do not edit
SET(EO_INCLUDE_DIRS "${EO_DIR}/src" CACHE PATH "EO include directory" FORCE)
SET(EO_LIBRARY_DIRS "${EO_DIR}/release/lib" CACHE PATH "EO library directory" FORCE)
SET(EO_LIBRARIES "eoutils eo es ga cma gcov")
SET(MO_INCLUDE_DIRS "${MO_DIR}/src" CACHE PATH "MO include directory" FORCE)
SET(MO_LIBRARY_DIRS "${MO_DIR}/release/lib" CACHE PATH "MO library directory" FORCE)
SET(MO_LIBRARIES "mo")
# ... or rather use pkg-config (dont forget to comment the code above)
#PKG_CHECK_MODULES(EO eo REQUIRED)
#PKG_CHECK_MODULES(MO mo REQUIRED)

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -25,4 +25,3 @@ Authors:
*/
#include "edo"

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -60,4 +60,3 @@ private:
};
#endif // !_edoBounderRng_h

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -39,16 +39,16 @@ public:
void operator()( EOT& sol )
{
unsigned int size = sol.size();
assert(size > 0);
unsigned int size = sol.size();
assert(size > 0);
for (unsigned int d = 0; d < size; ++d) {
for (unsigned int d = 0; d < size; ++d) {
if ( sol[d] < this->min()[d] || sol[d] > this->max()[d]) {
// use EO's global "rng"
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
}
} // for d in size
if ( sol[d] < this->min()[d] || sol[d] > this->max()[d]) {
// use EO's global "rng"
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
}
} // for d in size
}
};

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -108,7 +108,7 @@ public:
*/
void operator ()(eoPop< EOT > & pop)
{
assert(pop.size() > 0);
assert(pop.size() > 0);
//double temperature = _initial_temperature;

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -108,7 +108,7 @@ public:
*/
void operator ()(eoPop< EOT > & pop)
{
assert(pop.size() > 0);
assert(pop.size() > 0);
double temperature = _initial_temperature;

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -73,7 +73,7 @@ public:
//-------------------------------------------------------------
_varcovar.resize(s_size, s_size);
_varcovar.resize(s_size);
//-------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -38,4 +38,3 @@ public:
};
#endif // !_edoModifier_h

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -42,4 +42,3 @@ public:
};
#endif // !_edoModifierMass_h

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -44,4 +44,3 @@ public:
};
#endif // !_edoNormalMonoCenter_h

View file

@ -1,8 +1,8 @@
// (c) Thales group, 2010
/*
Authors:
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
Johann Dreo <johann.dreo@thalesgroup.com>
Caner Candan <caner.candan@thalesgroup.com>
*/
#ifndef _edoNormalMulti_h

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -74,7 +74,7 @@ public:
{
AtomType mean = distrib.mean()[i];
AtomType variance = distrib.variance()[i];
AtomType random = rng.normal(mean, variance);
AtomType random = rng.normal(mean, variance);
assert(variance >= 0);

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -53,7 +53,7 @@ public:
assert( Vl == Vc );
_L.resize(Vl, Vc);
_L.resize(Vl);
unsigned int i,j,k;

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or
@ -41,7 +41,7 @@ Authors:
#include <edo>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/symmetric_matrix.hpp>
#include <boost/numeric/ublas/symmetric.hpp>
#include "Rosenbrock.h"
#include "Sphere.h"

View file

@ -1,6 +1,6 @@
/*
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
The Evolving Distribution Objects framework (EDO) is a template-based,
ANSI-C++ evolutionary computation library which helps you to write your
own estimation of distribution algorithms.
This library is free software; you can redistribute it and/or

View file

@ -10,9 +10,9 @@ from numpy import arange
if __name__ == '__main__':
for p1 in list(arange(0.1, 1.1, 0.1)):
for p2 in list(arange(-1., 0., 0.1)) + list(arange(0., 1.1, 0.1)):
for p3 in list(arange(0.1, 1.1, 0.1)):
gen = '%d_%.1f_%.1f_%.1f_%.1f' % (PSIZE, MEAN, p1, p2, p3)
cmd = CMD % ( PSIZE, MEAN, p1, p2, p3, gen, gen )
print cmd
system( cmd )
for p2 in list(arange(-1., 0., 0.1)) + list(arange(0., 1.1, 0.1)):
for p3 in list(arange(0.1, 1.1, 0.1)):
gen = '%d_%.1f_%.1f_%.1f_%.1f' % (PSIZE, MEAN, p1, p2, p3)
cmd = CMD % ( PSIZE, MEAN, p1, p2, p3, gen, gen )
print cmd
system( cmd )

View file

@ -1274,11 +1274,11 @@ Date: Thu Feb 22 08:27:32 2007 +0000
* 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.
@ -1315,7 +1315,7 @@ Date: Sun Jan 14 18:56:31 2007 +0000
for automake finding the scripts of eo itself if we run it in a embedded
subdirectory.
(COPYING, INSTALL): create.
* README: State more explicitly what a "complete installation" means.
Give build-instructions for moved directories.
@ -1359,9 +1359,9 @@ Author: kuepper <kuepper>
Date: Mon Dec 18 11:17:55 2006 +0000
* TODO.html, README.html: Remove these old files.
* AUTHORS, COPYING, ForRelease, NEWS, ToDo: Update for release.
* eo.cfg (PROJECT_NUMBER): Bump version to 1.0
Author: kuepper <kuepper>
@ -1373,7 +1373,7 @@ Author: kuepper <kuepper>
Date: Sun Dec 17 22:59:53 2006 +0000
* README: Better links to Templates/
* configure.in: Bump version to 1.0-beta2.
Author: kuepper <kuepper>
@ -1402,11 +1402,11 @@ Date: Sat Dec 16 21:55:03 2006 +0000
* 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.
@ -1435,7 +1435,7 @@ Author: kuepper <kuepper>
Date: Mon Dec 4 22:27:41 2006 +0000
* Makefile.am: Add t-eoRNG
* t-eoRNG.cpp: Start test for random number generator.
Author: kuepper <kuepper>
@ -1472,11 +1472,11 @@ Author: kuepper <kuepper>
Date: Sun Dec 3 10:41:54 2006 +0000
* mainpage.html: update, add link to Niko Hansen's comparison
* README: Add more specific note about tutorial.
* configure.in: Bump version to 1.0-beta1
* tutorial/Makefile.am: Add all necessary files, including html and
Templates to distribution.
@ -1517,13 +1517,13 @@ Author: kuepper <kuepper>
Date: Sat Dec 2 10:18:57 2006 +0000
* eoTimedMonitor.h (eoTimedMonitor::seconds): Make unsigned.
* eoRNG.cpp, eoRNG.h (K, M, N): Declare static and initialize in cpp.
* t-eoGenOp.cpp (init): Do not add std::ends to end of string, as this
results in escape-codes (^@) to be printed at runtime and is not
necessary anyway.
* test/t-eoSymreg.cpp (SymregNode::operator()): Initialize r1 and r2 to
avoid compiler warnings.
@ -1531,7 +1531,7 @@ Author: kuepper <kuepper>
Date: Sat Dec 2 09:39:13 2006 +0000
* eoRNG.h: Cleanup docs and document /all/ members.
* eoRNG.cpp, eoRNG.h (K, M, N): Declare static and initialize in cpp.
Author: kuepper <kuepper>
@ -1548,9 +1548,9 @@ Author: kuepper <kuepper>
Date: Fri Dec 1 20:08:51 2006 +0000
* Makefile.am: Update for release-distribution.
* Makefile.am: Add missing CMA header for distribution.
* Makefile.am: Add missing header for distribution.
Author: kuepper <kuepper>
@ -1603,7 +1603,7 @@ Author: kuepper <kuepper>
Date: Thu Nov 16 12:52:46 2006 +0000
* configure.in (AC_DEBUG): add test
* acinclude.m4 (AC_DEBUG): Define debug-feature and set DEBUG, NODEBUG,
or NDEBUG according to its value.
@ -1613,10 +1613,10 @@ Date: Thu Nov 16 12:35:46 2006 +0000
* make_genotype_real.h (eoEsChromInit): Rewrite vecSigmaInit-handling:
If sigmaInit is relative (%), do not read vecSigmaInit. Otherwise
always use vecSigmaInit with default all values of sigmaInit.
* eoParser.h (eoParser::getORcreateParam): Make this a real if-then-else
clause around ptParam (found or not).
* eoParam.h (eoValueParam::setValue): Document.
(eoValueParam<std::vector<double> >::setValue): Allow delimiters ',' and
';'. A plain ' ' does not work, as it is not correctly read by
@ -1973,9 +1973,9 @@ Date: Sun Oct 2 21:42:08 2005 +0000
- add a user-option for gnuplot-support
- separate gnuplot-code into declaration and implementation,
so we can define at EO-build-time whether to use it or not.
Adopt code and Makefiles to above changes.
Some minor fixes.
Author: kuepper <kuepper>
@ -2311,7 +2311,7 @@ Date: Thu Dec 23 15:29:07 2004 +0000
Adjust code to perform to C++ standard according to gcc-3.4
interpretation... (Have not compiled/checked/changed paradisEO.)
That is, the current code compiles with gcc-3.4 and the checks
(besides t-MGE1bit) all pass.
@ -2362,7 +2362,7 @@ Date: Fri Nov 5 08:57:34 2004 +0000
easily read as a parameter)
- eoIntBound and all other integer-equivalent of the classes in eoRealBound.h
Note that there is no equivalent to eoRealVectorBounds for vector of integers
In file eo, I have added the 2 includes of eoRealBounds.h and eoIntBounds.h
The first one was already there by chance, through eoUniformInit.h
@ -2569,13 +2569,13 @@ Author: kuepper <kuepper>
Date: Fri Sep 17 16:53:31 2004 +0000
Updated build-prcess to be completely under automake control.
For the tutorial the old Makefiles are saved as Makefile.simple in all
the respective directories.
Use generated config.h instead of command-line passing of preprocessor
flags.
Updated support files from current automake.
Author: kuepper <kuepper>
@ -3300,7 +3300,7 @@ Date: Sun Jan 5 16:31:50 2003 +0000
Added pyeo. Some changes needed to be made for include files and the like
in some files (and some bugs were fixed as well [Marc: eoOneToOneBreeder was a mess])
eoFunctor.h now contains static functor_category members, this shouldn't hurt anyone.
Author: maartenkeijzer <maartenkeijzer>
@ -3398,7 +3398,7 @@ Date: Wed Sep 18 12:40:46 2002 +0000
A new readFrom & printOn function for EO.h
Now it CAN handle VALID/INVALID fitnesses.
The problems are over at last
Author: cahon <cahon>
@ -3592,7 +3592,7 @@ Date: Mon Jun 17 04:13:45 2002 +0000
Adding the truncation selectors.
2 versions: eoTruncatedSelectOne is an eoSelectOne, and
eoTruncatedSelectMany works like an eoSelectMany (but is NOT)
eoTruncatedSelectMany works like an eoSelectMany (but is NOT)
Author: jeggermo <jeggermo>
Date: Mon Jun 10 14:10:35 2002 +0000
@ -3609,7 +3609,7 @@ Date: Mon May 13 11:31:32 2002 +0000
EO::printOn has been changed so that the printOn function will
always print a valid fitness value even if the fitness is invalid
Jeroen
Author: jeggermo <jeggermo>
@ -3827,7 +3827,7 @@ Date: Mon Apr 15 12:56:35 2002 +0000
eoParseTree printOn and readFrom functions changed for
compatibility with paradisEO
The fitness is now printed in the same way as in eoBit
Author: evomarc <evomarc>
@ -4138,9 +4138,9 @@ Date: Mon Feb 4 14:28:00 2002 +0000
the gpsymreg code has been slightly altered to allow compilation using the
Intel C++ Compiler for Linux.
Other compilers should not be affected.
A slightly different makefile is needed
Author: jeggermo <jeggermo>
@ -4317,7 +4317,7 @@ Date: Tue Dec 4 21:15:16 2001 +0000
some template classes and functions which did not need
to be templates have been changed to normal classes and functions
with hard coded typed
This might help with M$VC++ 6.0 compatibility
Author: jeggermo <jeggermo>
@ -4537,8 +4537,8 @@ Date: Sat Nov 10 09:02:17 2001 +0000
Small modifications here and there to be MSVC++ compatible
Mainly, time.h -> ctime
definition of loop index out of loops when multiply used
no typename in declaration using template typename
definition of loop index out of loops when multiply used
no typename in declaration using template typename
Author: evomarc <evomarc>
Date: Sat Nov 10 06:59:02 2001 +0000
@ -4628,15 +4628,15 @@ Date: Sat Nov 3 22:10:11 2001 +0000
the name of the eoGpDepthInitializer class (initializer for
parse_tree's has been changed to
eoParseTreeDepthInit but backward compatibility is maintained by
using a #define statement:
#define eoGpDepthInitializer eoParseTreeDepthInit
The initializer for strongly typed GP has been changed to
eoStParseTreeDepthInit
the gpsymreg application has been changed to use the new name
Author: jeggermo <jeggermo>
@ -4839,7 +4839,7 @@ Author: jeggermo <jeggermo>
Date: Tue Jul 17 08:58:52 2001 +0000
small documentation change for eoParseTree.h.
added a depth initializer for strongly typed genetic programming
added subtree xover for strongly typed genetic programming
added branch mutation for strongly typed genetic programming
@ -4862,7 +4862,7 @@ Date: Wed Jul 4 04:44:30 2001 +0000
Adding eoPopEvalFunc, that handles evaluation globally: it receives
two populations, parents and offspring, and does whatever necessary.
The subclass eoPopLoopEval does the simple loop on the offspring.
eoEasyEA was subsequently modified to handle an eoPopEval passed in Ctor,
but also to encapsulate an eoEvalFunc into an eoPopLoopEval tranparently.
@ -4874,7 +4874,7 @@ Date: Tue Jul 3 12:56:44 2001 +0000
Modified eoEaseyEA accordingly - you can either pass an eoEvalFunc, as
before (it is then encapsulated into an eoPopLoopEval that does the good
old loop on the offspring - or directly pass a full eoPopEvalFunc
Small modification also in make_op_es -> keyword "none" is now recognized
for one of the crossover of either object variables or stdev's
@ -4883,9 +4883,9 @@ Date: Mon Jul 2 13:31:04 2001 +0000
Changed the directory structure for gp
now: eoParseTree <-- the eoParseTree class
eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer)
eoParseTreeOp <-- the operators (xover and mutation)
eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer)
eoParseTreeOp <-- the operators (xover and mutation)
base documentation written for:
* eoParseTree
* eoGpDepthInitializer
@ -4895,9 +4895,9 @@ Date: Mon Jul 2 13:31:04 2001 +0000
* eoExpansionMutation
* eoCollapseSubtreeMutation
* eoHoistMutation
I also created a group ParseTree which contains all classes related to eoParseTree
eoGpMutate.h has been removed (merged with eoParseTree operators into eoParseTreeOp
Author: jeggermo <jeggermo>
@ -4978,16 +4978,16 @@ Author: jeggermo <jeggermo>
Date: Thu Jun 28 14:03:59 2001 +0000
new Mutation operators for eoParseTree in src/gp/eoGpMutate.h
a symbolic regression example program added to the app-dir
configure.in and Makefile(s).am changed
Author: jeggermo <jeggermo>
Date: Thu Jun 28 13:55:14 2001 +0000
Additional mutation operators for eoParseTree
* Point Mutation
* Expansion Mutation
* Collapse Subtree Mutation
@ -5195,7 +5195,7 @@ Date: Wed May 2 10:42:32 2001 +0000
src/es/eoEsGlobalXover.h and src/es/eoEsLocalXover.h for crossover
src/es/make_XXX_es.h for user-input
test/t-eoEsAll.cpp to test
However, an old bug appeared: className was not const in eoGenOp (and derived classes)
so I had to change that throughtout the hierarchy
@ -5212,7 +5212,7 @@ Date: Mon Apr 30 13:24:42 2001 +0000
Changed the interface of make_genotype - now templatized by the EOT
and not the fitness - this is mandatory for ES genoptypes as it allows to
choose the type of gentype at run-time (from existing types, of course!)
Also moved make_help.cpp into utils dir (otherwise you'd had to maintain
a copy into each representation dir!).
@ -5224,7 +5224,7 @@ Date: Mon Apr 30 13:01:07 2001 +0000
Changed the interface of make_genotype - now templatized by the EOT
and not the fitness - this is mandatory for ES genoptypes as it allows to
choose the type of gentype at run-time (from existing types, of course!)
Also moved make_help.cpp into utils dir (otherwise you'd had to maintain
a copy into each representation dir!).
@ -5427,7 +5427,7 @@ Date: Wed Apr 4 03:47:33 2001 +0000
Added the signal handling - see eoCtrlCContinue.h
I've disabled it in case of MSC as I don't know if this works there ...
Also added a couple of "virtual" in the ga dir
Author: evomarc <evomarc>
@ -5455,7 +5455,7 @@ Date: Wed Mar 28 09:00:54 2001 +0000
FDCStat and FileSnapshot: better error messageing
Scalar fitness: is now a vector of doubles
exercise3.1 added gnuplot again
Don't know about eoCombinedContinue
Author: evomarc <evomarc>
@ -5646,7 +5646,7 @@ Author: maartenkeijzer <maartenkeijzer>
Date: Mon Mar 12 16:00:58 2001 +0000
EO: added overloaded printing of fitness (for vectors and pairs)
Various bugs and ommissions in eoPerf2Worth and eoSelectFromWorth
Author: maartenkeijzer <maartenkeijzer>
@ -5658,12 +5658,12 @@ Author: maartenkeijzer <maartenkeijzer>
Date: Sat Mar 10 14:02:23 2001 +0000
Changed the populator to be a) more efficient and b) more useable
It is no longer derived from eoPop, it now gets a destination population.
This saves a lot of copying. The semantics has changed a little as well. It is
now an _infinite_ iterator. operator++ will *not* dispense new individuals, but
will merely stay at the end. To get a new indy, use operator*() as before.
eoEasyEA now checks the checkpoint *after* making a generation and clears the offspring
eoGeneralBreeder is changed to reflect the changes in eoPopulator
eoSequentialSelect now uses setup() rather than init()
@ -5717,7 +5717,7 @@ Date: Mon Feb 19 12:23:13 2001 +0000
To be able to use the primitive std::generate function, added a
set of wrappers in eoSTLFunctor.h that have the copy semantics most
STL functions expect (namely pass-by-value rather then pass-by-reference).
Updated test/Makefile.am to also test t-eoRandom
Author: evomarc <evomarc>
@ -5736,14 +5736,14 @@ Author: maartenkeijzer <maartenkeijzer>
Date: Sat Feb 17 10:51:31 2001 +0000
eoVector is back (eoFixedLength and eoVariableLength are gone)
Also: introducing eoRndGenerators.h for eoRndGenerator derived classes:
eoNormalGenerator
eoUniformGenerator
eoBooleanGenerator
eoNegExpGenerator
Note the suffix that are added to aid in determining what these classes do
Author: evomarc <evomarc>
@ -5829,13 +5829,13 @@ Date: Wed Feb 14 14:09:16 2001 +0000
Author: maartenkeijzer <maartenkeijzer>
Date: Wed Feb 14 10:35:26 2001 +0000
Changed the signature of eoMon, eoBin and eoQuadOp to return a bool,
without invalidating fitness. Added a set of invalidators to take over
that job (see for instance eoSGA and eoSGATransform how this can transparantly used)
Derived eoState from eoFunctorStore (for convenience, from a design perspective this may sound wrong)
Added a wrap_op function that does the wrapping for you (see eoOpContainer how this made this functor
exceedingly less hairy). Checked all the tests removed the eoGeneric*Op family (not needed anymore)
and of course changed all the operators to reflect the change (and found a few that didn't
@ -5865,24 +5865,24 @@ Author: maartenkeijzer <maartenkeijzer>
Date: Tue Feb 13 12:38:19 2001 +0000
fixed a bug: the parser now correctly parses parameters of the form
-Pvalue
This will now produce 'value'. The buggy parser would parse 'alue' here. I am truly and deeply
ashamed to have created such an off-by-one error.
Marc assumed this was wanted behaviour (so that it should read: -P=value)
I must admit that this is a logical conclusion, though it was merely a side-effect
of the error. To not force Marc to rewrite the tutorial and his way of working with
EO, I decided to make a feature out of the bug, so that now the parser will parse:
-Pvalue
-P=value
and of course the true and blue:
-Parameter=value
I will now go and check if I sent out some crappy papers caused by this bug (as I've been using eo!)
Author: maartenkeijzer <maartenkeijzer>
@ -5894,14 +5894,14 @@ Author: maartenkeijzer <maartenkeijzer>
Date: Mon Feb 12 13:58:51 2001 +0000
Ok, updated the Makefile.am again to use the
make check
Command I picked up in the automake documentation (RTFM, you know)
Tagged a lot of header functions in the GnuPlot files with 'inline',
so they can be used from more than one sourcefile.
Ok, now the interesting news. Started a new library libga (not to be confused
with Matthew's GaLib). Here I suggest we put a fairly complete and configurable
genetic algorithm. Just to see how far we can stretch ourselves and also to have
@ -5920,7 +5920,7 @@ Author: maartenkeijzer <maartenkeijzer>
Date: Sun Feb 11 16:25:03 2001 +0000
Removed small bug in reading outside a buffer in eoParser::readFrom
This caused the parser to crash when a simple flag of the form program -f
was given.
@ -6014,8 +6014,8 @@ Date: Fri Feb 9 05:09:26 2001 +0000
I also changed
- the eoQuadratic into eoQuad (as dicussed with Maarten)
- the eoBin into eoBit, with more appropriate names for the "binary"
operators (that can be unary!) as no one protested when I posted on
eodev list
operators (that can be unary!) as no one protested when I posted on
eodev list
Author: evomarc <evomarc>
Date: Wed Feb 7 05:15:18 2001 +0000
@ -6039,7 +6039,7 @@ Date: Wed Feb 7 05:04:24 2001 +0000
Added selection methods
eoBestSelect always return the best individual
eoSequentialSelect a selectOne version of eoDetSelect (uses an index to
return next offspring from sorted pop)
return next offspring from sorted pop)
Author: evomarc <evomarc>
Date: Thu Feb 1 05:27:36 2001 +0000
@ -6061,7 +6061,7 @@ Date: Wed Jan 31 18:38:39 2001 +0000
every generation) which is different from the continuous monitoring (same file/plot is
angemented every generation).
This lead to a number of modifications in many files in utils dir
But now we can watch on-line
- fitness spreadout
- FDC plots
@ -6078,7 +6078,7 @@ Date: Mon Jan 29 10:25:44 2001 +0000
Added the truncate and the hasNoBoundAtAll methods in eoRealBounds.
The former simply set values to the boundary values in case they are out
The latter allows to short-cut all bound-checks when no need
SOme day I will put this in utils, and have a eoRealBounds.cpp in the
pre-compiled library
@ -6129,12 +6129,12 @@ Date: Sat Jan 27 07:43:58 2001 +0000
eo everything that is general to any representation
es.h everything about real representation (in es dir)
ga.h everything related to bitstring representation (in ga dir)
To be continued by gp.h, and ...
This has lead to some slight modifications in test file eobin and all tutorial
examples files...
I've also added in utils eoDistance, generic functor to compute distances,
including also the generic Euclidian distance
@ -6145,9 +6145,9 @@ Date: Sat Jan 27 07:41:46 2001 +0000
eo everything that is general to any representation
es.h everything about real representation (in es dir)
ga.h everything related to bitstring representation (in ga dir)
To be continued by gp.h, and ...
This has lead to some slight modifications in test file eobin and all tutorial
examples files...
@ -6405,7 +6405,7 @@ Date: Tue Jan 2 07:03:57 2001 +0000
permanent parameters (eoParser only holds references), and egcs did not allow
to create them by reference, i.e. in the line
eoValueParam<xxx> & blablaParam(...);
So now everything is done in the main_function, and 3 lines are needed to create
and read every paramter (sigh ...)
@ -6483,16 +6483,16 @@ Date: Tue Dec 19 18:41:19 2000 +0000
THe big eoReplacement update:
The interface for eoReplacement is now eoPop<EOT>&, eoPop<EOT>&
(i.e. no const) and the result must be in the first argument in the end.
Hence it is possible to do SSGA and all intermediate replacmeent procedures
The classes derived from eoMergeReduce.h are now in a separate file
The SSGA-like replcaement procedures are in eoReduceMerge.h
A more general replacement can be found in eoSurviveAndDie.h
(it could be made a littel more general - still open for upgrades).
Also some accessors have been added to the eoPop (best and worse individuals)
And include file eo has been updated
Author: evomarc <evomarc>
@ -6630,16 +6630,16 @@ Author: evomarc <evomarc>
Date: Mon Dec 4 06:58:43 2000 +0000
Added the lastCall construct: if the stopping condition becomes true in eoCheckPoint,
a method called lastCall is called for everything contained in that checkpoint
(stats, updaters and monitors). This can be extremely useful
- for stateSavers (see below)
- for monitoring things like rates of success of operators, where what you
are interested in is the final result only.
a method called lastCall is called for everything contained in that checkpoint
(stats, updaters and monitors). This can be extremely useful
- for stateSavers (see below)
- for monitoring things like rates of success of operators, where what you
are interested in is the final result only.
Added of course a virtual method lastCall that does nothing by default in classes
eoBaseStat, eoBaseSortedStat, eoUpdater and eoMonitor
eoBaseStat, eoBaseSortedStat, eoUpdater and eoMonitor
Added a boolean to control the save of the state in method eoCountedStateSaver::lastCall
so you can ask that the state is saved at final population, whatever happens.
I also added the corresponding constructor to take this into account.
so you can ask that the state is saved at final population, whatever happens.
I also added the corresponding constructor to take this into account.
Author: evomarc <evomarc>
Date: Mon Dec 4 05:55:59 2000 +0000
@ -6822,8 +6822,8 @@ Author: evomarc <evomarc>
Date: Tue Nov 28 06:46:37 2000 +0000
Modified the contructor: the default value for the delimiter is now " "
and I added a boolean argument to indicate whether or not we want to
overwrite an existing file with same name (default is overwrite).
and I added a boolean argument to indicate whether or not we want to
overwrite an existing file with same name (default is overwrite).
Added the getFileName accessor.
Author: evomarc <evomarc>
@ -7085,7 +7085,7 @@ Author: maartenkeijzer <maartenkeijzer>
Date: Fri Oct 6 10:41:38 2000 +0000
Added an eoSortedStatBase for more efficient statistic calculations
updated a few makefiles to include the html and latex docs with the
distribution.
@ -7844,12 +7844,12 @@ Author: mac <mac>
Date: Mon Mar 6 16:05:47 2000 +0000
Fixed bug in eoGOpSelector (missing break!)
eoOp.h: binOp's second arg is const once more
all dsp and dsw files were touched by msvc, but did add some stuff (which
will be added to eo later)
Hope this all works
Author: mac <mac>
@ -7879,7 +7879,7 @@ Author: marc <marc>
Date: Tue Feb 29 05:14:40 2000 +0000
wherease the command "cvs ci" is OK.
Here we go:
- added the virtual destructors of all classes,
to suppress g++ annoying warnings when using -Wall option
@ -7930,7 +7930,7 @@ Date: Sat Feb 19 16:30:42 2000 +0000
Moved the static eoRNG rng to an extern eoRNG
This external object is now defined in eoPersistent.cpp
This should change...
Author: mac <mac>

View file

@ -44,6 +44,12 @@ ENABLE_LANGUAGE(C)
### 2) Include required modules / configuration files
#####################################################################################
FIND_PACKAGE(OpenMP REQUIRED)
IF(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
ENDIF()
INCLUDE(CMakeBackwardCompatibilityCXX)
INCLUDE(FindDoxygen)
@ -103,7 +109,7 @@ ENDIF (ENABLE_CMAKE_TESTING)
### 5) Where must cmake go now ?
######################################################################################
ADD_SUBDIRECTORY(app)
#ADD_SUBDIRECTORY(app)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)

View file

@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
@ -457,7 +457,7 @@ DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that

View file

@ -1,4 +1,3 @@
# NOTE: only add something here if it is really needed by EO
include(CheckIncludeFile)
@ -7,17 +6,17 @@ include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckLibraryExists)
check_library_exists(m cos "cos in libm" HAVE_LIBM)
check_library_exists(m cos "cos in libm" HAVE_LIBM)
check_include_files(cmath.h "cmath.h" HAVE_CMATH_H)
check_include_files(stdio.h "stdio.h" HAVE_STDIO_H)
check_include_files(stdlib.h "stdlib.h" HAVE_STDLIB_H)
check_include_files(string.h "string.h" HAVE_STRING_H)
check_include_files(strings.h "strings.h" HAVE_STRINGS_H)
check_include_files(malloc.h "malloc.h" HAVE_MALLOC_H)
check_include_files(limits.h "limits.h" HAVE_LIMITS_H)
check_include_files(unistd.h "unistd.h" HAVE_UNISTD_H)
check_include_files(stdint.h "stdint.h" HAVE_STDINT_H)
check_include_files(cmath.h "cmath.h" HAVE_CMATH_H)
check_include_files(stdio.h "stdio.h" HAVE_STDIO_H)
check_include_files(stdlib.h "stdlib.h" HAVE_STDLIB_H)
check_include_files(string.h "string.h" HAVE_STRING_H)
check_include_files(strings.h "strings.h" HAVE_STRINGS_H)
check_include_files(malloc.h "malloc.h" HAVE_MALLOC_H)
check_include_files(limits.h "limits.h" HAVE_LIMITS_H)
check_include_files(unistd.h "unistd.h" HAVE_UNISTD_H)
check_include_files(stdint.h "stdint.h" HAVE_STDINT_H)
# Use check_symbol_exists to check for symbols in a reliable
@ -27,7 +26,4 @@ check_include_files(stdint.h "stdint.h" HAVE_STDINT_H)
# specific order. Refer to the man page for each symbol for which a
# check is to be added to get the proper set of headers. Example :
#check_symbol_exists(asymbol "symbole.h" HAVE_SYMBOLE)
#check_symbol_exists(asymbol "symbole.h" HAVE_SYMBOLE)

View file

@ -233,4 +233,3 @@ operates.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View file

@ -146,7 +146,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
@ -457,7 +457,7 @@ DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
@ -500,5 +500,3 @@ necessary. Here is a sample; alter the names:
Ty Coon, President of Vice
That's all there is to it!

13
eo/NEWS
View file

@ -7,11 +7,11 @@
- GCC 4.3 compatibility
- new versatile log system with several nested verbose levels
- classes using intern verbose parameters marked as deprecated, please update your code accordingly if you use one of the following files:
eo/src/eoCombinedInit.h
eo/src/eoGenContinue.h
eo/src/eoProportionalCombinedOp.h
eo/src/utils/eoData.h
eo/src/utils/eoStdoutMonitor.h
eo/src/eoCombinedInit.h
eo/src/eoGenContinue.h
eo/src/eoProportionalCombinedOp.h
eo/src/utils/eoData.h
eo/src/utils/eoStdoutMonitor.h
- an evaluator that throw an exception if a maximum eval numbers has been reached, independently of the number of generations
- new monitor that can write on any ostream
- new continuator that can catch POSIX system user signals
@ -33,10 +33,9 @@
- Add Microsoft Visual C++ project support files (for Visual Studio 2003 and 2005)
- Upgrade Teamplates/ script to create a complete standalone EO project (using autotools)
- Remove support for pre-standard C++ compiler (i.e. gcc-2.x), which allows to
clean up the code considerably.
clean up the code considerably.
Assume availability of sstream and limits.
* release 0.9.3z.1 (1. Oct. 2005)
- Support gcc-3.4 and gcc.4.x.
- Provide full automake/autoconf/configure support.

View file

@ -1,8 +1,7 @@
EO README FILE
EO README FILE
=======================================================================
check latest news at http://eodev.sourceforge.net/
check latest news at http://eodev.sourceforge.net/
=======================================================================
Welcome to EO, the Evolving Objects library.
@ -14,7 +13,7 @@ In case of any problem, please e-mail us at
eodev-help@lists.sourceforge.net, eodev@egroups.com
To get started, take a look at the tutorial, starting with
./tutorial/html/eoTutorial.html
./tutorial/html/eoTutorial.html
The easiest way to start programming a new genome with all EO
evolution engines handy is to create a new standalone EO project from
@ -23,11 +22,11 @@ an introduction;)
==================================================================
BUILDING EO
BUILDING EO
==================================================================
The basic installation procedure goes the following:
Go to your build-directory and run
Go to your build-directory and run
$(SRCDIR)/configure
make
make check
@ -50,7 +49,7 @@ specific about EO.
===================================================================
DIRECTORY STRUCTURE
DIRECTORY STRUCTURE
===================================================================
After unpacking the archive file, you should end up with the following
structure:
@ -63,7 +62,7 @@ structure:
| |
| +- ga bistring-genotypes source files
| |
| +- es real-valued-genotypes source files
| +- es real-valued-genotypes source files
| |
| +- gp Genetic Programming source files
| |
@ -74,9 +73,9 @@ structure:
+-- tutorial TUTORIAL dir (indeed :-)
| |
| +- html all html files - start by browsing index.html
| |
| |
| +- LessonX for X=1, 2, 3, ... : example of increasing complexity
|
|
|
|
+-- doc DOCUMENTATION dir (generated by Doxygen)
@ -93,7 +92,7 @@ structure:
|
+-- app APPLICATIONS - one dir per separate application
| |
| +- gprop GA/backpropagation for neural nets
| +- gprop GA/backpropagation for neural nets
| |
| +- mastermind the wellknown MasterMind game
|
@ -103,7 +102,7 @@ structure:
===================================================================
NOTES
NOTES
===================================================================
If you extracted a fresh snapshot from the cvs-repository, remember
to run

View file

@ -18,15 +18,14 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib)
SET (GPROP_SOURCES gprop.cpp)
# especially for Visual Studio
IF(NOT WIN32 OR CYGWIN)
ADD_EXECUTABLE(gprop ${GPROP_SOURCES})
IF(NOT WIN32 OR CYGWIN)
ADD_EXECUTABLE(gprop ${GPROP_SOURCES})
ADD_DEPENDENCIES(gprop eo eoutils)
TARGET_LINK_LIBRARIES(gprop eo eoutils)
TARGET_LINK_LIBRARIES(gprop eo eoutils)
SET(GPROP_VERSION ${GLOBAL_VERSION})
SET_TARGET_PROPERTIES(gprop PROPERTIES VERSION "${GPROP_VERSION}")
ENDIF(NOT WIN32 OR CYGWIN)
######################################################################################

View file

@ -207,12 +207,12 @@ int correct(const mlp::net& net, const mlp::set& set)
unsigned partial = 0;
for (unsigned i = 0; i < s->output.size(); ++i)
if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) ||
(s->output[i] > 0.5 && net(s->input)[i] > 0.5))
++partial;
if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) ||
(s->output[i] > 0.5 && net(s->input)[i] > 0.5))
++partial;
if (partial == s->output.size())
++sum;
++sum;
}
return sum;

View file

@ -29,7 +29,7 @@ namespace l2
//---------------------------------------------------------------------------
// error
//---------------------------------------------------------------------------
real error(const mlp::net& net, const set& ts)
{
real error_ = 0.0;
@ -37,12 +37,12 @@ namespace l2
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
{
vector out = net(s->input);
for (unsigned i = 0; i < out.size(); ++i)
{
real target = s->output[i];
real value = out[i];
error_ -= target * log(value + min_real) +
error_ -= target * log(value + min_real) +
(1.0 - target) * log(1.0 - value + min_real);
}
}
@ -53,25 +53,25 @@ namespace l2
//-------------------------------------------------------------------------
// l2
//-------------------------------------------------------------------------
class net: public qp::net
{
public:
net(mlp::net& n): qp::net(n) {}
real error(const set& ts)
{
real error_ = 0;
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
{
forward(s->input);
error_ -= backward(s->input, s->output);
}
return error_;
}
private:
real backward(const vector& input, const vector& output)
{
@ -84,7 +84,7 @@ namespace l2
{
neuron& n = (*current_layer)[j];
real out = output[j];
n.ndelta += n.delta = (out - n.out) /
n.ndelta += n.delta = (out - n.out) /
(n.out * (1.0 - n.out) + min_real) * n.out * (1.0 - n.out);
if (size() == 1) // monolayer
@ -92,21 +92,21 @@ namespace l2
else // multilayer
for (unsigned k = 0; k < n.dxo.size(); ++k)
n.dxo[k] += n.delta * (*backward_layer)[k].out;
error_ += out * log(n.out + min_real) +
error_ += out * log(n.out + min_real) +
(1.0 - out) * log(1.0 - n.out + min_real);
}
// hidden layers
while (++current_layer != rend())
{
reverse_iterator forward_layer = current_layer - 1;
reverse_iterator backward_layer = current_layer + 1;
reverse_iterator backward_layer = current_layer + 1;
for (unsigned j = 0; j < current_layer->size(); ++j)
{
neuron& n = (*current_layer)[j];
real sum = 0;
real sum = 0;
for (unsigned k = 0; k < forward_layer->size(); ++k)
{
neuron& nf = (*forward_layer)[k];
@ -114,7 +114,7 @@ namespace l2
}
n.delta = n.out * (1.0 - n.out) * sum;
n.ndelta += n.delta;
if (backward_layer == rend()) // first hidden layer
n.dxo += n.delta * input;
else // rest of hidden layers
@ -122,19 +122,19 @@ namespace l2
n.dxo[k] += n.delta * (*backward_layer)[k].out;
}
}
return error_;
}
};
//---------------------------------------------------------------------------
} // namespace l2
//-----------------------------------------------------------------------------
#endif // l2_h
// Local Variables:
// mode:C++
// Local Variables:
// mode:C++
// End:

View file

@ -45,7 +45,7 @@ namespace std {
istream& operator>>(istream& is, mlp::vector& v)
{
for (mlp::vector::iterator vi = v.begin() ; vi != v.end() ; vi++) {
is >> *vi;
is >> *vi;
}
return is;
}
@ -133,15 +133,15 @@ namespace mlp
#ifdef HAVE_LIBYAML_CPP
YAML_SERIALIZABLE_AUTO(neuron)
void emit_yaml(YAML::Emitter&out) const {
out << YAML::BeginMap;
out << YAML::Key << "Class" << YAML::Value << "mlp::neuron";
YAML_EMIT_MEMBER(out,bias);
YAML_EMIT_MEMBER(out,weight);
out << YAML::EndMap;
out << YAML::BeginMap;
out << YAML::Key << "Class" << YAML::Value << "mlp::neuron";
YAML_EMIT_MEMBER(out,bias);
YAML_EMIT_MEMBER(out,weight);
out << YAML::EndMap;
}
void load_yaml(const YAML::Node& node) {
YAML_LOAD_MEMBER(node, bias);
YAML_LOAD_MEMBER(node, weight);
YAML_LOAD_MEMBER(node, bias);
YAML_LOAD_MEMBER(node, weight);
}
#endif
};
@ -213,17 +213,17 @@ namespace mlp {
}
#ifdef HAVE_LIBYAML_CPP
friend ostream& operator<<(YAML::Emitter& e, const layer &l) {
e << ((std::vector<neuron>)l);
e << ((std::vector<neuron>)l);
}
friend void operator>>(const YAML::Node& n, layer &l) {
// These temporary variable shenanegins are necessary because
// the compiler gets very confused about which template operator>>
// function to use.
// The following does not work: n >> l;
// So we use a temporary variable thusly:
std::vector<mlp::neuron> *obviously_a_vector = &l;
n >> *obviously_a_vector;
// These temporary variable shenanegins are necessary because
// the compiler gets very confused about which template operator>>
// function to use.
// The following does not work: n >> l;
// So we use a temporary variable thusly:
std::vector<mlp::neuron> *obviously_a_vector = &l;
n >> *obviously_a_vector;
}
#endif
@ -243,7 +243,7 @@ namespace std {
istream& operator>>(istream& is, mlp::layer& l)
{
for (mlp::layer::iterator li = l.begin() ; li != l.end() ; li++) {
is >> *li;
is >> *li;
}
return is;
}
@ -277,15 +277,15 @@ namespace mlp {
#ifdef HAVE_LIBYAML_CPP
YAML_SERIALIZABLE_AUTO(net)
void emit_members(YAML::Emitter&out) const {
const std::vector<layer>* me_as_layer_vector = this;
out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector;
const std::vector<layer>* me_as_layer_vector = this;
out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector;
}
void load_members(const YAML::Node& node) {
std::vector<layer>* me_as_layer_vector = this;
node["layers"] >> *me_as_layer_vector;
std::vector<layer>* me_as_layer_vector = this;
node["layers"] >> *me_as_layer_vector;
}
#endif // HAVE_LIBYAML_CPP
#endif // HAVE_LIBYAML_CPP
/** Virtual destructor */
virtual ~net() {};
@ -303,14 +303,14 @@ namespace mlp {
is >> layer_size;
layer_sizes.push_back(layer_size);
}
unsigned check_outputs;
unsigned check_outputs;
is >> check_outputs;
assert (check_outputs == num_outputs);
init (num_inputs,num_outputs,layer_sizes);
// skip forward to pass up opening '<' char
char c=' ';
while (c!='<' && !is.eof()) { is >> c;}
for (iterator l =begin() ; l != end(); l++) {
// skip forward to pass up opening '<' char
char c=' ';
while (c!='<' && !is.eof()) { is >> c;}
for (iterator l =begin() ; l != end(); l++) {
is >> *l;
}
do { is >> c; } while (c == ' ' && !is.eof());
@ -351,15 +351,15 @@ namespace mlp {
}
void save(ostream &os) const {
// Save the number of inputs, number of outputs, and number of hidden layers
// Save the number of inputs, number of outputs, and number of hidden layers
os << num_inputs() << "\n" << num_outputs() << "\n" << num_hidden_layers() << "\n";
for(const_iterator l = begin(); l != end(); ++l)
for(const_iterator l = begin(); l != end(); ++l)
os << l->size() << " ";
os << "\n";
os << "< ";
for(const_iterator l = begin(); l != end(); ++l)
os << "\n";
os << "< ";
for(const_iterator l = begin(); l != end(); ++l)
os << *l << " ";
os << ">\n";
os << ">\n";
}
@ -454,7 +454,7 @@ namespace mlp {
void load(istream &is) {
unsigned input_size, output_size;
is >> input_size >> output_size;
is >> input_size >> output_size;
sample samp(input_size, output_size);;
while (is >> samp) { push_back(samp); }
}

View file

@ -28,7 +28,7 @@ namespace mse
//---------------------------------------------------------------------------
// error
//---------------------------------------------------------------------------
real error(const mlp::net& net, const set& ts)
{
real error_ = 0.0;
@ -36,7 +36,7 @@ namespace mse
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
{
vector out = net(s->input);
for (unsigned i = 0; i < out.size(); ++i)
{
real diff = s->output[i] - out[i];
@ -49,26 +49,26 @@ namespace mse
//-------------------------------------------------------------------------
// mse
//-------------------------------------------------------------------------
class net: public qp::net
{
public:
net(mlp::net& n): qp::net(n) {}
real error(const set& ts)
{
real error_ = 0;
for (set::const_iterator s = ts.begin(); s != ts.end(); ++s)
{
forward(s->input);
error_ += backward(s->input, s->output);
}
error_ /= ts.size();
return error_;
}
private:
real backward(const vector& input, const vector& output)
{
@ -89,22 +89,22 @@ namespace mse
else // multilayer
for (unsigned k = 0; k < n.dxo.size(); ++k)
n.dxo[k] += n.delta * (*backward_layer)[k].out;
error_ += diff * diff;
}
// hidden layers
while (++current_layer != rend())
{
reverse_iterator forward_layer = current_layer - 1;
reverse_iterator backward_layer = current_layer + 1;
for (unsigned j = 0; j < current_layer->size(); ++j)
{
neuron& n = (*current_layer)[j];
real sum = 0;
for (unsigned k = 0; k < forward_layer->size(); ++k)
{
neuron& nf = (*forward_layer)[k];
@ -113,8 +113,8 @@ namespace mse
n.delta = n.out * (1.0 - n.out) * sum;
n.ndelta += n.delta;
if (backward_layer == rend()) // first hidden layer
n.dxo += n.delta * input;
else // rest of hidden layers
@ -122,19 +122,19 @@ namespace mse
n.dxo[k] += n.delta * (*backward_layer)[k].out;
}
}
return error_;
}
};
//---------------------------------------------------------------------------
} // namespace mse
//-----------------------------------------------------------------------------
#endif // mse_h
// Local Variables:
// mode:C++
// Local Variables:
// mode:C++
// End:

View file

@ -41,55 +41,55 @@ namespace qp
const real backtrack_step = 0.5;
const real me_floor = 0.0001;
const real mw_floor = 0.0001;
//---------------------------------------------------------------------------
// neuron
//---------------------------------------------------------------------------
struct neuron
{
mlp::neuron* n;
real out, delta, ndelta, dbias1, dbias2;
vector dweight1, dweight2, dxo;
neuron(mlp::neuron& _n):
n(&_n), out(0), delta(0), ndelta(0), dbias1(0), dbias2(0),
dweight1(n->weight.size(), 0),
dweight2(n->weight.size(), 0),
neuron(mlp::neuron& _n):
n(&_n), out(0), delta(0), ndelta(0), dbias1(0), dbias2(0),
dweight1(n->weight.size(), 0),
dweight2(n->weight.size(), 0),
dxo(n->weight.size(), 0) {}
void reset()
{
// underlaying neuron
n->reset();
// addons
out = delta = ndelta = dbias1 = dbias2 = 0;
fill(dweight1.begin(), dweight1.end(), 0);
fill(dweight2.begin(), dweight2.end(), 0);
fill(dxo.begin(), dxo.end(), 0);
}
real operator()(const vector& input)
{
return out = mlp::sigmoid(n->bias + dbias1 +
return out = mlp::sigmoid(n->bias + dbias1 +
(n->weight + dweight1) * input);
}
};
std::ostream& operator<<(std::ostream& os, const neuron& n)
{
return os << *n.n << " " << n.out << " " << n.delta << " "
<< n.ndelta << " " << n.dbias1 << " " << n.dbias2 << " "
return os << *n.n << " " << n.out << " " << n.delta << " "
<< n.ndelta << " " << n.dbias1 << " " << n.dbias2 << " "
<< n.dweight1 << " " << n.dweight2 << " " << n.dxo;
}
//---------------------------------------------------------------------------
// layer
//---------------------------------------------------------------------------
class layer: public std::vector<neuron>
{
public:
@ -102,16 +102,16 @@ namespace qp
void reset()
{
for(iterator n = begin(); n != end(); ++n)
n->reset();
n->reset();
}
vector operator()(const vector& input)
{
vector output(size());
for(unsigned i = 0; i < output.size(); ++i)
output[i] = (*this)[i](input);
output[i] = (*this)[i](input);
return output;
}
};
@ -120,10 +120,10 @@ namespace qp
//---------------------------------------------------------------------------
// net
//---------------------------------------------------------------------------
class net: public std::vector<layer>
{
public:
public:
net(mlp::net& n) //: std::vector<layer>(n.begin(), n.end()) { reset(); }
{
for (mlp::net::iterator l = n.begin(); l != n.end(); ++l)
@ -135,27 +135,27 @@ namespace qp
void reset()
{
for(iterator l = begin(); l != end(); ++l)
l->reset();
l->reset();
}
real train(const set& ts,
unsigned epochs,
real target_error,
real train(const set& ts,
unsigned epochs,
real target_error,
real tolerance,
real eta = eta_default,
real momentum = alpha_default,
real eta = eta_default,
real momentum = alpha_default,
real lambda = lambda_default)
{
real error_ = max_real;
while (epochs-- && error_ > target_error)
{
real last_error = error_;
init_delta();
error_ = error(ts);
if (error_ < last_error + tolerance)
{
coeff_adapt(eta, momentum, lambda);
@ -170,10 +170,10 @@ namespace qp
error_ = last_error;
}
}
return error_;
}
virtual real error(const set& ts) = 0;
// protected:
@ -185,7 +185,7 @@ namespace qp
input.swap(tmp);
}
}
// private:
void init_delta()
{
@ -193,11 +193,11 @@ namespace qp
for (layer::iterator n = l->begin(); n != l->end(); ++n)
fill(n->dxo.begin(), n->dxo.end(), n->ndelta = 0.0);
}
void coeff_adapt(real& eta, real& momentum, real& lambda)
{
real me = 0, mw = 0, ew = 0;
for (iterator l = begin(); l != end(); ++l)
for (layer::iterator n = l->begin(); n != l->end(); ++n)
{
@ -205,7 +205,7 @@ namespace qp
mw += n->dweight1 * n->dweight1;
ew += n->dxo * n->dweight1;
}
me = std::max(static_cast<real>(sqrt(me)), me_floor);
mw = std::max(static_cast<real>(sqrt(mw)), mw_floor);
eta *= (1.0 + 0.5 * ew / ( me * mw));
@ -213,11 +213,11 @@ namespace qp
lambda = lambda0 * me / mw;
momentum = eta * lambda;
#ifdef DEBUG
std::cout << me << " \t" << mw << " \t" << ew << " \t"
std::cout << me << " \t" << mw << " \t" << ew << " \t"
<< eta << " \t" << momentum << " \t" << lambda << std::endl;
#endif // DEBUG
}
void weight_update(unsigned size, bool fire, real eta, real momentum)
{
for (iterator l = begin(); l != end(); ++l)
@ -239,13 +239,13 @@ namespace qp
};
//---------------------------------------------------------------------------
} // namespace qp
//-----------------------------------------------------------------------------
#endif // qp_h
// Local Variables:
// mode:C++
// Local Variables:
// mode:C++
// End:

View file

@ -160,14 +160,14 @@ template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T
{
std::copy(v.begin(), v.end() - 1, std::ostream_iterator<T>(os, " "));
os << v.back();
}
}
return os << '>';
}
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& v)
{
v.clear();
char c;
is >> c;
if (!is || c != '<')
@ -186,7 +186,7 @@ template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& v)
}
} while (is && c != '>');
}
return is;
}
@ -194,11 +194,11 @@ template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& v)
// euclidean_distance
//-----------------------------------------------------------------------------
template<class T> T euclidean_distance(const std::vector<T>& v1,
template<class T> T euclidean_distance(const std::vector<T>& v1,
const std::vector<T>& v2)
{
T sum = 0, tmp;
for (unsigned i = 0; i < v1.size(); ++i)
{
tmp = v1[i] - v2[i];
@ -211,4 +211,3 @@ template<class T> T euclidean_distance(const std::vector<T>& v1,
//-----------------------------------------------------------------------------
#endif

View file

@ -18,8 +18,8 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib)
SET (GPSYMREG_SOURCES main.cpp)
# no matter what is the OS, hopefully
ADD_EXECUTABLE(gpsymreg ${GPSYMREG_SOURCES})
ADD_EXECUTABLE(gpsymreg ${GPSYMREG_SOURCES})
ADD_DEPENDENCIES(gpsymreg eo eoutils)
######################################################################################
@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(gpsymreg PROPERTIES VERSION "${GPSYMREG_VERSION}")
TARGET_LINK_LIBRARIES(gpsymreg eo eoutils)
######################################################################################

View file

@ -14,7 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
jeggermo@liacs.nl
jeggermo@liacs.nl
*/
#ifndef _FITNESS_FUNCTION_H
@ -225,4 +225,3 @@ class RegFitness: public eoEvalFunc< eoParseTree<FitnessType, Node> >
};
#endif

View file

@ -30,7 +30,7 @@
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
jeggermo@liacs.nl
jeggermo@liacs.nl
*/
@ -146,25 +146,25 @@ int main(int argc, char *argv[])
// the parameters are passed on as well
RegFitness eval(generationCounter, initSequence, parameter);
RegFitness eval(generationCounter, initSequence, parameter);
// Depth Initializor, set for Ramped Half and Half Initialization
eoParseTreeDepthInit<FitnessType, Node> initializer(parameter.InitMaxDepth, initSequence, true, true);
eoParseTreeDepthInit<FitnessType, Node> initializer(parameter.InitMaxDepth, initSequence, true, true);
// create the initial population
Pop pop(parameter.population_size, initializer);
Pop pop(parameter.population_size, initializer);
// and evaluate the individuals
apply<EoType>(eval, pop);
apply<EoType>(eval, pop);
@ -335,10 +335,3 @@ int main(int argc, char *argv[])
}

View file

@ -3,18 +3,18 @@
it under the terms of the GNU 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 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
jeggermo@liacs.nl
jeggermo@liacs.nl
*/
#ifndef _NODE_H
@ -33,13 +33,13 @@ using namespace std;
/* A new Operation and Node class for even more flexibility.
Improvements over the t-eoSymreg code are:
* No hardcoded functions or operators. The Operation and Node class below
allow you to specify your own unary and binary functions as well as
binary operators (like +,-,*,/). Moreover you can detemine if you want
to allow primitve subroutines with either one or two arguments.
If a Node has a subroutine Operation it will take evaluate the first
If a Node has a subroutine Operation it will take evaluate the first
(and possible second) child branch and use them as input variables for
the remaining second (or third) child branch.
*/
@ -47,20 +47,20 @@ using namespace std;
typedef enum {Variable, UFunction, BFunction, BOperator, Const} Type;
typedef double (*BinaryFunction)(const double,const double);
typedef double (*BinaryFunction)(const double,const double);
typedef double (*UnaryFunction)(const double);
struct Operation
{
public:
typedef unsigned int VariableID;
typedef string Label;
// if your compiler allows you to have nameless unions you can make this a
// union by removing the //'s below
//union
//{
UnaryFunction uFunction;
@ -68,34 +68,34 @@ struct Operation
VariableID id;
double constant;
//};
Label label;
Type type;
// the default constructor results in a constant with value 0
Operation() : constant(0), label("0"), type(Const){};
// two possible constructors for Unary Functions
Operation(UnaryFunction _uf, Label _label): uFunction(_uf), label(_label), type(UFunction) {};
Operation(Label _label, UnaryFunction _uf): uFunction(_uf), label(_label), type(UFunction) {};
// Watch out there are two constructors using pointers two binary functions:
// Binary Function (printed as label(subtree0,subtree1) (e.g. pow(x,y))
// Binary Operator (printed as (subtree0 label subtree1) (e.g. x^y)
// The difference is purely cosmetic.
// If you specify the label before the function pointer -> Binary Function
Operation(Label _label, BinaryFunction _bf): bFunction(_bf), label(_label), type(BFunction) {};
// If you specify the function pointer before the label -> Binary Operator
Operation(BinaryFunction _bf, Label _label): bFunction(_bf), label(_label), type(BOperator) {};
// A constructor for variables
Operation(VariableID _id, Label _label): id(_id), label(_label), type(Variable) {};
// A constructor for constants
Operation(double _constant, Label _label): constant(_constant), label(_label), type(Const) {};
Operation(const Operation &_op)
{
switch(_op.type)
@ -110,7 +110,7 @@ struct Operation
label = _op.label;
};
virtual ~Operation(){};
};
@ -118,14 +118,14 @@ class Node
{
private:
Operation op;
public:
Node(void): op(Operation()){};
Node(Operation &_op) : op(_op){};
virtual ~Node(void) {}
int arity(void) const
int arity(void) const
{
switch(op.type)
{
@ -134,53 +134,53 @@ class Node
case BFunction: return 2;
case BOperator: return 2;
case Const: return 0;
}
return 0;
}
return 0;
}
void randomize(void) {}
template<class Children>
void operator()(double& result, Children args, vector<double> &var) const
{
double result0;
double result1;
switch(op.type)
{
case Variable: result = var[op.id%var.size()]; //%var.size() used in the case of Subroutines and as a security measure
break;
case UFunction: args[0].apply(result0, var);
result = op.uFunction(result0);
result = op.uFunction(result0);
break;
case BFunction:
case BFunction:
case BOperator: args[0].apply(result0, var);
args[1].apply(result1, var);
args[1].apply(result1, var);
result = op.bFunction(result0,result1);
break;
case Const: result = op.constant;
break;
break;
}
}
template<class Children>
void operator()(string& result, Children args) const
{
string subtree0;
string subtree1;
string subtree2;
switch(op.type)
{
case Variable:
case Variable:
case Const: result += op.label;
break;
case UFunction: result += op.label;
result += "(";
args[0].apply(subtree0);
@ -195,7 +195,7 @@ class Node
args[1].apply(subtree1);
result += subtree1;
result += ")";
break;
break;
case BOperator: result += "(";
args[0].apply(subtree0);
result += subtree0;
@ -204,16 +204,16 @@ class Node
result += subtree1;
result += ")";
break;
default: result += "ERROR in Node::operator(string,...) \n"; break;
default: result += "ERROR in Node::operator(string,...) \n"; break;
}
}
Operation getOp(void) const {return op;}
};
@ -230,7 +230,7 @@ class Node
std::ostream& operator<<(std::ostream& os, const Node& eot)
{
Operation op(eot.getOp());
os << (eot.getOp()).label;
return os;
}

View file

@ -3,18 +3,18 @@
it under the terms of the GNU 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 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
jeggermo@liacs.nl
jeggermo@liacs.nl
*/
#ifndef _PARAMETERS_FUNCTION_H
@ -28,7 +28,7 @@ using namespace std;
struct Parameters{
unsigned int nGenerations; // -G
unsigned population_size; // -P
unsigned population_size; // -P
unsigned offspring_size; // -O
unsigned int MaxSize; // -S
unsigned int InitMaxDepth; // -D
@ -41,72 +41,72 @@ struct Parameters{
Parameters(int argc, char **argv)
{
eoParser parser(argc,argv);
// generations
eoValueParam<unsigned int> paramGenerations(1, "generations", "Generations", 'G', false);
parser.processParam( paramGenerations );
nGenerations = paramGenerations.value();
cerr << "nGenerations= " << nGenerations << endl;
// populationsize
eoValueParam<unsigned int> paramPopulationSize(10, "populationsize", "PopulationSize", 'P', false);
parser.processParam( paramPopulationSize );
population_size = paramPopulationSize.value();
cerr << "population_size= " << population_size << endl;
// offspringsize
eoValueParam<unsigned int> paramOffspringSize(population_size, "offspringsize", "OffspringSize", 'O', false);
parser.processParam( paramOffspringSize );
offspring_size = paramOffspringSize.value();
cerr << "offspring_size= " << offspring_size << endl;
// maxsize
eoValueParam<unsigned int> paramMaxSize(15, "maxsize", "MaxSize", 'S', false);
parser.processParam( paramMaxSize );
MaxSize = paramMaxSize.value();
cerr << "MaxSize= " << MaxSize << endl;
// initialmaxdepth
eoValueParam<unsigned int> paramInitialMaxDepth(4, "initialmaxdepth", "InitialMaxDepth", 'D', false);
parser.processParam( paramInitialMaxDepth );
InitMaxDepth = paramInitialMaxDepth.value();
cerr << "InitMaxDepth= " << InitMaxDepth << endl;
// randomseed
eoValueParam<unsigned int> paramRandomSeed(1, "randomseed", "Random Seed", 'R', false);
parser.processParam( paramRandomSeed );
randomseed = paramRandomSeed.value();
cerr << "randomseed= " << randomseed << endl;
// crossover-rate
eoValueParam<double> paramXover(0.75, "crossoverrate", "crossover rate", 'x', false);
parser.processParam(paramXover );
xover_rate = paramXover.value();
cerr << "xover_rate= " << xover_rate << endl;
//mutation-rate
eoValueParam<double> paramMutation(0.25, "mutationrate", "mutation rate", 'm', false);
parser.processParam(paramMutation );
mutation_rate = paramMutation.value();
cerr << "mutation_rate= " << mutation_rate << endl;
//tournament size
eoValueParam<unsigned int > paramTournamentSize(5, "tournamentsize", "tournament size", 't', false);
parser.processParam(paramTournamentSize );
tournamentsize = paramTournamentSize.value();
cerr << "Tournament Size= " << tournamentsize << endl;
if (parser.userNeedsHelp())
{
parser.printHelp(cout);
exit(1);
parser.printHelp(cout);
exit(1);
}
};
~Parameters(){};
};
};
#endif

View file

@ -18,8 +18,8 @@ LINK_DIRECTORIES(${EO_BINARY_DIR}/lib)
SET (MASTERMIND_SOURCES mastermind.cpp)
# no matter what is the OS, hopefully
ADD_EXECUTABLE(mastermind ${MASTERMIND_SOURCES})
ADD_EXECUTABLE(mastermind ${MASTERMIND_SOURCES})
ADD_DEPENDENCIES(mastermind eo eoutils)
######################################################################################
@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(mastermind PROPERTIES VERSION "${MASTERMIND_VERSION}")
TARGET_LINK_LIBRARIES(mastermind eo eoutils)
######################################################################################

View file

@ -51,8 +51,8 @@ int main(int argc, char** argv)
}
catch (exception& e)
{
cerr << argv[0] << ": " << e.what() << endl;
exit(EXIT_FAILURE);
cerr << argv[0] << ": " << e.what() << endl;
exit(EXIT_FAILURE);
}
return 0;

170
eo/config.guess vendored
View file

@ -3,7 +3,7 @@
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
timestamp='2004-03-03'
timestamp='2011-05-05'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@ -186,7 +186,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
fi
;;
*)
os=netbsd
os=netbsd
;;
esac
# The OS release
@ -270,7 +270,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
@ -342,7 +342,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo i370-ibm-openedition
exit 0 ;;
*:OS400:*:*)
echo powerpc-ibm-os400
echo powerpc-ibm-os400
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
@ -419,23 +419,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
exit 0 ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit 0 ;;
echo m68k-milan-mint${UNAME_RELEASE}
exit 0 ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit 0 ;;
echo m68k-hades-mint${UNAME_RELEASE}
exit 0 ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit 0 ;;
@ -504,8 +504,8 @@ EOF
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@ -614,52 +614,52 @@ EOF
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
32) HP_ARCH="hppa2.0n" ;;
64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
esac ;;
esac
esac ;;
esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
#define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
int main ()
{
#if defined(_SC_KERNEL_BITS)
long bits = sysconf(_SC_KERNEL_BITS);
#endif
long cpu = sysconf (_SC_CPU_VERSION);
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
switch (cpu)
{
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
case CPU_PA_RISC2_0:
#if defined(_SC_KERNEL_BITS)
switch (bits)
{
case 64: puts ("hppa2.0w"); break;
case 32: puts ("hppa2.0n"); break;
default: puts ("hppa2.0"); break;
} break;
#else /* !defined(_SC_KERNEL_BITS) */
puts ("hppa2.0"); break;
#endif
default: puts ("hppa1.0"); break;
}
exit (0);
}
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
@ -739,22 +739,22 @@ EOF
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
@ -778,14 +778,14 @@ EOF
exit 0 ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
5000:UNIX_System_V:4.*:*)
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@ -919,7 +919,7 @@ EOF
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC}
@ -961,7 +961,7 @@ EOF
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux"
;;
@ -1013,11 +1013,11 @@ EOF
echo i386-sequent-sysv4
exit 0 ;;
i*86:UNIX_SV:4.2MP:2.*)
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# Unixware is an offshoot of SVR4, but it has its own version
# number series starting with 2...
# I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
# Use sysv4.2uw... so that sysv4* matches it.
# Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;;
i*86:OS/2:*:*)
@ -1076,10 +1076,10 @@ EOF
exit 0 ;;
pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
exit 0 ;;
exit 0 ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit 0 ;;
@ -1114,8 +1114,8 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4 && exit 0 ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit 0 ;;
@ -1149,9 +1149,9 @@ EOF
fi
exit 0 ;;
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
# says <Richard.M.Bartel@ccMail.Census.GOV>
echo i586-unisys-sysv4
exit 0 ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
@ -1173,11 +1173,11 @@ EOF
exit 0 ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
echo mips-unknown-sysv${UNAME_RELEASE}
fi
exit 0 ;;
exit 0 ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit 0 ;;
@ -1262,7 +1262,7 @@ EOF
echo pdp10-unknown-its
exit 0 ;;
SEI:*:*:SEIUX)
echo mips-sei-seiux${UNAME_RELEASE}
echo mips-sei-seiux${UNAME_RELEASE}
exit 0 ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
@ -1289,11 +1289,11 @@ main ()
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
"4"
#else
""
#endif
); exit (0);
); exit (0);
#endif
#endif

View file

@ -71,5 +71,3 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
#cmakedefine size_t

View file

@ -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
mak@dhi.dk
Marc.Schoenauer@polytechnique.fr
mak@dhi.dk
*/
//-----------------------------------------------------------------------------
@ -43,7 +43,7 @@ public:
eoInitVirus(unsigned _combien, eoRndGenerator<bool>& _generator )
: combien(_combien), generator(_generator) {}
virtual void operator()( eoVirus<FitT>& chrom)
{
chrom.resize(combien);
@ -54,7 +54,7 @@ public:
}
chrom.invalidate();
}
private :
unsigned combien;
/// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics
@ -68,7 +68,7 @@ public:
eoInitVirus1bit(unsigned _combien, eoRndGenerator<bool>& _generator )
: combien(_combien), generator(_generator) {}
virtual void operator()( eoVirus<FitT>& chrom)
{
chrom.resize(combien);
@ -77,7 +77,7 @@ public:
chrom.virusBitSet(0, true );
chrom.invalidate();
}
private :
unsigned combien;
/// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics

View file

@ -1,8 +1,8 @@
// Boost config.hpp configuration header file ------------------------------//
// (C) Copyright John Maddock 2002.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// (C) Copyright John Maddock 2002.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
@ -57,14 +57,3 @@
#include <boost/config/suffix.hpp>
#endif // BOOST_CONFIG_HPP

View file

@ -1,7 +1,7 @@
// abi_prefix header -------------------------------------------------------//
// © Copyright John Maddock 2003
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).

View file

@ -1,7 +1,7 @@
// abi_sufffix header -------------------------------------------------------//
// © Copyright John Maddock 2003
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
@ -19,5 +19,3 @@
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif

View file

@ -18,13 +18,13 @@ USAGE:
Before including this header you must define one or more of define the following macros:
BOOST_LIB_NAME: Required: A string containing the basename of the library,
for example boost_regex.
for example boost_regex.
BOOST_LIB_TOOLSET: Optional: the base name of the toolset.
BOOST_DYN_LINK: Optional: when set link to dll rather than static library.
BOOST_LIB_DIAGNOSTIC: Optional: when set the header will print out the name
of the library selected (useful for debugging).
of the library selected (useful for debugging).
BOOST_AUTO_LINK_NOMANGLE: Specifies that we should link to BOOST_LIB_NAME.lib,
rather than a mangled-name version.
rather than a mangled-name version.
These macros will be undef'ed at the end of the header, further this header
has no include guards - so be sure to include it only once from your library!
@ -56,13 +56,13 @@ BOOST_LIB_TOOLSET: The compiler toolset name (vc6, vc7, bcb5 etc).
BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used,
contains one or more of the following letters after
a hiphen:
contains one or more of the following letters after
a hiphen:
s static runtime (dynamic if not present).
d debug build (release if not present).
g debug/diagnostic runtime (release if not present).
p STLPort Build.
s static runtime (dynamic if not present).
d debug build (release if not present).
g debug/diagnostic runtime (release if not present).
p STLPort Build.
BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
@ -342,13 +342,3 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
#if defined(BOOST_AUTO_LINK_NOMANGLE)
# undef BOOST_AUTO_LINK_NOMANGLE
#endif

View file

@ -1,5 +1,4 @@
// (C) Copyright John maddock 1999.
// (C) Copyright John maddock 1999.
// (C) David Abrahams 2002. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@ -33,7 +32,7 @@
namespace std
{
template<>
class numeric_limits<BOOST_LLT>
class numeric_limits<BOOST_LLT>
{
public:
@ -82,11 +81,11 @@ namespace std
BOOST_STATIC_CONSTANT(bool, traps = false);
BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
};
template<>
class numeric_limits<BOOST_ULLT>
class numeric_limits<BOOST_ULLT>
{
public:
@ -135,9 +134,9 @@ namespace std
BOOST_STATIC_CONSTANT(bool, traps = false);
BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
};
}
#endif
#endif
#endif

View file

@ -4,7 +4,7 @@
//-----------------------------------------------------------------------------
// eoAge.h
// (c) GeNeura Team, 1998
/*
/*
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
@ -38,7 +38,7 @@ using namespace std;
//-----------------------------------------------------------------------------
/** eoAge is a template class that adds an age to an object.\\
Requisites for template instantiation are that the object must admit a default ctor
Requisites for template instantiation are that the object must admit a default ctor
and a copy ctor. The Object must be an eoObject, thus, it must have its methods: className,
printOn, readFrom.
@see eoObject
@ -55,7 +55,7 @@ class eoAged: public Object
/// Virtual dtor. They are needed in virtual class hierarchies
virtual ~eoAged() {};
///returns the age of the object
unsigned long Age() const {return age;}
@ -67,7 +67,7 @@ class eoAged: public Object
readFrom and printOn are directly inherited from eo1d
*/
//@{
/** Return the class id. This should be redefined in each class; but
/** Return the class id. This should be redefined in each class; but
it's got code as an example of implementation. Only "leaf" classes
can be non-virtual.
*/
@ -83,7 +83,7 @@ class eoAged: public Object
_is >> age;
}
/**
* Write object. It's called printOn since it prints the object _on_ a stream.
* @param _os A ostream.
@ -93,7 +93,7 @@ class eoAged: public Object
_os << age;
}
//@}
private:
/** Default Constructor. \\
@ -106,4 +106,3 @@ class eoAged: public Object
};
#endif EOAGE_H

View file

@ -1,9 +1,9 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// eoDrawable.h
// eoDrawable.h
// (c) GeNeura Team, 1999
/*
/*
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
@ -27,38 +27,38 @@
//-----------------------------------------------------------------------------
using namespace std;
using namespace std;
//-----------------------------------------------------------------------------
// eoDrawable
//-----------------------------------------------------------------------------
/** eoDrawable is a template class that adds a drawing interface to an object.\\
Requisites for template instantiation are that the object must admit a default ctor
and a copy ctor. The Object must be an eoObject, thus, it must have its methods: className,
eoDrawables can be drawn on any two-dimensional surface; it can be added to any
object with above characteristics.
@see eoObject
*/
/** eoDrawable is a template class that adds a drawing interface to an object.
Requisites for template instantiation are that the object must admit a default ctor
and a copy ctor. The Object must be an eoObject, thus, it must have its methods: className,
eoDrawables can be drawn on any two-dimensional surface; it can be added to any
object with above characteristics.
@see eoObject
*/
template <class Object>
class eoDrawable
{
public:
/// Main ctor from an already built Object.
eoDrawable( const Object& _o): Object( _o ){};
/// Main ctor from an already built Object.
eoDrawable( const Object& _o): Object( _o ){};
/// Copy constructor.
eoDrawable( const eoDrawable& _d): Object( _d ){};
/// Virtual dtor. They are needed in virtual class hierarchies
virtual ~eoDrawable() {};
/**Draws the object. It must be redefined in any subclass, it´s impossible
to have a general drawing method
@param _x, _y coorinates */
virtual void draw( unsigned _x, unsigned _y) = 0;
};
eoDrawable( const eoDrawable& _d): Object( _d ){};
#endif EODRAWABLE_H
/// Virtual dtor. They are needed in virtual class hierarchies
virtual ~eoDrawable() {};
/**Draws the object. It must be redefined in any subclass, it´s impossible
to have a general drawing method
@param _x, _y coorinates */
virtual void draw( unsigned _x, unsigned _y) = 0;
};
#endif //! EODRAWABLE_H

View file

@ -9,9 +9,9 @@ PREFIX = "/usr"
DATA = {
'dirs': [ "%s/share/%s" % (PREFIX, NAME) ],
'links': [ ("%s/src" % SOURCE, "%s/include/%s" % (PREFIX, NAME)),
("%s/doc" % BINARY, "%s/share/%s/doc" % (PREFIX, NAME)),
("%s/%s.pc" % (BINARY, NAME), "%s/lib/pkgconfig/%s.pc" % (PREFIX, NAME)),
]
("%s/doc" % BINARY, "%s/share/%s/doc" % (PREFIX, NAME)),
("%s/%s.pc" % (BINARY, NAME), "%s/lib/pkgconfig/%s.pc" % (PREFIX, NAME)),
]
}
LIBRARIES = ["libcma.a", "libeo.a", "libeoutils.a", "libes.a", "libga.a"]
@ -21,8 +21,8 @@ import os, sys
def isroot():
if os.getuid() != 0:
print '[WARNING] you have to be root'
return False
print '[WARNING] you have to be root'
return False
return True
def uninstall():
@ -41,11 +41,11 @@ def data():
if __name__ == '__main__':
if not isroot():
sys.exit()
sys.exit()
if len(sys.argv) < 2:
print 'Usage: %s [install|uninstall|data]' % sys.argv[0]
sys.exit()
print 'Usage: %s [install|uninstall|data]' % sys.argv[0]
sys.exit()
if sys.argv[1] == 'install': install()
elif sys.argv[1] == 'uninstall': uninstall()

View file

@ -11,14 +11,15 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(EO_LIB_OUTPUT_PATH ${EO_BINARY_DIR}/lib)
SET(LIBRARY_OUTPUT_PATH ${EO_LIB_OUTPUT_PATH})
SET (EO_SOURCES eoFunctorStore.cpp
eoPersistent.cpp
eoPrintable.cpp
eoCtrlCContinue.cpp
eoScalarFitnessAssembled.cpp
eoSIGContinue.cpp)
SET(EO_SOURCES
eoFunctorStore.cpp
eoPersistent.cpp
eoPrintable.cpp
eoCtrlCContinue.cpp
eoScalarFitnessAssembled.cpp
eoSIGContinue.cpp
)
ADD_LIBRARY(eo STATIC ${EO_SOURCES})
INSTALL(TARGETS eo ARCHIVE DESTINATION lib COMPONENT libraries)
@ -42,6 +43,6 @@ ADD_SUBDIRECTORY(ga)
ADD_SUBDIRECTORY(gp)
ADD_SUBDIRECTORY(other)
ADD_SUBDIRECTORY(utils)
ADD_SUBDIRECTORY(pyeo)
######################################################################################

View file

@ -40,17 +40,17 @@
*/
/** EO is the base class for objects with a fitness.
Those evolvable objects are the subjects of
evolution. EOs have only got a fitness, which at the same time needs to be
only an object with the operation less than (<) defined. Fitness says how
good is the object; evolution or change of these objects is left to the
genetic operators.
genetic operators.
A fitness less than another means a worse fitness, in
whatever the context; thus, fitness is always maximized; although it can
be minimized with a proper definition of the < operator.
be minimized with a proper definition of the < operator.
A fitness can be invalid if undefined, trying to read an invalid fitness will raise an error.
@ref Operators that effectively modify EO objects must invalidate them.
@ -123,23 +123,23 @@ public:
* @throw runtime_std::exception If a valid object can't be read.
*/
virtual void readFrom(std::istream& _is) {
// the new version of the reafFrom function.
// It can distinguish between valid and invalid fitness values.
// It can distinguish between valid and invalid fitness values.
std::string fitness_str;
int pos = _is.tellg();
_is >> fitness_str;
_is >> fitness_str;
if (fitness_str == "INVALID")
{
invalidFitness = true;
}
else
{
invalidFitness = false;
_is.seekg(pos); // rewind
_is >> repFitness;
}
if (fitness_str == "INVALID")
{
invalidFitness = true;
}
else
{
invalidFitness = false;
_is.seekg(pos); // rewind
_is >> repFitness;
}
}
/**
@ -151,13 +151,13 @@ public:
// the latest version of the code. Very similar to the old code
if (invalid()) {
_os << "INVALID ";
_os << "INVALID ";
}
else
{
_os << repFitness << ' ';
_os << repFitness << ' ';
}
}
//@}
@ -171,4 +171,3 @@ private:
#endif
/** @} */

View file

@ -1,5 +1,5 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
//-----------------------------------------------------------------------------
// PO.h
// (c) OPAC 2007
@ -43,11 +43,11 @@ template < class F > class PO:public EO < F >
public:
#if defined(__CUDACC__)
typedef typename EO < F >::Fitness Fitness;
#else
typedef typename PO<F>::Fitness Fitness;
#endif
#if defined(__CUDACC__)
typedef typename EO < F >::Fitness Fitness;
#else
typedef typename PO<F>::Fitness Fitness;
#endif
/** Default constructor.
Fitness must have a ctor which takes 0 as a value. Best fitness mush also have the same constructor.

View file

@ -26,8 +26,12 @@
#ifndef _apply_h
#define _apply_h
#include <utils/eoParallel.h>
#include <utils/eoParser.h>
#include <utils/eoLogger.h>
#include <eoFunctor.h>
#include <vector>
#include <omp.h>
/**
Applies a unary function to a std::vector of things.
@ -37,7 +41,76 @@
template <class EOT>
void apply(eoUF<EOT&, void>& _proc, std::vector<EOT>& _pop)
{
for (unsigned i = 0; i < _pop.size(); ++i)
size_t size = _pop.size();
#ifdef _OPENMP
double t1 = 0;
if ( eo::parallel.enableResults() )
{
t1 = omp_get_wtime();
}
if (!eo::parallel.isDynamic())
{
#pragma omp parallel for if(eo::parallel.isEnabled()) //default(none) shared(_proc, _pop, size)
for (size_t i = 0; i < size; ++i) { _proc(_pop[i]); }
}
else
{
#pragma omp parallel for schedule(dynamic) if(eo::parallel.isEnabled())
//doesnot work with gcc 4.1.2
//default(none) shared(_proc, _pop, size)
for (size_t i = 0; i < size; ++i) { _proc(_pop[i]); }
}
if ( eo::parallel.enableResults() )
{
double t2 = omp_get_wtime();
eoLogger log;
log << eo::file(eo::parallel.prefix()) << t2 - t1 << ' ';
}
#else // _OPENMP
for (size_t i = 0; i < size; ++i) { _proc(_pop[i]); }
#endif // !_OPENMP
}
/**
This is a variant of apply<EOT> which is called in parallel
thanks to OpenMP.
@ingroup Utilities
*/
template <class EOT>
void omp_apply(eoUF<EOT&, void>& _proc, std::vector<EOT>& _pop)
{
size_t size = _pop.size();
#pragma omp parallel for if(eo::parallel.isEnabled())
//doesnot work with gcc 4.1.2
//default(none) shared(_proc, _pop, size)
for (size_t i = 0; i < size; ++i)
{
_proc(_pop[i]);
}
}
/**
And now we are using the dynamic scheduling.
@ingroup Utilities
*/
template <class EOT>
void omp_dynamic_apply(eoUF<EOT&, void>& _proc, std::vector<EOT>& _pop)
{
size_t size = _pop.size();
#pragma omp parallel for if(eo::parallel.isEnabled()) schedule(dynamic)
//doesnot work with gcc 4.1.2
//default(none) shared(_proc, _pop, size)
for (size_t i = 0; i < size; ++i)
{
_proc(_pop[i]);
}

View file

@ -9,11 +9,11 @@ the functions here for eoBit<double> AND eoBit<eoMinimizingFitness>
and in EO test dir the t-eoGA.cpp file that is a sample program that uses
the whole facility.
All make_XXX.h file define some parser-based constructions of basic
All make_XXX.h file define some parser-based constructions of basic
Evolutionary Algorithms components, using state-based memory management
(see in src/utils dir, or read the tutorial).
In this src/do dir, the following ***representation indedendent*** code
In this src/do dir, the following ***representation indedendent*** code
is defined
make_algo_scalar.h The selection/replacement for scalar fitnesses
@ -23,7 +23,7 @@ make_pop.h Init of the population (from an EOT initializer)
make_run.h Run the algorithm
See also (NOW MOVED TO util DIR, as it was useful everywhere)
make_help.cpp Help on demand (+ status file)
make_help.cpp Help on demand (+ status file)
Note:
-----

View file

@ -3,7 +3,7 @@
//-----------------------------------------------------------------------------
// make_algo_easea.h
// (c) Marc Schoenauer and Pierre Collet, 2002
/*
/*
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
@ -81,18 +81,18 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
eoParamParamType & ppSelect = selectionParam.value(); // std::pair<std::string,std::vector<std::string> >
eoSelectOne<EOT>* select ;
if (ppSelect.first == std::string("DetTour"))
if (ppSelect.first == std::string("DetTour"))
{
unsigned detSize;
if (!ppSelect.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2;
// put back 2 in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("2"));
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2;
// put back 2 in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("2"));
}
else // parameter passed by user as DetTour(T)
else // parameter passed by user as DetTour(T)
detSize = atoi(ppSelect.second[0].c_str());
select = new eoDetTournamentSelect<EOT>(detSize);
}
@ -100,57 +100,57 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
{
double p;
if (!ppSelect.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1;
// put back p in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("1"));
}
else // parameter passed by user as DetTour(T)
p = atof(ppSelect.second[0].c_str());
{
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1;
// put back p in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("1"));
}
else // parameter passed by user as DetTour(T)
p = atof(ppSelect.second[0].c_str());
select = new eoStochTournamentSelect<EOT>(p);
}
else if (ppSelect.first == std::string("Ranking"))
{
double p,e;
if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent
{
p = atof(ppSelect.second[0].c_str());
e = atof(ppSelect.second[1].c_str());
}
else if (ppSelect.second.size()==1) // 1 parameter: pressure
{
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
e = 1;
ppSelect.second.push_back(std::string("1"));
p = atof(ppSelect.second[0].c_str());
}
{
p = atof(ppSelect.second[0].c_str());
e = atof(ppSelect.second[1].c_str());
}
else if (ppSelect.second.size()==1) // 1 parameter: pressure
{
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
e = 1;
ppSelect.second.push_back(std::string("1"));
p = atof(ppSelect.second[0].c_str());
}
else // no parameters ... or garbage
{
std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
p=2;
e=1;
// put back in parameter for consistency (and status file)
ppSelect.second.resize(2); // just in case
ppSelect.second[0] = (std::string("2"));
ppSelect.second[1] = (std::string("1"));
}
{
std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
p=2;
e=1;
// put back in parameter for consistency (and status file)
ppSelect.second.resize(2); // just in case
ppSelect.second[0] = (std::string("2"));
ppSelect.second[1] = (std::string("1"));
}
// check for authorized values
// pressure in (0,1]
if ( (p<=1) || (p>2) )
{
std::cerr << "WARNING, selective pressure must be in (1,2] in Ranking, using 2\n";
p=2;
ppSelect.second[0] = (std::string("2"));
}
{
std::cerr << "WARNING, selective pressure must be in (1,2] in Ranking, using 2\n";
p=2;
ppSelect.second[0] = (std::string("2"));
}
// exponent >0
if (e<=0)
{
std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
e=1;
ppSelect.second[1] = (std::string("1"));
}
{
std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
e=1;
ppSelect.second[1] = (std::string("1"));
}
// now we're OK
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
select = new eoRouletteWorthSelect<EOT>(p2w);
@ -159,13 +159,13 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
{
bool b;
if (ppSelect.second.size() == 0) // no argument -> default = ordered
{
b=true;
// put back in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("ordered"));
}
{
b=true;
// put back in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("ordered"));
}
else
b = !(ppSelect.second[0] == std::string("unordered"));
b = !(ppSelect.second[0] == std::string("unordered"));
select = new eoSequentialSelect<EOT>(b);
}
else if (ppSelect.first == std::string("EliteSequential")) // Best first, one after the other in random order afterwards
@ -188,7 +188,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
_state.storeFunctor(select);
// the number of offspring
// the number of offspring
eoValueParam<eoHowMany>& offspringRateParam = _parser.createParam(eoHowMany(1.0), "nbOffspring", "Nb of offspring (percentage or absolute)", 'O', "Evolution Engine");
/////////////////////////////////////////////////////
@ -196,7 +196,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
/////////////////////////////////////////////////////
/** Replacement type - high level: predefined replacements
* ESComma :
* ESComma :
* elite = 0
* surviveParents=0 (no reduce)
* surviveOffspring=100% (no reduce)
@ -208,8 +208,8 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
* GGA : generational GA - idem ESComma except for
* offspringRate = 100%
* all reducers are unused
*
* SSGA(T/t) : Steady-State GA
*
* SSGA(T/t) : Steady-State GA
* surviveParents = 1.0 - offspringRate
* reduceFinal = DetTour(T>1) ou StochTour(0.5<t<1)
*
@ -246,28 +246,28 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
// the tournament size
if (!replacementParam.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to MGG replacement, using 2" << std::endl;
tSize = 2;
// put back 2 in parameter for consistency (and status file)
replacementParam.second.push_back(std::string("2"));
std::cerr << "WARNING, no parameter passed to MGG replacement, using 2" << std::endl;
tSize = 2;
// put back 2 in parameter for consistency (and status file)
replacementParam.second.push_back(std::string("2"));
}
else
{
t = atof(replacementParam.second[0].c_str());
if (t>=2)
{ // build the appropriate deafult value
tSize = unsigned(t);
}
else
{
throw std::runtime_error("Sorry, only deterministic tournament available at the moment");
}
t = atof(replacementParam.second[0].c_str());
if (t>=2)
{ // build the appropriate deafult value
tSize = unsigned(t);
}
else
{
throw std::runtime_error("Sorry, only deterministic tournament available at the moment");
}
}
ptReplace = new eoMGGReplacement<EOT>(-surviveParents, tSize);
ptReplace = new eoMGGReplacement<EOT>(-surviveParents, tSize);
_state.storeFunctor(ptReplace);
}
else { // until the end of what was the only loop/switch
// the default deafult values
eoHowMany elite (0.0);
bool strongElitism (false);
@ -283,12 +283,12 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
// ---------- General
if (replacementParam.first == std::string("General"))
{
; // defaults OK
; // defaults OK
}
// ---------- ESComma
else if (replacementParam.first == std::string("ESComma"))
{
; // OK too
; // OK too
}
// ---------- ESPlus
else if (replacementParam.first == std::string("ESPlus"))
@ -298,16 +298,16 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
// ---------- Generational
else if (replacementParam.first == std::string("Generational"))
{
; // OK too (we should check nb of offspring)
; // OK too (we should check nb of offspring)
}
// ---------- EP
else if (replacementParam.first == std::string("EP"))
{
if (!replacementParam.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to EP replacement, using 6" << std::endl;
// put back 6 in parameter for consistency (and status file)
replacementParam.second.push_back(std::string("6"));
std::cerr << "WARNING, no parameter passed to EP replacement, using 6" << std::endl;
// put back 6 in parameter for consistency (and status file)
replacementParam.second.push_back(std::string("6"));
}
// by coincidence, the syntax for the EP reducer is the same than here:
reduceFinalType = replacementParam;
@ -318,28 +318,28 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
{
if (!replacementParam.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to SSGA replacement, using 2" << std::endl;
// put back 2 in parameter for consistency (and status file)
replacementParam.second.push_back(std::string("2"));
reduceParentType = eoParamParamType(std::string("DetTour(2)"));
std::cerr << "WARNING, no parameter passed to SSGA replacement, using 2" << std::endl;
// put back 2 in parameter for consistency (and status file)
replacementParam.second.push_back(std::string("2"));
reduceParentType = eoParamParamType(std::string("DetTour(2)"));
}
else
{
t = atof(replacementParam.second[0].c_str());
if (t>=2)
{ // build the appropriate deafult value
reduceParentType = eoParamParamType(std::string("DetTour(") + replacementParam.second[0].c_str() + ")");
}
else // check for [0.5,1] will be made in make_general_replacement
{ // build the appropriate deafult value
reduceParentType = eoParamParamType(std::string("StochTour(") + replacementParam.second[0].c_str() + ")");
}
t = atof(replacementParam.second[0].c_str());
if (t>=2)
{ // build the appropriate deafult value
reduceParentType = eoParamParamType(std::string("DetTour(") + replacementParam.second[0].c_str() + ")");
}
else // check for [0.5,1] will be made in make_general_replacement
{ // build the appropriate deafult value
reduceParentType = eoParamParamType(std::string("StochTour(") + replacementParam.second[0].c_str() + ")");
}
}
//
//
surviveParents = eoHowMany(-1);
surviveOffspring = eoHowMany(1);
}
else // no replacement recognized
else // no replacement recognized
{
throw std::runtime_error("Invalid replacement type " + replacementParam.first);
}
@ -353,7 +353,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
///////////////////////////////
// the general breeder
///////////////////////////////
eoGeneralBreeder<EOT> *breed =
eoGeneralBreeder<EOT> *breed =
new eoGeneralBreeder<EOT>(*select, _op, offspringRateParam.value());
_state.storeFunctor(breed);
@ -381,7 +381,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
template <class EOT>
eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<EOT>& _eval, eoContinue<EOT>& _continue, eoGenOp<EOT>& _op)
{
do_make_algo_scalar( _parser, _state, *(new eoPopLoopEval<EOT>(_eval)), _continue, _op);
do_make_algo_scalar( _parser, _state, *(new eoPopLoopEval<EOT>(_eval)), _continue, _op);
}

View file

@ -3,7 +3,7 @@
//-----------------------------------------------------------------------------
// make_algo_scalar.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
@ -84,42 +84,42 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
if (_dist == NULL)
comment = "Selection: DetTour(T), StochTour(t), Roulette, Ranking(p,e) or Sequential(ordered/unordered)";
else
comment = "Selection: DetTour(T), StochTour(t), Roulette, Ranking(p,e), Sharing(sigma_share) or Sequential(ordered/unordered)";
comment = "Selection: DetTour(T), StochTour(t), Roulette, Ranking(p,e), Sharing(sigma_share) or Sequential(ordered/unordered)";
eoValueParam<eoParamParamType>& selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection", comment, 'S', "Evolution Engine");
eoParamParamType & ppSelect = selectionParam.value(); // std::pair<std::string,std::vector<std::string> >
eoSelectOne<EOT>* select ;
if (ppSelect.first == std::string("DetTour"))
if (ppSelect.first == std::string("DetTour"))
{
unsigned detSize;
if (!ppSelect.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2;
// put back 2 in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("2"));
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2;
// put back 2 in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("2"));
}
else // parameter passed by user as DetTour(T)
else // parameter passed by user as DetTour(T)
detSize = atoi(ppSelect.second[0].c_str());
select = new eoDetTournamentSelect<EOT>(detSize);
}
else if (ppSelect.first == std::string("Sharing"))
else if (ppSelect.first == std::string("Sharing"))
{
double nicheSize;
if (!ppSelect.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to Sharing, using 0.5" << std::endl;
nicheSize = 0.5;
// put back 2 in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("0.5"));
std::cerr << "WARNING, no parameter passed to Sharing, using 0.5" << std::endl;
nicheSize = 0.5;
// put back 2 in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("0.5"));
}
else // parameter passed by user as DetTour(T)
else // parameter passed by user as DetTour(T)
nicheSize = atof(ppSelect.second[0].c_str());
if (_dist == NULL) // no distance
if (_dist == NULL) // no distance
throw std::runtime_error("You didn't specify a distance when calling make_algo_scalar and using sharing");
select = new eoSharingSelect<EOT>(nicheSize, *_dist);
}
@ -127,57 +127,57 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
{
double p;
if (!ppSelect.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1;
// put back p in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("1"));
}
else // parameter passed by user as DetTour(T)
p = atof(ppSelect.second[0].c_str());
{
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1;
// put back p in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("1"));
}
else // parameter passed by user as DetTour(T)
p = atof(ppSelect.second[0].c_str());
select = new eoStochTournamentSelect<EOT>(p);
}
else if (ppSelect.first == std::string("Ranking"))
{
double p,e;
if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent
{
p = atof(ppSelect.second[0].c_str());
e = atof(ppSelect.second[1].c_str());
}
else if (ppSelect.second.size()==1) // 1 parameter: pressure
{
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
e = 1;
ppSelect.second.push_back(std::string("1"));
p = atof(ppSelect.second[0].c_str());
}
{
p = atof(ppSelect.second[0].c_str());
e = atof(ppSelect.second[1].c_str());
}
else if (ppSelect.second.size()==1) // 1 parameter: pressure
{
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
e = 1;
ppSelect.second.push_back(std::string("1"));
p = atof(ppSelect.second[0].c_str());
}
else // no parameters ... or garbage
{
std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
p=2;
e=1;
// put back in parameter for consistency (and status file)
ppSelect.second.resize(2); // just in case
ppSelect.second[0] = (std::string("2"));
ppSelect.second[1] = (std::string("1"));
}
{
std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
p=2;
e=1;
// put back in parameter for consistency (and status file)
ppSelect.second.resize(2); // just in case
ppSelect.second[0] = (std::string("2"));
ppSelect.second[1] = (std::string("1"));
}
// check for authorized values
// pressure in (0,1]
if ( (p<=1) || (p>2) )
{
std::cerr << "WARNING, selective pressure must be in (0,1] in Ranking, using 2\n";
p=2;
ppSelect.second[0] = (std::string("2"));
}
{
std::cerr << "WARNING, selective pressure must be in (0,1] in Ranking, using 2\n";
p=2;
ppSelect.second[0] = (std::string("2"));
}
// exponent >0
if (e<=0)
{
std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
e=1;
ppSelect.second[1] = (std::string("1"));
}
{
std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
e=1;
ppSelect.second[1] = (std::string("1"));
}
// now we're OK
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
select = new eoRouletteWorthSelect<EOT>(p2w);
@ -186,13 +186,13 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
{
bool b;
if (ppSelect.second.size() == 0) // no argument -> default = ordered
{
b=true;
// put back in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("ordered"));
}
{
b=true;
// put back in parameter for consistency (and status file)
ppSelect.second.push_back(std::string("ordered"));
}
else
b = !(ppSelect.second[0] == std::string("unordered"));
b = !(ppSelect.second[0] == std::string("unordered"));
select = new eoSequentialSelect<EOT>(b);
}
else if (ppSelect.first == std::string("Roulette")) // no argument (yet)
@ -211,7 +211,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
_state.storeFunctor(select);
// the number of offspring
// the number of offspring
eoValueParam<eoHowMany>& offspringRateParam = _parser.createParam(eoHowMany(1.0), "nbOffspring", "Nb of offspring (percentage or absolute)", 'O', "Evolution Engine");
// the replacement
@ -231,16 +231,16 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
else if (ppReplace.first == std::string("EPTour"))
{
unsigned detSize;
if (!ppReplace.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to EPTour, using 6" << std::endl;
detSize = 6;
// put back in parameter for consistency (and status file)
ppReplace.second.push_back(std::string("6"));
}
else // parameter passed by user as EPTour(T)
detSize = atoi(ppSelect.second[0].c_str());
{
std::cerr << "WARNING, no parameter passed to EPTour, using 6" << std::endl;
detSize = 6;
// put back in parameter for consistency (and status file)
ppReplace.second.push_back(std::string("6"));
}
else // parameter passed by user as EPTour(T)
detSize = atoi(ppSelect.second[0].c_str());
replace = new eoEPReplacement<EOT>(detSize);
}
@ -251,32 +251,32 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
else if (ppReplace.first == std::string("SSGADet"))
{
unsigned detSize;
if (!ppReplace.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to SSGADet, using 2" << std::endl;
detSize = 2;
// put back in parameter for consistency (and status file)
ppReplace.second.push_back(std::string("2"));
}
else // parameter passed by user as SSGADet(T)
detSize = atoi(ppSelect.second[0].c_str());
{
std::cerr << "WARNING, no parameter passed to SSGADet, using 2" << std::endl;
detSize = 2;
// put back in parameter for consistency (and status file)
ppReplace.second.push_back(std::string("2"));
}
else // parameter passed by user as SSGADet(T)
detSize = atoi(ppSelect.second[0].c_str());
replace = new eoSSGADetTournamentReplacement<EOT>(detSize);
}
else if (ppReplace.first == std::string("SSGAStoch"))
{
double p;
if (!ppReplace.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to SSGAStoch, using 1" << std::endl;
p = 1;
// put back in parameter for consistency (and status file)
ppReplace.second.push_back(std::string("1"));
}
else // parameter passed by user as SSGADet(T)
p = atof(ppSelect.second[0].c_str());
{
std::cerr << "WARNING, no parameter passed to SSGAStoch, using 1" << std::endl;
p = 1;
// put back in parameter for consistency (and status file)
ppReplace.second.push_back(std::string("1"));
}
else // parameter passed by user as SSGADet(T)
p = atof(ppSelect.second[0].c_str());
replace = new eoSSGAStochTournamentReplacement<EOT>(p);
}
else
@ -294,10 +294,10 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
eoReplacement<EOT> *replaceTmp = replace;
replace = new eoWeakElitistReplacement<EOT>(*replaceTmp);
_state.storeFunctor(replace);
}
}
// the general breeder
eoGeneralBreeder<EOT> *breed =
eoGeneralBreeder<EOT> *breed =
new eoGeneralBreeder<EOT>(*select, _op, offspringRateParam.value());
_state.storeFunctor(breed);

View file

@ -129,7 +129,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
eoValueParam<bool>& eraseParam = _parser.createParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk");
bool dirOK = false; // not tested yet
bool dirOK = false; // not tested yet
@ -179,15 +179,15 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
{
bestStat = new eoBestFitnessStat<EOT>;
bestStat = new eoBestFitnessStat<EOT>;
// store it
// store it
_state.storeFunctor(bestStat);
_state.storeFunctor(bestStat);
// add it to the checkpoint
// add it to the checkpoint
checkpoint->add(*bestStat);
checkpoint->add(*bestStat);
}
@ -203,15 +203,15 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
{
averageStat = new eoAverageStat<EOT>;
averageStat = new eoAverageStat<EOT>;
// store it
// store it
_state.storeFunctor(averageStat);
_state.storeFunctor(averageStat);
// add it to the checkpoint
// add it to the checkpoint
checkpoint->add(*averageStat);
checkpoint->add(*averageStat);
}
@ -223,19 +223,19 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
eoSecondMomentStats<EOT> *secondStat = NULL;
if ( printBestParam.value() || fileBestParam.value() ) // we need it for screen output or file output
if ( printBestParam.value() || fileBestParam.value() ) // we need it for screen output or file output
{
secondStat = new eoSecondMomentStats<EOT>;
secondStat = new eoSecondMomentStats<EOT>;
// store it
// store it
_state.storeFunctor(secondStat);
_state.storeFunctor(secondStat);
// add it to the checkpoint
// add it to the checkpoint
checkpoint->add(*secondStat);
checkpoint->add(*secondStat);
}
@ -255,15 +255,15 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
{
popStat = new eoSortedPopStat<EOT>;
popStat = new eoSortedPopStat<EOT>;
// store it
// store it
_state.storeFunctor(popStat);
_state.storeFunctor(popStat);
// add it to the checkpoint
// add it to the checkpoint
checkpoint->add(*popStat);
checkpoint->add(*popStat);
}
@ -287,7 +287,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
bool needStdoutMonitor = printBestParam.value()
|| printPopParam.value() ;
|| printPopParam.value() ;
@ -297,53 +297,53 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
{
eoStdoutMonitor *monitor = new eoStdoutMonitor(false);
eoStdoutMonitor *monitor = new eoStdoutMonitor(false);
_state.storeFunctor(monitor);
_state.storeFunctor(monitor);
// when called by the checkpoint (i.e. at every generation)
// when called by the checkpoint (i.e. at every generation)
checkpoint->add(*monitor);
checkpoint->add(*monitor);
// the monitor will output a series of parameters: add them
// the monitor will output a series of parameters: add them
monitor->add(*generationCounter);
monitor->add(*generationCounter);
if (useEvalParam.value()) // we want nb of evaluations
if (useEvalParam.value()) // we want nb of evaluations
monitor->add(_eval);
monitor->add(_eval);
if (useTimeParam.value()) // we want time
if (useTimeParam.value()) // we want time
{
{
tCounter = new eoTimeCounter;
tCounter = new eoTimeCounter;
_state.storeFunctor(tCounter);
_state.storeFunctor(tCounter);
checkpoint->add(*tCounter);
checkpoint->add(*tCounter);
monitor->add(*tCounter);
monitor->add(*tCounter);
}
}
if (printBestParam.value())
if (printBestParam.value())
{
{
monitor->add(*bestStat);
monitor->add(*bestStat);
monitor->add(*secondStat);
monitor->add(*secondStat);
}
}
if ( printPopParam.value())
if ( printPopParam.value())
monitor->add(*popStat);
monitor->add(*popStat);
}
@ -353,9 +353,9 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
if ( ( fileBestParam.value() || plotBestParam.value() ||
plotHistogramParam.value() )
plotHistogramParam.value() )
&& !dirOK ) // just in case we add something before
&& !dirOK ) // just in case we add something before
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
@ -367,41 +367,41 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
#ifdef _MSVC
std::string stmp = dirNameParam.value() + "\best.xg";
std::string stmp = dirNameParam.value() + "\best.xg";
#else
std::string stmp = dirNameParam.value() + "/best.xg";
std::string stmp = dirNameParam.value() + "/best.xg";
#endif
eoFileMonitor *fileMonitor = new eoFileMonitor(stmp);
eoFileMonitor *fileMonitor = new eoFileMonitor(stmp);
// save and give to checkpoint
// save and give to checkpoint
_state.storeFunctor(fileMonitor);
_state.storeFunctor(fileMonitor);
checkpoint->add(*fileMonitor);
checkpoint->add(*fileMonitor);
// and feed with some statistics
// and feed with some statistics
fileMonitor->add(*generationCounter);
fileMonitor->add(*generationCounter);
fileMonitor->add(_eval);
fileMonitor->add(_eval);
if (tCounter) // we want the time as well
if (tCounter) // we want the time as well
{
{
// std::cout << "On met timecounter\n";
// std::cout << "On met timecounter\n";
fileMonitor->add(*tCounter);
fileMonitor->add(*tCounter);
}
}
fileMonitor->add(*bestStat);
fileMonitor->add(*bestStat);
fileMonitor->add(*secondStat);
fileMonitor->add(*secondStat);
}
@ -413,33 +413,33 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
{
std::string stmp = dirNameParam.value() + "/gnu_best.xg";
std::string stmp = dirNameParam.value() + "/gnu_best.xg";
eoGnuplot1DMonitor *gnuMonitor = new eoGnuplot1DMonitor(stmp,minimizing_fitness<EOT>());
eoGnuplot1DMonitor *gnuMonitor = new eoGnuplot1DMonitor(stmp,minimizing_fitness<EOT>());
// save and give to checkpoint
// save and give to checkpoint
_state.storeFunctor(gnuMonitor);
_state.storeFunctor(gnuMonitor);
checkpoint->add(*gnuMonitor);
checkpoint->add(*gnuMonitor);
// and feed with some statistics
// and feed with some statistics
if (useEvalParam.value()) // do we want eval as X coordinate
if (useEvalParam.value()) // do we want eval as X coordinate
gnuMonitor->add(_eval);
gnuMonitor->add(_eval);
else if (tCounter) // or time?
else if (tCounter) // or time?
gnuMonitor->add(*tCounter);
gnuMonitor->add(*tCounter);
else // default: generation
else // default: generation
gnuMonitor->add(*generationCounter);
gnuMonitor->add(*generationCounter);
gnuMonitor->add(*bestStat);
gnuMonitor->add(*bestStat);
gnuMonitor->add(*averageStat);
gnuMonitor->add(*averageStat);
}
@ -451,25 +451,25 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
{
eoScalarFitnessStat<EOT> *fitStat = new eoScalarFitnessStat<EOT>;
eoScalarFitnessStat<EOT> *fitStat = new eoScalarFitnessStat<EOT>;
_state.storeFunctor(fitStat);
_state.storeFunctor(fitStat);
checkpoint->add(*fitStat);
checkpoint->add(*fitStat);
// a gnuplot-based monitor for snapshots: needs a dir name
// a gnuplot-based monitor for snapshots: needs a dir name
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value());
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value());
_state.storeFunctor(fitSnapshot);
_state.storeFunctor(fitSnapshot);
// add any stat that is a std::vector<double> to it
// add any stat that is a std::vector<double> to it
fitSnapshot->add(*fitStat);
fitSnapshot->add(*fitStat);
// and of course add it to the checkpoint
// and of course add it to the checkpoint
checkpoint->add(*fitSnapshot);
checkpoint->add(*fitSnapshot);
}
@ -499,7 +499,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
if (! dirOK )
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
@ -537,7 +537,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
if (! dirOK )
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
@ -570,4 +570,3 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
#endif

View file

@ -70,7 +70,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
eoValueParam<std::string>& dirNameParam = _parser.createParam(std::string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output - Disk");
// shoudl we empty it if exists
eoValueParam<bool>& eraseParam = _parser.createParam(false, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk");
bool dirOK = false; // not tested yet
bool dirOK = false; // not tested yet
/////////////////////////////////////////
// now some statistics on the population:
@ -98,11 +98,11 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
if ( printBestParam.value() || plotBestParam.value() || fileBestParam.value() )
// we need the bestStat for at least one of the 3 above
{
bestStat = new eoBestFitnessStat<EOT>;
// store it
_state.storeFunctor(bestStat);
// add it to the checkpoint
checkpoint->add(*bestStat);
bestStat = new eoBestFitnessStat<EOT>;
// store it
_state.storeFunctor(bestStat);
// add it to the checkpoint
checkpoint->add(*bestStat);
}
// Average fitness alone
@ -110,11 +110,11 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
eoAverageStat<EOT> *averageStat = NULL; // do we need averageStat?
if ( plotBestParam.value() ) // we need it for gnuplot output
{
averageStat = new eoAverageStat<EOT>;
// store it
_state.storeFunctor(averageStat);
// add it to the checkpoint
checkpoint->add(*averageStat);
averageStat = new eoAverageStat<EOT>;
// store it
_state.storeFunctor(averageStat);
// add it to the checkpoint
checkpoint->add(*averageStat);
}
// Second moment stats: average and stdev
@ -122,11 +122,11 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
eoSecondMomentStats<EOT> *secondStat = NULL;
if ( printBestParam.value() ) // we need it for sreen output
{
secondStat = new eoSecondMomentStats<EOT>;
// store it
_state.storeFunctor(secondStat);
// add it to the checkpoint
checkpoint->add(*secondStat);
secondStat = new eoSecondMomentStats<EOT>;
// store it
_state.storeFunctor(secondStat);
// add it to the checkpoint
checkpoint->add(*secondStat);
}
@ -136,11 +136,11 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
eoValueParam<bool>& printPopParam = _parser.createParam(false, "printPop", "Print sorted pop. every gen.", '\0', "Output");
if ( printPopParam.value() ) // we do want pop dump
{
popStat = new eoSortedPopStat<EOT>("Dump of whole population");
// store it
_state.storeFunctor(popStat);
// add it to the checkpoint
checkpoint->add(*popStat);
popStat = new eoSortedPopStat<EOT>("Dump of whole population");
// store it
_state.storeFunctor(popStat);
// add it to the checkpoint
checkpoint->add(*popStat);
}
@ -152,14 +152,14 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
eoFDCStat<EOT> *fdcStat = NULL;
if ( printFDCParam.value() || plotFDCParam.value() ) // we need FDCStat
{
// need first an object to compute the distances - here Hamming dist.
eoQuadDistance<EOT> *dist = new eoQuadDistance<EOT>;
_state.storeFunctor(dist);
fdcStat = new eoFDCStat<EOT>(*dist);
// storeFunctor it
_state.storeFunctor(fdcStat);
// add it to the checkpoint
checkpoint->add(*fdcStat);
// need first an object to compute the distances - here Hamming dist.
eoQuadDistance<EOT> *dist = new eoQuadDistance<EOT>;
_state.storeFunctor(dist);
fdcStat = new eoFDCStat<EOT>(*dist);
// storeFunctor it
_state.storeFunctor(fdcStat);
// add it to the checkpoint
checkpoint->add(*fdcStat);
}
// do we wnat some histogram of fitnesses snpashots?
@ -170,95 +170,95 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
///////////////
// do we want an eoStdoutMonitor?
bool needStdoutMonitor = printBestParam.value() || printFDCParam.value()
|| printPopParam.value() ;
|| printPopParam.value() ;
// The Stdout monitor will print parameters to the screen ...
if ( needStdoutMonitor )
{
eoStdoutMonitor *monitor = new eoStdoutMonitor(false);
_state.storeFunctor(monitor);
eoStdoutMonitor *monitor = new eoStdoutMonitor(false);
_state.storeFunctor(monitor);
// when called by the checkpoint (i.e. at every generation)
checkpoint->add(*monitor);
// when called by the checkpoint (i.e. at every generation)
checkpoint->add(*monitor);
// the monitor will output a series of parameters: add them
monitor->add(*generationCounter);
if (useEvalParam.value()) // we want nb of evaluations
monitor->add(_eval);
if (printBestParam.value())
{
monitor->add(*bestStat);
monitor->add(*secondStat);
}
if (printFDCParam.value())
monitor->add(*fdcStat);
if ( printPopParam.value())
monitor->add(*popStat);
// the monitor will output a series of parameters: add them
monitor->add(*generationCounter);
if (useEvalParam.value()) // we want nb of evaluations
monitor->add(_eval);
if (printBestParam.value())
{
monitor->add(*bestStat);
monitor->add(*secondStat);
}
if (printFDCParam.value())
monitor->add(*fdcStat);
if ( printPopParam.value())
monitor->add(*popStat);
}
// first handle the dir test - if we need at least one file
if ( ( fileBestParam.value() || plotBestParam.value() ||
plotFDCParam.value() || plotHistogramParam.value() )
&& !dirOK ) // just in case we add something before
plotFDCParam.value() || plotHistogramParam.value() )
&& !dirOK ) // just in case we add something before
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
if (fileBestParam.value()) // A file monitor for best & secondMoment
{
std::string stmp = dirNameParam.value() + "/best.xg";
eoFileMonitor *fileMonitor = new eoFileMonitor(stmp);
// save and give to checkpoint
_state.storeFunctor(fileMonitor);
checkpoint->add(*fileMonitor);
// and feed with some statistics
fileMonitor->add(*generationCounter);
fileMonitor->add(_eval);
fileMonitor->add(*bestStat);
fileMonitor->add(*secondStat);
std::string stmp = dirNameParam.value() + "/best.xg";
eoFileMonitor *fileMonitor = new eoFileMonitor(stmp);
// save and give to checkpoint
_state.storeFunctor(fileMonitor);
checkpoint->add(*fileMonitor);
// and feed with some statistics
fileMonitor->add(*generationCounter);
fileMonitor->add(_eval);
fileMonitor->add(*bestStat);
fileMonitor->add(*secondStat);
}
if (plotBestParam.value()) // an eoGnuplot1DMonitor for best & average
{
std::string stmp = dirNameParam.value() + "_gnu_best.xg";
eoGnuplot1DMonitor *gnuMonitor = new eoGnuplot1DMonitor(stmp,minimizing_fitness<EOT>());
// save and give to checkpoint
_state.storeFunctor(gnuMonitor);
checkpoint->add(*gnuMonitor);
// and feed with some statistics
if (useEvalParam.value())
gnuMonitor->add(_eval);
else
gnuMonitor->add(*generationCounter);
gnuMonitor->add(*bestStat);
gnuMonitor->add(*averageStat);
std::string stmp = dirNameParam.value() + "_gnu_best.xg";
eoGnuplot1DMonitor *gnuMonitor = new eoGnuplot1DMonitor(stmp,minimizing_fitness<EOT>());
// save and give to checkpoint
_state.storeFunctor(gnuMonitor);
checkpoint->add(*gnuMonitor);
// and feed with some statistics
if (useEvalParam.value())
gnuMonitor->add(_eval);
else
gnuMonitor->add(*generationCounter);
gnuMonitor->add(*bestStat);
gnuMonitor->add(*averageStat);
}
if (plotFDCParam.value()) // a specific plot monitor for FDC
{
// first into a file (it adds everything ti itself
eoFDCFileSnapshot<EOT> *fdcFileSnapshot = new eoFDCFileSnapshot<EOT>(*fdcStat, dirNameParam.value());
_state.storeFunctor(fdcFileSnapshot);
// then to a Gnuplot monitor
eoGnuplot1DSnapshot *fdcGnuplot = new eoGnuplot1DSnapshot(*fdcFileSnapshot);
_state.storeFunctor(fdcGnuplot);
// first into a file (it adds everything ti itself
eoFDCFileSnapshot<EOT> *fdcFileSnapshot = new eoFDCFileSnapshot<EOT>(*fdcStat, dirNameParam.value());
_state.storeFunctor(fdcFileSnapshot);
// then to a Gnuplot monitor
eoGnuplot1DSnapshot *fdcGnuplot = new eoGnuplot1DSnapshot(*fdcFileSnapshot);
_state.storeFunctor(fdcGnuplot);
// and of course add them to the checkPoint
checkpoint->add(*fdcFileSnapshot);
checkpoint->add(*fdcGnuplot);
// and of course add them to the checkPoint
checkpoint->add(*fdcFileSnapshot);
checkpoint->add(*fdcGnuplot);
}
// historgram?
if (plotHistogramParam.value()) // want to see how the fitness is spread?
{
eoScalarFitnessStat<EOT> *fitStat = new eoScalarFitnessStat<EOT>;
_state.storeFunctor(fitStat);
checkpoint->add(*fitStat);
// a gnuplot-based monitor for snapshots: needs a dir name
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value());
_state.storeFunctor(fitSnapshot);
// add any stat that is a std::vector<double> to it
fitSnapshot->add(*fitStat);
// and of course add it to the checkpoint
checkpoint->add(*fitSnapshot);
eoScalarFitnessStat<EOT> *fitStat = new eoScalarFitnessStat<EOT>;
_state.storeFunctor(fitStat);
checkpoint->add(*fitStat);
// a gnuplot-based monitor for snapshots: needs a dir name
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value());
_state.storeFunctor(fitSnapshot);
// add any stat that is a std::vector<double> to it
fitSnapshot->add(*fitStat);
// and of course add it to the checkpoint
checkpoint->add(*fitSnapshot);
}
//////////////////////////////////
@ -273,7 +273,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
{
// first make sure dirName is OK
if (! dirOK )
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
std::string stmp = dirNameParam.value() + "/generations";
@ -288,7 +288,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
{
// first make sure dirName is OK
if (! dirOK )
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
std::string stmp = dirNameParam.value() + "/time";
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);

View file

@ -49,7 +49,7 @@
bool testDirRes(std::string _dirName, bool _erase);
/////////////////// The checkpoint and other I/O //////////////
/** Of course, Fitness needs to be an eoScalarFitnessAssembled!!!
/** Of course, Fitness needs to be an eoScalarFitnessAssembled!!!
*
*
* @ingroup Builders
@ -153,7 +153,7 @@ eoCheckPoint<EOT>& do_make_checkpoint_assembled(eoParser& _parser, eoState& _sta
_state.storeFunctor(fitStat);
checkpoint->add(*fitStat);
#ifdef HAVE_GNUPLOT
// a gnuplot-based monitor for snapshots: needs a dir name
// a gnuplot-based monitor for snapshots: needs a dir name
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirName);
_state.storeFunctor(fitSnapshot);
// add any stat that is a vector<double> to it

View file

@ -55,7 +55,7 @@ It can then be instantiated, and compiled on its own for a given EOType
template <class Indi>
eoCombinedContinue<Indi> * make_combinedContinue(eoCombinedContinue<Indi> *_combined, eoContinue<Indi> *_cont)
{
if (_combined) // already exists
if (_combined) // already exists
_combined->add(*_cont);
else
_combined = new eoCombinedContinue<Indi>(*_cont);
@ -81,10 +81,10 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
if (maxGenParam.value()) // positive: -> define and store
{
eoGenContinue<Indi> *genCont = new eoGenContinue<Indi>(maxGenParam.value());
_state.storeFunctor(genCont);
// and "add" to combined
continuator = make_combinedContinue<Indi>(continuator, genCont);
eoGenContinue<Indi> *genCont = new eoGenContinue<Indi>(maxGenParam.value());
_state.storeFunctor(genCont);
// and "add" to combined
continuator = make_combinedContinue<Indi>(continuator, genCont);
}
// the steadyGen continue - only if user imput
@ -92,12 +92,12 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
eoValueParam<unsigned>& minGenParam = _parser.createParam(unsigned(0), "minGen", "Minimum number of generations",'g', "Stopping criterion");
if (_parser.isItThere(steadyGenParam))
{
eoSteadyFitContinue<Indi> *steadyCont = new eoSteadyFitContinue<Indi>
(minGenParam.value(), steadyGenParam.value());
// store
_state.storeFunctor(steadyCont);
// add to combinedContinue
continuator = make_combinedContinue<Indi>(continuator, steadyCont);
eoSteadyFitContinue<Indi> *steadyCont = new eoSteadyFitContinue<Indi>
(minGenParam.value(), steadyGenParam.value());
// store
_state.storeFunctor(steadyCont);
// add to combinedContinue
continuator = make_combinedContinue<Indi>(continuator, steadyCont);
}
// Same thing with Eval - but here default value is 0
@ -108,10 +108,10 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
if (maxEvalParam.value()) // positive: -> define and store
{
eoEvalContinue<Indi> *evalCont = new eoEvalContinue<Indi>(_eval, maxEvalParam.value());
_state.storeFunctor(evalCont);
// and "add" to combined
continuator = make_combinedContinue<Indi>(continuator, evalCont);
eoEvalContinue<Indi> *evalCont = new eoEvalContinue<Indi>(_eval, maxEvalParam.value());
_state.storeFunctor(evalCont);
// and "add" to combined
continuator = make_combinedContinue<Indi>(continuator, evalCont);
}
/*
// the steadyEval continue - only if user imput
@ -119,12 +119,12 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
eoValueParam<unsigned>& minGenParam = _parser.createParam(unsigned(0), "minGen", "Minimum number of generations",'g', "Stopping criterion");
if (_parser.isItThere(steadyGenParam))
{
eoSteadyGenContinue<Indi> *steadyCont = new eoSteadyFitContinue<Indi>
(minGenParam.value(), steadyGenParam.value());
// store
_state.storeFunctor(steadyCont);
// add to combinedContinue
continuator = make_combinedContinue<Indi>(continuator, steadyCont);
eoSteadyGenContinue<Indi> *steadyCont = new eoSteadyFitContinue<Indi>
(minGenParam.value(), steadyGenParam.value());
// store
_state.storeFunctor(steadyCont);
// add to combinedContinue
continuator = make_combinedContinue<Indi>(continuator, steadyCont);
}
*/
// the target fitness
@ -132,12 +132,12 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
eoValueParam<double>& targetFitnessParam = _parser.createParam(double(0.0), "targetFitness", "Stop when fitness reaches",'T', "Stopping criterion");
if (_parser.isItThere(targetFitnessParam))
{
fitCont = new eoFitContinue<Indi>
(targetFitnessParam.value());
// store
_state.storeFunctor(fitCont);
// add to combinedContinue
continuator = make_combinedContinue<Indi>(continuator, fitCont);
fitCont = new eoFitContinue<Indi>
(targetFitnessParam.value());
// store
_state.storeFunctor(fitCont);
// add to combinedContinue
continuator = make_combinedContinue<Indi>(continuator, fitCont);
}
#ifndef _MSC_VER
@ -146,11 +146,11 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
eoValueParam<bool>& ctrlCParam = _parser.createParam(false, "CtrlC", "Terminate current generation upon Ctrl C",'C', "Stopping criterion");
if (ctrlCParam.value())
{
ctrlCCont = new eoCtrlCContinue<Indi>;
// store
_state.storeFunctor(ctrlCCont);
// add to combinedContinue
continuator = make_combinedContinue<Indi>(continuator, ctrlCCont);
ctrlCCont = new eoCtrlCContinue<Indi>;
// store
_state.storeFunctor(ctrlCCont);
// add to combinedContinue
continuator = make_combinedContinue<Indi>(continuator, ctrlCCont);
}
#endif

View file

@ -3,7 +3,7 @@
//-----------------------------------------------------------------------------
// make_general_replacement.h
// (c) Marc Schoenauer and Pierre Collet, 2002
/*
/*
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
@ -49,8 +49,8 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
eoReduce<EOT> * ptReduce;
// ---------- Deterministic
if ( (_ppReduce.first == std::string("Deterministic")) ||
(_ppReduce.first == std::string("Sequential"))
if ( (_ppReduce.first == std::string("Deterministic")) ||
(_ppReduce.first == std::string("Sequential"))
)
{
ptReduce = new eoTruncate<EOT>;
@ -65,7 +65,7 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
// put back 6 in parameter for consistency (and status file)
_ppReduce.second.push_back(std::string("6"));
}
else // parameter passed by user as EP(T)
else // parameter passed by user as EP(T)
detSize = atoi(_ppReduce.second[0].c_str());
ptReduce = new eoEPReduce<EOT>(detSize);
}
@ -74,12 +74,12 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
{
if (!_ppReduce.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2;
// put back 2 in parameter for consistency (and status file)
_ppReduce.second.push_back(std::string("2"));
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2;
// put back 2 in parameter for consistency (and status file)
_ppReduce.second.push_back(std::string("2"));
}
else // parameter passed by user as DetTour(T)
else // parameter passed by user as DetTour(T)
detSize = atoi(_ppReduce.second[0].c_str());
ptReduce = new eoDetTournamentTruncate<EOT>(detSize);
}
@ -87,24 +87,24 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
{
double p;
if (!_ppReduce.second.size()) // no parameter added
{
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1;
// put back p in parameter for consistency (and status file)
_ppReduce.second.push_back(std::string("1"));
}
else // parameter passed by user as DetTour(T)
{
p = atof(_ppReduce.second[0].c_str());
if ( (p<=0.5) || (p>1) )
throw std::runtime_error("Stochastic tournament size should be in [0.5,1]");
}
{
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1;
// put back p in parameter for consistency (and status file)
_ppReduce.second.push_back(std::string("1"));
}
else // parameter passed by user as DetTour(T)
{
p = atof(_ppReduce.second[0].c_str());
if ( (p<=0.5) || (p>1) )
throw std::runtime_error("Stochastic tournament size should be in [0.5,1]");
}
ptReduce = new eoStochTournamentTruncate<EOT>(p);
}
else if ( (_ppReduce.first == std::string("Uniform")) ||
(_ppReduce.first == std::string("Random"))
)
else if ( (_ppReduce.first == std::string("Uniform")) ||
(_ppReduce.first == std::string("Random"))
)
{
ptReduce = new eoRandomReduce<EOT>;
}
@ -117,10 +117,10 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
return (*ptReduce);
}
/** Helper function that creates a replacement from the class
* eoReduceMergeReduce using 6 parameters
/** Helper function that creates a replacement from the class
* eoReduceMergeReduce using 6 parameters
* (after the usual eoState and eoParser)
*
*
* eoHowMany _elite the number of elite parents (0 = no elitism)
* see below
* bool _strongElitism if elite > 0, std::string elitism or weak elitism
@ -136,15 +136,15 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
*/
template <class EOT>
eoReplacement<EOT> & make_general_replacement(
eoParser& _parser, eoState& _state,
eoHowMany _elite = eoHowMany(0),
eoParser& _parser, eoState& _state,
eoHowMany _elite = eoHowMany(0),
bool _strongElitism = false,
eoHowMany _surviveParents = eoHowMany(0.0),
eoParamParamType & _reduceParentType = eoParamParamType("Deterministic"),
eoHowMany _surviveOffspring = eoHowMany(1.0),
eoParamParamType & _reduceOffspringType = eoParamParamType("Deterministic"),
eoParamParamType & _reduceFinalType = eoParamParamType("Deterministic")
)
)
{
/////////////////////////////////////////////////////
// the replacement
@ -157,14 +157,14 @@ eoReplacement<EOT> & make_general_replacement(
// reduce the parents
eoHowMany surviveParents = _parser.createParam(_surviveParents, "surviveParents", "Nb of surviving parents (percentage or absolute)", '\0', "Evolution Engine / Replacement").value();
eoParamParamType & reduceParentType = _parser.createParam(_reduceParentType, "reduceParents", "Parents reducer: Deterministic, EP(T), DetTour(T), StochTour(t), Uniform", '\0', "Evolution Engine / Replacement").value();
eoReduce<EOT> & reduceParent = decode_reduce<EOT>(reduceParentType, _state);
// reduce the offspring
eoHowMany surviveOffspring = _parser.createParam(_surviveOffspring, "surviveOffspring", "Nb of surviving offspring (percentage or absolute)", '\0', "Evolution Engine / Replacement").value();
eoParamParamType & reduceOffspringType = _parser.createParam(_reduceOffspringType, "reduceOffspring", "Offspring reducer: Deterministic, EP(T), DetTour(T), StochTour(t), Uniform", '\0', "Evolution Engine / Replacement").value();
eoReduce<EOT> & reduceOffspring = decode_reduce<EOT>(reduceOffspringType, _state);

View file

@ -59,7 +59,7 @@ eoPop<EOT>& do_make_pop(eoParser & _parser, eoState& _state, eoInit<EOT> & _ini
// random seed
eoValueParam<uint32_t>& seedParam = _parser.getORcreateParam(uint32_t(0), "seed", "Random number seed", 'S');
if (seedParam.value() == 0)
seedParam.value() = time(0);
seedParam.value() = time(0);
eoValueParam<unsigned>& popSize = _parser.getORcreateParam(unsigned(20), "popSize", "Population Size", 'P', "Evolution Engine");
// Either load or initialize
@ -82,17 +82,17 @@ eoPop<EOT>& do_make_pop(eoParser & _parser, eoState& _state, eoInit<EOT> & _ini
// the fitness is read in the file:
// do only evaluate the pop if the fitness has changed
if (recomputeFitnessParam.value())
{
for (unsigned i=0; i<pop.size(); i++)
pop[i].invalidate();
}
{
for (unsigned i=0; i<pop.size(); i++)
pop[i].invalidate();
}
if (pop.size() < popSize.value())
std::cerr << "WARNING, only " << pop.size() << " individuals read in file " << loadNameParam.value() << "\nThe remaining " << popSize.value() - pop.size() << " will be randomly drawn" << std::endl;
std::cerr << "WARNING, only " << pop.size() << " individuals read in file " << loadNameParam.value() << "\nThe remaining " << popSize.value() - pop.size() << " will be randomly drawn" << std::endl;
if (pop.size() > popSize.value())
{
std::cerr << "WARNING, Load file contained too many individuals. Only the best will be retained" << std::endl;
pop.resize(popSize.value());
}
{
std::cerr << "WARNING, Load file contained too many individuals. Only the best will be retained" << std::endl;
pop.resize(popSize.value());
}
}
else // nothing loaded from a file
{

View file

@ -3,7 +3,7 @@
//-----------------------------------------------------------------------------
// make_run.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

View file

@ -201,7 +201,7 @@
#include <utils/eoParserLogger.h>
//-----------------------------------------------------------------------------
#include <utils/eoParallel.h>
#endif

View file

@ -8,16 +8,16 @@
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: cahon@lifl.fr
*/
@ -32,26 +32,26 @@
#include <eoOp.h>
/**
The abstract cellular easy algorithm.
The abstract cellular easy algorithm.
@ingroup Algorithms
*/
template <class EOT> class eoCellularEasyEA : public eoAlgo <EOT> {
public :
/**
Two constructors
*/
eoCellularEasyEA (eoContinue <EOT> & _cont, // Stop. criterion
eoEvalFunc <EOT> & _eval, // Evaluation function
eoSelectOne <EOT> & _sel_neigh, // To choose a partner
eoBinOp <EOT> & _cross, // Cross-over operator
eoMonOp <EOT> & _mut, // Mutation operator
eoSelectOne <EOT> & _sel_repl /* Which to keep between the new
child and the old individual ? */
) :
eoEvalFunc <EOT> & _eval, // Evaluation function
eoSelectOne <EOT> & _sel_neigh, // To choose a partner
eoBinOp <EOT> & _cross, // Cross-over operator
eoMonOp <EOT> & _mut, // Mutation operator
eoSelectOne <EOT> & _sel_repl /* Which to keep between the new
child and the old individual ? */
) :
cont (_cont),
eval (_eval),
popEval (_eval),
@ -60,18 +60,18 @@ public :
mut (_mut),
sel_child (eoSelectFirstOne ()),
sel_repl (_sel_repl) {
}
eoCellularEasyEA (eoContinue <EOT> & _cont,
eoEvalFunc <EOT> & _eval,
eoSelectOne <EOT> & _sel_neigh,
eoQuadOp <EOT> & _cross,
eoMonOp <EOT> & _mut,
eoSelectOne <EOT> & _sel_child, /* To choose one from
the both children */
eoSelectOne <EOT> & _sel_repl
) :
eoEvalFunc <EOT> & _eval,
eoSelectOne <EOT> & _sel_neigh,
eoQuadOp <EOT> & _cross,
eoMonOp <EOT> & _mut,
eoSelectOne <EOT> & _sel_child, /* To choose one from
the both children */
eoSelectOne <EOT> & _sel_repl
) :
cont (_cont),
eval (_eval),
popEval (_eval),
@ -80,7 +80,7 @@ public :
mut (_mut),
sel_child (_sel_child),
sel_repl (_sel_repl) {
}
/**
@ -88,55 +88,55 @@ public :
*/
void operator () (eoPop <EOT> & pop) {
do {
for (unsigned i = 0 ; i < pop.size () ; i ++) {
// Who are neighbouring to the current individual ?
eoPop <EOT> neigh = neighbours (pop, i) ;
// To select a partner
EOT part, old_sol = pop [i] ;
part = sel_neigh (neigh) ;
// To perform cross-over
cross (pop [i], part) ;
// Who are neighbouring to the current individual ?
eoPop <EOT> neigh = neighbours (pop, i) ;
// To perform mutation
mut (pop [i]) ;
mut (part) ;
pop [i].invalidate () ;
part.invalidate () ;
eval (pop [i]) ;
eval (part) ;
// To select a partner
EOT part, old_sol = pop [i] ;
part = sel_neigh (neigh) ;
// To choose one of the two children ...
eoPop <EOT> pop_loc ;
pop_loc.push_back (pop [i]) ;
pop_loc.push_back (part) ;
// To perform cross-over
cross (pop [i], part) ;
pop [i] = sel_child (pop_loc) ;
// To perform mutation
mut (pop [i]) ;
mut (part) ;
// To choose only one between the new made child and the old individual
pop_loc.clear () ;
pop_loc.push_back (pop [i]) ;
pop_loc.push_back (old_sol) ;
pop [i] = sel_repl (pop_loc) ;
pop [i].invalidate () ;
part.invalidate () ;
eval (pop [i]) ;
eval (part) ;
// To choose one of the two children ...
eoPop <EOT> pop_loc ;
pop_loc.push_back (pop [i]) ;
pop_loc.push_back (part) ;
pop [i] = sel_child (pop_loc) ;
// To choose only one between the new made child and the old individual
pop_loc.clear () ;
pop_loc.push_back (pop [i]) ;
pop_loc.push_back (old_sol) ;
pop [i] = sel_repl (pop_loc) ;
}
} while (cont (pop)) ;
}
protected :
virtual eoPop <EOT> neighbours (const eoPop <EOT> & pop, int rank) = 0 ;
private :
eoContinue <EOT> & cont ;
eoEvalFunc <EOT> & eval ;
eoPopLoopEval <EOT> popEval ;
@ -145,18 +145,18 @@ private :
eoMonOp <EOT> & mut ;
eoSelectOne <EOT> & sel_child ;
eoSelectOne <EOT> & sel_repl ;
class eoSelectFirstOne : public eoSelectOne <EOT> {
public :
const EOT & operator () (const eoPop <EOT> & pop) {
return pop [0] ;
return pop [0] ;
}
} ;
} ;
} ;
#endif

Some files were not shown because too many files have changed in this diff Show more