Merge branch 'master' of /tools/eo
This commit is contained in:
commit
11f01d5a53
108 changed files with 8642 additions and 1297 deletions
45
ForRelease
Normal file
45
ForRelease
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
In order to create a new release from the current repository, perform the
|
||||||
|
following steps:
|
||||||
|
|
||||||
|
- If necessary, create a branch named "eo_x.y.z"
|
||||||
|
- Set version number in eo-conf.cmake
|
||||||
|
- Check/update NEWS file, set release date and version in NEWS.
|
||||||
|
- use the "archive_current.sh" script to create the source archive
|
||||||
|
- Put source archive and packages files at SourceForge
|
||||||
|
- Update the documentation on the website
|
||||||
|
- Post news on SourceForge project-page
|
||||||
|
- Send announcement to mailing lists
|
||||||
|
- Bump version number to next "x.y.z-edge" in eo-conf.cmake
|
||||||
|
|
||||||
|
|
||||||
|
When reaching stable versions:
|
||||||
|
- prepare a message with the following template:
|
||||||
|
-----8<-----
|
||||||
|
A new version of the "Evolving Objects" framework is available.
|
||||||
|
|
||||||
|
EO is a template-based, C++ evolutionary computation library which
|
||||||
|
helps you to write your own stochastic optimization algorithms
|
||||||
|
insanely fast.
|
||||||
|
|
||||||
|
Learn more about EO on the official website:
|
||||||
|
http://eodev.sourceforge.net/
|
||||||
|
|
||||||
|
You will find the release x.y.z at the following address:
|
||||||
|
https://sourceforge.net/projects/eodev/files/eo/
|
||||||
|
|
||||||
|
Here is a summary of the change log:
|
||||||
|
- XXXXX
|
||||||
|
- and more…
|
||||||
|
|
||||||
|
Do not hesitate to submit the bugs you will face:
|
||||||
|
https://sourceforge.net/apps/trac/eodev/wiki/WikiStart
|
||||||
|
|
||||||
|
Happy evolutionary hacking.
|
||||||
|
-----8<-----
|
||||||
|
- Post the message to:
|
||||||
|
- EO news https://sourceforge.net/news/?group_id=9775
|
||||||
|
- EO mailing list: eodev-main@lists.sourceforge.net
|
||||||
|
- ParadisEO mailing list: paradiseo-users@lists.gforge.inria.fr
|
||||||
|
- EC-digest maling list: ec-digest-l@listserv.gmu.edu
|
||||||
|
- JET mailing list: jet@inria.fr
|
||||||
|
|
||||||
|
|
@ -16,8 +16,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
PROJECT(EDO)
|
PROJECT(EDO)
|
||||||
|
|
||||||
SET(PROJECT_VERSION_MAJOR 1)
|
SET(PROJECT_VERSION_MAJOR 0)
|
||||||
SET(PROJECT_VERSION_MINOR 0)
|
SET(PROJECT_VERSION_MINOR 1)
|
||||||
SET(PROJECT_VERSION_PATCH 0)
|
SET(PROJECT_VERSION_PATCH 0)
|
||||||
SET(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
SET(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||||
|
|
||||||
|
|
@ -29,25 +29,57 @@ SET(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
# include useful features for cmake
|
# include useful features for cmake
|
||||||
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
|
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/cmake/modules)
|
||||||
|
|
||||||
|
|
||||||
INCLUDE(FindDoxygen)
|
INCLUDE(FindDoxygen)
|
||||||
INCLUDE(FindPkgConfig)
|
INCLUDE(FindPkgConfig)
|
||||||
|
|
||||||
FIND_PACKAGE(Boost 1.33.0)
|
IF( WITH_BOOST AND WITH_EIGEN )
|
||||||
|
MESSAGE( "ERROR: You have to choose between Boost:ublas and Eigen, you cannot compile with both libraries" )
|
||||||
|
SET(IS_FATAL 1)
|
||||||
|
ELSEIF( NOT WITH_BOOST AND NOT WITH_EIGEN )
|
||||||
|
#MESSAGE( "WARNING: Boost:ublas and Eigen are both deactivated, some features may lack." )
|
||||||
|
# FIXME ideally, we would have a minimal implementation with STL vectors…
|
||||||
|
MESSAGE( "FIXME: Boost:ublas and Eigen are both deactivated, too much features will lack, you should choose one." )
|
||||||
|
SET(IS_FATAL 1)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(WITH_BOOST)
|
||||||
|
FIND_PACKAGE(Boost 1.33.0)
|
||||||
|
IF( Boost_FOUND )
|
||||||
|
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
|
||||||
|
ADD_DEFINITIONS( -DWITH_BOOST )
|
||||||
|
ELSE()
|
||||||
|
MESSAGE( "ERROR: You asked for Boost:ublas but it has nost been found." )
|
||||||
|
SET(IS_FATAL 1)
|
||||||
|
ENDIF()
|
||||||
|
ELSEIF( WITH_EIGEN )
|
||||||
|
# FIXME FindEigen3.cmake does not work
|
||||||
|
#find_package(Eigen3)
|
||||||
|
#include_directories(EIGEN3_INCLUDE_DIR)
|
||||||
|
SET( EIGEN3_FOUND 1)
|
||||||
|
SET( EIGEN3_INCLUDE_DIR "/usr/include/eigen3/" )
|
||||||
|
|
||||||
|
IF( EIGEN3_FOUND )
|
||||||
|
INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} )
|
||||||
|
ADD_DEFINITIONS( -DWITH_EIGEN )
|
||||||
|
ELSE()
|
||||||
|
MESSAGE( "ERROR: You asked for Eigen but it has nost been found." )
|
||||||
|
SET(IS_FATAL 1)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
FIND_PACKAGE(EO)
|
FIND_PACKAGE(EO)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
${EO_INCLUDE_DIRS}
|
${EO_INCLUDE_DIRS}
|
||||||
${MO_INCLUDE_DIRS}
|
${MO_INCLUDE_DIRS}
|
||||||
${Boost_INCLUDE_DIRS}
|
)
|
||||||
# /Dev/ometah-0.3/common
|
|
||||||
)
|
|
||||||
|
|
||||||
LINK_DIRECTORIES(
|
LINK_DIRECTORIES(
|
||||||
${EO_LIBRARY_DIRS}
|
${EO_LIBRARY_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
@ -58,7 +90,7 @@ LINK_DIRECTORIES(
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(
|
INCLUDE_DIRECTORIES(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
)
|
)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
@ -92,8 +124,8 @@ SET(SAMPLE_SRCS)
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(src)
|
ADD_SUBDIRECTORY(src)
|
||||||
#ADD_SUBDIRECTORY(application)
|
ADD_SUBDIRECTORY(application)
|
||||||
ADD_SUBDIRECTORY(test)
|
#ADD_SUBDIRECTORY(test)
|
||||||
ADD_SUBDIRECTORY(doc)
|
ADD_SUBDIRECTORY(doc)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
|
||||||
10
edo/NEWS
Normal file
10
edo/NEWS
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
* current release:
|
||||||
|
|
||||||
|
* release 1.3.0 (2011-07-24)
|
||||||
|
- alternative implementation of the multi-normal operators using the Eigen3 library
|
||||||
|
|
||||||
|
* release 0.0 (2011-09-15)
|
||||||
|
- basic design for estimation of distribution algorithms and, more generally for randomized search heuristics
|
||||||
|
- continuous EDA example
|
||||||
|
- EDA using multi-normal distribution, implementation using the boost::ublas library
|
||||||
|
|
||||||
|
|
@ -33,11 +33,11 @@ In the edo/build/ directory:
|
||||||
(Unix) > ctest
|
(Unix) > ctest
|
||||||
Windows users, please refer to this tutorial: http://paradiseo.gforge.inria.fr/index.php?n=Paradiseo.VisualCTutorial
|
Windows users, please refer to this tutorial: http://paradiseo.gforge.inria.fr/index.php?n=Paradiseo.VisualCTutorial
|
||||||
|
|
||||||
In the directory "application", there are several directory such as eda_sa which instantiate EDA-SA solver.
|
In the directory "application", there are several directory such as eda which instantiate EDA solver.
|
||||||
|
|
||||||
(Unix) After compilation you can run the binary "build/eda_sa" and see results. Parameters can be modified from command line.
|
(Unix) After compilation you can run the binary "build/eda" and see results. Parameters can be modified from command line.
|
||||||
|
|
||||||
(Windows) Add argument "eda_sa.param" and execute the corresponding algorithms.
|
(Windows) Add argument "eda.param" and execute the corresponding algorithms.
|
||||||
Windows users, please refer to this tutorial: http://paradiseo.gforge.inria.fr/index.php?n=Paradiseo.VisualCTutorial
|
Windows users, please refer to this tutorial: http://paradiseo.gforge.inria.fr/index.php?n=Paradiseo.VisualCTutorial
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ INCLUDE_DIRECTORIES(
|
||||||
)
|
)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(common)
|
ADD_SUBDIRECTORY(common)
|
||||||
ADD_SUBDIRECTORY(eda_sa)
|
#ADD_SUBDIRECTORY(eda_sa)
|
||||||
ADD_SUBDIRECTORY(eda)
|
ADD_SUBDIRECTORY(eda)
|
||||||
#ADD_SUBDIRECTORY(sa)
|
ADD_SUBDIRECTORY(cmaes)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
|
||||||
33
edo/application/cmaes/CMakeLists.txt
Normal file
33
edo/application/cmaes/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
PROJECT(cmaes)
|
||||||
|
|
||||||
|
|
||||||
|
#find_package(Eigen3 REQUIRED)
|
||||||
|
#include_directories(EIGEN3_INCLUDE_DIR)
|
||||||
|
INCLUDE_DIRECTORIES( ${EIGEN3_INCLUDE_DIR} )
|
||||||
|
MESSAGE( "MESSAGE:" ${EIGEN3_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
#FIND_PACKAGE(Boost 1.33.0)
|
||||||
|
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
|
||||||
|
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
SET(RESOURCES
|
||||||
|
${PROJECT_NAME}.param
|
||||||
|
)
|
||||||
|
|
||||||
|
FOREACH(file ${RESOURCES})
|
||||||
|
EXECUTE_PROCESS(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/${file}
|
||||||
|
${EDO_BINARY_DIR}/${file}
|
||||||
|
)
|
||||||
|
ENDFOREACH(file)
|
||||||
|
|
||||||
|
#FILE(GLOB SOURCES *.cpp)
|
||||||
|
|
||||||
|
SET(EXECUTABLE_OUTPUT_PATH ${EDO_BINARY_DIR})
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(${PROJECT_NAME} main.cpp)
|
||||||
|
TARGET_LINK_LIBRARIES(${PROJECT_NAME} edo edoutils ${EO_LIBRARIES} ${Boost_LIBRARIES})
|
||||||
|
|
||||||
160
edo/application/cmaes/main.cpp
Normal file
160
edo/application/cmaes/main.cpp
Normal file
|
|
@ -0,0 +1,160 @@
|
||||||
|
/*
|
||||||
|
The Evolving Distribution Objects framework (EDO) is a template-based,
|
||||||
|
ANSI-C++ evolutionary computation library which helps you to write your
|
||||||
|
own estimation of distribution algorithms.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Copyright (C) 2010 Thales group
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Authors:
|
||||||
|
Johann Dréo <johann.dreo@thalesgroup.com>
|
||||||
|
Caner Candan <caner.candan@thalesgroup.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <eo>
|
||||||
|
//#include <mo>
|
||||||
|
|
||||||
|
#include <eoEvalFuncCounterBounder.h>
|
||||||
|
|
||||||
|
#include <do/make_pop.h>
|
||||||
|
#include <do/make_run.h>
|
||||||
|
#include <do/make_continue.h>
|
||||||
|
#include <do/make_checkpoint.h>
|
||||||
|
|
||||||
|
#include <edo>
|
||||||
|
|
||||||
|
#include "Rosenbrock.h"
|
||||||
|
#include "Sphere.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef eoReal<eoMinimizingFitness> RealVec;
|
||||||
|
typedef edoNormalAdaptive< RealVec > Distrib;
|
||||||
|
|
||||||
|
|
||||||
|
int main(int ac, char** av)
|
||||||
|
{
|
||||||
|
eoParser parser(ac, av);
|
||||||
|
|
||||||
|
// Letters used by the following declarations:
|
||||||
|
// a d i p t
|
||||||
|
|
||||||
|
std::string section("Algorithm parameters");
|
||||||
|
|
||||||
|
eoState state;
|
||||||
|
|
||||||
|
// Instantiate all needed parameters for EDA algorithm
|
||||||
|
//double selection_rate = parser.createParam((double)0.5, "selection_rate", "Selection Rate", 'R', section).value(); // R
|
||||||
|
|
||||||
|
unsigned long max_eval = parser.getORcreateParam((unsigned long)0, "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion").value(); // E
|
||||||
|
|
||||||
|
unsigned int dim = parser.createParam((unsigned int)10, "dimension-size", "Dimension size", 'd', section).value(); // d
|
||||||
|
|
||||||
|
|
||||||
|
double mu = dim / 2;
|
||||||
|
|
||||||
|
|
||||||
|
edoNormalAdaptive<RealVec> distribution(dim);
|
||||||
|
|
||||||
|
eoSelect< RealVec >* selector = new eoRankMuSelect< RealVec >( mu );
|
||||||
|
state.storeFunctor(selector);
|
||||||
|
|
||||||
|
edoEstimator< Distrib >* estimator = new edoEstimatorNormalAdaptive<RealVec>( distribution );
|
||||||
|
state.storeFunctor(estimator);
|
||||||
|
|
||||||
|
eoEvalFunc< RealVec >* plainEval = new Rosenbrock< RealVec >();
|
||||||
|
state.storeFunctor(plainEval);
|
||||||
|
|
||||||
|
eoEvalFuncCounterBounder< RealVec > eval(*plainEval, max_eval);
|
||||||
|
|
||||||
|
eoRndGenerator< double >* gen = new eoUniformGenerator< double >(-5, 5);
|
||||||
|
state.storeFunctor(gen);
|
||||||
|
|
||||||
|
|
||||||
|
eoInitFixedLength< RealVec >* init = new eoInitFixedLength< RealVec >( dim, *gen );
|
||||||
|
state.storeFunctor(init);
|
||||||
|
|
||||||
|
|
||||||
|
// (1) Population init and sampler
|
||||||
|
// Generation of population from do_make_pop (creates parameters, manages persistance and so on...)
|
||||||
|
// ... and creates the parameters: L P r S
|
||||||
|
// this first sampler creates a uniform distribution independently from our distribution (it does not use edoUniform).
|
||||||
|
eoPop< RealVec >& pop = do_make_pop(parser, state, *init);
|
||||||
|
|
||||||
|
// (2) First evaluation before starting the research algorithm
|
||||||
|
apply(eval, pop);
|
||||||
|
|
||||||
|
// Prepare bounder class to set bounds of sampling.
|
||||||
|
// This is used by edoSampler.
|
||||||
|
edoBounder< RealVec >* bounder =
|
||||||
|
new edoBounderRng< RealVec >( RealVec(dim, -5), RealVec(dim, 5), *gen); // FIXME do not use hard-coded bounds
|
||||||
|
state.storeFunctor(bounder);
|
||||||
|
|
||||||
|
// Prepare sampler class with a specific distribution
|
||||||
|
edoSampler< Distrib >* sampler = new edoSamplerNormalAdaptive< RealVec >( *bounder );
|
||||||
|
state.storeFunctor(sampler);
|
||||||
|
|
||||||
|
// stopping criteria
|
||||||
|
// ... and creates the parameter letters: C E g G s T
|
||||||
|
eoContinue< RealVec >& eo_continue = do_make_continue(parser, state, eval);
|
||||||
|
|
||||||
|
// population output
|
||||||
|
eoCheckPoint< RealVec >& pop_continue = do_make_checkpoint(parser, state, eval, eo_continue);
|
||||||
|
|
||||||
|
// distribution output
|
||||||
|
edoDummyContinue< Distrib >* dummy_continue = new edoDummyContinue< Distrib >();
|
||||||
|
state.storeFunctor(dummy_continue);
|
||||||
|
|
||||||
|
edoCheckPoint< Distrib >* distribution_continue = new edoCheckPoint< Distrib >( *dummy_continue );
|
||||||
|
state.storeFunctor(distribution_continue);
|
||||||
|
|
||||||
|
// eoEPRemplacement causes the using of the current and previous
|
||||||
|
// sample for sampling.
|
||||||
|
eoReplacement< RealVec >* replacor = new eoEPReplacement< RealVec >(pop.size());
|
||||||
|
state.storeFunctor(replacor);
|
||||||
|
|
||||||
|
// Some stuff to display helper when we are using -h option
|
||||||
|
if (parser.userNeedsHelp())
|
||||||
|
{
|
||||||
|
parser.printHelp(std::cout);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Help + Verbose routines
|
||||||
|
make_verbose(parser);
|
||||||
|
make_help(parser);
|
||||||
|
|
||||||
|
eoPopLoopEval<RealVec> popEval( eval );
|
||||||
|
|
||||||
|
// EDA algorithm configuration
|
||||||
|
edoAlgo< Distrib >* algo = new edoAlgoAdaptive< Distrib >
|
||||||
|
(distribution, popEval, *selector, *estimator, *sampler, *replacor,
|
||||||
|
pop_continue, *distribution_continue );
|
||||||
|
|
||||||
|
|
||||||
|
// Beginning of the algorithm call
|
||||||
|
try {
|
||||||
|
do_run(*algo, pop);
|
||||||
|
|
||||||
|
} catch (eoEvalFuncCounterBounderException& e) {
|
||||||
|
eo::log << eo::warnings << "warning: " << e.what() << std::endl;
|
||||||
|
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
eo::log << eo::errors << "error: " << e.what() << std::endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -26,7 +26,7 @@ Authors:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <eo>
|
#include <eo>
|
||||||
#include <mo>
|
// #include <mo>
|
||||||
|
|
||||||
#include <eoEvalFuncCounterBounder.h>
|
#include <eoEvalFuncCounterBounder.h>
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ int main(int ac, char** av)
|
||||||
// Prepare bounder class to set bounds of sampling.
|
// Prepare bounder class to set bounds of sampling.
|
||||||
// This is used by edoSampler.
|
// This is used by edoSampler.
|
||||||
edoBounder< EOT >* bounder =
|
edoBounder< EOT >* bounder =
|
||||||
new edoBounderRng< EOT >( EOT(pop[0].size(), -5), EOT(pop[0].size(), 5), *gen); // FIXME do not use hard-coded bounds
|
new edoBounderRng< EOT >( EOT(dimension_size, -5), EOT(dimension_size, 5), *gen); // FIXME do not use hard-coded bounds
|
||||||
state.storeFunctor(bounder);
|
state.storeFunctor(bounder);
|
||||||
|
|
||||||
// Prepare sampler class with a specific distribution
|
// Prepare sampler class with a specific distribution
|
||||||
|
|
@ -118,6 +118,10 @@ int main(int ac, char** av)
|
||||||
eoReplacement< EOT >* replacor = new eoEPReplacement< EOT >(pop.size());
|
eoReplacement< EOT >* replacor = new eoEPReplacement< EOT >(pop.size());
|
||||||
state.storeFunctor(replacor);
|
state.storeFunctor(replacor);
|
||||||
|
|
||||||
|
// Help + Verbose routines
|
||||||
|
make_verbose(parser);
|
||||||
|
make_help(parser);
|
||||||
|
|
||||||
// Some stuff to display helper when we are using -h option
|
// Some stuff to display helper when we are using -h option
|
||||||
if (parser.userNeedsHelp())
|
if (parser.userNeedsHelp())
|
||||||
{
|
{
|
||||||
|
|
@ -125,10 +129,6 @@ int main(int ac, char** av)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Help + Verbose routines
|
|
||||||
make_verbose(parser);
|
|
||||||
make_help(parser);
|
|
||||||
|
|
||||||
// population output (after helper)
|
// population output (after helper)
|
||||||
//
|
//
|
||||||
// FIXME: theses objects are instanciated there in order to avoid a folder
|
// FIXME: theses objects are instanciated there in order to avoid a folder
|
||||||
|
|
@ -161,10 +161,9 @@ int main(int ac, char** av)
|
||||||
eoPopLoopEval<EOT> popEval( eval );
|
eoPopLoopEval<EOT> popEval( eval );
|
||||||
|
|
||||||
// EDA algorithm configuration
|
// EDA algorithm configuration
|
||||||
edoAlgo< Distrib >* algo = new edoEDA< Distrib >
|
edoAlgo< Distrib >* algo = new edoAlgoStateless< Distrib >
|
||||||
(*selector, *estimator, *sampler,
|
(popEval, *selector, *estimator, *sampler, *replacor,
|
||||||
pop_continue, *distribution_continue,
|
pop_continue, *distribution_continue );
|
||||||
popEval, *replacor);
|
|
||||||
|
|
||||||
// Beginning of the algorithm call
|
// Beginning of the algorithm call
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
mkdir -p debug
|
mkdir -p debug
|
||||||
cd debug
|
cd debug
|
||||||
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_EIGEN=1 ..
|
||||||
make
|
make
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
||||||
7
edo/build_gcc_linux_eigen_debug
Executable file
7
edo/build_gcc_linux_eigen_debug
Executable file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
mkdir -p debug
|
||||||
|
cd debug
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_EIGEN=1 ..
|
||||||
|
make
|
||||||
|
cd ..
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
mkdir -p release
|
mkdir -p release
|
||||||
cd release
|
cd release
|
||||||
cmake ..
|
cmake -DWITH_EIGEN=1 ..
|
||||||
|
#cmake -DWITH_BOOST=1 ..
|
||||||
|
|
||||||
make
|
make
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ EXTRACT_ANON_NSPACES = NO
|
||||||
# various overviews, but no documentation section is generated.
|
# various overviews, but no documentation section is generated.
|
||||||
# This option has no effect if EXTRACT_ALL is enabled.
|
# This option has no effect if EXTRACT_ALL is enabled.
|
||||||
|
|
||||||
HIDE_UNDOC_MEMBERS = YES
|
HIDE_UNDOC_MEMBERS = NO
|
||||||
|
|
||||||
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
|
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
|
||||||
# undocumented classes that are normally visible in the class hierarchy.
|
# undocumented classes that are normally visible in the class hierarchy.
|
||||||
|
|
@ -771,7 +771,7 @@ COLS_IN_ALPHA_INDEX = 3
|
||||||
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
|
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
|
||||||
# should be ignored while generating the index headers.
|
# should be ignored while generating the index headers.
|
||||||
|
|
||||||
IGNORE_PREFIX = moeo
|
IGNORE_PREFIX = edo
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the HTML output
|
# configuration options related to the HTML output
|
||||||
|
|
@ -1273,13 +1273,13 @@ ENABLE_PREPROCESSING = YES
|
||||||
# compilation will be performed. Macro expansion can be done in a controlled
|
# compilation will be performed. Macro expansion can be done in a controlled
|
||||||
# way by setting EXPAND_ONLY_PREDEF to YES.
|
# way by setting EXPAND_ONLY_PREDEF to YES.
|
||||||
|
|
||||||
MACRO_EXPANSION = NO
|
MACRO_EXPANSION = YES
|
||||||
|
|
||||||
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
|
||||||
# then the macro expansion is limited to the macros specified with the
|
# then the macro expansion is limited to the macros specified with the
|
||||||
# PREDEFINED and EXPAND_AS_DEFINED tags.
|
# PREDEFINED and EXPAND_AS_DEFINED tags.
|
||||||
|
|
||||||
EXPAND_ONLY_PREDEF = NO
|
EXPAND_ONLY_PREDEF = YES
|
||||||
|
|
||||||
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
|
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
|
||||||
# in the INCLUDE_PATH (see below) will be search if a #include is found.
|
# in the INCLUDE_PATH (see below) will be search if a #include is found.
|
||||||
|
|
@ -1307,7 +1307,7 @@ INCLUDE_FILE_PATTERNS =
|
||||||
# undefined via #undef or recursively expanded use the := operator
|
# undefined via #undef or recursively expanded use the := operator
|
||||||
# instead of the = operator.
|
# instead of the = operator.
|
||||||
|
|
||||||
PREDEFINED =
|
PREDEFINED = WITH_EIGEN
|
||||||
|
|
||||||
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
|
||||||
# this tag can be used to specify a list of macro names that should be expanded.
|
# this tag can be used to specify a list of macro names that should be expanded.
|
||||||
|
|
|
||||||
2689
edo/doc/edo_design.svg
Normal file
2689
edo/doc/edo_design.svg
Normal file
File diff suppressed because it is too large
Load diff
|
After Width: | Height: | Size: 158 KiB |
2885
edo/doc/edo_distrib.svg
Normal file
2885
edo/doc/edo_distrib.svg
Normal file
File diff suppressed because it is too large
Load diff
|
After Width: | Height: | Size: 133 KiB |
|
|
@ -0,0 +1,39 @@
|
||||||
|
/** @mainpage Welcome to Evolving Distribution Objects
|
||||||
|
|
||||||
|
@section shortcuts In one word
|
||||||
|
|
||||||
|
%EDO is an extension of %EO oriented toward Estimation-of-Distribution-like
|
||||||
|
Algorithms.
|
||||||
|
|
||||||
|
You can search for advanced features by browsing the <a
|
||||||
|
href="modules.html">modules</a> page.
|
||||||
|
|
||||||
|
@section intro Introduction
|
||||||
|
|
||||||
|
%EDO is an extension of %EO, that facilitate the design and implementation of
|
||||||
|
stochastic search metaheuristics. It is based on the assumption that those
|
||||||
|
algorithms are updating a probability distribution, that is used to generate
|
||||||
|
a sample (a population, in %EO) of solutions (individuals, in %EO).
|
||||||
|
|
||||||
|
Basically, EDO decompose the <em>variation</em> operators of %EO in a set of
|
||||||
|
sub-operators that are binded by a <em>distribution</em>. Thus, most of the
|
||||||
|
representation-independent operators of %EO can be used in %EDO algorithms.
|
||||||
|
|
||||||
|
Apart from choosing which distribution he want to use as a model, the user is
|
||||||
|
not supposed to directly manipulate it. Using the same approach than within %EO,
|
||||||
|
the user has just to indicate what he want to use, without having to bother how
|
||||||
|
he want to use it.
|
||||||
|
|
||||||
|
On the designer side, it is still possible to implement specific operators
|
||||||
|
without having to change other ones.
|
||||||
|
|
||||||
|
<img src="edo_design.png" />
|
||||||
|
|
||||||
|
The two main operators are the <em>Estimators</em>, that builds a given
|
||||||
|
distribution according to a population and the <em>Samplers</em> that builds a
|
||||||
|
population according to a distribution. There is also <em>Modifiers</em> that
|
||||||
|
are here to change arbitrarily the parameters of a distribution, if necessary.
|
||||||
|
|
||||||
|
<img src="edo_distrib.png" />
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
@ -2,19 +2,9 @@
|
||||||
|
|
||||||
# directory we need to build project
|
# directory we need to build project
|
||||||
SET(EO_DIR "<<PATH_TO_EO>>" CACHE PATH "EO directory" FORCE)
|
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
|
# automagically set parameters, do not edit
|
||||||
|
|
||||||
SET(EO_INCLUDE_DIRS "${EO_DIR}/src" CACHE PATH "EO include directory" FORCE)
|
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_LIBRARY_DIRS "${EO_DIR}/release/lib" CACHE PATH "EO library directory" FORCE)
|
||||||
SET(EO_LIBRARIES eoutils eo es ga cma gcov) # do not use quotes around this list or it will fail
|
SET(EO_LIBRARIES eoutils eo es ga cma gcov) # do not use quotes around this list or it will fail
|
||||||
|
|
||||||
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") # no library is generated when building 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)
|
|
||||||
|
|
|
||||||
|
|
@ -29,18 +29,22 @@ Authors:
|
||||||
#define _edo_
|
#define _edo_
|
||||||
|
|
||||||
#include "edoAlgo.h"
|
#include "edoAlgo.h"
|
||||||
#include "edoEDASA.h"
|
//#include "edoEDASA.h"
|
||||||
#include "edoEDA.h"
|
#include "edoAlgoAdaptive.h"
|
||||||
|
#include "edoAlgoStateless.h"
|
||||||
|
|
||||||
#include "edoDistrib.h"
|
#include "edoDistrib.h"
|
||||||
#include "edoUniform.h"
|
#include "edoUniform.h"
|
||||||
#include "edoNormalMono.h"
|
#include "edoNormalMono.h"
|
||||||
#include "edoNormalMulti.h"
|
#include "edoNormalMulti.h"
|
||||||
|
#include "edoNormalAdaptive.h"
|
||||||
|
|
||||||
#include "edoEstimator.h"
|
#include "edoEstimator.h"
|
||||||
#include "edoEstimatorUniform.h"
|
#include "edoEstimatorUniform.h"
|
||||||
#include "edoEstimatorNormalMono.h"
|
#include "edoEstimatorNormalMono.h"
|
||||||
#include "edoEstimatorNormalMulti.h"
|
#include "edoEstimatorNormalMulti.h"
|
||||||
|
#include "edoEstimatorAdaptive.h"
|
||||||
|
#include "edoEstimatorNormalAdaptive.h"
|
||||||
|
|
||||||
#include "edoModifier.h"
|
#include "edoModifier.h"
|
||||||
#include "edoModifierDispersion.h"
|
#include "edoModifierDispersion.h"
|
||||||
|
|
@ -53,6 +57,7 @@ Authors:
|
||||||
#include "edoSamplerUniform.h"
|
#include "edoSamplerUniform.h"
|
||||||
#include "edoSamplerNormalMono.h"
|
#include "edoSamplerNormalMono.h"
|
||||||
#include "edoSamplerNormalMulti.h"
|
#include "edoSamplerNormalMulti.h"
|
||||||
|
#include "edoSamplerNormalAdaptive.h"
|
||||||
|
|
||||||
#include "edoVectorBounds.h"
|
#include "edoVectorBounds.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,16 +31,29 @@ Authors:
|
||||||
|
|
||||||
#include <eoAlgo.h>
|
#include <eoAlgo.h>
|
||||||
|
|
||||||
/** An EDO algorithm difffers from a canonical EO algorithm because it is
|
/**
|
||||||
|
@defgroup Algorithms Algorithms
|
||||||
|
|
||||||
|
In EDO, as in EO, an algorithm is a functor that takes one or several
|
||||||
|
solutions to an optimization problem as arguments, and iteratively modify
|
||||||
|
them with the help of operators.It differs from a canonical EO algorithm
|
||||||
|
because it is templatized on a edoDistrib rather than just an EOT.
|
||||||
|
|
||||||
|
@see eoAlgo
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** An EDO algorithm differs from a canonical EO algorithm because it is
|
||||||
* templatized on a Distribution rather than just an EOT.
|
* templatized on a Distribution rather than just an EOT.
|
||||||
*
|
*
|
||||||
* Derivating from an eoAlgo, it should define an operator()( EOT sol )
|
* Derivating from an eoAlgo, it should define an operator()( EOT sol )
|
||||||
|
*
|
||||||
|
* @ingroup Algorithms
|
||||||
*/
|
*/
|
||||||
template < typename D >
|
template < typename D >
|
||||||
class edoAlgo : public eoAlgo< typename D::EOType >
|
class edoAlgo : public eoAlgo< typename D::EOType >
|
||||||
{
|
{
|
||||||
//! Alias for the type
|
//! Alias for the type
|
||||||
typedef typename D::EOType EOT;
|
typedef typename D::EOType EOType;
|
||||||
|
|
||||||
// virtual R operator()(A1) = 0; (defined in eoUF)
|
// virtual R operator()(A1) = 0; (defined in eoUF)
|
||||||
|
|
||||||
|
|
|
||||||
213
edo/src/edoAlgoAdaptive.h
Normal file
213
edo/src/edoAlgoAdaptive.h
Normal file
|
|
@ -0,0 +1,213 @@
|
||||||
|
/*
|
||||||
|
The Evolving Distribution Objects framework (EDO) is a template-based,
|
||||||
|
ANSI-C++ evolutionary computation library which helps you to write your
|
||||||
|
own estimation of distribution algorithms.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Copyright (C) 2010 Thales group
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Authors:
|
||||||
|
Johann Dréo <johann.dreo@thalesgroup.com>
|
||||||
|
Pierre Savéant <pierre.saveant@thalesgroup.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _edoAlgoAdaptive_h
|
||||||
|
#define _edoAlgoAdaptive_h
|
||||||
|
|
||||||
|
#include <eo>
|
||||||
|
|
||||||
|
#include <utils/eoRNG.h>
|
||||||
|
|
||||||
|
#include "edoAlgo.h"
|
||||||
|
#include "edoEstimator.h"
|
||||||
|
#include "edoModifierMass.h"
|
||||||
|
#include "edoSampler.h"
|
||||||
|
#include "edoContinue.h"
|
||||||
|
|
||||||
|
/** A generic stochastic search template for algorithms that need a distribution parameter.
|
||||||
|
*
|
||||||
|
* An adaptive algorithm will directly updates a distribution, it must thus be instanciated
|
||||||
|
* with an edoDistrib at hand. Thus, this distribution object should be instanciated appart.
|
||||||
|
* The reference to this distribution is generally also needed by at least one of the
|
||||||
|
* algorithm's operator, generally for algorithms that shares the same algorithms across
|
||||||
|
* operators and/or iterations.
|
||||||
|
*
|
||||||
|
* If you no operator needs to update the distribution, then it is simpler to use an
|
||||||
|
* edoAlgoStateless .
|
||||||
|
*
|
||||||
|
* @ingroup Algorithms
|
||||||
|
*/
|
||||||
|
template < typename D >
|
||||||
|
class edoAlgoAdaptive : public edoAlgo< D >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Alias for the type EOT
|
||||||
|
typedef typename D::EOType EOType;
|
||||||
|
|
||||||
|
//! Alias for the atom type
|
||||||
|
typedef typename EOType::AtomType AtomType;
|
||||||
|
|
||||||
|
//! Alias for the fitness
|
||||||
|
typedef typename EOType::Fitness Fitness;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Takes algo operators, all are mandatory
|
||||||
|
|
||||||
|
\param distrib A distribution to use, if you want to update this parameter (e.gMA-ES) instead of replacing it (e.g. an EDA)
|
||||||
|
\param evaluator Evaluate a population
|
||||||
|
\param selector Selection of the best candidate solutions in the population
|
||||||
|
\param estimator Estimation of the distribution parameters
|
||||||
|
\param sampler Generate feasible solutions using the distribution
|
||||||
|
\param replacor Replace old solutions by new ones
|
||||||
|
\param pop_continuator Stopping criterion based on the population features
|
||||||
|
\param distribution_continuator Stopping criterion based on the distribution features
|
||||||
|
*/
|
||||||
|
edoAlgoAdaptive(
|
||||||
|
D & distrib,
|
||||||
|
eoPopEvalFunc < EOType > & evaluator,
|
||||||
|
eoSelect< EOType > & selector,
|
||||||
|
edoEstimator< D > & estimator,
|
||||||
|
edoSampler< D > & sampler,
|
||||||
|
eoReplacement< EOType > & replacor,
|
||||||
|
eoContinue< EOType > & pop_continuator,
|
||||||
|
edoContinue< D > & distribution_continuator
|
||||||
|
) :
|
||||||
|
_distrib(distrib),
|
||||||
|
_evaluator(evaluator),
|
||||||
|
_selector(selector),
|
||||||
|
_estimator(estimator),
|
||||||
|
_sampler(sampler),
|
||||||
|
_replacor(replacor),
|
||||||
|
_pop_continuator(pop_continuator),
|
||||||
|
_dummy_continue(),
|
||||||
|
_distribution_continuator(distribution_continuator)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
//! constructor without an edoContinue
|
||||||
|
/*!
|
||||||
|
Takes algo operators, all are mandatory
|
||||||
|
|
||||||
|
\param distrib A distribution to use, if you want to update this parameter (e.gMA-ES) instead of replacing it (e.g. an EDA)
|
||||||
|
\param evaluator Evaluate a population
|
||||||
|
\param selector Selection of the best candidate solutions in the population
|
||||||
|
\param estimator Estimation of the distribution parameters
|
||||||
|
\param sampler Generate feasible solutions using the distribution
|
||||||
|
\param replacor Replace old solutions by new ones
|
||||||
|
\param pop_continuator Stopping criterion based on the population features
|
||||||
|
*/
|
||||||
|
edoAlgoAdaptive (
|
||||||
|
D & distrib,
|
||||||
|
eoPopEvalFunc < EOType > & evaluator,
|
||||||
|
eoSelect< EOType > & selector,
|
||||||
|
edoEstimator< D > & estimator,
|
||||||
|
edoSampler< D > & sampler,
|
||||||
|
eoReplacement< EOType > & replacor,
|
||||||
|
eoContinue< EOType > & pop_continuator
|
||||||
|
) :
|
||||||
|
_distrib( distrib ),
|
||||||
|
_evaluator(evaluator),
|
||||||
|
_selector(selector),
|
||||||
|
_estimator(estimator),
|
||||||
|
_sampler(sampler),
|
||||||
|
_replacor(replacor),
|
||||||
|
_pop_continuator(pop_continuator),
|
||||||
|
_dummy_continue(),
|
||||||
|
_distribution_continuator( _dummy_continue )
|
||||||
|
{}
|
||||||
|
|
||||||
|
/** Call the algorithm
|
||||||
|
*
|
||||||
|
* \param pop the population of candidate solutions
|
||||||
|
* \return void
|
||||||
|
*/
|
||||||
|
void operator ()(eoPop< EOType > & pop)
|
||||||
|
{
|
||||||
|
assert(pop.size() > 0);
|
||||||
|
|
||||||
|
eoPop< EOType > current_pop;
|
||||||
|
eoPop< EOType > selected_pop;
|
||||||
|
|
||||||
|
// update the extern distribution passed to the estimator (cf. CMA-ES)
|
||||||
|
// OR replace the dummy distribution for estimators that do not need extern distributions (cf. EDA)
|
||||||
|
_distrib = _estimator(pop);
|
||||||
|
|
||||||
|
// Evaluating a first time the candidate solutions
|
||||||
|
// The first pop is not supposed to be evaluated (@see eoPopLoopEval).
|
||||||
|
// _evaluator( current_pop, pop );
|
||||||
|
|
||||||
|
do {
|
||||||
|
// (1) Selection of the best points in the population
|
||||||
|
_selector(pop, selected_pop);
|
||||||
|
assert( selected_pop.size() > 0 );
|
||||||
|
|
||||||
|
// (2) Estimation of the distribution parameters
|
||||||
|
_distrib = _estimator(selected_pop);
|
||||||
|
|
||||||
|
// (3) sampling
|
||||||
|
// The sampler produces feasible solutions (@see edoSampler that
|
||||||
|
// encapsulate an edoBounder)
|
||||||
|
current_pop.clear();
|
||||||
|
for( unsigned int i = 0; i < pop.size(); ++i ) {
|
||||||
|
current_pop.push_back( _sampler(_distrib) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// (4) Evaluate new solutions
|
||||||
|
_evaluator( pop, current_pop );
|
||||||
|
|
||||||
|
// (5) Replace old solutions by new ones
|
||||||
|
_replacor(pop, current_pop); // e.g. copy current_pop in pop
|
||||||
|
|
||||||
|
} while( _distribution_continuator( _distrib ) && _pop_continuator( pop ) );
|
||||||
|
} // operator()
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//! The distribution that you want to update
|
||||||
|
D & _distrib;
|
||||||
|
|
||||||
|
//! A full evaluation function.
|
||||||
|
eoPopEvalFunc<EOType> & _evaluator;
|
||||||
|
|
||||||
|
//! A EOType selector
|
||||||
|
eoSelect<EOType> & _selector;
|
||||||
|
|
||||||
|
//! A EOType estimator. It is going to estimate distribution parameters.
|
||||||
|
edoEstimator<D> & _estimator;
|
||||||
|
|
||||||
|
//! A D sampler
|
||||||
|
edoSampler<D> & _sampler;
|
||||||
|
|
||||||
|
//! A EOType replacor
|
||||||
|
eoReplacement<EOType> & _replacor;
|
||||||
|
|
||||||
|
//! A EOType population continuator
|
||||||
|
eoContinue<EOType> & _pop_continuator;
|
||||||
|
|
||||||
|
//! A D continuator that always return true
|
||||||
|
edoDummyContinue<D> _dummy_continue;
|
||||||
|
|
||||||
|
//! A D continuator
|
||||||
|
edoContinue<D> & _distribution_continuator;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !_edoAlgoAdaptive_h
|
||||||
|
|
||||||
105
edo/src/edoAlgoStateless.h
Normal file
105
edo/src/edoAlgoStateless.h
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
The Evolving Distribution Objects framework (EDO) is a template-based,
|
||||||
|
ANSI-C++ evolutionary computation library which helps you to write your
|
||||||
|
own estimation of distribution algorithms.
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Copyright (C) 2010 Thales group
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
Authors:
|
||||||
|
Johann Dréo <johann.dreo@thalesgroup.com>
|
||||||
|
Pierre Savéant <pierre.saveant@thalesgroup.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _edoAlgoStateless_h
|
||||||
|
#define _edoAlgoStateless_h
|
||||||
|
|
||||||
|
#include "edoAlgoAdaptive.h"
|
||||||
|
|
||||||
|
/** A generic stochastic search template for algorithms that need a distribution parameter but replace it rather than update it
|
||||||
|
*
|
||||||
|
* This use a default dummy distribution, for algorithms willing to replace it instead of updating
|
||||||
|
* Thus we can instanciate _distrib on this and replace it at the first iteration with an estimator.
|
||||||
|
* This is why an edoDistrib must have an empty constructor.
|
||||||
|
*
|
||||||
|
* @ingroup Algorithms
|
||||||
|
*/
|
||||||
|
template < typename D >
|
||||||
|
class edoAlgoStateless : public edoAlgoAdaptive< D >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Alias for the type EOT
|
||||||
|
typedef typename D::EOType EOType;
|
||||||
|
|
||||||
|
//! Alias for the atom type
|
||||||
|
typedef typename EOType::AtomType AtomType;
|
||||||
|
|
||||||
|
//! Alias for the fitness
|
||||||
|
typedef typename EOType::Fitness Fitness;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** Full constructor
|
||||||
|
\param evaluator Evaluate a population
|
||||||
|
\param selector Selection of the best candidate solutions in the population
|
||||||
|
\param estimator Estimation of the distribution parameters
|
||||||
|
\param sampler Generate feasible solutions using the distribution
|
||||||
|
\param replacor Replace old solutions by new ones
|
||||||
|
\param pop_continuator Stopping criterion based on the population features
|
||||||
|
\param distribution_continuator Stopping criterion based on the distribution features
|
||||||
|
*/
|
||||||
|
edoAlgoStateless(
|
||||||
|
eoPopEvalFunc < EOType > & evaluator,
|
||||||
|
eoSelect< EOType > & selector,
|
||||||
|
edoEstimator< D > & estimator,
|
||||||
|
edoSampler< D > & sampler,
|
||||||
|
eoReplacement< EOType > & replacor,
|
||||||
|
eoContinue< EOType > & pop_continuator,
|
||||||
|
edoContinue< D > & distribution_continuator
|
||||||
|
) :
|
||||||
|
edoAlgoAdaptive<D>( *(new D), evaluator, selector, estimator, sampler, replacor, pop_continuator, distribution_continuator)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/** Constructor without an edoContinue
|
||||||
|
|
||||||
|
\param evaluator Evaluate a population
|
||||||
|
\param selector Selection of the best candidate solutions in the population
|
||||||
|
\param estimator Estimation of the distribution parameters
|
||||||
|
\param sampler Generate feasible solutions using the distribution
|
||||||
|
\param replacor Replace old solutions by new ones
|
||||||
|
\param pop_continuator Stopping criterion based on the population features
|
||||||
|
*/
|
||||||
|
edoAlgoStateless (
|
||||||
|
eoPopEvalFunc < EOType > & evaluator,
|
||||||
|
eoSelect< EOType > & selector,
|
||||||
|
edoEstimator< D > & estimator,
|
||||||
|
edoSampler< D > & sampler,
|
||||||
|
eoReplacement< EOType > & replacor,
|
||||||
|
eoContinue< EOType > & pop_continuator
|
||||||
|
) :
|
||||||
|
edoAlgoAdaptive<D>( *(new D), evaluator, selector, estimator, sampler, replacor, pop_continuator)
|
||||||
|
{}
|
||||||
|
|
||||||
|
~edoAlgoStateless()
|
||||||
|
{
|
||||||
|
// delete the temporary distrib allocated in constructors
|
||||||
|
delete &(this->_distrib);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // !_edoAlgoStateless_h
|
||||||
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue