Merge branch 'master' of ssh://eodev.git.sourceforge.net/gitroot/eodev/eodev
This commit is contained in:
commit
f8202d238a
496 changed files with 8734 additions and 8186 deletions
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
The Evolving Distribution Objects framework (EDO) is a template-based,
|
The Evolving Distribution Objects framework (EDO) is a template-based,
|
||||||
ANSI-C++ evolutionary computation library which helps you to write your
|
ANSI-C++ evolutionary computation library which helps you to write your
|
||||||
own estimation of distribution algorithms.
|
own estimation of distribution algorithms.
|
||||||
|
|
|
||||||
|
|
@ -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
|
# 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(FindDoxygen)
|
||||||
INCLUDE(FindPkgConfig)
|
INCLUDE(FindPkgConfig)
|
||||||
|
|
||||||
PKG_CHECK_MODULES(EO eo REQUIRED)
|
|
||||||
PKG_CHECK_MODULES(MO mo REQUIRED)
|
|
||||||
|
|
||||||
FIND_PACKAGE(Boost 1.33.0)
|
FIND_PACKAGE(Boost 1.33.0)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
|
|
@ -34,11 +40,16 @@ INCLUDE_DIRECTORIES(
|
||||||
# /Dev/ometah-0.3/common
|
# /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(
|
INCLUDE_DIRECTORIES(
|
||||||
|
|
@ -49,7 +60,7 @@ INCLUDE_DIRECTORIES(
|
||||||
|
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
### 4) Set compiler definitions
|
### 5) Set compiler definitions
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
IF(UNIX)
|
IF(UNIX)
|
||||||
|
|
@ -63,7 +74,7 @@ ENDIF()
|
||||||
|
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
### 5) Prepare some variables for CMAKE usage
|
### 6) Prepare some variables for CMAKE usage
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
SET(SAMPLE_SRCS)
|
SET(SAMPLE_SRCS)
|
||||||
|
|
@ -72,7 +83,7 @@ SET(SAMPLE_SRCS)
|
||||||
|
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
### 6) Now where we go ?
|
### 7) Now where we go ?
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(src)
|
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)
|
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)
|
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)
|
INCLUDE(Packaging.cmake)
|
||||||
|
|
|
||||||
14
edo/COPYING
14
edo/COPYING
|
|
@ -1,5 +1,5 @@
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
Version 2.1, February 1999
|
Version 2.1, February 1999
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
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
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
the version number 2.1.]
|
the version number 2.1.]
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
The licenses for most software are designed to take away your
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
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
|
former contains code derived from the library, whereas the latter must
|
||||||
be combined with the library in order to run.
|
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
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
0. This License Agreement applies to any software library or other
|
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
|
of all derivatives of our free software and of promoting the sharing
|
||||||
and reuse of software generally.
|
and reuse of software generally.
|
||||||
|
|
||||||
NO WARRANTY
|
NO WARRANTY
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
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
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
DAMAGES.
|
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
|
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
|
possible use to the public, we recommend making it free software that
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,6 @@ FOREACH(file ${RESOURCES})
|
||||||
EXECUTE_PROCESS(
|
EXECUTE_PROCESS(
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/${file}
|
${CMAKE_CURRENT_SOURCE_DIR}/${file}
|
||||||
${DO_BINARY_DIR}/${file}
|
${EDO_BINARY_DIR}/${file}
|
||||||
)
|
)
|
||||||
ENDFOREACH(file)
|
ENDFOREACH(file)
|
||||||
|
|
|
||||||
20
edo/install.cmake-dist
Normal file
20
edo/install.cmake-dist
Normal 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)
|
||||||
|
|
@ -25,4 +25,3 @@ Authors:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "edo"
|
#include "edo"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,4 +60,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_edoBounderRng_h
|
#endif // !_edoBounderRng_h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,16 +39,16 @@ public:
|
||||||
|
|
||||||
void operator()( EOT& sol )
|
void operator()( EOT& sol )
|
||||||
{
|
{
|
||||||
unsigned int size = sol.size();
|
unsigned int size = sol.size();
|
||||||
assert(size > 0);
|
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]) {
|
if ( sol[d] < this->min()[d] || sol[d] > this->max()[d]) {
|
||||||
// use EO's global "rng"
|
// use EO's global "rng"
|
||||||
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
|
sol[d] = rng.uniform( this->min()[d], this->max()[d] );
|
||||||
}
|
}
|
||||||
} // for d in size
|
} // for d in size
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void operator ()(eoPop< EOT > & pop)
|
void operator ()(eoPop< EOT > & pop)
|
||||||
{
|
{
|
||||||
assert(pop.size() > 0);
|
assert(pop.size() > 0);
|
||||||
|
|
||||||
//double temperature = _initial_temperature;
|
//double temperature = _initial_temperature;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void operator ()(eoPop< EOT > & pop)
|
void operator ()(eoPop< EOT > & pop)
|
||||||
{
|
{
|
||||||
assert(pop.size() > 0);
|
assert(pop.size() > 0);
|
||||||
|
|
||||||
double temperature = _initial_temperature;
|
double temperature = _initial_temperature;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ public:
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
_varcovar.resize(s_size, s_size);
|
_varcovar.resize(s_size);
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_edoModifier_h
|
#endif // !_edoModifier_h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,4 +42,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_edoModifierMass_h
|
#endif // !_edoModifierMass_h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // !_edoNormalMonoCenter_h
|
#endif // !_edoNormalMonoCenter_h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
// (c) Thales group, 2010
|
// (c) Thales group, 2010
|
||||||
/*
|
/*
|
||||||
Authors:
|
Authors:
|
||||||
Johann Dreo <johann.dreo@thalesgroup.com>
|
Johann Dreo <johann.dreo@thalesgroup.com>
|
||||||
Caner Candan <caner.candan@thalesgroup.com>
|
Caner Candan <caner.candan@thalesgroup.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _edoNormalMulti_h
|
#ifndef _edoNormalMulti_h
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public:
|
||||||
{
|
{
|
||||||
AtomType mean = distrib.mean()[i];
|
AtomType mean = distrib.mean()[i];
|
||||||
AtomType variance = distrib.variance()[i];
|
AtomType variance = distrib.variance()[i];
|
||||||
AtomType random = rng.normal(mean, variance);
|
AtomType random = rng.normal(mean, variance);
|
||||||
|
|
||||||
assert(variance >= 0);
|
assert(variance >= 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public:
|
||||||
|
|
||||||
assert( Vl == Vc );
|
assert( Vl == Vc );
|
||||||
|
|
||||||
_L.resize(Vl, Vc);
|
_L.resize(Vl);
|
||||||
|
|
||||||
unsigned int i,j,k;
|
unsigned int i,j,k;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ Authors:
|
||||||
#include <edo>
|
#include <edo>
|
||||||
|
|
||||||
#include <boost/numeric/ublas/vector.hpp>
|
#include <boost/numeric/ublas/vector.hpp>
|
||||||
#include <boost/numeric/ublas/symmetric_matrix.hpp>
|
#include <boost/numeric/ublas/symmetric.hpp>
|
||||||
|
|
||||||
#include "Rosenbrock.h"
|
#include "Rosenbrock.h"
|
||||||
#include "Sphere.h"
|
#include "Sphere.h"
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ from numpy import arange
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
for p1 in list(arange(0.1, 1.1, 0.1)):
|
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 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)):
|
for p3 in list(arange(0.1, 1.1, 0.1)):
|
||||||
gen = '%d_%.1f_%.1f_%.1f_%.1f' % (PSIZE, MEAN, p1, p2, p3)
|
gen = '%d_%.1f_%.1f_%.1f_%.1f' % (PSIZE, MEAN, p1, p2, p3)
|
||||||
cmd = CMD % ( PSIZE, MEAN, p1, p2, p3, gen, gen )
|
cmd = CMD % ( PSIZE, MEAN, p1, p2, p3, gen, gen )
|
||||||
print cmd
|
print cmd
|
||||||
system( cmd )
|
system( cmd )
|
||||||
|
|
|
||||||
36
eo/CHANGELOG
36
eo/CHANGELOG
|
|
@ -3592,7 +3592,7 @@ Date: Mon Jun 17 04:13:45 2002 +0000
|
||||||
|
|
||||||
Adding the truncation selectors.
|
Adding the truncation selectors.
|
||||||
2 versions: eoTruncatedSelectOne is an eoSelectOne, and
|
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>
|
Author: jeggermo <jeggermo>
|
||||||
Date: Mon Jun 10 14:10:35 2002 +0000
|
Date: Mon Jun 10 14:10:35 2002 +0000
|
||||||
|
|
@ -4537,8 +4537,8 @@ Date: Sat Nov 10 09:02:17 2001 +0000
|
||||||
|
|
||||||
Small modifications here and there to be MSVC++ compatible
|
Small modifications here and there to be MSVC++ compatible
|
||||||
Mainly, time.h -> ctime
|
Mainly, time.h -> ctime
|
||||||
definition of loop index out of loops when multiply used
|
definition of loop index out of loops when multiply used
|
||||||
no typename in declaration using template typename
|
no typename in declaration using template typename
|
||||||
|
|
||||||
Author: evomarc <evomarc>
|
Author: evomarc <evomarc>
|
||||||
Date: Sat Nov 10 06:59:02 2001 +0000
|
Date: Sat Nov 10 06:59:02 2001 +0000
|
||||||
|
|
@ -4883,8 +4883,8 @@ Date: Mon Jul 2 13:31:04 2001 +0000
|
||||||
|
|
||||||
Changed the directory structure for gp
|
Changed the directory structure for gp
|
||||||
now: eoParseTree <-- the eoParseTree class
|
now: eoParseTree <-- the eoParseTree class
|
||||||
eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer)
|
eoParseTreeDepthInit <-- the eoParseTree depth initializer (eoGpDepthInitializer)
|
||||||
eoParseTreeOp <-- the operators (xover and mutation)
|
eoParseTreeOp <-- the operators (xover and mutation)
|
||||||
|
|
||||||
base documentation written for:
|
base documentation written for:
|
||||||
* eoParseTree
|
* eoParseTree
|
||||||
|
|
@ -6014,8 +6014,8 @@ Date: Fri Feb 9 05:09:26 2001 +0000
|
||||||
I also changed
|
I also changed
|
||||||
- the eoQuadratic into eoQuad (as dicussed with Maarten)
|
- the eoQuadratic into eoQuad (as dicussed with Maarten)
|
||||||
- the eoBin into eoBit, with more appropriate names for the "binary"
|
- the eoBin into eoBit, with more appropriate names for the "binary"
|
||||||
operators (that can be unary!) as no one protested when I posted on
|
operators (that can be unary!) as no one protested when I posted on
|
||||||
eodev list
|
eodev list
|
||||||
|
|
||||||
Author: evomarc <evomarc>
|
Author: evomarc <evomarc>
|
||||||
Date: Wed Feb 7 05:15:18 2001 +0000
|
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
|
Added selection methods
|
||||||
eoBestSelect always return the best individual
|
eoBestSelect always return the best individual
|
||||||
eoSequentialSelect a selectOne version of eoDetSelect (uses an index to
|
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>
|
Author: evomarc <evomarc>
|
||||||
Date: Thu Feb 1 05:27:36 2001 +0000
|
Date: Thu Feb 1 05:27:36 2001 +0000
|
||||||
|
|
@ -6630,16 +6630,16 @@ Author: evomarc <evomarc>
|
||||||
Date: Mon Dec 4 06:58:43 2000 +0000
|
Date: Mon Dec 4 06:58:43 2000 +0000
|
||||||
|
|
||||||
Added the lastCall construct: if the stopping condition becomes true in eoCheckPoint,
|
Added the lastCall construct: if the stopping condition becomes true in eoCheckPoint,
|
||||||
a method called lastCall is called for everything contained in that checkpoint
|
a method called lastCall is called for everything contained in that checkpoint
|
||||||
(stats, updaters and monitors). This can be extremely useful
|
(stats, updaters and monitors). This can be extremely useful
|
||||||
- for stateSavers (see below)
|
- for stateSavers (see below)
|
||||||
- for monitoring things like rates of success of operators, where what you
|
- for monitoring things like rates of success of operators, where what you
|
||||||
are interested in is the final result only.
|
are interested in is the final result only.
|
||||||
Added of course a virtual method lastCall that does nothing by default in classes
|
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
|
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.
|
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.
|
I also added the corresponding constructor to take this into account.
|
||||||
|
|
||||||
Author: evomarc <evomarc>
|
Author: evomarc <evomarc>
|
||||||
Date: Mon Dec 4 05:55:59 2000 +0000
|
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
|
Date: Tue Nov 28 06:46:37 2000 +0000
|
||||||
|
|
||||||
Modified the contructor: the default value for the delimiter is now " "
|
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
|
and I added a boolean argument to indicate whether or not we want to
|
||||||
overwrite an existing file with same name (default is overwrite).
|
overwrite an existing file with same name (default is overwrite).
|
||||||
Added the getFileName accessor.
|
Added the getFileName accessor.
|
||||||
|
|
||||||
Author: evomarc <evomarc>
|
Author: evomarc <evomarc>
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,12 @@ ENABLE_LANGUAGE(C)
|
||||||
### 2) Include required modules / configuration files
|
### 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(CMakeBackwardCompatibilityCXX)
|
||||||
|
|
||||||
INCLUDE(FindDoxygen)
|
INCLUDE(FindDoxygen)
|
||||||
|
|
@ -103,7 +109,7 @@ ENDIF (ENABLE_CMAKE_TESTING)
|
||||||
### 5) Where must cmake go now ?
|
### 5) Where must cmake go now ?
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(app)
|
#ADD_SUBDIRECTORY(app)
|
||||||
ADD_SUBDIRECTORY(doc)
|
ADD_SUBDIRECTORY(doc)
|
||||||
ADD_SUBDIRECTORY(src)
|
ADD_SUBDIRECTORY(src)
|
||||||
ADD_SUBDIRECTORY(test)
|
ADD_SUBDIRECTORY(test)
|
||||||
|
|
|
||||||
|
|
@ -457,7 +457,7 @@ 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
|
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
|
possible use to the public, we recommend making it free software that
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
# NOTE: only add something here if it is really needed by EO
|
# NOTE: only add something here if it is really needed by EO
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
|
|
@ -28,6 +27,3 @@ check_include_files(stdint.h "stdint.h" HAVE_STDINT_H)
|
||||||
# check is to be added to get the proper set of headers. Example :
|
# 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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,4 +233,3 @@ operates.
|
||||||
|
|
||||||
`configure' also accepts some other, not widely useful, options. Run
|
`configure' also accepts some other, not widely useful, options. Run
|
||||||
`configure --help' for more details.
|
`configure --help' for more details.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -457,7 +457,7 @@ 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
|
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
|
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
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
That's all there is to it!
|
That's all there is to it!
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
11
eo/NEWS
11
eo/NEWS
|
|
@ -7,11 +7,11 @@
|
||||||
- GCC 4.3 compatibility
|
- GCC 4.3 compatibility
|
||||||
- new versatile log system with several nested verbose levels
|
- 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:
|
- 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/eoCombinedInit.h
|
||||||
eo/src/eoGenContinue.h
|
eo/src/eoGenContinue.h
|
||||||
eo/src/eoProportionalCombinedOp.h
|
eo/src/eoProportionalCombinedOp.h
|
||||||
eo/src/utils/eoData.h
|
eo/src/utils/eoData.h
|
||||||
eo/src/utils/eoStdoutMonitor.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
|
- 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 monitor that can write on any ostream
|
||||||
- new continuator that can catch POSIX system user signals
|
- new continuator that can catch POSIX system user signals
|
||||||
|
|
@ -39,4 +39,3 @@
|
||||||
* release 0.9.3z.1 (1. Oct. 2005)
|
* release 0.9.3z.1 (1. Oct. 2005)
|
||||||
- Support gcc-3.4 and gcc.4.x.
|
- Support gcc-3.4 and gcc.4.x.
|
||||||
- Provide full automake/autoconf/configure support.
|
- Provide full automake/autoconf/configure support.
|
||||||
|
|
||||||
|
|
|
||||||
11
eo/README
11
eo/README
|
|
@ -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.
|
Welcome to EO, the Evolving Objects library.
|
||||||
|
|
@ -23,7 +22,7 @@ an introduction;)
|
||||||
|
|
||||||
|
|
||||||
==================================================================
|
==================================================================
|
||||||
BUILDING EO
|
BUILDING EO
|
||||||
==================================================================
|
==================================================================
|
||||||
The basic installation procedure goes the following:
|
The basic installation procedure goes the following:
|
||||||
|
|
||||||
|
|
@ -50,7 +49,7 @@ specific about EO.
|
||||||
|
|
||||||
|
|
||||||
===================================================================
|
===================================================================
|
||||||
DIRECTORY STRUCTURE
|
DIRECTORY STRUCTURE
|
||||||
===================================================================
|
===================================================================
|
||||||
After unpacking the archive file, you should end up with the following
|
After unpacking the archive file, you should end up with the following
|
||||||
structure:
|
structure:
|
||||||
|
|
@ -103,7 +102,7 @@ structure:
|
||||||
|
|
||||||
|
|
||||||
===================================================================
|
===================================================================
|
||||||
NOTES
|
NOTES
|
||||||
===================================================================
|
===================================================================
|
||||||
If you extracted a fresh snapshot from the cvs-repository, remember
|
If you extracted a fresh snapshot from the cvs-repository, remember
|
||||||
to run
|
to run
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,3 @@ IF(NOT WIN32 OR CYGWIN)
|
||||||
ENDIF(NOT WIN32 OR CYGWIN)
|
ENDIF(NOT WIN32 OR CYGWIN)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,12 +207,12 @@ int correct(const mlp::net& net, const mlp::set& set)
|
||||||
unsigned partial = 0;
|
unsigned partial = 0;
|
||||||
|
|
||||||
for (unsigned i = 0; i < s->output.size(); ++i)
|
for (unsigned i = 0; i < s->output.size(); ++i)
|
||||||
if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) ||
|
if ((s->output[i] < 0.5 && net(s->input)[i] < 0.5) ||
|
||||||
(s->output[i] > 0.5 && net(s->input)[i] > 0.5))
|
(s->output[i] > 0.5 && net(s->input)[i] > 0.5))
|
||||||
++partial;
|
++partial;
|
||||||
|
|
||||||
if (partial == s->output.size())
|
if (partial == s->output.size())
|
||||||
++sum;
|
++sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sum;
|
return sum;
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ namespace l2
|
||||||
while (++current_layer != rend())
|
while (++current_layer != rend())
|
||||||
{
|
{
|
||||||
reverse_iterator forward_layer = current_layer - 1;
|
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)
|
for (unsigned j = 0; j < current_layer->size(); ++j)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ namespace std {
|
||||||
istream& operator>>(istream& is, mlp::vector& v)
|
istream& operator>>(istream& is, mlp::vector& v)
|
||||||
{
|
{
|
||||||
for (mlp::vector::iterator vi = v.begin() ; vi != v.end() ; vi++) {
|
for (mlp::vector::iterator vi = v.begin() ; vi != v.end() ; vi++) {
|
||||||
is >> *vi;
|
is >> *vi;
|
||||||
}
|
}
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
@ -133,15 +133,15 @@ namespace mlp
|
||||||
#ifdef HAVE_LIBYAML_CPP
|
#ifdef HAVE_LIBYAML_CPP
|
||||||
YAML_SERIALIZABLE_AUTO(neuron)
|
YAML_SERIALIZABLE_AUTO(neuron)
|
||||||
void emit_yaml(YAML::Emitter&out) const {
|
void emit_yaml(YAML::Emitter&out) const {
|
||||||
out << YAML::BeginMap;
|
out << YAML::BeginMap;
|
||||||
out << YAML::Key << "Class" << YAML::Value << "mlp::neuron";
|
out << YAML::Key << "Class" << YAML::Value << "mlp::neuron";
|
||||||
YAML_EMIT_MEMBER(out,bias);
|
YAML_EMIT_MEMBER(out,bias);
|
||||||
YAML_EMIT_MEMBER(out,weight);
|
YAML_EMIT_MEMBER(out,weight);
|
||||||
out << YAML::EndMap;
|
out << YAML::EndMap;
|
||||||
}
|
}
|
||||||
void load_yaml(const YAML::Node& node) {
|
void load_yaml(const YAML::Node& node) {
|
||||||
YAML_LOAD_MEMBER(node, bias);
|
YAML_LOAD_MEMBER(node, bias);
|
||||||
YAML_LOAD_MEMBER(node, weight);
|
YAML_LOAD_MEMBER(node, weight);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
@ -213,17 +213,17 @@ namespace mlp {
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LIBYAML_CPP
|
#ifdef HAVE_LIBYAML_CPP
|
||||||
friend ostream& operator<<(YAML::Emitter& e, const layer &l) {
|
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) {
|
friend void operator>>(const YAML::Node& n, layer &l) {
|
||||||
// These temporary variable shenanegins are necessary because
|
// These temporary variable shenanegins are necessary because
|
||||||
// the compiler gets very confused about which template operator>>
|
// the compiler gets very confused about which template operator>>
|
||||||
// function to use.
|
// function to use.
|
||||||
// The following does not work: n >> l;
|
// The following does not work: n >> l;
|
||||||
// So we use a temporary variable thusly:
|
// So we use a temporary variable thusly:
|
||||||
std::vector<mlp::neuron> *obviously_a_vector = &l;
|
std::vector<mlp::neuron> *obviously_a_vector = &l;
|
||||||
n >> *obviously_a_vector;
|
n >> *obviously_a_vector;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -243,7 +243,7 @@ namespace std {
|
||||||
istream& operator>>(istream& is, mlp::layer& l)
|
istream& operator>>(istream& is, mlp::layer& l)
|
||||||
{
|
{
|
||||||
for (mlp::layer::iterator li = l.begin() ; li != l.end() ; li++) {
|
for (mlp::layer::iterator li = l.begin() ; li != l.end() ; li++) {
|
||||||
is >> *li;
|
is >> *li;
|
||||||
}
|
}
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
@ -277,13 +277,13 @@ namespace mlp {
|
||||||
#ifdef HAVE_LIBYAML_CPP
|
#ifdef HAVE_LIBYAML_CPP
|
||||||
YAML_SERIALIZABLE_AUTO(net)
|
YAML_SERIALIZABLE_AUTO(net)
|
||||||
void emit_members(YAML::Emitter&out) const {
|
void emit_members(YAML::Emitter&out) const {
|
||||||
const std::vector<layer>* me_as_layer_vector = this;
|
const std::vector<layer>* me_as_layer_vector = this;
|
||||||
out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector;
|
out << YAML::Key << "layers" << YAML::Value << *me_as_layer_vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_members(const YAML::Node& node) {
|
void load_members(const YAML::Node& node) {
|
||||||
std::vector<layer>* me_as_layer_vector = this;
|
std::vector<layer>* me_as_layer_vector = this;
|
||||||
node["layers"] >> *me_as_layer_vector;
|
node["layers"] >> *me_as_layer_vector;
|
||||||
}
|
}
|
||||||
#endif // HAVE_LIBYAML_CPP
|
#endif // HAVE_LIBYAML_CPP
|
||||||
|
|
||||||
|
|
@ -303,14 +303,14 @@ namespace mlp {
|
||||||
is >> layer_size;
|
is >> layer_size;
|
||||||
layer_sizes.push_back(layer_size);
|
layer_sizes.push_back(layer_size);
|
||||||
}
|
}
|
||||||
unsigned check_outputs;
|
unsigned check_outputs;
|
||||||
is >> check_outputs;
|
is >> check_outputs;
|
||||||
assert (check_outputs == num_outputs);
|
assert (check_outputs == num_outputs);
|
||||||
init (num_inputs,num_outputs,layer_sizes);
|
init (num_inputs,num_outputs,layer_sizes);
|
||||||
// skip forward to pass up opening '<' char
|
// skip forward to pass up opening '<' char
|
||||||
char c=' ';
|
char c=' ';
|
||||||
while (c!='<' && !is.eof()) { is >> c;}
|
while (c!='<' && !is.eof()) { is >> c;}
|
||||||
for (iterator l =begin() ; l != end(); l++) {
|
for (iterator l =begin() ; l != end(); l++) {
|
||||||
is >> *l;
|
is >> *l;
|
||||||
}
|
}
|
||||||
do { is >> c; } while (c == ' ' && !is.eof());
|
do { is >> c; } while (c == ' ' && !is.eof());
|
||||||
|
|
@ -351,15 +351,15 @@ namespace mlp {
|
||||||
}
|
}
|
||||||
|
|
||||||
void save(ostream &os) const {
|
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";
|
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 << l->size() << " ";
|
||||||
os << "\n";
|
os << "\n";
|
||||||
os << "< ";
|
os << "< ";
|
||||||
for(const_iterator l = begin(); l != end(); ++l)
|
for(const_iterator l = begin(); l != end(); ++l)
|
||||||
os << *l << " ";
|
os << *l << " ";
|
||||||
os << ">\n";
|
os << ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -454,7 +454,7 @@ namespace mlp {
|
||||||
|
|
||||||
void load(istream &is) {
|
void load(istream &is) {
|
||||||
unsigned input_size, output_size;
|
unsigned input_size, output_size;
|
||||||
is >> input_size >> output_size;
|
is >> input_size >> output_size;
|
||||||
sample samp(input_size, output_size);;
|
sample samp(input_size, output_size);;
|
||||||
while (is >> samp) { push_back(samp); }
|
while (is >> samp) { push_back(samp); }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ namespace qp
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
for(iterator n = begin(); n != end(); ++n)
|
for(iterator n = begin(); n != end(); ++n)
|
||||||
n->reset();
|
n->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
vector operator()(const vector& input)
|
vector operator()(const vector& input)
|
||||||
|
|
@ -110,7 +110,7 @@ namespace qp
|
||||||
vector output(size());
|
vector output(size());
|
||||||
|
|
||||||
for(unsigned i = 0; i < output.size(); ++i)
|
for(unsigned i = 0; i < output.size(); ++i)
|
||||||
output[i] = (*this)[i](input);
|
output[i] = (*this)[i](input);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +135,7 @@ namespace qp
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
for(iterator l = begin(); l != end(); ++l)
|
for(iterator l = begin(); l != end(); ++l)
|
||||||
l->reset();
|
l->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
real train(const set& ts,
|
real train(const set& ts,
|
||||||
|
|
|
||||||
|
|
@ -211,4 +211,3 @@ template<class T> T euclidean_distance(const std::vector<T>& v1,
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(gpsymreg PROPERTIES VERSION "${GPSYMREG_VERSION}")
|
||||||
TARGET_LINK_LIBRARIES(gpsymreg eo eoutils)
|
TARGET_LINK_LIBRARIES(gpsymreg eo eoutils)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
jeggermo@liacs.nl
|
jeggermo@liacs.nl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _FITNESS_FUNCTION_H
|
#ifndef _FITNESS_FUNCTION_H
|
||||||
|
|
@ -225,4 +225,3 @@ class RegFitness: public eoEvalFunc< eoParseTree<FitnessType, Node> >
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
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
|
// 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
|
// 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
|
// create the initial population
|
||||||
|
|
||||||
Pop pop(parameter.population_size, initializer);
|
Pop pop(parameter.population_size, initializer);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// and evaluate the individuals
|
// and evaluate the individuals
|
||||||
|
|
||||||
apply<EoType>(eval, pop);
|
apply<EoType>(eval, pop);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -335,10 +335,3 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
jeggermo@liacs.nl
|
jeggermo@liacs.nl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _NODE_H
|
#ifndef _NODE_H
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
jeggermo@liacs.nl
|
jeggermo@liacs.nl
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _PARAMETERS_FUNCTION_H
|
#ifndef _PARAMETERS_FUNCTION_H
|
||||||
|
|
@ -100,8 +100,8 @@ struct Parameters{
|
||||||
|
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
parser.printHelp(cout);
|
parser.printHelp(cout);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,3 @@ SET_TARGET_PROPERTIES(mastermind PROPERTIES VERSION "${MASTERMIND_VERSION}")
|
||||||
TARGET_LINK_LIBRARIES(mastermind eo eoutils)
|
TARGET_LINK_LIBRARIES(mastermind eo eoutils)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
catch (exception& e)
|
catch (exception& e)
|
||||||
{
|
{
|
||||||
cerr << argv[0] << ": " << e.what() << endl;
|
cerr << argv[0] << ": " << e.what() << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
170
eo/config.guess
vendored
170
eo/config.guess
vendored
|
|
@ -3,7 +3,7 @@
|
||||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
# 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
# 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
|
# 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
|
# 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
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
os=netbsd
|
os=netbsd
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# The OS release
|
# 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}'`
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||||
;;
|
;;
|
||||||
*5.*)
|
*5.*)
|
||||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
# 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
|
echo i370-ibm-openedition
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:OS400:*:*)
|
*:OS400:*:*)
|
||||||
echo powerpc-ibm-os400
|
echo powerpc-ibm-os400
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
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
|
# MiNT. But MiNT is downward compatible to TOS, so this should
|
||||||
# be no problem.
|
# be no problem.
|
||||||
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
||||||
echo m68k-atari-mint${UNAME_RELEASE}
|
echo m68k-atari-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
||||||
echo m68k-milan-mint${UNAME_RELEASE}
|
echo m68k-milan-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
||||||
echo m68k-hades-mint${UNAME_RELEASE}
|
echo m68k-hades-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
m68k:machten:*:*)
|
m68k:machten:*:*)
|
||||||
echo m68k-apple-machten${UNAME_RELEASE}
|
echo m68k-apple-machten${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -504,8 +504,8 @@ EOF
|
||||||
echo m88k-motorola-sysv3
|
echo m88k-motorola-sysv3
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
AViiON:dgux:*:*)
|
AViiON:dgux:*:*)
|
||||||
# DG/UX returns AViiON for all architectures
|
# DG/UX returns AViiON for all architectures
|
||||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||||
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
||||||
then
|
then
|
||||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
||||||
|
|
@ -614,52 +614,52 @@ EOF
|
||||||
9000/[678][0-9][0-9])
|
9000/[678][0-9][0-9])
|
||||||
if [ -x /usr/bin/getconf ]; then
|
if [ -x /usr/bin/getconf ]; then
|
||||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||||
case "${sc_cpu_version}" in
|
case "${sc_cpu_version}" in
|
||||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||||
532) # CPU_PA_RISC2_0
|
532) # CPU_PA_RISC2_0
|
||||||
case "${sc_kernel_bits}" in
|
case "${sc_kernel_bits}" in
|
||||||
32) HP_ARCH="hppa2.0n" ;;
|
32) HP_ARCH="hppa2.0n" ;;
|
||||||
64) HP_ARCH="hppa2.0w" ;;
|
64) HP_ARCH="hppa2.0w" ;;
|
||||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||||
esac ;;
|
esac ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
if [ "${HP_ARCH}" = "" ]; then
|
if [ "${HP_ARCH}" = "" ]; then
|
||||||
eval $set_cc_for_build
|
eval $set_cc_for_build
|
||||||
sed 's/^ //' << EOF >$dummy.c
|
sed 's/^ //' << EOF >$dummy.c
|
||||||
|
|
||||||
#define _HPUX_SOURCE
|
#define _HPUX_SOURCE
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
{
|
{
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
long bits = sysconf(_SC_KERNEL_BITS);
|
long bits = sysconf(_SC_KERNEL_BITS);
|
||||||
#endif
|
#endif
|
||||||
long cpu = sysconf (_SC_CPU_VERSION);
|
long cpu = sysconf (_SC_CPU_VERSION);
|
||||||
|
|
||||||
switch (cpu)
|
switch (cpu)
|
||||||
{
|
{
|
||||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||||
case CPU_PA_RISC2_0:
|
case CPU_PA_RISC2_0:
|
||||||
#if defined(_SC_KERNEL_BITS)
|
#if defined(_SC_KERNEL_BITS)
|
||||||
switch (bits)
|
switch (bits)
|
||||||
{
|
{
|
||||||
case 64: puts ("hppa2.0w"); break;
|
case 64: puts ("hppa2.0w"); break;
|
||||||
case 32: puts ("hppa2.0n"); break;
|
case 32: puts ("hppa2.0n"); break;
|
||||||
default: puts ("hppa2.0"); break;
|
default: puts ("hppa2.0"); break;
|
||||||
} break;
|
} break;
|
||||||
#else /* !defined(_SC_KERNEL_BITS) */
|
#else /* !defined(_SC_KERNEL_BITS) */
|
||||||
puts ("hppa2.0"); break;
|
puts ("hppa2.0"); break;
|
||||||
#endif
|
#endif
|
||||||
default: puts ("hppa1.0"); break;
|
default: puts ("hppa1.0"); break;
|
||||||
}
|
}
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||||
|
|
@ -739,22 +739,22 @@ EOF
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||||
echo c1-convex-bsd
|
echo c1-convex-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||||
if getsysinfo -f scalar_acc
|
if getsysinfo -f scalar_acc
|
||||||
then echo c32-convex-bsd
|
then echo c32-convex-bsd
|
||||||
else echo c2-convex-bsd
|
else echo c2-convex-bsd
|
||||||
fi
|
fi
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||||
echo c34-convex-bsd
|
echo c34-convex-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||||
echo c38-convex-bsd
|
echo c38-convex-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||||
echo c4-convex-bsd
|
echo c4-convex-bsd
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
CRAY*Y-MP:*:*:*)
|
CRAY*Y-MP:*:*:*)
|
||||||
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -778,14 +778,14 @@ EOF
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
5000:UNIX_System_V:4.*:*)
|
5000:UNIX_System_V:4.*:*)
|
||||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||||
|
|
@ -919,7 +919,7 @@ EOF
|
||||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||||
esac
|
esac
|
||||||
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
|
||||||
if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi
|
if test "$?" = 0 ; then LIBC="-libc1" ; else LIBC="" ; fi
|
||||||
echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC}
|
echo ${UNAME_MACHINE}-${VENDOR}-linux${LIBC}
|
||||||
|
|
@ -961,7 +961,7 @@ EOF
|
||||||
s/.*supported targets: *//
|
s/.*supported targets: *//
|
||||||
s/ .*//
|
s/ .*//
|
||||||
p'`
|
p'`
|
||||||
case "$ld_supported_targets" in
|
case "$ld_supported_targets" in
|
||||||
elf32-i386)
|
elf32-i386)
|
||||||
TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux"
|
TENTATIVE="${UNAME_MACHINE}-${VENDOR}-linux"
|
||||||
;;
|
;;
|
||||||
|
|
@ -1013,11 +1013,11 @@ EOF
|
||||||
echo i386-sequent-sysv4
|
echo i386-sequent-sysv4
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
i*86:UNIX_SV:4.2MP:2.*)
|
i*86:UNIX_SV:4.2MP:2.*)
|
||||||
# Unixware is an offshoot of SVR4, but it has its own version
|
# Unixware is an offshoot of SVR4, but it has its own version
|
||||||
# number series starting with 2...
|
# number series starting with 2...
|
||||||
# I am not positive that other SVR4 systems won't match this,
|
# I am not positive that other SVR4 systems won't match this,
|
||||||
# I just have to hope. -- rms.
|
# 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}
|
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
i*86:OS/2:*:*)
|
i*86:OS/2:*:*)
|
||||||
|
|
@ -1076,10 +1076,10 @@ EOF
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
pc:*:*:*)
|
pc:*:*:*)
|
||||||
# Left here for compatibility:
|
# Left here for compatibility:
|
||||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||||
# the processor, so we play safe by assuming i386.
|
# the processor, so we play safe by assuming i386.
|
||||||
echo i386-pc-msdosdjgpp
|
echo i386-pc-msdosdjgpp
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
Intel:Mach:3*:*)
|
Intel:Mach:3*:*)
|
||||||
echo i386-pc-mach3
|
echo i386-pc-mach3
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -1114,8 +1114,8 @@ EOF
|
||||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||||
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
&& echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
|
||||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||||
&& echo i486-ncr-sysv4 && exit 0 ;;
|
&& echo i486-ncr-sysv4 && exit 0 ;;
|
||||||
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
|
||||||
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
echo m68k-unknown-lynxos${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -1149,9 +1149,9 @@ EOF
|
||||||
fi
|
fi
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||||
echo i586-unisys-sysv4
|
echo i586-unisys-sysv4
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:UNIX_System_V:4*:FTX*)
|
*:UNIX_System_V:4*:FTX*)
|
||||||
# From Gerald Hewes <hewes@openmarket.com>.
|
# From Gerald Hewes <hewes@openmarket.com>.
|
||||||
# How about differentiating between stratus architectures? -djm
|
# How about differentiating between stratus architectures? -djm
|
||||||
|
|
@ -1173,11 +1173,11 @@ EOF
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||||
if [ -d /usr/nec ]; then
|
if [ -d /usr/nec ]; then
|
||||||
echo mips-nec-sysv${UNAME_RELEASE}
|
echo mips-nec-sysv${UNAME_RELEASE}
|
||||||
else
|
else
|
||||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||||
fi
|
fi
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
||||||
echo powerpc-be-beos
|
echo powerpc-be-beos
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
|
|
@ -1262,7 +1262,7 @@ EOF
|
||||||
echo pdp10-unknown-its
|
echo pdp10-unknown-its
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
SEI:*:*:SEIUX)
|
SEI:*:*:SEIUX)
|
||||||
echo mips-sei-seiux${UNAME_RELEASE}
|
echo mips-sei-seiux${UNAME_RELEASE}
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*:DragonFly:*:*)
|
*:DragonFly:*:*)
|
||||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||||
|
|
@ -1289,11 +1289,11 @@ main ()
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
printf ("m68k-sony-newsos%s\n",
|
printf ("m68k-sony-newsos%s\n",
|
||||||
#ifdef NEWSOS4
|
#ifdef NEWSOS4
|
||||||
"4"
|
"4"
|
||||||
#else
|
#else
|
||||||
""
|
""
|
||||||
#endif
|
#endif
|
||||||
); exit (0);
|
); exit (0);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,5 +71,3 @@
|
||||||
|
|
||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
#cmakedefine size_t
|
#cmakedefine size_t
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
Contact: todos@geneura.ugr.es, http://geneura.ugr.es
|
||||||
Marc.Schoenauer@polytechnique.fr
|
Marc.Schoenauer@polytechnique.fr
|
||||||
mak@dhi.dk
|
mak@dhi.dk
|
||||||
*/
|
*/
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,14 +57,3 @@
|
||||||
#include <boost/config/suffix.hpp>
|
#include <boost/config/suffix.hpp>
|
||||||
|
|
||||||
#endif // BOOST_CONFIG_HPP
|
#endif // BOOST_CONFIG_HPP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,5 +19,3 @@
|
||||||
#ifdef BOOST_HAS_ABI_HEADERS
|
#ifdef BOOST_HAS_ABI_HEADERS
|
||||||
# include BOOST_ABI_SUFFIX
|
# include BOOST_ABI_SUFFIX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,13 @@ USAGE:
|
||||||
Before including this header you must define one or more of define the following macros:
|
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,
|
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_LIB_TOOLSET: Optional: the base name of the toolset.
|
||||||
BOOST_DYN_LINK: Optional: when set link to dll rather than static library.
|
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
|
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,
|
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
|
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!
|
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_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
|
||||||
|
|
||||||
BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used,
|
BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used,
|
||||||
contains one or more of the following letters after
|
contains one or more of the following letters after
|
||||||
a hiphen:
|
a hiphen:
|
||||||
|
|
||||||
s static runtime (dynamic if not present).
|
s static runtime (dynamic if not present).
|
||||||
d debug build (release if not present).
|
d debug build (release if not present).
|
||||||
g debug/diagnostic runtime (release if not present).
|
g debug/diagnostic runtime (release if not present).
|
||||||
p STLPort Build.
|
p STLPort Build.
|
||||||
|
|
||||||
BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
|
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)
|
#if defined(BOOST_AUTO_LINK_NOMANGLE)
|
||||||
# undef BOOST_AUTO_LINK_NOMANGLE
|
# undef BOOST_AUTO_LINK_NOMANGLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// (C) Copyright John maddock 1999.
|
// (C) Copyright John maddock 1999.
|
||||||
// (C) David Abrahams 2002. Distributed under the Boost
|
// (C) David Abrahams 2002. Distributed under the Boost
|
||||||
// Software License, Version 1.0. (See accompanying file
|
// Software License, Version 1.0. (See accompanying file
|
||||||
|
|
|
||||||
|
|
@ -106,4 +106,3 @@ class eoAged: public Object
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif EOAGE_H
|
#endif EOAGE_H
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ using namespace std;
|
||||||
// eoDrawable
|
// eoDrawable
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
/** eoDrawable is a template class that adds a drawing interface to an object.\\
|
/** 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
|
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,
|
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
|
eoDrawables can be drawn on any two-dimensional surface; it can be added to any
|
||||||
|
|
@ -61,4 +61,4 @@ class eoDrawable
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif EODRAWABLE_H
|
#endif //! EODRAWABLE_H
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ PREFIX = "/usr"
|
||||||
DATA = {
|
DATA = {
|
||||||
'dirs': [ "%s/share/%s" % (PREFIX, NAME) ],
|
'dirs': [ "%s/share/%s" % (PREFIX, NAME) ],
|
||||||
'links': [ ("%s/src" % SOURCE, "%s/include/%s" % (PREFIX, NAME)),
|
'links': [ ("%s/src" % SOURCE, "%s/include/%s" % (PREFIX, NAME)),
|
||||||
("%s/doc" % BINARY, "%s/share/%s/doc" % (PREFIX, NAME)),
|
("%s/doc" % BINARY, "%s/share/%s/doc" % (PREFIX, NAME)),
|
||||||
("%s/%s.pc" % (BINARY, NAME), "%s/lib/pkgconfig/%s.pc" % (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"]
|
LIBRARIES = ["libcma.a", "libeo.a", "libeoutils.a", "libes.a", "libga.a"]
|
||||||
|
|
@ -21,8 +21,8 @@ import os, sys
|
||||||
|
|
||||||
def isroot():
|
def isroot():
|
||||||
if os.getuid() != 0:
|
if os.getuid() != 0:
|
||||||
print '[WARNING] you have to be root'
|
print '[WARNING] you have to be root'
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def uninstall():
|
def uninstall():
|
||||||
|
|
@ -41,11 +41,11 @@ def data():
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if not isroot():
|
if not isroot():
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print 'Usage: %s [install|uninstall|data]' % sys.argv[0]
|
print 'Usage: %s [install|uninstall|data]' % sys.argv[0]
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if sys.argv[1] == 'install': install()
|
if sys.argv[1] == 'install': install()
|
||||||
elif sys.argv[1] == 'uninstall': uninstall()
|
elif sys.argv[1] == 'uninstall': uninstall()
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,14 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
SET(EO_LIB_OUTPUT_PATH ${EO_BINARY_DIR}/lib)
|
SET(EO_LIB_OUTPUT_PATH ${EO_BINARY_DIR}/lib)
|
||||||
SET(LIBRARY_OUTPUT_PATH ${EO_LIB_OUTPUT_PATH})
|
SET(LIBRARY_OUTPUT_PATH ${EO_LIB_OUTPUT_PATH})
|
||||||
|
|
||||||
SET (EO_SOURCES eoFunctorStore.cpp
|
SET(EO_SOURCES
|
||||||
eoPersistent.cpp
|
eoFunctorStore.cpp
|
||||||
eoPrintable.cpp
|
eoPersistent.cpp
|
||||||
eoCtrlCContinue.cpp
|
eoPrintable.cpp
|
||||||
eoScalarFitnessAssembled.cpp
|
eoCtrlCContinue.cpp
|
||||||
eoSIGContinue.cpp)
|
eoScalarFitnessAssembled.cpp
|
||||||
|
eoSIGContinue.cpp
|
||||||
|
)
|
||||||
|
|
||||||
ADD_LIBRARY(eo STATIC ${EO_SOURCES})
|
ADD_LIBRARY(eo STATIC ${EO_SOURCES})
|
||||||
INSTALL(TARGETS eo ARCHIVE DESTINATION lib COMPONENT libraries)
|
INSTALL(TARGETS eo ARCHIVE DESTINATION lib COMPONENT libraries)
|
||||||
|
|
@ -42,6 +43,6 @@ ADD_SUBDIRECTORY(ga)
|
||||||
ADD_SUBDIRECTORY(gp)
|
ADD_SUBDIRECTORY(gp)
|
||||||
ADD_SUBDIRECTORY(other)
|
ADD_SUBDIRECTORY(other)
|
||||||
ADD_SUBDIRECTORY(utils)
|
ADD_SUBDIRECTORY(utils)
|
||||||
|
ADD_SUBDIRECTORY(pyeo)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
|
||||||
27
eo/src/EO.h
27
eo/src/EO.h
|
|
@ -128,18 +128,18 @@ public:
|
||||||
// It can distinguish between valid and invalid fitness values.
|
// It can distinguish between valid and invalid fitness values.
|
||||||
std::string fitness_str;
|
std::string fitness_str;
|
||||||
int pos = _is.tellg();
|
int pos = _is.tellg();
|
||||||
_is >> fitness_str;
|
_is >> fitness_str;
|
||||||
|
|
||||||
if (fitness_str == "INVALID")
|
if (fitness_str == "INVALID")
|
||||||
{
|
{
|
||||||
invalidFitness = true;
|
invalidFitness = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
invalidFitness = false;
|
invalidFitness = false;
|
||||||
_is.seekg(pos); // rewind
|
_is.seekg(pos); // rewind
|
||||||
_is >> repFitness;
|
_is >> repFitness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -151,11 +151,11 @@ public:
|
||||||
|
|
||||||
// the latest version of the code. Very similar to the old code
|
// the latest version of the code. Very similar to the old code
|
||||||
if (invalid()) {
|
if (invalid()) {
|
||||||
_os << "INVALID ";
|
_os << "INVALID ";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_os << repFitness << ' ';
|
_os << repFitness << ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -171,4 +171,3 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
10
eo/src/PO.h
10
eo/src/PO.h
|
|
@ -43,11 +43,11 @@ template < class F > class PO:public EO < F >
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#if defined(__CUDACC__)
|
#if defined(__CUDACC__)
|
||||||
typedef typename EO < F >::Fitness Fitness;
|
typedef typename EO < F >::Fitness Fitness;
|
||||||
#else
|
#else
|
||||||
typedef typename PO<F>::Fitness Fitness;
|
typedef typename PO<F>::Fitness Fitness;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Default constructor.
|
/** Default constructor.
|
||||||
Fitness must have a ctor which takes 0 as a value. Best fitness mush also have the same constructor.
|
Fitness must have a ctor which takes 0 as a value. Best fitness mush also have the same constructor.
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,12 @@
|
||||||
#ifndef _apply_h
|
#ifndef _apply_h
|
||||||
#define _apply_h
|
#define _apply_h
|
||||||
|
|
||||||
|
#include <utils/eoParallel.h>
|
||||||
|
#include <utils/eoParser.h>
|
||||||
|
#include <utils/eoLogger.h>
|
||||||
#include <eoFunctor.h>
|
#include <eoFunctor.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <omp.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Applies a unary function to a std::vector of things.
|
Applies a unary function to a std::vector of things.
|
||||||
|
|
@ -37,7 +41,76 @@
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
void apply(eoUF<EOT&, void>& _proc, std::vector<EOT>& _pop)
|
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]);
|
_proc(_pop[i]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,12 +87,12 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
|
||||||
|
|
||||||
if (!ppSelect.second.size()) // no parameter added
|
if (!ppSelect.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
|
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
|
||||||
detSize = 2;
|
detSize = 2;
|
||||||
// put back 2 in parameter for consistency (and status file)
|
// put back 2 in parameter for consistency (and status file)
|
||||||
ppSelect.second.push_back(std::string("2"));
|
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());
|
detSize = atoi(ppSelect.second[0].c_str());
|
||||||
select = new eoDetTournamentSelect<EOT>(detSize);
|
select = new eoDetTournamentSelect<EOT>(detSize);
|
||||||
}
|
}
|
||||||
|
|
@ -100,14 +100,14 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
|
||||||
{
|
{
|
||||||
double p;
|
double p;
|
||||||
if (!ppSelect.second.size()) // no parameter added
|
if (!ppSelect.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
|
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
|
||||||
p = 1;
|
p = 1;
|
||||||
// put back p in parameter for consistency (and status file)
|
// put back p in parameter for consistency (and status file)
|
||||||
ppSelect.second.push_back(std::string("1"));
|
ppSelect.second.push_back(std::string("1"));
|
||||||
}
|
}
|
||||||
else // parameter passed by user as DetTour(T)
|
else // parameter passed by user as DetTour(T)
|
||||||
p = atof(ppSelect.second[0].c_str());
|
p = atof(ppSelect.second[0].c_str());
|
||||||
|
|
||||||
select = new eoStochTournamentSelect<EOT>(p);
|
select = new eoStochTournamentSelect<EOT>(p);
|
||||||
}
|
}
|
||||||
|
|
@ -115,42 +115,42 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
|
||||||
{
|
{
|
||||||
double p,e;
|
double p,e;
|
||||||
if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent
|
if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent
|
||||||
{
|
{
|
||||||
p = atof(ppSelect.second[0].c_str());
|
p = atof(ppSelect.second[0].c_str());
|
||||||
e = atof(ppSelect.second[1].c_str());
|
e = atof(ppSelect.second[1].c_str());
|
||||||
}
|
}
|
||||||
else if (ppSelect.second.size()==1) // 1 parameter: pressure
|
else if (ppSelect.second.size()==1) // 1 parameter: pressure
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
|
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
|
||||||
e = 1;
|
e = 1;
|
||||||
ppSelect.second.push_back(std::string("1"));
|
ppSelect.second.push_back(std::string("1"));
|
||||||
p = atof(ppSelect.second[0].c_str());
|
p = atof(ppSelect.second[0].c_str());
|
||||||
}
|
}
|
||||||
else // no parameters ... or garbage
|
else // no parameters ... or garbage
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
|
std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
|
||||||
p=2;
|
p=2;
|
||||||
e=1;
|
e=1;
|
||||||
// put back in parameter for consistency (and status file)
|
// put back in parameter for consistency (and status file)
|
||||||
ppSelect.second.resize(2); // just in case
|
ppSelect.second.resize(2); // just in case
|
||||||
ppSelect.second[0] = (std::string("2"));
|
ppSelect.second[0] = (std::string("2"));
|
||||||
ppSelect.second[1] = (std::string("1"));
|
ppSelect.second[1] = (std::string("1"));
|
||||||
}
|
}
|
||||||
// check for authorized values
|
// check for authorized values
|
||||||
// pressure in (0,1]
|
// pressure in (0,1]
|
||||||
if ( (p<=1) || (p>2) )
|
if ( (p<=1) || (p>2) )
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, selective pressure must be in (1,2] in Ranking, using 2\n";
|
std::cerr << "WARNING, selective pressure must be in (1,2] in Ranking, using 2\n";
|
||||||
p=2;
|
p=2;
|
||||||
ppSelect.second[0] = (std::string("2"));
|
ppSelect.second[0] = (std::string("2"));
|
||||||
}
|
}
|
||||||
// exponent >0
|
// exponent >0
|
||||||
if (e<=0)
|
if (e<=0)
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
|
std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
|
||||||
e=1;
|
e=1;
|
||||||
ppSelect.second[1] = (std::string("1"));
|
ppSelect.second[1] = (std::string("1"));
|
||||||
}
|
}
|
||||||
// now we're OK
|
// now we're OK
|
||||||
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
|
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
|
||||||
select = new eoRouletteWorthSelect<EOT>(p2w);
|
select = new eoRouletteWorthSelect<EOT>(p2w);
|
||||||
|
|
@ -159,13 +159,13 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
|
||||||
{
|
{
|
||||||
bool b;
|
bool b;
|
||||||
if (ppSelect.second.size() == 0) // no argument -> default = ordered
|
if (ppSelect.second.size() == 0) // no argument -> default = ordered
|
||||||
{
|
{
|
||||||
b=true;
|
b=true;
|
||||||
// put back in parameter for consistency (and status file)
|
// put back in parameter for consistency (and status file)
|
||||||
ppSelect.second.push_back(std::string("ordered"));
|
ppSelect.second.push_back(std::string("ordered"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
b = !(ppSelect.second[0] == std::string("unordered"));
|
b = !(ppSelect.second[0] == std::string("unordered"));
|
||||||
select = new eoSequentialSelect<EOT>(b);
|
select = new eoSequentialSelect<EOT>(b);
|
||||||
}
|
}
|
||||||
else if (ppSelect.first == std::string("EliteSequential")) // Best first, one after the other in random order afterwards
|
else if (ppSelect.first == std::string("EliteSequential")) // Best first, one after the other in random order afterwards
|
||||||
|
|
@ -246,22 +246,22 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
|
||||||
// the tournament size
|
// the tournament size
|
||||||
if (!replacementParam.second.size()) // no parameter added
|
if (!replacementParam.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to MGG replacement, using 2" << std::endl;
|
std::cerr << "WARNING, no parameter passed to MGG replacement, using 2" << std::endl;
|
||||||
tSize = 2;
|
tSize = 2;
|
||||||
// put back 2 in parameter for consistency (and status file)
|
// put back 2 in parameter for consistency (and status file)
|
||||||
replacementParam.second.push_back(std::string("2"));
|
replacementParam.second.push_back(std::string("2"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t = atof(replacementParam.second[0].c_str());
|
t = atof(replacementParam.second[0].c_str());
|
||||||
if (t>=2)
|
if (t>=2)
|
||||||
{ // build the appropriate deafult value
|
{ // build the appropriate deafult value
|
||||||
tSize = unsigned(t);
|
tSize = unsigned(t);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Sorry, only deterministic tournament available at the moment");
|
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);
|
_state.storeFunctor(ptReplace);
|
||||||
|
|
@ -283,12 +283,12 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
|
||||||
// ---------- General
|
// ---------- General
|
||||||
if (replacementParam.first == std::string("General"))
|
if (replacementParam.first == std::string("General"))
|
||||||
{
|
{
|
||||||
; // defaults OK
|
; // defaults OK
|
||||||
}
|
}
|
||||||
// ---------- ESComma
|
// ---------- ESComma
|
||||||
else if (replacementParam.first == std::string("ESComma"))
|
else if (replacementParam.first == std::string("ESComma"))
|
||||||
{
|
{
|
||||||
; // OK too
|
; // OK too
|
||||||
}
|
}
|
||||||
// ---------- ESPlus
|
// ---------- ESPlus
|
||||||
else if (replacementParam.first == std::string("ESPlus"))
|
else if (replacementParam.first == std::string("ESPlus"))
|
||||||
|
|
@ -298,16 +298,16 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
|
||||||
// ---------- Generational
|
// ---------- Generational
|
||||||
else if (replacementParam.first == std::string("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
|
// ---------- EP
|
||||||
else if (replacementParam.first == std::string("EP"))
|
else if (replacementParam.first == std::string("EP"))
|
||||||
{
|
{
|
||||||
if (!replacementParam.second.size()) // no parameter added
|
if (!replacementParam.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to EP replacement, using 6" << std::endl;
|
std::cerr << "WARNING, no parameter passed to EP replacement, using 6" << std::endl;
|
||||||
// put back 6 in parameter for consistency (and status file)
|
// put back 6 in parameter for consistency (and status file)
|
||||||
replacementParam.second.push_back(std::string("6"));
|
replacementParam.second.push_back(std::string("6"));
|
||||||
}
|
}
|
||||||
// by coincidence, the syntax for the EP reducer is the same than here:
|
// by coincidence, the syntax for the EP reducer is the same than here:
|
||||||
reduceFinalType = replacementParam;
|
reduceFinalType = replacementParam;
|
||||||
|
|
@ -318,28 +318,28 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
|
||||||
{
|
{
|
||||||
if (!replacementParam.second.size()) // no parameter added
|
if (!replacementParam.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to SSGA replacement, using 2" << std::endl;
|
std::cerr << "WARNING, no parameter passed to SSGA replacement, using 2" << std::endl;
|
||||||
// put back 2 in parameter for consistency (and status file)
|
// put back 2 in parameter for consistency (and status file)
|
||||||
replacementParam.second.push_back(std::string("2"));
|
replacementParam.second.push_back(std::string("2"));
|
||||||
reduceParentType = eoParamParamType(std::string("DetTour(2)"));
|
reduceParentType = eoParamParamType(std::string("DetTour(2)"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t = atof(replacementParam.second[0].c_str());
|
t = atof(replacementParam.second[0].c_str());
|
||||||
if (t>=2)
|
if (t>=2)
|
||||||
{ // build the appropriate deafult value
|
{ // build the appropriate deafult value
|
||||||
reduceParentType = eoParamParamType(std::string("DetTour(") + replacementParam.second[0].c_str() + ")");
|
reduceParentType = eoParamParamType(std::string("DetTour(") + replacementParam.second[0].c_str() + ")");
|
||||||
}
|
}
|
||||||
else // check for [0.5,1] will be made in make_general_replacement
|
else // check for [0.5,1] will be made in make_general_replacement
|
||||||
{ // build the appropriate deafult value
|
{ // build the appropriate deafult value
|
||||||
reduceParentType = eoParamParamType(std::string("StochTour(") + replacementParam.second[0].c_str() + ")");
|
reduceParentType = eoParamParamType(std::string("StochTour(") + replacementParam.second[0].c_str() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
surviveParents = eoHowMany(-1);
|
surviveParents = eoHowMany(-1);
|
||||||
surviveOffspring = eoHowMany(1);
|
surviveOffspring = eoHowMany(1);
|
||||||
}
|
}
|
||||||
else // no replacement recognized
|
else // no replacement recognized
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Invalid replacement type " + replacementParam.first);
|
throw std::runtime_error("Invalid replacement type " + replacementParam.first);
|
||||||
}
|
}
|
||||||
|
|
@ -381,7 +381,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc<EOT>& _eval, eoContinue<EOT>& _continue, eoGenOp<EOT>& _op)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
||||||
if (_dist == NULL)
|
if (_dist == NULL)
|
||||||
comment = "Selection: DetTour(T), StochTour(t), Roulette, Ranking(p,e) or Sequential(ordered/unordered)";
|
comment = "Selection: DetTour(T), StochTour(t), Roulette, Ranking(p,e) or Sequential(ordered/unordered)";
|
||||||
else
|
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");
|
eoValueParam<eoParamParamType>& selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection", comment, 'S', "Evolution Engine");
|
||||||
|
|
||||||
|
|
@ -97,12 +97,12 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
||||||
|
|
||||||
if (!ppSelect.second.size()) // no parameter added
|
if (!ppSelect.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
|
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
|
||||||
detSize = 2;
|
detSize = 2;
|
||||||
// put back 2 in parameter for consistency (and status file)
|
// put back 2 in parameter for consistency (and status file)
|
||||||
ppSelect.second.push_back(std::string("2"));
|
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());
|
detSize = atoi(ppSelect.second[0].c_str());
|
||||||
select = new eoDetTournamentSelect<EOT>(detSize);
|
select = new eoDetTournamentSelect<EOT>(detSize);
|
||||||
}
|
}
|
||||||
|
|
@ -112,14 +112,14 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
||||||
|
|
||||||
if (!ppSelect.second.size()) // no parameter added
|
if (!ppSelect.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to Sharing, using 0.5" << std::endl;
|
std::cerr << "WARNING, no parameter passed to Sharing, using 0.5" << std::endl;
|
||||||
nicheSize = 0.5;
|
nicheSize = 0.5;
|
||||||
// put back 2 in parameter for consistency (and status file)
|
// put back 2 in parameter for consistency (and status file)
|
||||||
ppSelect.second.push_back(std::string("0.5"));
|
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());
|
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");
|
throw std::runtime_error("You didn't specify a distance when calling make_algo_scalar and using sharing");
|
||||||
select = new eoSharingSelect<EOT>(nicheSize, *_dist);
|
select = new eoSharingSelect<EOT>(nicheSize, *_dist);
|
||||||
}
|
}
|
||||||
|
|
@ -127,14 +127,14 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
||||||
{
|
{
|
||||||
double p;
|
double p;
|
||||||
if (!ppSelect.second.size()) // no parameter added
|
if (!ppSelect.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
|
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
|
||||||
p = 1;
|
p = 1;
|
||||||
// put back p in parameter for consistency (and status file)
|
// put back p in parameter for consistency (and status file)
|
||||||
ppSelect.second.push_back(std::string("1"));
|
ppSelect.second.push_back(std::string("1"));
|
||||||
}
|
}
|
||||||
else // parameter passed by user as DetTour(T)
|
else // parameter passed by user as DetTour(T)
|
||||||
p = atof(ppSelect.second[0].c_str());
|
p = atof(ppSelect.second[0].c_str());
|
||||||
|
|
||||||
select = new eoStochTournamentSelect<EOT>(p);
|
select = new eoStochTournamentSelect<EOT>(p);
|
||||||
}
|
}
|
||||||
|
|
@ -142,42 +142,42 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
||||||
{
|
{
|
||||||
double p,e;
|
double p,e;
|
||||||
if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent
|
if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent
|
||||||
{
|
{
|
||||||
p = atof(ppSelect.second[0].c_str());
|
p = atof(ppSelect.second[0].c_str());
|
||||||
e = atof(ppSelect.second[1].c_str());
|
e = atof(ppSelect.second[1].c_str());
|
||||||
}
|
}
|
||||||
else if (ppSelect.second.size()==1) // 1 parameter: pressure
|
else if (ppSelect.second.size()==1) // 1 parameter: pressure
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
|
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
|
||||||
e = 1;
|
e = 1;
|
||||||
ppSelect.second.push_back(std::string("1"));
|
ppSelect.second.push_back(std::string("1"));
|
||||||
p = atof(ppSelect.second[0].c_str());
|
p = atof(ppSelect.second[0].c_str());
|
||||||
}
|
}
|
||||||
else // no parameters ... or garbage
|
else // no parameters ... or garbage
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
|
std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
|
||||||
p=2;
|
p=2;
|
||||||
e=1;
|
e=1;
|
||||||
// put back in parameter for consistency (and status file)
|
// put back in parameter for consistency (and status file)
|
||||||
ppSelect.second.resize(2); // just in case
|
ppSelect.second.resize(2); // just in case
|
||||||
ppSelect.second[0] = (std::string("2"));
|
ppSelect.second[0] = (std::string("2"));
|
||||||
ppSelect.second[1] = (std::string("1"));
|
ppSelect.second[1] = (std::string("1"));
|
||||||
}
|
}
|
||||||
// check for authorized values
|
// check for authorized values
|
||||||
// pressure in (0,1]
|
// pressure in (0,1]
|
||||||
if ( (p<=1) || (p>2) )
|
if ( (p<=1) || (p>2) )
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, selective pressure must be in (0,1] in Ranking, using 2\n";
|
std::cerr << "WARNING, selective pressure must be in (0,1] in Ranking, using 2\n";
|
||||||
p=2;
|
p=2;
|
||||||
ppSelect.second[0] = (std::string("2"));
|
ppSelect.second[0] = (std::string("2"));
|
||||||
}
|
}
|
||||||
// exponent >0
|
// exponent >0
|
||||||
if (e<=0)
|
if (e<=0)
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
|
std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
|
||||||
e=1;
|
e=1;
|
||||||
ppSelect.second[1] = (std::string("1"));
|
ppSelect.second[1] = (std::string("1"));
|
||||||
}
|
}
|
||||||
// now we're OK
|
// now we're OK
|
||||||
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
|
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
|
||||||
select = new eoRouletteWorthSelect<EOT>(p2w);
|
select = new eoRouletteWorthSelect<EOT>(p2w);
|
||||||
|
|
@ -186,13 +186,13 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
||||||
{
|
{
|
||||||
bool b;
|
bool b;
|
||||||
if (ppSelect.second.size() == 0) // no argument -> default = ordered
|
if (ppSelect.second.size() == 0) // no argument -> default = ordered
|
||||||
{
|
{
|
||||||
b=true;
|
b=true;
|
||||||
// put back in parameter for consistency (and status file)
|
// put back in parameter for consistency (and status file)
|
||||||
ppSelect.second.push_back(std::string("ordered"));
|
ppSelect.second.push_back(std::string("ordered"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
b = !(ppSelect.second[0] == std::string("unordered"));
|
b = !(ppSelect.second[0] == std::string("unordered"));
|
||||||
select = new eoSequentialSelect<EOT>(b);
|
select = new eoSequentialSelect<EOT>(b);
|
||||||
}
|
}
|
||||||
else if (ppSelect.first == std::string("Roulette")) // no argument (yet)
|
else if (ppSelect.first == std::string("Roulette")) // no argument (yet)
|
||||||
|
|
@ -233,14 +233,14 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
||||||
unsigned detSize;
|
unsigned detSize;
|
||||||
|
|
||||||
if (!ppReplace.second.size()) // no parameter added
|
if (!ppReplace.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to EPTour, using 6" << std::endl;
|
std::cerr << "WARNING, no parameter passed to EPTour, using 6" << std::endl;
|
||||||
detSize = 6;
|
detSize = 6;
|
||||||
// put back in parameter for consistency (and status file)
|
// put back in parameter for consistency (and status file)
|
||||||
ppReplace.second.push_back(std::string("6"));
|
ppReplace.second.push_back(std::string("6"));
|
||||||
}
|
}
|
||||||
else // parameter passed by user as EPTour(T)
|
else // parameter passed by user as EPTour(T)
|
||||||
detSize = atoi(ppSelect.second[0].c_str());
|
detSize = atoi(ppSelect.second[0].c_str());
|
||||||
|
|
||||||
replace = new eoEPReplacement<EOT>(detSize);
|
replace = new eoEPReplacement<EOT>(detSize);
|
||||||
}
|
}
|
||||||
|
|
@ -253,14 +253,14 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
||||||
unsigned detSize;
|
unsigned detSize;
|
||||||
|
|
||||||
if (!ppReplace.second.size()) // no parameter added
|
if (!ppReplace.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to SSGADet, using 2" << std::endl;
|
std::cerr << "WARNING, no parameter passed to SSGADet, using 2" << std::endl;
|
||||||
detSize = 2;
|
detSize = 2;
|
||||||
// put back in parameter for consistency (and status file)
|
// put back in parameter for consistency (and status file)
|
||||||
ppReplace.second.push_back(std::string("2"));
|
ppReplace.second.push_back(std::string("2"));
|
||||||
}
|
}
|
||||||
else // parameter passed by user as SSGADet(T)
|
else // parameter passed by user as SSGADet(T)
|
||||||
detSize = atoi(ppSelect.second[0].c_str());
|
detSize = atoi(ppSelect.second[0].c_str());
|
||||||
|
|
||||||
replace = new eoSSGADetTournamentReplacement<EOT>(detSize);
|
replace = new eoSSGADetTournamentReplacement<EOT>(detSize);
|
||||||
}
|
}
|
||||||
|
|
@ -268,14 +268,14 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
||||||
{
|
{
|
||||||
double p;
|
double p;
|
||||||
if (!ppReplace.second.size()) // no parameter added
|
if (!ppReplace.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to SSGAStoch, using 1" << std::endl;
|
std::cerr << "WARNING, no parameter passed to SSGAStoch, using 1" << std::endl;
|
||||||
p = 1;
|
p = 1;
|
||||||
// put back in parameter for consistency (and status file)
|
// put back in parameter for consistency (and status file)
|
||||||
ppReplace.second.push_back(std::string("1"));
|
ppReplace.second.push_back(std::string("1"));
|
||||||
}
|
}
|
||||||
else // parameter passed by user as SSGADet(T)
|
else // parameter passed by user as SSGADet(T)
|
||||||
p = atof(ppSelect.second[0].c_str());
|
p = atof(ppSelect.second[0].c_str());
|
||||||
|
|
||||||
replace = new eoSSGAStochTournamentReplacement<EOT>(p);
|
replace = new eoSSGAStochTournamentReplacement<EOT>(p);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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");
|
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;
|
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()
|
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() ||
|
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
|
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
|
||||||
|
|
||||||
|
|
@ -367,41 +367,41 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu
|
||||||
|
|
||||||
#ifdef _MSVC
|
#ifdef _MSVC
|
||||||
|
|
||||||
std::string stmp = dirNameParam.value() + "\best.xg";
|
std::string stmp = dirNameParam.value() + "\best.xg";
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
std::string stmp = dirNameParam.value() + "/best.xg";
|
std::string stmp = dirNameParam.value() + "/best.xg";
|
||||||
|
|
||||||
#endif
|
#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 )
|
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 )
|
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
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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");
|
eoValueParam<std::string>& dirNameParam = _parser.createParam(std::string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output - Disk");
|
||||||
// shoudl we empty it if exists
|
// shoudl we empty it if exists
|
||||||
eoValueParam<bool>& eraseParam = _parser.createParam(false, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk");
|
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:
|
// 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() )
|
if ( printBestParam.value() || plotBestParam.value() || fileBestParam.value() )
|
||||||
// we need the bestStat for at least one of the 3 above
|
// we need the bestStat for at least one of the 3 above
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Average fitness alone
|
// 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?
|
eoAverageStat<EOT> *averageStat = NULL; // do we need averageStat?
|
||||||
if ( plotBestParam.value() ) // we need it for gnuplot output
|
if ( plotBestParam.value() ) // we need it for gnuplot output
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second moment stats: average and stdev
|
// Second moment stats: average and stdev
|
||||||
|
|
@ -122,11 +122,11 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
||||||
eoSecondMomentStats<EOT> *secondStat = NULL;
|
eoSecondMomentStats<EOT> *secondStat = NULL;
|
||||||
if ( printBestParam.value() ) // we need it for sreen output
|
if ( printBestParam.value() ) // we need it for sreen 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -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");
|
eoValueParam<bool>& printPopParam = _parser.createParam(false, "printPop", "Print sorted pop. every gen.", '\0', "Output");
|
||||||
if ( printPopParam.value() ) // we do want pop dump
|
if ( printPopParam.value() ) // we do want pop dump
|
||||||
{
|
{
|
||||||
popStat = new eoSortedPopStat<EOT>("Dump of whole population");
|
popStat = new eoSortedPopStat<EOT>("Dump of whole population");
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -152,14 +152,14 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
||||||
eoFDCStat<EOT> *fdcStat = NULL;
|
eoFDCStat<EOT> *fdcStat = NULL;
|
||||||
if ( printFDCParam.value() || plotFDCParam.value() ) // we need FDCStat
|
if ( printFDCParam.value() || plotFDCParam.value() ) // we need FDCStat
|
||||||
{
|
{
|
||||||
// need first an object to compute the distances - here Hamming dist.
|
// need first an object to compute the distances - here Hamming dist.
|
||||||
eoQuadDistance<EOT> *dist = new eoQuadDistance<EOT>;
|
eoQuadDistance<EOT> *dist = new eoQuadDistance<EOT>;
|
||||||
_state.storeFunctor(dist);
|
_state.storeFunctor(dist);
|
||||||
fdcStat = new eoFDCStat<EOT>(*dist);
|
fdcStat = new eoFDCStat<EOT>(*dist);
|
||||||
// storeFunctor it
|
// storeFunctor it
|
||||||
_state.storeFunctor(fdcStat);
|
_state.storeFunctor(fdcStat);
|
||||||
// add it to the checkpoint
|
// add it to the checkpoint
|
||||||
checkpoint->add(*fdcStat);
|
checkpoint->add(*fdcStat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do we wnat some histogram of fitnesses snpashots?
|
// 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?
|
// do we want an eoStdoutMonitor?
|
||||||
bool needStdoutMonitor = printBestParam.value() || printFDCParam.value()
|
bool needStdoutMonitor = printBestParam.value() || printFDCParam.value()
|
||||||
|| printPopParam.value() ;
|
|| printPopParam.value() ;
|
||||||
|
|
||||||
// The Stdout monitor will print parameters to the screen ...
|
// The Stdout monitor will print parameters to the screen ...
|
||||||
if ( needStdoutMonitor )
|
if ( needStdoutMonitor )
|
||||||
{
|
{
|
||||||
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 (printBestParam.value())
|
if (printBestParam.value())
|
||||||
{
|
{
|
||||||
monitor->add(*bestStat);
|
monitor->add(*bestStat);
|
||||||
monitor->add(*secondStat);
|
monitor->add(*secondStat);
|
||||||
}
|
}
|
||||||
if (printFDCParam.value())
|
if (printFDCParam.value())
|
||||||
monitor->add(*fdcStat);
|
monitor->add(*fdcStat);
|
||||||
if ( printPopParam.value())
|
if ( printPopParam.value())
|
||||||
monitor->add(*popStat);
|
monitor->add(*popStat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// first handle the dir test - if we need at least one file
|
// first handle the dir test - if we need at least one file
|
||||||
if ( ( fileBestParam.value() || plotBestParam.value() ||
|
if ( ( fileBestParam.value() || plotBestParam.value() ||
|
||||||
plotFDCParam.value() || plotHistogramParam.value() )
|
plotFDCParam.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
|
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
|
||||||
|
|
||||||
if (fileBestParam.value()) // A file monitor for best & secondMoment
|
if (fileBestParam.value()) // A file monitor for best & secondMoment
|
||||||
{
|
{
|
||||||
std::string stmp = dirNameParam.value() + "/best.xg";
|
std::string stmp = dirNameParam.value() + "/best.xg";
|
||||||
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);
|
||||||
fileMonitor->add(*bestStat);
|
fileMonitor->add(*bestStat);
|
||||||
fileMonitor->add(*secondStat);
|
fileMonitor->add(*secondStat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plotBestParam.value()) // an eoGnuplot1DMonitor for best & average
|
if (plotBestParam.value()) // an eoGnuplot1DMonitor for best & average
|
||||||
{
|
{
|
||||||
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())
|
if (useEvalParam.value())
|
||||||
gnuMonitor->add(_eval);
|
gnuMonitor->add(_eval);
|
||||||
else
|
else
|
||||||
gnuMonitor->add(*generationCounter);
|
gnuMonitor->add(*generationCounter);
|
||||||
gnuMonitor->add(*bestStat);
|
gnuMonitor->add(*bestStat);
|
||||||
gnuMonitor->add(*averageStat);
|
gnuMonitor->add(*averageStat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plotFDCParam.value()) // a specific plot monitor for FDC
|
if (plotFDCParam.value()) // a specific plot monitor for FDC
|
||||||
{
|
{
|
||||||
// first into a file (it adds everything ti itself
|
// first into a file (it adds everything ti itself
|
||||||
eoFDCFileSnapshot<EOT> *fdcFileSnapshot = new eoFDCFileSnapshot<EOT>(*fdcStat, dirNameParam.value());
|
eoFDCFileSnapshot<EOT> *fdcFileSnapshot = new eoFDCFileSnapshot<EOT>(*fdcStat, dirNameParam.value());
|
||||||
_state.storeFunctor(fdcFileSnapshot);
|
_state.storeFunctor(fdcFileSnapshot);
|
||||||
// then to a Gnuplot monitor
|
// then to a Gnuplot monitor
|
||||||
eoGnuplot1DSnapshot *fdcGnuplot = new eoGnuplot1DSnapshot(*fdcFileSnapshot);
|
eoGnuplot1DSnapshot *fdcGnuplot = new eoGnuplot1DSnapshot(*fdcFileSnapshot);
|
||||||
_state.storeFunctor(fdcGnuplot);
|
_state.storeFunctor(fdcGnuplot);
|
||||||
|
|
||||||
// and of course add them to the checkPoint
|
// and of course add them to the checkPoint
|
||||||
checkpoint->add(*fdcFileSnapshot);
|
checkpoint->add(*fdcFileSnapshot);
|
||||||
checkpoint->add(*fdcGnuplot);
|
checkpoint->add(*fdcGnuplot);
|
||||||
}
|
}
|
||||||
|
|
||||||
// historgram?
|
// historgram?
|
||||||
if (plotHistogramParam.value()) // want to see how the fitness is spread?
|
if (plotHistogramParam.value()) // want to see how the fitness is spread?
|
||||||
{
|
{
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
|
|
@ -273,7 +273,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
||||||
{
|
{
|
||||||
// first make sure dirName is OK
|
// first make sure dirName is OK
|
||||||
if (! dirOK )
|
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 );
|
unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
|
||||||
std::string stmp = dirNameParam.value() + "/generations";
|
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
|
// first make sure dirName is OK
|
||||||
if (! dirOK )
|
if (! dirOK )
|
||||||
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
|
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
|
||||||
|
|
||||||
std::string stmp = dirNameParam.value() + "/time";
|
std::string stmp = dirNameParam.value() + "/time";
|
||||||
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
|
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ eoCheckPoint<EOT>& do_make_checkpoint_assembled(eoParser& _parser, eoState& _sta
|
||||||
_state.storeFunctor(fitStat);
|
_state.storeFunctor(fitStat);
|
||||||
checkpoint->add(*fitStat);
|
checkpoint->add(*fitStat);
|
||||||
#ifdef HAVE_GNUPLOT
|
#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);
|
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirName);
|
||||||
_state.storeFunctor(fitSnapshot);
|
_state.storeFunctor(fitSnapshot);
|
||||||
// add any stat that is a vector<double> to it
|
// add any stat that is a vector<double> to it
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ It can then be instantiated, and compiled on its own for a given EOType
|
||||||
template <class Indi>
|
template <class Indi>
|
||||||
eoCombinedContinue<Indi> * make_combinedContinue(eoCombinedContinue<Indi> *_combined, eoContinue<Indi> *_cont)
|
eoCombinedContinue<Indi> * make_combinedContinue(eoCombinedContinue<Indi> *_combined, eoContinue<Indi> *_cont)
|
||||||
{
|
{
|
||||||
if (_combined) // already exists
|
if (_combined) // already exists
|
||||||
_combined->add(*_cont);
|
_combined->add(*_cont);
|
||||||
else
|
else
|
||||||
_combined = new eoCombinedContinue<Indi>(*_cont);
|
_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
|
if (maxGenParam.value()) // positive: -> define and store
|
||||||
{
|
{
|
||||||
eoGenContinue<Indi> *genCont = new eoGenContinue<Indi>(maxGenParam.value());
|
eoGenContinue<Indi> *genCont = new eoGenContinue<Indi>(maxGenParam.value());
|
||||||
_state.storeFunctor(genCont);
|
_state.storeFunctor(genCont);
|
||||||
// and "add" to combined
|
// and "add" to combined
|
||||||
continuator = make_combinedContinue<Indi>(continuator, genCont);
|
continuator = make_combinedContinue<Indi>(continuator, genCont);
|
||||||
}
|
}
|
||||||
|
|
||||||
// the steadyGen continue - only if user imput
|
// 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");
|
eoValueParam<unsigned>& minGenParam = _parser.createParam(unsigned(0), "minGen", "Minimum number of generations",'g', "Stopping criterion");
|
||||||
if (_parser.isItThere(steadyGenParam))
|
if (_parser.isItThere(steadyGenParam))
|
||||||
{
|
{
|
||||||
eoSteadyFitContinue<Indi> *steadyCont = new eoSteadyFitContinue<Indi>
|
eoSteadyFitContinue<Indi> *steadyCont = new eoSteadyFitContinue<Indi>
|
||||||
(minGenParam.value(), steadyGenParam.value());
|
(minGenParam.value(), steadyGenParam.value());
|
||||||
// store
|
// store
|
||||||
_state.storeFunctor(steadyCont);
|
_state.storeFunctor(steadyCont);
|
||||||
// add to combinedContinue
|
// add to combinedContinue
|
||||||
continuator = make_combinedContinue<Indi>(continuator, steadyCont);
|
continuator = make_combinedContinue<Indi>(continuator, steadyCont);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same thing with Eval - but here default value is 0
|
// 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
|
if (maxEvalParam.value()) // positive: -> define and store
|
||||||
{
|
{
|
||||||
eoEvalContinue<Indi> *evalCont = new eoEvalContinue<Indi>(_eval, maxEvalParam.value());
|
eoEvalContinue<Indi> *evalCont = new eoEvalContinue<Indi>(_eval, maxEvalParam.value());
|
||||||
_state.storeFunctor(evalCont);
|
_state.storeFunctor(evalCont);
|
||||||
// and "add" to combined
|
// and "add" to combined
|
||||||
continuator = make_combinedContinue<Indi>(continuator, evalCont);
|
continuator = make_combinedContinue<Indi>(continuator, evalCont);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// the steadyEval continue - only if user imput
|
// 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");
|
eoValueParam<unsigned>& minGenParam = _parser.createParam(unsigned(0), "minGen", "Minimum number of generations",'g', "Stopping criterion");
|
||||||
if (_parser.isItThere(steadyGenParam))
|
if (_parser.isItThere(steadyGenParam))
|
||||||
{
|
{
|
||||||
eoSteadyGenContinue<Indi> *steadyCont = new eoSteadyFitContinue<Indi>
|
eoSteadyGenContinue<Indi> *steadyCont = new eoSteadyFitContinue<Indi>
|
||||||
(minGenParam.value(), steadyGenParam.value());
|
(minGenParam.value(), steadyGenParam.value());
|
||||||
// store
|
// store
|
||||||
_state.storeFunctor(steadyCont);
|
_state.storeFunctor(steadyCont);
|
||||||
// add to combinedContinue
|
// add to combinedContinue
|
||||||
continuator = make_combinedContinue<Indi>(continuator, steadyCont);
|
continuator = make_combinedContinue<Indi>(continuator, steadyCont);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// the target fitness
|
// 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");
|
eoValueParam<double>& targetFitnessParam = _parser.createParam(double(0.0), "targetFitness", "Stop when fitness reaches",'T', "Stopping criterion");
|
||||||
if (_parser.isItThere(targetFitnessParam))
|
if (_parser.isItThere(targetFitnessParam))
|
||||||
{
|
{
|
||||||
fitCont = new eoFitContinue<Indi>
|
fitCont = new eoFitContinue<Indi>
|
||||||
(targetFitnessParam.value());
|
(targetFitnessParam.value());
|
||||||
// store
|
// store
|
||||||
_state.storeFunctor(fitCont);
|
_state.storeFunctor(fitCont);
|
||||||
// add to combinedContinue
|
// add to combinedContinue
|
||||||
continuator = make_combinedContinue<Indi>(continuator, fitCont);
|
continuator = make_combinedContinue<Indi>(continuator, fitCont);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#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");
|
eoValueParam<bool>& ctrlCParam = _parser.createParam(false, "CtrlC", "Terminate current generation upon Ctrl C",'C', "Stopping criterion");
|
||||||
if (ctrlCParam.value())
|
if (ctrlCParam.value())
|
||||||
{
|
{
|
||||||
ctrlCCont = new eoCtrlCContinue<Indi>;
|
ctrlCCont = new eoCtrlCContinue<Indi>;
|
||||||
// store
|
// store
|
||||||
_state.storeFunctor(ctrlCCont);
|
_state.storeFunctor(ctrlCCont);
|
||||||
// add to combinedContinue
|
// add to combinedContinue
|
||||||
continuator = make_combinedContinue<Indi>(continuator, ctrlCCont);
|
continuator = make_combinedContinue<Indi>(continuator, ctrlCCont);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
|
||||||
// put back 6 in parameter for consistency (and status file)
|
// put back 6 in parameter for consistency (and status file)
|
||||||
_ppReduce.second.push_back(std::string("6"));
|
_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());
|
detSize = atoi(_ppReduce.second[0].c_str());
|
||||||
ptReduce = new eoEPReduce<EOT>(detSize);
|
ptReduce = new eoEPReduce<EOT>(detSize);
|
||||||
}
|
}
|
||||||
|
|
@ -74,12 +74,12 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
|
||||||
{
|
{
|
||||||
if (!_ppReduce.second.size()) // no parameter added
|
if (!_ppReduce.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
|
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
|
||||||
detSize = 2;
|
detSize = 2;
|
||||||
// put back 2 in parameter for consistency (and status file)
|
// put back 2 in parameter for consistency (and status file)
|
||||||
_ppReduce.second.push_back(std::string("2"));
|
_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());
|
detSize = atoi(_ppReduce.second[0].c_str());
|
||||||
ptReduce = new eoDetTournamentTruncate<EOT>(detSize);
|
ptReduce = new eoDetTournamentTruncate<EOT>(detSize);
|
||||||
}
|
}
|
||||||
|
|
@ -87,24 +87,24 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
|
||||||
{
|
{
|
||||||
double p;
|
double p;
|
||||||
if (!_ppReduce.second.size()) // no parameter added
|
if (!_ppReduce.second.size()) // no parameter added
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
|
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
|
||||||
p = 1;
|
p = 1;
|
||||||
// put back p in parameter for consistency (and status file)
|
// put back p in parameter for consistency (and status file)
|
||||||
_ppReduce.second.push_back(std::string("1"));
|
_ppReduce.second.push_back(std::string("1"));
|
||||||
}
|
}
|
||||||
else // parameter passed by user as DetTour(T)
|
else // parameter passed by user as DetTour(T)
|
||||||
{
|
{
|
||||||
p = atof(_ppReduce.second[0].c_str());
|
p = atof(_ppReduce.second[0].c_str());
|
||||||
if ( (p<=0.5) || (p>1) )
|
if ( (p<=0.5) || (p>1) )
|
||||||
throw std::runtime_error("Stochastic tournament size should be in [0.5,1]");
|
throw std::runtime_error("Stochastic tournament size should be in [0.5,1]");
|
||||||
}
|
}
|
||||||
|
|
||||||
ptReduce = new eoStochTournamentTruncate<EOT>(p);
|
ptReduce = new eoStochTournamentTruncate<EOT>(p);
|
||||||
}
|
}
|
||||||
else if ( (_ppReduce.first == std::string("Uniform")) ||
|
else if ( (_ppReduce.first == std::string("Uniform")) ||
|
||||||
(_ppReduce.first == std::string("Random"))
|
(_ppReduce.first == std::string("Random"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ptReduce = new eoRandomReduce<EOT>;
|
ptReduce = new eoRandomReduce<EOT>;
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +144,7 @@ eoReplacement<EOT> & make_general_replacement(
|
||||||
eoHowMany _surviveOffspring = eoHowMany(1.0),
|
eoHowMany _surviveOffspring = eoHowMany(1.0),
|
||||||
eoParamParamType & _reduceOffspringType = eoParamParamType("Deterministic"),
|
eoParamParamType & _reduceOffspringType = eoParamParamType("Deterministic"),
|
||||||
eoParamParamType & _reduceFinalType = eoParamParamType("Deterministic")
|
eoParamParamType & _reduceFinalType = eoParamParamType("Deterministic")
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// the replacement
|
// the replacement
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ eoPop<EOT>& do_make_pop(eoParser & _parser, eoState& _state, eoInit<EOT> & _ini
|
||||||
// random seed
|
// random seed
|
||||||
eoValueParam<uint32_t>& seedParam = _parser.getORcreateParam(uint32_t(0), "seed", "Random number seed", 'S');
|
eoValueParam<uint32_t>& seedParam = _parser.getORcreateParam(uint32_t(0), "seed", "Random number seed", 'S');
|
||||||
if (seedParam.value() == 0)
|
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");
|
eoValueParam<unsigned>& popSize = _parser.getORcreateParam(unsigned(20), "popSize", "Population Size", 'P', "Evolution Engine");
|
||||||
|
|
||||||
// Either load or initialize
|
// 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:
|
// the fitness is read in the file:
|
||||||
// do only evaluate the pop if the fitness has changed
|
// do only evaluate the pop if the fitness has changed
|
||||||
if (recomputeFitnessParam.value())
|
if (recomputeFitnessParam.value())
|
||||||
{
|
{
|
||||||
for (unsigned i=0; i<pop.size(); i++)
|
for (unsigned i=0; i<pop.size(); i++)
|
||||||
pop[i].invalidate();
|
pop[i].invalidate();
|
||||||
}
|
}
|
||||||
if (pop.size() < popSize.value())
|
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())
|
if (pop.size() > popSize.value())
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING, Load file contained too many individuals. Only the best will be retained" << std::endl;
|
std::cerr << "WARNING, Load file contained too many individuals. Only the best will be retained" << std::endl;
|
||||||
pop.resize(popSize.value());
|
pop.resize(popSize.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // nothing loaded from a file
|
else // nothing loaded from a file
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@
|
||||||
|
|
||||||
#include <utils/eoParserLogger.h>
|
#include <utils/eoParserLogger.h>
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
#include <utils/eoParallel.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,13 +45,13 @@ public :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
eoCellularEasyEA (eoContinue <EOT> & _cont, // Stop. criterion
|
eoCellularEasyEA (eoContinue <EOT> & _cont, // Stop. criterion
|
||||||
eoEvalFunc <EOT> & _eval, // Evaluation function
|
eoEvalFunc <EOT> & _eval, // Evaluation function
|
||||||
eoSelectOne <EOT> & _sel_neigh, // To choose a partner
|
eoSelectOne <EOT> & _sel_neigh, // To choose a partner
|
||||||
eoBinOp <EOT> & _cross, // Cross-over operator
|
eoBinOp <EOT> & _cross, // Cross-over operator
|
||||||
eoMonOp <EOT> & _mut, // Mutation operator
|
eoMonOp <EOT> & _mut, // Mutation operator
|
||||||
eoSelectOne <EOT> & _sel_repl /* Which to keep between the new
|
eoSelectOne <EOT> & _sel_repl /* Which to keep between the new
|
||||||
child and the old individual ? */
|
child and the old individual ? */
|
||||||
) :
|
) :
|
||||||
cont (_cont),
|
cont (_cont),
|
||||||
eval (_eval),
|
eval (_eval),
|
||||||
popEval (_eval),
|
popEval (_eval),
|
||||||
|
|
@ -64,14 +64,14 @@ public :
|
||||||
}
|
}
|
||||||
|
|
||||||
eoCellularEasyEA (eoContinue <EOT> & _cont,
|
eoCellularEasyEA (eoContinue <EOT> & _cont,
|
||||||
eoEvalFunc <EOT> & _eval,
|
eoEvalFunc <EOT> & _eval,
|
||||||
eoSelectOne <EOT> & _sel_neigh,
|
eoSelectOne <EOT> & _sel_neigh,
|
||||||
eoQuadOp <EOT> & _cross,
|
eoQuadOp <EOT> & _cross,
|
||||||
eoMonOp <EOT> & _mut,
|
eoMonOp <EOT> & _mut,
|
||||||
eoSelectOne <EOT> & _sel_child, /* To choose one from
|
eoSelectOne <EOT> & _sel_child, /* To choose one from
|
||||||
the both children */
|
the both children */
|
||||||
eoSelectOne <EOT> & _sel_repl
|
eoSelectOne <EOT> & _sel_repl
|
||||||
) :
|
) :
|
||||||
cont (_cont),
|
cont (_cont),
|
||||||
eval (_eval),
|
eval (_eval),
|
||||||
popEval (_eval),
|
popEval (_eval),
|
||||||
|
|
@ -93,39 +93,39 @@ public :
|
||||||
|
|
||||||
for (unsigned i = 0 ; i < pop.size () ; i ++) {
|
for (unsigned i = 0 ; i < pop.size () ; i ++) {
|
||||||
|
|
||||||
// Who are neighbouring to the current individual ?
|
// Who are neighbouring to the current individual ?
|
||||||
eoPop <EOT> neigh = neighbours (pop, i) ;
|
eoPop <EOT> neigh = neighbours (pop, i) ;
|
||||||
|
|
||||||
// To select a partner
|
// To select a partner
|
||||||
EOT part, old_sol = pop [i] ;
|
EOT part, old_sol = pop [i] ;
|
||||||
part = sel_neigh (neigh) ;
|
part = sel_neigh (neigh) ;
|
||||||
|
|
||||||
// To perform cross-over
|
// To perform cross-over
|
||||||
cross (pop [i], part) ;
|
cross (pop [i], part) ;
|
||||||
|
|
||||||
// To perform mutation
|
// To perform mutation
|
||||||
mut (pop [i]) ;
|
mut (pop [i]) ;
|
||||||
mut (part) ;
|
mut (part) ;
|
||||||
|
|
||||||
pop [i].invalidate () ;
|
pop [i].invalidate () ;
|
||||||
part.invalidate () ;
|
part.invalidate () ;
|
||||||
eval (pop [i]) ;
|
eval (pop [i]) ;
|
||||||
eval (part) ;
|
eval (part) ;
|
||||||
|
|
||||||
// To choose one of the two children ...
|
// To choose one of the two children ...
|
||||||
eoPop <EOT> pop_loc ;
|
eoPop <EOT> pop_loc ;
|
||||||
pop_loc.push_back (pop [i]) ;
|
pop_loc.push_back (pop [i]) ;
|
||||||
pop_loc.push_back (part) ;
|
pop_loc.push_back (part) ;
|
||||||
|
|
||||||
pop [i] = sel_child (pop_loc) ;
|
pop [i] = sel_child (pop_loc) ;
|
||||||
|
|
||||||
// To choose only one between the new made child and the old individual
|
// To choose only one between the new made child and the old individual
|
||||||
pop_loc.clear () ;
|
pop_loc.clear () ;
|
||||||
pop_loc.push_back (pop [i]) ;
|
pop_loc.push_back (pop [i]) ;
|
||||||
|
|
||||||
pop_loc.push_back (old_sol) ;
|
pop_loc.push_back (old_sol) ;
|
||||||
|
|
||||||
pop [i] = sel_repl (pop_loc) ;
|
pop [i] = sel_repl (pop_loc) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (cont (pop)) ;
|
} while (cont (pop)) ;
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,3 @@ virtual bool operator()(EOT& , EOT& ) {return false;}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,4 +90,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public:
|
||||||
virtual void operator() ( EOT & _eo )
|
virtual void operator() ( EOT & _eo )
|
||||||
{
|
{
|
||||||
unsigned what = rng.roulette_wheel(rates); // choose one op
|
unsigned what = rng.roulette_wheel(rates); // choose one op
|
||||||
(*initializers[what])(_eo); // apply it
|
(*initializers[what])(_eo); // apply it
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,4 +90,3 @@ std::vector<double> rates;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -191,20 +191,19 @@ protected:
|
||||||
eoTopology < POT > & topology;
|
eoTopology < POT > & topology;
|
||||||
|
|
||||||
const VelocityType & coeff; // the fixed constriction coefficient
|
const VelocityType & coeff; // the fixed constriction coefficient
|
||||||
eoWeightUpdater<VelocityType> & weightUpdater; // the updater used to make the weight evoluate
|
eoWeightUpdater<VelocityType> & weightUpdater; // the updater used to make the weight evoluate
|
||||||
|
|
||||||
const VelocityType & c1; // learning factor 1
|
const VelocityType & c1; // learning factor 1
|
||||||
const VelocityType & c2; // learning factor 2
|
const VelocityType & c2; // learning factor 2
|
||||||
|
|
||||||
eoRealVectorBounds & bounds; // REAL bounds even if the velocity could be of another type.
|
eoRealVectorBounds & bounds; // REAL bounds even if the velocity could be of another type.
|
||||||
eoRealBoundModifier & bndsModifier;
|
eoRealBoundModifier & bndsModifier;
|
||||||
|
|
||||||
VelocityType weight;
|
VelocityType weight;
|
||||||
eoRng & gen; // the random generator
|
eoRng & gen; // the random generator
|
||||||
|
|
||||||
// If the bound modifier doesn't need to be used, use the dummy instance
|
// If the bound modifier doesn't need to be used, use the dummy instance
|
||||||
eoDummyRealBoundModifier dummyModifier;
|
eoDummyRealBoundModifier dummyModifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*EOCONSTRICTEDVARIABLEWEIGHTVELOCITY_H*/
|
#endif /*EOCONSTRICTEDVARIABLEWEIGHTVELOCITY_H*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,20 +173,20 @@ public:
|
||||||
topology.updateNeighborhood(_po,_indice);
|
topology.updateNeighborhood(_po,_indice);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! eoTopology<POT> getTopology
|
//! eoTopology<POT> getTopology
|
||||||
//! @return topology
|
//! @return topology
|
||||||
|
|
||||||
eoTopology<POT> & getTopology ()
|
eoTopology<POT> & getTopology ()
|
||||||
{
|
{
|
||||||
return topology;
|
return topology;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
eoTopology < POT > & topology;
|
eoTopology < POT > & topology;
|
||||||
const VelocityType & c1; // learning factor 1
|
const VelocityType & c1; // learning factor 1
|
||||||
const VelocityType & c2; // learning factor 2
|
const VelocityType & c2; // learning factor 2
|
||||||
const VelocityType & coeff; // the fixed constriction coefficient
|
const VelocityType & coeff; // the fixed constriction coefficient
|
||||||
eoRng & gen; // the random generator
|
eoRng & gen; // the random generator
|
||||||
|
|
||||||
eoRealVectorBounds & bounds; // REAL bounds even if the velocity could be of another type.
|
eoRealVectorBounds & bounds; // REAL bounds even if the velocity could be of another type.
|
||||||
eoRealBoundModifier & bndsModifier;
|
eoRealBoundModifier & bndsModifier;
|
||||||
|
|
@ -197,4 +197,3 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
#endif /*EOCONSTRICTEDVELOCITY_H */
|
#endif /*EOCONSTRICTEDVELOCITY_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,4 +68,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,9 @@
|
||||||
#include <utils/eoParam.h>
|
#include <utils/eoParam.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Generic counter class that counts the number of times
|
Generic counter class that counts the number of times
|
||||||
a procedure is used. Add a procedure through its ctor and
|
a procedure is used. Add a procedure through its ctor and
|
||||||
use this class instead of it.
|
use this class instead of it.
|
||||||
|
|
||||||
It is derived from eoValueParam so you can add it to a monitor.
|
It is derived from eoValueParam so you can add it to a monitor.
|
||||||
|
|
||||||
|
|
@ -79,9 +79,9 @@ class eoProcedureCounter : public Procedure, public eoValueParam<unsigned long>
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Generic counter class that counts the number of times
|
Generic counter class that counts the number of times
|
||||||
a unary function is used. Add a unary function through its ctor and
|
a unary function is used. Add a unary function through its ctor and
|
||||||
use this class instead of it.
|
use this class instead of it.
|
||||||
|
|
||||||
It is derived from eoValueParam so you can add it to a monitor.
|
It is derived from eoValueParam so you can add it to a monitor.
|
||||||
|
|
||||||
|
|
@ -133,9 +133,9 @@ class eoUnaryFunctorCounter : public UnaryFunctor, public eoValueParam<unsigned
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Generic counter class that counts the number of times
|
Generic counter class that counts the number of times
|
||||||
a binary function is used. Add a binary function through its ctor and
|
a binary function is used. Add a binary function through its ctor and
|
||||||
use this class instead of it.
|
use this class instead of it.
|
||||||
|
|
||||||
It is derived from eoValueParam so you can add it to a monitor.
|
It is derived from eoValueParam so you can add it to a monitor.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,4 +84,3 @@ public:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,10 @@ class eoDetSelect : public eoSelect<EOT>
|
||||||
size_t target = howMany(pSize);
|
size_t target = howMany(pSize);
|
||||||
|
|
||||||
if ( target == 0 )
|
if ( target == 0 )
|
||||||
{
|
{
|
||||||
eo::log << eo::warnings << "Call to a eoHowMany instance returns 0 (target=" << target << ") it will be replaced by 1 to continue." << std::endl;
|
eo::log << eo::warnings << "Call to a eoHowMany instance returns 0 (target=" << target << ") it will be replaced by 1 to continue." << std::endl;
|
||||||
target = 1;
|
target = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_dest.resize(target);
|
_dest.resize(target);
|
||||||
|
|
||||||
|
|
@ -71,16 +71,16 @@ class eoDetSelect : public eoSelect<EOT>
|
||||||
|
|
||||||
if (target >= pSize)
|
if (target >= pSize)
|
||||||
{
|
{
|
||||||
for (unsigned i=0; i<entireCopy; i++)
|
for (unsigned i=0; i<entireCopy; i++)
|
||||||
{
|
{
|
||||||
std::copy(_source.begin(), _source.end(), it);
|
std::copy(_source.begin(), _source.end(), it);
|
||||||
it += pSize;
|
it += pSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// the last ones
|
// the last ones
|
||||||
if (remain)
|
if (remain)
|
||||||
{
|
{
|
||||||
std::copy(_source.begin(), _source.begin()+remain, it);
|
std::copy(_source.begin(), _source.begin()+remain, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,4 +71,3 @@ template <class EOT> class eoDetTournamentSelect: public eoSelectOne<EOT>
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
class eoDistribution : public eoInit<EOT>,
|
class eoDistribution : public eoInit<EOT>,
|
||||||
public eoPersistent, public eoObject
|
public eoPersistent, public eoObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void operator()(EOT &) = 0; // DO NOT FORGET TO INVALIDATE the EOT
|
virtual void operator()(EOT &) = 0; // DO NOT FORGET TO INVALIDATE the EOT
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ public:
|
||||||
eoStat<EOT,std::string>(
|
eoStat<EOT,std::string>(
|
||||||
"?"+sep+"?",
|
"?"+sep+"?",
|
||||||
stat_feasible.longName()+sep+stat_unfeasible.longName()
|
stat_feasible.longName()+sep+stat_unfeasible.longName()
|
||||||
),
|
),
|
||||||
_stat_feasible(stat_feasible),
|
_stat_feasible(stat_feasible),
|
||||||
_stat_unfeasible(stat_unfeasible),
|
_stat_unfeasible(stat_unfeasible),
|
||||||
_sep(sep)
|
_sep(sep)
|
||||||
|
|
@ -314,4 +314,3 @@ protected:
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif // _eoDualFitness_h_
|
#endif // _eoDualFitness_h_
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,3 @@ template<class EOT> class eoEDA: public eoUF<eoDistribution<EOT>&, void>
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,25 @@ template<class EOT> class eoEasyEA: public eoAlgo<EOT>
|
||||||
replace(_replace)
|
replace(_replace)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
/** Ctor taking a breed and merge, an overload of ctor to define an offspring size */
|
||||||
|
eoEasyEA(
|
||||||
|
eoContinue<EOT>& _continuator,
|
||||||
|
eoEvalFunc<EOT>& _eval,
|
||||||
|
eoBreed<EOT>& _breed,
|
||||||
|
eoReplacement<EOT>& _replace,
|
||||||
|
unsigned _offspringSize
|
||||||
|
) : continuator(_continuator),
|
||||||
|
eval (_eval),
|
||||||
|
loopEval(_eval),
|
||||||
|
popEval(loopEval),
|
||||||
|
selectTransform(dummySelect, dummyTransform),
|
||||||
|
breed(_breed),
|
||||||
|
mergeReduce(dummyMerge, dummyReduce),
|
||||||
|
replace(_replace)
|
||||||
|
{
|
||||||
|
offspring.reserve(_offspringSize); // This line avoids an incremental resize of offsprings.
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
eoEasyEA(eoContinue <EOT> & _continuator,
|
eoEasyEA(eoContinue <EOT> & _continuator,
|
||||||
eoPopEvalFunc <EOT> & _pop_eval,
|
eoPopEvalFunc <EOT> & _pop_eval,
|
||||||
|
|
@ -116,8 +135,8 @@ template<class EOT> class eoEasyEA: public eoAlgo<EOT>
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
/// Ctor eoSelect, eoTransform, eoReplacement and an eoPopEval
|
/// Ctor eoSelect, eoTransform, eoReplacement and an eoPopEval
|
||||||
eoEasyEA(
|
eoEasyEA(
|
||||||
eoContinue<EOT>& _continuator,
|
eoContinue<EOT>& _continuator,
|
||||||
eoPopEvalFunc<EOT>& _eval,
|
eoPopEvalFunc<EOT>& _eval,
|
||||||
eoSelect<EOT>& _select,
|
eoSelect<EOT>& _select,
|
||||||
|
|
@ -191,7 +210,9 @@ template<class EOT> class eoEasyEA: public eoAlgo<EOT>
|
||||||
/// Apply a few generation of evolution to the population.
|
/// Apply a few generation of evolution to the population.
|
||||||
virtual void operator()(eoPop<EOT>& _pop)
|
virtual void operator()(eoPop<EOT>& _pop)
|
||||||
{
|
{
|
||||||
eoPop<EOT> offspring, empty_pop;
|
_pop.reserve(offspring.capacity());
|
||||||
|
|
||||||
|
eoPop<EOT> empty_pop;
|
||||||
|
|
||||||
popEval(empty_pop, _pop); // A first eval of pop.
|
popEval(empty_pop, _pop); // A first eval of pop.
|
||||||
|
|
||||||
|
|
@ -270,6 +291,8 @@ template<class EOT> class eoEasyEA: public eoAlgo<EOT>
|
||||||
eoMergeReduce<EOT> mergeReduce;
|
eoMergeReduce<EOT> mergeReduce;
|
||||||
eoReplacement<EOT>& replace;
|
eoReplacement<EOT>& replace;
|
||||||
|
|
||||||
|
eoPop<EOT> offspring;
|
||||||
|
|
||||||
// Friend classes
|
// Friend classes
|
||||||
friend class eoIslandsEasyEA <EOT> ;
|
friend class eoIslandsEasyEA <EOT> ;
|
||||||
friend class eoDistEvalEasyEA <EOT> ;
|
friend class eoDistEvalEasyEA <EOT> ;
|
||||||
|
|
@ -280,4 +303,3 @@ Example of a test program building an EA algorithm.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,12 @@
|
||||||
* Use any particle, any flight, any topology...
|
* Use any particle, any flight, any topology...
|
||||||
*
|
*
|
||||||
* The main steps are :
|
* The main steps are :
|
||||||
* (The population is expected to be already evaluated)
|
* (The population is expected to be already evaluated)
|
||||||
* - for each generation and each particle pi
|
* - for each generation and each particle pi
|
||||||
* - evaluate the velocities
|
* - evaluate the velocities
|
||||||
* -- perform the fligth of pi
|
* -- perform the fligth of pi
|
||||||
* -- evaluate pi
|
* -- evaluate pi
|
||||||
* -- update the neighborhoods
|
* -- update the neighborhoods
|
||||||
*
|
*
|
||||||
* @ingroup Algorithms
|
* @ingroup Algorithms
|
||||||
*/
|
*/
|
||||||
|
|
@ -90,7 +90,7 @@ public:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
/* Constructor without eoInitializerBase. Assume the initialization is done before running the algorithm
|
/* Constructor without eoInitializerBase. Assume the initialization is done before running the algorithm
|
||||||
* @param _continuator - An eoContinue that manages the stopping criterion and the checkpointing system
|
* @param _continuator - An eoContinue that manages the stopping criterion and the checkpointing system
|
||||||
* @param _eval - An eoEvalFunc: the evaluation performer
|
* @param _eval - An eoEvalFunc: the evaluation performer
|
||||||
* @param _velocity - An eoVelocity that defines how to compute the velocities
|
* @param _velocity - An eoVelocity that defines how to compute the velocities
|
||||||
|
|
@ -171,21 +171,21 @@ protected:
|
||||||
eoVelocity < POT > &velocity;
|
eoVelocity < POT > &velocity;
|
||||||
eoFlight < POT > &flight;
|
eoFlight < POT > &flight;
|
||||||
|
|
||||||
// if the flight does not need to be used, use the dummy flight instance
|
// if the flight does not need to be used, use the dummy flight instance
|
||||||
class eoDummyFlight:public eoFlight < POT >
|
class eoDummyFlight:public eoFlight < POT >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
eoDummyFlight () {}
|
eoDummyFlight () {}
|
||||||
void operator () (POT & _po) {}
|
void operator () (POT & _po) {}
|
||||||
}dummyFlight;
|
}dummyFlight;
|
||||||
|
|
||||||
// if the initializer does not need to be used, use the dummy one instead
|
// if the initializer does not need to be used, use the dummy one instead
|
||||||
class eoDummyInitializer:public eoInitializerBase < POT >
|
class eoDummyInitializer:public eoInitializerBase < POT >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
eoDummyInitializer () {}
|
eoDummyInitializer () {}
|
||||||
void operator () (POT & _po) {}
|
void operator () (POT & _po) {}
|
||||||
}dummyInit;
|
}dummyInit;
|
||||||
|
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class eoEvalContinue: public eoContinue<EOT>
|
||||||
public:
|
public:
|
||||||
/// Ctor
|
/// Ctor
|
||||||
eoEvalContinue( eoEvalFuncCounter<EOT> & _eval, unsigned long _totalEval)
|
eoEvalContinue( eoEvalFuncCounter<EOT> & _eval, unsigned long _totalEval)
|
||||||
: eval(_eval), repTotalEvaluations( _totalEval ) {};
|
: eval(_eval), repTotalEvaluations( _totalEval ) {};
|
||||||
|
|
||||||
/** Returns false when a certain number of evaluations has been done
|
/** Returns false when a certain number of evaluations has been done
|
||||||
*/
|
*/
|
||||||
|
|
@ -49,7 +49,7 @@ public:
|
||||||
if (eval.value() >= repTotalEvaluations)
|
if (eval.value() >= repTotalEvaluations)
|
||||||
{
|
{
|
||||||
eo::log << eo::progress << "STOP in eoEvalContinue: Reached maximum number of evaluations [" << repTotalEvaluations << "]" << std::endl;
|
eo::log << eo::progress << "STOP in eoEvalContinue: Reached maximum number of evaluations [" << repTotalEvaluations << "]" << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class eoEvalCounterThrowException : public eoEvalFuncCounter< EOT >
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
eoEvalCounterThrowException( eoEvalFunc<EOT>& func, unsigned long max_evals, std::string name = "Eval. ")
|
eoEvalCounterThrowException( eoEvalFunc<EOT>& func, unsigned long max_evals, std::string name = "Eval. ")
|
||||||
: eoEvalFuncCounter< EOT >( func, name ), _threshold( max_evals )
|
: eoEvalFuncCounter< EOT >( func, name ), _threshold( max_evals )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
using eoEvalFuncCounter< EOT >::value;
|
using eoEvalFuncCounter< EOT >::value;
|
||||||
|
|
@ -84,4 +84,3 @@ private :
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __eoEvalCounterThrowException_h__
|
#endif // __eoEvalCounterThrowException_h__
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ template<class EOT> class eoEvalFunc : public eoUF<EOT&, void>
|
||||||
public :
|
public :
|
||||||
typedef EOT EOType;
|
typedef EOT EOType;
|
||||||
|
|
||||||
typedef typename EOT::Fitness EOFitT;
|
typedef typename EOT::Fitness EOFitT;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,9 @@ public:
|
||||||
|
|
||||||
const char* what() const throw()
|
const char* what() const throw()
|
||||||
{
|
{
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "STOP in eoEvalFuncCounterBounderException: the maximum number of evaluation has been reached (" << _threshold << ").";
|
ss << "STOP in eoEvalFuncCounterBounderException: the maximum number of evaluation has been reached (" << _threshold << ").";
|
||||||
return ss.str().c_str();
|
return ss.str().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -39,21 +39,21 @@ class eoEvalFuncCounterBounder : public eoEvalFuncCounter< EOT >
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
eoEvalFuncCounterBounder(eoEvalFunc<EOT>& func, unsigned long threshold, std::string name = "Eval. ")
|
eoEvalFuncCounterBounder(eoEvalFunc<EOT>& func, unsigned long threshold, std::string name = "Eval. ")
|
||||||
: eoEvalFuncCounter< EOT >( func, name ), _threshold( threshold )
|
: eoEvalFuncCounter< EOT >( func, name ), _threshold( threshold )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
using eoEvalFuncCounter< EOT >::value;
|
using eoEvalFuncCounter< EOT >::value;
|
||||||
|
|
||||||
virtual void operator()(EOT& eo)
|
virtual void operator()(EOT& eo)
|
||||||
{
|
{
|
||||||
if (eo.invalid())
|
if (eo.invalid())
|
||||||
{
|
{
|
||||||
value()++;
|
value()++;
|
||||||
|
|
||||||
if (_threshold > 0 && value() >= _threshold)
|
if (_threshold > 0 && value() >= _threshold)
|
||||||
{
|
{
|
||||||
throw eoEvalFuncCounterBounderException(_threshold);
|
throw eoEvalFuncCounterBounderException(_threshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
func(eo);
|
func(eo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,3 @@ struct eoEvalFuncPtr: public eoEvalFunc<EOT> {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public:
|
||||||
* @param _gen - The eo random generator, default=rng
|
* @param _gen - The eo random generator, default=rng
|
||||||
*/
|
*/
|
||||||
eoExtendedVelocity (eoTopology < POT > & _topology,
|
eoExtendedVelocity (eoTopology < POT > & _topology,
|
||||||
const VelocityType & _w,
|
const VelocityType & _w,
|
||||||
const VelocityType & _c1,
|
const VelocityType & _c1,
|
||||||
const VelocityType & _c2,
|
const VelocityType & _c2,
|
||||||
const VelocityType & _c3,
|
const VelocityType & _c3,
|
||||||
|
|
@ -145,14 +145,14 @@ public:
|
||||||
{
|
{
|
||||||
VelocityType r1;
|
VelocityType r1;
|
||||||
VelocityType r2;
|
VelocityType r2;
|
||||||
VelocityType r3;
|
VelocityType r3;
|
||||||
|
|
||||||
VelocityType newVelocity;
|
VelocityType newVelocity;
|
||||||
|
|
||||||
// cast the learning factors to VelocityType
|
// cast the learning factors to VelocityType
|
||||||
r1 = (VelocityType) rng.uniform (1) * c1;
|
r1 = (VelocityType) rng.uniform (1) * c1;
|
||||||
r2 = (VelocityType) rng.uniform (1) * c2;
|
r2 = (VelocityType) rng.uniform (1) * c2;
|
||||||
r3 = (VelocityType) rng.uniform (1) * c3;
|
r3 = (VelocityType) rng.uniform (1) * c3;
|
||||||
|
|
||||||
// need to resize the bounds even if there are dummy because of "isBounded" call
|
// need to resize the bounds even if there are dummy because of "isBounded" call
|
||||||
bounds.adjust_size(_po.size());
|
bounds.adjust_size(_po.size());
|
||||||
|
|
@ -161,9 +161,9 @@ public:
|
||||||
for (unsigned j = 0; j < _po.size (); j++)
|
for (unsigned j = 0; j < _po.size (); j++)
|
||||||
{
|
{
|
||||||
newVelocity= omega * _po.velocities[j]
|
newVelocity= omega * _po.velocities[j]
|
||||||
+ r1 * (_po.bestPositions[j] - _po[j])
|
+ r1 * (_po.bestPositions[j] - _po[j])
|
||||||
+ r2 * (topology.best (_indice)[j] - _po[j])
|
+ r2 * (topology.best (_indice)[j] - _po[j])
|
||||||
+ r3 * (topology.globalBest()[j] - _po[j]);
|
+ r3 * (topology.globalBest()[j] - _po[j]);
|
||||||
|
|
||||||
/* check bounds */
|
/* check bounds */
|
||||||
if (bounds.isMinBounded(j))
|
if (bounds.isMinBounded(j))
|
||||||
|
|
@ -186,10 +186,10 @@ public:
|
||||||
//! eoTopology<POT> getTopology
|
//! eoTopology<POT> getTopology
|
||||||
//! @return topology
|
//! @return topology
|
||||||
|
|
||||||
eoTopology<POT> & getTopology ()
|
eoTopology<POT> & getTopology ()
|
||||||
{
|
{
|
||||||
return topology;
|
return topology;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
eoTopology < POT > & topology;
|
eoTopology < POT > & topology;
|
||||||
|
|
@ -199,9 +199,9 @@ protected:
|
||||||
const VelocityType & c3; // social/cognitive coefficient
|
const VelocityType & c3; // social/cognitive coefficient
|
||||||
|
|
||||||
eoRealVectorBounds bounds; // REAL bounds even if the velocity could be of another type.
|
eoRealVectorBounds bounds; // REAL bounds even if the velocity could be of another type.
|
||||||
eoRealBoundModifier & bndsModifier;
|
eoRealBoundModifier & bndsModifier;
|
||||||
|
|
||||||
eoRng & gen; // the random generator
|
eoRng & gen; // the random generator
|
||||||
|
|
||||||
// If the bound modifier doesn't need to be used, use the dummy instance
|
// If the bound modifier doesn't need to be used, use the dummy instance
|
||||||
eoDummyRealBoundModifier dummyModifier;
|
eoDummyRealBoundModifier dummyModifier;
|
||||||
|
|
@ -211,4 +211,3 @@ protected:
|
||||||
* Example of a test program using this class:
|
* Example of a test program using this class:
|
||||||
*/
|
*/
|
||||||
#endif /*eoExtendedVelocity_H */
|
#endif /*eoExtendedVelocity_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,28 +46,28 @@ class eoFactory: public eoObject {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// @name ctors and dtors
|
/// @name ctors and dtors
|
||||||
//{@
|
//{@
|
||||||
/// constructor
|
/// constructor
|
||||||
eoFactory( ) {}
|
eoFactory( ) {}
|
||||||
|
|
||||||
/// destructor
|
/// destructor
|
||||||
virtual ~eoFactory() {}
|
virtual ~eoFactory() {}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** Another factory methods: creates an object from an std::istream, reading from
|
/** Another factory methods: creates an object from an std::istream, reading from
|
||||||
it whatever is needed to create the object. Usually, the format for the std::istream will be\\
|
it whatever is needed to create the object. Usually, the format for the std::istream will be\\
|
||||||
objectType parameter1 parameter2 ... parametern\\
|
objectType parameter1 parameter2 ... parametern\\
|
||||||
*/
|
*/
|
||||||
virtual EOClass* make(std::istream& _is) = 0;
|
virtual EOClass* make(std::istream& _is) = 0;
|
||||||
|
|
||||||
///@name eoObject methods
|
///@name eoObject methods
|
||||||
//@{
|
//@{
|
||||||
/** Return the class id */
|
/** Return the class id */
|
||||||
virtual std::string className() const { return "eoFactory"; }
|
virtual std::string className() const { return "eoFactory"; }
|
||||||
|
|
||||||
/** Read and print are left without implementation */
|
/** Read and print are left without implementation */
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,15 +49,15 @@ public:
|
||||||
/** Returns false when a fitness criterium is reached. Assumes pop is not sorted! */
|
/** Returns false when a fitness criterium is reached. Assumes pop is not sorted! */
|
||||||
virtual bool operator() ( const eoPop<EOT>& _pop )
|
virtual bool operator() ( const eoPop<EOT>& _pop )
|
||||||
{
|
{
|
||||||
//FitnessType bestCurrentFitness = _pop.nth_element_fitness(0);
|
//FitnessType bestCurrentFitness = _pop.nth_element_fitness(0);
|
||||||
FitnessType bestCurrentFitness = _pop.best_element().fitness();
|
FitnessType bestCurrentFitness = _pop.best_element().fitness();
|
||||||
if (bestCurrentFitness >= optimum)
|
if (bestCurrentFitness >= optimum)
|
||||||
{
|
{
|
||||||
eo::log << eo::logging << "STOP in eoFitContinue: Best fitness has reached " <<
|
eo::log << eo::logging << "STOP in eoFitContinue: Best fitness has reached " <<
|
||||||
bestCurrentFitness << "\n";
|
bestCurrentFitness << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::string className(void) const { return "eoFitContinue"; }
|
virtual std::string className(void) const { return "eoFitContinue"; }
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,7 @@ public:
|
||||||
eoRouletteWorthSelect<EOT, double>(scaling), scaling(_p) {}
|
eoRouletteWorthSelect<EOT, double>(scaling), scaling(_p) {}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
eoLinearFitScaling<EOT> scaling; // derived from eoPerf2Worth
|
eoLinearFitScaling<EOT> scaling; // derived from eoPerf2Worth
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,10 +175,10 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
eoTopology < POT > & topology;
|
eoTopology < POT > & topology;
|
||||||
const VelocityType & c1; // learning factor 1
|
const VelocityType & c1; // learning factor 1
|
||||||
const VelocityType & c2; // learning factor 2
|
const VelocityType & c2; // learning factor 2
|
||||||
const VelocityType & weight; // the fixed weight
|
const VelocityType & weight; // the fixed weight
|
||||||
eoRng & gen; // the random generator
|
eoRng & gen; // the random generator
|
||||||
|
|
||||||
eoRealVectorBounds & bounds; // REAL bounds even if the velocity could be of another type.
|
eoRealVectorBounds & bounds; // REAL bounds even if the velocity could be of another type.
|
||||||
eoRealBoundModifier & bndsModifier;
|
eoRealBoundModifier & bndsModifier;
|
||||||
|
|
@ -189,4 +189,3 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
#endif /*EOFIXEDINERTIAWEIGHTEDVELOCITY_H */
|
#endif /*EOFIXEDINERTIAWEIGHTEDVELOCITY_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,14 +65,14 @@ public :
|
||||||
{
|
{
|
||||||
if (_eo1.size() != _eo2.size())
|
if (_eo1.size() != _eo2.size())
|
||||||
{
|
{
|
||||||
string s = "Operand size don't match in " + className();
|
string s = "Operand size don't match in " + className();
|
||||||
throw runtime_error(s);
|
throw runtime_error(s);
|
||||||
}
|
}
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
for ( unsigned i = 0; i < _eo1.size(); i++ ) {
|
for ( unsigned i = 0; i < _eo1.size(); i++ ) {
|
||||||
if ( rng.flip( rate ) ) {
|
if ( rng.flip( rate ) ) {
|
||||||
bool changedHere = op( _eo1[i], _eo2[i] );
|
bool changedHere = op( _eo1[i], _eo2[i] );
|
||||||
changed |= changedHere;
|
changed |= changedHere;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
|
|
@ -108,16 +108,16 @@ public :
|
||||||
{
|
{
|
||||||
if (_eo1.size() != _eo2.size())
|
if (_eo1.size() != _eo2.size())
|
||||||
{
|
{
|
||||||
string s = "Operand size don't match in " + className();
|
string s = "Operand size don't match in " + className();
|
||||||
throw runtime_error(s);
|
throw runtime_error(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
for ( unsigned i = 0; i < k; i++ ) //! @todo check that we don't do twice the same
|
for ( unsigned i = 0; i < k; i++ ) //! @todo check that we don't do twice the same
|
||||||
{
|
{
|
||||||
unsigned where = eo::rng.random(_eo1.size());
|
unsigned where = eo::rng.random(_eo1.size());
|
||||||
bool changedHere = op( _eo1[where], _eo2[where] );
|
bool changedHere = op( _eo1[where], _eo2[where] );
|
||||||
changed |= changedHere;
|
changed |= changedHere;
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
@ -154,17 +154,17 @@ public :
|
||||||
Atom tmp;
|
Atom tmp;
|
||||||
if (_eo1.size() != _eo2.size())
|
if (_eo1.size() != _eo2.size())
|
||||||
{
|
{
|
||||||
string s = "Operand size don't match in " + className();
|
string s = "Operand size don't match in " + className();
|
||||||
throw runtime_error(s);
|
throw runtime_error(s);
|
||||||
}
|
}
|
||||||
bool hasChanged = false;
|
bool hasChanged = false;
|
||||||
for (unsigned i=0; i<_eo1.size(); i++)
|
for (unsigned i=0; i<_eo1.size(); i++)
|
||||||
{
|
{
|
||||||
if ( (_eo1[i]!=_eo2[i]) && (eo::rng.filp(rate)) )
|
if ( (_eo1[i]!=_eo2[i]) && (eo::rng.filp(rate)) )
|
||||||
{
|
{
|
||||||
_eo1[i] = _eo2[i];
|
_eo1[i] = _eo2[i];
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hasChanged;
|
return hasChanged;
|
||||||
}
|
}
|
||||||
|
|
@ -198,18 +198,18 @@ public :
|
||||||
Atom tmp;
|
Atom tmp;
|
||||||
if (_eo1.size() != _eo2.size())
|
if (_eo1.size() != _eo2.size())
|
||||||
{
|
{
|
||||||
string s = "Operand size don't match in " + className();
|
string s = "Operand size don't match in " + className();
|
||||||
throw runtime_error(s);
|
throw runtime_error(s);
|
||||||
}
|
}
|
||||||
bool hasChanged = false;
|
bool hasChanged = false;
|
||||||
unsigned where = eo::rng.random(_eo1.size()-1);
|
unsigned where = eo::rng.random(_eo1.size()-1);
|
||||||
for (unsigned i=where+1; i<_eo1.size(); i++)
|
for (unsigned i=where+1; i<_eo1.size(); i++)
|
||||||
{
|
{
|
||||||
if ( (_eo1[i]!=_eo2[i]) )
|
if ( (_eo1[i]!=_eo2[i]) )
|
||||||
{
|
{
|
||||||
_eo1[i] = _eo2[i];
|
_eo1[i] = _eo2[i];
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hasChanged;
|
return hasChanged;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ public :
|
||||||
bool modified=false;
|
bool modified=false;
|
||||||
for (unsigned i=0; i<_eo.size(); i++)
|
for (unsigned i=0; i<_eo.size(); i++)
|
||||||
if (eo::rng.flip(rate))
|
if (eo::rng.flip(rate))
|
||||||
if (atomMutation(_eo[i]))
|
if (atomMutation(_eo[i]))
|
||||||
modified = true;
|
modified = true;
|
||||||
|
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
@ -76,7 +76,7 @@ public :
|
||||||
|
|
||||||
private:
|
private:
|
||||||
eoMonOp<AtomType> & atomMutation; // the atom mutation
|
eoMonOp<AtomType> & atomMutation; // the atom mutation
|
||||||
double rate; // the mutation rate PER ATOM
|
double rate; // the mutation rate PER ATOM
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Applies an atomic mutation to a fixed
|
/** Applies an atomic mutation to a fixed
|
||||||
|
|
@ -100,9 +100,9 @@ public :
|
||||||
bool modified=false;
|
bool modified=false;
|
||||||
for (unsigned k=0; k<nb; k++)
|
for (unsigned k=0; k<nb; k++)
|
||||||
{
|
{
|
||||||
unsigned i = rng.random(_eo.size()); // we don't test for duplicates...
|
unsigned i = rng.random(_eo.size()); // we don't test for duplicates...
|
||||||
if (atomMutation(_eo[i]))
|
if (atomMutation(_eo[i]))
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +114,7 @@ public :
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned nb; // the number of atoms to mutate
|
unsigned nb; // the number of atoms to mutate
|
||||||
eoMonOp<AtomType> & atomMutation; // the atom mutation
|
eoMonOp<AtomType> & atomMutation; // the atom mutation
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,8 @@ public :
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
for ( unsigned i = 0; i < _eo1.size(); i++ ) {
|
for ( unsigned i = 0; i < _eo1.size(); i++ ) {
|
||||||
if ( rng.flip( rate ) ) {
|
if ( rng.flip( rate ) ) {
|
||||||
bool changedHere = op( _eo1[i], _eo2[i] );
|
bool changedHere = op( _eo1[i], _eo2[i] );
|
||||||
changed |= changedHere;
|
changed |= changedHere;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
|
|
@ -100,16 +100,16 @@ public :
|
||||||
{
|
{
|
||||||
if (_eo1.size() != _eo2.size())
|
if (_eo1.size() != _eo2.size())
|
||||||
{
|
{
|
||||||
string s = "Operand size don't match in " + className();
|
string s = "Operand size don't match in " + className();
|
||||||
throw runtime_error(s);
|
throw runtime_error(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
for ( unsigned i = 0; i < k; i++ ) //! @todo check that we don't do twice the same
|
for ( unsigned i = 0; i < k; i++ ) //! @todo check that we don't do twice the same
|
||||||
{
|
{
|
||||||
unsigned where = eo::rng.random(_eo1.size());
|
unsigned where = eo::rng.random(_eo1.size());
|
||||||
bool changedHere = op( _eo1[where], _eo2[where] );
|
bool changedHere = op( _eo1[where], _eo2[where] );
|
||||||
changed |= changedHere;
|
changed |= changedHere;
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
@ -145,19 +145,19 @@ public :
|
||||||
Atom tmp;
|
Atom tmp;
|
||||||
if (_eo1.size() != _eo2.size())
|
if (_eo1.size() != _eo2.size())
|
||||||
{
|
{
|
||||||
string s = "Operand size don't match in " + className();
|
string s = "Operand size don't match in " + className();
|
||||||
throw runtime_error(s);
|
throw runtime_error(s);
|
||||||
}
|
}
|
||||||
bool hasChanged = false;
|
bool hasChanged = false;
|
||||||
for (unsigned i=0; i<_eo1.size(); i++)
|
for (unsigned i=0; i<_eo1.size(); i++)
|
||||||
{
|
{
|
||||||
if ( (_eo1[i]!=_eo2[i]) && (eo::rng.filp(rate)) )
|
if ( (_eo1[i]!=_eo2[i]) && (eo::rng.filp(rate)) )
|
||||||
{
|
{
|
||||||
tmp = _eo1[i];
|
tmp = _eo1[i];
|
||||||
_eo1[i] = _eo2[i];
|
_eo1[i] = _eo2[i];
|
||||||
_eo2[i] = tmp;
|
_eo2[i] = tmp;
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hasChanged;
|
return hasChanged;
|
||||||
}
|
}
|
||||||
|
|
@ -190,20 +190,20 @@ public :
|
||||||
Atom tmp;
|
Atom tmp;
|
||||||
if (_eo1.size() != _eo2.size())
|
if (_eo1.size() != _eo2.size())
|
||||||
{
|
{
|
||||||
string s = "Operand size don't match in " + className();
|
string s = "Operand size don't match in " + className();
|
||||||
throw runtime_error(s);
|
throw runtime_error(s);
|
||||||
}
|
}
|
||||||
bool hasChanged = false;
|
bool hasChanged = false;
|
||||||
unsigned where = eo::rng.random(_eo1.size()-1);
|
unsigned where = eo::rng.random(_eo1.size()-1);
|
||||||
for (unsigned i=where+1; i<_eo1.size(); i++)
|
for (unsigned i=where+1; i<_eo1.size(); i++)
|
||||||
{
|
{
|
||||||
if ( (_eo1[i]!=_eo2[i]) )
|
if ( (_eo1[i]!=_eo2[i]) )
|
||||||
{
|
{
|
||||||
tmp = _eo1[i];
|
tmp = _eo1[i];
|
||||||
_eo1[i] = _eo2[i];
|
_eo1[i] = _eo2[i];
|
||||||
_eo2[i] = tmp;
|
_eo2[i] = tmp;
|
||||||
hasChanged = true;
|
hasChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hasChanged;
|
return hasChanged;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public :
|
||||||
/// tag to identify a procedure in compile time function selection @see functor_category
|
/// tag to identify a procedure in compile time function selection @see functor_category
|
||||||
static eoFunctorBase::procedure_tag functor_category()
|
static eoFunctorBase::procedure_tag functor_category()
|
||||||
{
|
{
|
||||||
return eoFunctorBase::procedure_tag();
|
return eoFunctorBase::procedure_tag();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -124,7 +124,7 @@ public :
|
||||||
/// tag to identify a procedure in compile time function selection @see functor_category
|
/// tag to identify a procedure in compile time function selection @see functor_category
|
||||||
static eoFunctorBase::unary_function_tag functor_category()
|
static eoFunctorBase::unary_function_tag functor_category()
|
||||||
{
|
{
|
||||||
return eoFunctorBase::unary_function_tag();
|
return eoFunctorBase::unary_function_tag();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -164,7 +164,7 @@ public :
|
||||||
/// tag to identify a procedure in compile time function selection @see functor_category
|
/// tag to identify a procedure in compile time function selection @see functor_category
|
||||||
static eoFunctorBase::binary_function_tag functor_category()
|
static eoFunctorBase::binary_function_tag functor_category()
|
||||||
{
|
{
|
||||||
return eoFunctorBase::binary_function_tag();
|
return eoFunctorBase::binary_function_tag();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,23 +63,23 @@ public:
|
||||||
split(_parents, temp);
|
split(_parents, temp);
|
||||||
unsigned toKeep = temp.size(); // how many to keep from merged populations
|
unsigned toKeep = temp.size(); // how many to keep from merged populations
|
||||||
// merge temp into offspring
|
// merge temp into offspring
|
||||||
plus(temp, _offspring); // add temp to _offspring (a little inconsistent!)
|
plus(temp, _offspring); // add temp to _offspring (a little inconsistent!)
|
||||||
|
|
||||||
// reduce merged
|
// reduce merged
|
||||||
reduce(_offspring, temp); // temp dummy arg. will not be modified
|
reduce(_offspring, temp); // temp dummy arg. will not be modified
|
||||||
// minimla check:
|
// minimla check:
|
||||||
if (_offspring.size() != toKeep)
|
if (_offspring.size() != toKeep)
|
||||||
{
|
{
|
||||||
std::cerr << "Les tailles " << _offspring.size() << " " << toKeep << std::endl;
|
std::cerr << "Les tailles " << _offspring.size() << " " << toKeep << std::endl;
|
||||||
throw std::runtime_error("eoG3Replacement: wrong number of remaining offspring");
|
throw std::runtime_error("eoG3Replacement: wrong number of remaining offspring");
|
||||||
}
|
}
|
||||||
// and put back into _parents
|
// and put back into _parents
|
||||||
plus(_offspring, _parents);
|
plus(_offspring, _parents);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
eoLinearTruncateSplit<EOT> split; // few parents to truncate -> linear
|
eoLinearTruncateSplit<EOT> split; // few parents to truncate -> linear
|
||||||
eoTruncateSplit<EOT> reduce; // supposedly many offspring to truncate
|
eoTruncateSplit<EOT> reduce; // supposedly many offspring to truncate
|
||||||
eoPlus<EOT> plus;
|
eoPlus<EOT> plus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,22 +41,22 @@ public:
|
||||||
|
|
||||||
/// Ctor for setting a
|
/// Ctor for setting a
|
||||||
eoGenContinue( unsigned long _totalGens)
|
eoGenContinue( unsigned long _totalGens)
|
||||||
: eoValueParam<unsigned>(0, "Generations", "Generations"),
|
: eoValueParam<unsigned>(0, "Generations", "Generations"),
|
||||||
repTotalGenerations( _totalGens ),
|
repTotalGenerations( _totalGens ),
|
||||||
thisGenerationPlaceHolder(0),
|
thisGenerationPlaceHolder(0),
|
||||||
thisGeneration(thisGenerationPlaceHolder)
|
thisGeneration(thisGenerationPlaceHolder)
|
||||||
{};
|
{};
|
||||||
|
|
||||||
/// Ctor for enabling the save/load the no. of generations counted
|
/// Ctor for enabling the save/load the no. of generations counted
|
||||||
eoGenContinue( unsigned long _totalGens, unsigned long& _currentGen)
|
eoGenContinue( unsigned long _totalGens, unsigned long& _currentGen)
|
||||||
: eoValueParam<unsigned>(0, "Generations", "Generations"),
|
: eoValueParam<unsigned>(0, "Generations", "Generations"),
|
||||||
repTotalGenerations( _totalGens ),
|
repTotalGenerations( _totalGens ),
|
||||||
thisGenerationPlaceHolder(0),
|
thisGenerationPlaceHolder(0),
|
||||||
thisGeneration(_currentGen)
|
thisGeneration(_currentGen)
|
||||||
{};
|
{};
|
||||||
|
|
||||||
/** Returns false when a certain number of generations is
|
/** Returns false when a certain number of generations is
|
||||||
* reached */
|
* reached */
|
||||||
virtual bool operator() ( const eoPop<EOT>& _vEO ) {
|
virtual bool operator() ( const eoPop<EOT>& _vEO ) {
|
||||||
(void)_vEO;
|
(void)_vEO;
|
||||||
thisGeneration++;
|
thisGeneration++;
|
||||||
|
|
@ -64,21 +64,21 @@ public:
|
||||||
|
|
||||||
if (thisGeneration >= repTotalGenerations)
|
if (thisGeneration >= repTotalGenerations)
|
||||||
{
|
{
|
||||||
eo::log << eo::logging << "STOP in eoGenContinue: Reached maximum number of generations [" << thisGeneration << "/" << repTotalGenerations << "]\n";
|
eo::log << eo::logging << "STOP in eoGenContinue: Reached maximum number of generations [" << thisGeneration << "/" << repTotalGenerations << "]\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets the number of generations to reach
|
/** Sets the number of generations to reach
|
||||||
and sets the current generation to 0 (the begin)
|
and sets the current generation to 0 (the begin)
|
||||||
|
|
||||||
@todo replace this by an "init" method
|
@todo replace this by an "init" method
|
||||||
*/
|
*/
|
||||||
virtual void totalGenerations( unsigned long _tg ) {
|
virtual void totalGenerations( unsigned long _tg ) {
|
||||||
repTotalGenerations = _tg;
|
repTotalGenerations = _tg;
|
||||||
thisGeneration = 0;
|
thisGeneration = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Returns the number of generations to reach*/
|
/** Returns the number of generations to reach*/
|
||||||
virtual unsigned long totalGenerations( )
|
virtual unsigned long totalGenerations( )
|
||||||
|
|
@ -112,4 +112,3 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,17 +66,17 @@ class eoGenOp : public eoOp<EOT>, public eoUF<eoPopulator<EOT> &, void>
|
||||||
/** Max production is used to reserve space for all elements that are used by the operator,
|
/** Max production is used to reserve space for all elements that are used by the operator,
|
||||||
not setting it properly can result in a crash
|
not setting it properly can result in a crash
|
||||||
*/
|
*/
|
||||||
virtual unsigned max_production(void) = 0;
|
virtual unsigned max_production(void) = 0;
|
||||||
|
|
||||||
|
virtual std::string className() const = 0;
|
||||||
|
|
||||||
virtual std::string className() const = 0;
|
|
||||||
void operator()(eoPopulator<EOT>& _pop)
|
void operator()(eoPopulator<EOT>& _pop)
|
||||||
{
|
{
|
||||||
_pop.reserve(max_production());
|
_pop.reserve( max_production() );
|
||||||
apply(_pop);
|
apply(_pop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//protected :
|
||||||
protected :
|
|
||||||
/** the function that will do the work
|
/** the function that will do the work
|
||||||
*/
|
*/
|
||||||
virtual void apply(eoPopulator<EOT>& _pop) = 0;
|
virtual void apply(eoPopulator<EOT>& _pop) = 0;
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ class eoGeneralBreeder: public eoBreed<EOT>
|
||||||
eoGeneralBreeder(
|
eoGeneralBreeder(
|
||||||
eoSelectOne<EOT>& _select,
|
eoSelectOne<EOT>& _select,
|
||||||
eoGenOp<EOT>& _op,
|
eoGenOp<EOT>& _op,
|
||||||
double _rate=1.0,
|
double _rate=1.0,
|
||||||
bool _interpret_as_rate = true) :
|
bool _interpret_as_rate = true) :
|
||||||
select( _select ), op(_op), howMany(_rate, _interpret_as_rate) {}
|
select( _select ), op(_op), howMany(_rate, _interpret_as_rate) {}
|
||||||
|
|
||||||
|
|
@ -71,7 +71,7 @@ class eoGeneralBreeder: public eoBreed<EOT>
|
||||||
eoGeneralBreeder(
|
eoGeneralBreeder(
|
||||||
eoSelectOne<EOT>& _select,
|
eoSelectOne<EOT>& _select,
|
||||||
eoGenOp<EOT>& _op,
|
eoGenOp<EOT>& _op,
|
||||||
eoHowMany _howMany ) :
|
eoHowMany _howMany ) :
|
||||||
select( _select ), op(_op), howMany(_howMany) {}
|
select( _select ), op(_op), howMany(_howMany) {}
|
||||||
|
|
||||||
/** The breeder: simply calls the genOp on a selective populator!
|
/** The breeder: simply calls the genOp on a selective populator!
|
||||||
|
|
@ -87,10 +87,10 @@ class eoGeneralBreeder: public eoBreed<EOT>
|
||||||
eoSelectivePopulator<EOT> it(_parents, _offspring, select);
|
eoSelectivePopulator<EOT> it(_parents, _offspring, select);
|
||||||
|
|
||||||
while (_offspring.size() < target)
|
while (_offspring.size() < target)
|
||||||
{
|
{
|
||||||
op(it);
|
op(it);
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
_offspring.resize(target); // you might have generated a few more
|
_offspring.resize(target); // you might have generated a few more
|
||||||
}
|
}
|
||||||
|
|
@ -105,4 +105,3 @@ class eoGeneralBreeder: public eoBreed<EOT>
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,11 @@
|
||||||
*/
|
*/
|
||||||
/** @{*/
|
/** @{*/
|
||||||
/**
|
/**
|
||||||
Base (name) class for Initialization of chromosomes, used in a population
|
Base (name) class for Initialization of chromosomes, used in a population
|
||||||
contructor. It is derived from eoMonOp, so it can be used
|
contructor. It is derived from eoMonOp, so it can be used
|
||||||
inside the algorithm as well.
|
inside the algorithm as well.
|
||||||
|
|
||||||
@see eoPop
|
@see eoPop
|
||||||
*/
|
*/
|
||||||
template <class EOT>
|
template <class EOT>
|
||||||
class eoInit : public eoUF<EOT&, void>
|
class eoInit : public eoUF<EOT&, void>
|
||||||
|
|
@ -120,8 +120,8 @@ typedef typename EOT::AtomType AtomType;
|
||||||
// /** Ctor from a generator */
|
// /** Ctor from a generator */
|
||||||
// eoInitVariableLength(unsigned _minSize, unsigned _maxSize, eoF<typename EOT::AtomType> & _generator = Gen())
|
// eoInitVariableLength(unsigned _minSize, unsigned _maxSize, eoF<typename EOT::AtomType> & _generator = Gen())
|
||||||
// : offset(_minSize), extent(_maxSize - _minSize),
|
// : offset(_minSize), extent(_maxSize - _minSize),
|
||||||
// repGenerator( eoInitGenerator<typename EOT::AtomType>(*(new eoInit<EOT>)) ),
|
// repGenerator( eoInitGenerator<typename EOT::AtomType>(*(new eoInit<EOT>)) ),
|
||||||
// generator(_generator)
|
// generator(_generator)
|
||||||
// {
|
// {
|
||||||
// if (_minSize >= _maxSize)
|
// if (_minSize >= _maxSize)
|
||||||
// throw std::logic_error("eoInitVariableLength: minSize larger or equal to maxSize");
|
// throw std::logic_error("eoInitVariableLength: minSize larger or equal to maxSize");
|
||||||
|
|
@ -172,7 +172,7 @@ class eoInitPermutation: public eoInit<EOT>
|
||||||
{
|
{
|
||||||
chrom.resize(chromSize);
|
chrom.resize(chromSize);
|
||||||
for(unsigned idx=0;idx <chrom.size();idx++)
|
for(unsigned idx=0;idx <chrom.size();idx++)
|
||||||
chrom[idx]=idx+startFrom;
|
chrom[idx]=idx+startFrom;
|
||||||
|
|
||||||
std::random_shuffle(chrom.begin(), chrom.end(),gen);
|
std::random_shuffle(chrom.begin(), chrom.end(),gen);
|
||||||
chrom.invalidate();
|
chrom.invalidate();
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,9 @@ public :
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Base (name) class for Initialization of algorithm PSO
|
Base (name) class for Initialization of algorithm PSO
|
||||||
|
|
||||||
@see eoInitializerBase eoUF apply
|
@see eoInitializerBase eoUF apply
|
||||||
*/
|
*/
|
||||||
template <class POT> class eoInitializer : public eoInitializerBase <POT>
|
template <class POT> class eoInitializer : public eoInitializerBase <POT>
|
||||||
{
|
{
|
||||||
|
|
@ -115,9 +115,9 @@ public:
|
||||||
private :
|
private :
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@param proc First evaluation
|
@param proc First evaluation
|
||||||
@param initVelo Initialization of the velocity
|
@param initVelo Initialization of the velocity
|
||||||
@param initBest Initialization of the best
|
@param initBest Initialization of the best
|
||||||
*/
|
*/
|
||||||
eoUF<POT&, void>& proc;
|
eoUF<POT&, void>& proc;
|
||||||
eoVelocityInit < POT > & initVelo;
|
eoVelocityInit < POT > & initVelo;
|
||||||
|
|
@ -145,4 +145,3 @@ class eoDummy : public eoUF<POT&, void>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ public:
|
||||||
* @param _gen - The eo random generator, default=rng
|
* @param _gen - The eo random generator, default=rng
|
||||||
*/
|
*/
|
||||||
eoIntegerVelocity (eoTopology < POT > & _topology,
|
eoIntegerVelocity (eoTopology < POT > & _topology,
|
||||||
const VelocityType & _c1,
|
const VelocityType & _c1,
|
||||||
const VelocityType & _c2,
|
const VelocityType & _c2,
|
||||||
const VelocityType & _c3,
|
const VelocityType & _c3,
|
||||||
eoRealVectorBounds & _bounds,
|
eoRealVectorBounds & _bounds,
|
||||||
|
|
@ -82,8 +82,8 @@ public:
|
||||||
/** Constructor: No bound updater required <-> fixed bounds
|
/** Constructor: No bound updater required <-> fixed bounds
|
||||||
* @param _topology - The topology to get the global/local/other best
|
* @param _topology - The topology to get the global/local/other best
|
||||||
* @param _c1 - The first learning factor quantify how much the particle trusts itself. Type must be POT::ParticleVelocityType
|
* @param _c1 - The first learning factor quantify how much the particle trusts itself. Type must be POT::ParticleVelocityType
|
||||||
* @param _c2 - The second learning factor used for the particle's best. Type must be POT::ParticleVelocityType
|
* @param _c2 - The second learning factor used for the particle's best. Type must be POT::ParticleVelocityType
|
||||||
* @param _c3 - The third learning factor used for the local/global best(s). Type must be POT::ParticleVelocityType
|
* @param _c3 - The third learning factor used for the local/global best(s). Type must be POT::ParticleVelocityType
|
||||||
* @param _bounds - An eoRealBaseVectorBounds: real bounds for real velocities.
|
* @param _bounds - An eoRealBaseVectorBounds: real bounds for real velocities.
|
||||||
* If the velocities are not real, they won't be bounded by default. Should have a eoBounds ?
|
* If the velocities are not real, they won't be bounded by default. Should have a eoBounds ?
|
||||||
* @param _gen - The eo random generator, default=rng
|
* @param _gen - The eo random generator, default=rng
|
||||||
|
|
@ -116,7 +116,7 @@ public:
|
||||||
const VelocityType & _c3,
|
const VelocityType & _c3,
|
||||||
eoRng & _gen = rng):
|
eoRng & _gen = rng):
|
||||||
topology(_topology),
|
topology(_topology),
|
||||||
c1 (_c1),
|
c1 (_c1),
|
||||||
c2 (_c2),
|
c2 (_c2),
|
||||||
c3 (_c3),
|
c3 (_c3),
|
||||||
bounds(*(new eoRealVectorNoBounds(0))),
|
bounds(*(new eoRealVectorNoBounds(0))),
|
||||||
|
|
@ -171,10 +171,10 @@ public:
|
||||||
//! eoTopology<POT> getTopology
|
//! eoTopology<POT> getTopology
|
||||||
//! @return topology
|
//! @return topology
|
||||||
|
|
||||||
eoTopology<POT> & getTopology ()
|
eoTopology<POT> & getTopology ()
|
||||||
{
|
{
|
||||||
return topology;
|
return topology;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
eoTopology < POT > & topology;
|
eoTopology < POT > & topology;
|
||||||
|
|
@ -183,9 +183,9 @@ protected:
|
||||||
const VelocityType & c3; // social/cognitive coefficient
|
const VelocityType & c3; // social/cognitive coefficient
|
||||||
|
|
||||||
eoRealVectorBounds bounds; // REAL bounds even if the velocity could be of another type.
|
eoRealVectorBounds bounds; // REAL bounds even if the velocity could be of another type.
|
||||||
eoRealBoundModifier & bndsModifier;
|
eoRealBoundModifier & bndsModifier;
|
||||||
|
|
||||||
eoRng & gen; // the random generator
|
eoRng & gen; // the random generator
|
||||||
|
|
||||||
// If the bound modifier doesn't need to be used, use the dummy instance
|
// If the bound modifier doesn't need to be used, use the dummy instance
|
||||||
eoDummyRealBoundModifier dummyModifier;
|
eoDummyRealBoundModifier dummyModifier;
|
||||||
|
|
@ -193,4 +193,3 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
#endif /*EOINTEGERVELOCITY_H */
|
#endif /*EOINTEGERVELOCITY_H */
|
||||||
|
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue