From 85fded52a5dc82b650de518150125675c553f155 Mon Sep 17 00:00:00 2001 From: Ronaldd Pinho Date: Fri, 12 Apr 2019 22:56:50 -0300 Subject: [PATCH 001/296] Add README.md --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..d7487ae83 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# ParadisEO: A C++ evolutionary computation framework to build parallel stochastic optimization solvers + +## Release + +The actual release is paradiseo-2.0 + +## Installation + +The basic installation procedure must be done in a separatly folder in order to keep your file tree clean. + +Create a directory to build and access it: + +``` +$ mkdir build && cd build +``` + +Compile the project into the directory with ```cmake```: +``` +$ cmake .. +$ make +``` + +Take a coffee ;) + +**Congratulations!! ParadiseEO is installed!** + +Please refer to paradisEO website or INSTALL file for further information about installation types and options. + +--- + +## Directory Structure + From 71c51139d21e8bab7d63a5c01892bbce794501fb Mon Sep 17 00:00:00 2001 From: Ronaldd Pinho Date: Fri, 12 Apr 2019 23:11:09 -0300 Subject: [PATCH 002/296] Replace README file with a Markdown file README.md --- README | 83 ------------------------------------------------------- README.md | 19 +++++++++++++ 2 files changed, 19 insertions(+), 83 deletions(-) delete mode 100644 README diff --git a/README b/README deleted file mode 100644 index c989a97b5..000000000 --- a/README +++ /dev/null @@ -1,83 +0,0 @@ - -========================================================================================== - RELEASE -========================================================================================== - -The current release is paradisEO-2.0 - -========================================================================================== - INSTALLATION -========================================================================================== -The basic installation procedure must be done in a separatly folder in order to keep -your file tree clean. - -1) mkdir build -2) cd build -3) cmake .. -4) make -5) Take a cofee. -6) Congratulation, ParadiseEO is installed ! - -Please refer to paradisEO website or INSTALL file for further information about -installation types and options. - -========================================================================================== - DIRECTORY STRUCTURE -========================================================================================== -After unpacking the archive file, you should end up with the following -structure: - -.../ - | - | - +-- AUTHORS Author list - | - | - +-- cmake/ CMake dir - | - | - +-- CMakeLists.txt For building process - | - | - +-- CTestConfig.cmake For testing process - | - | - +-- INSTALL INSTALL file - | - | - +-- LICENCE Licence contents - | - | - +-- paradiseo-eo paradiseo-eo dir - | - | - +-- paradiseo-mo paradiseo-mo dir - | - | - +-- paradiseo-moeo paradiseo-moeo dir - | - | - +-- problems classical problems evaluation functions - | - | - +-- README README file - -========================================================================================== - NOTES -========================================================================================== - -ParadisEO uses EO, a templates-based, ANSI-C++ compliant evolutionary computation library. -It contains classes for almost any kind of evolutionary computation you might come up to - at -least for the ones we could think of. -EO Website: http://eodev.sourceforge.net/. -EO is distributed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html - -Please read README file of each extracted directory if you have -problems for the installation. - -========================================================================================== - CONTACT -========================================================================================== -For further information about ParadisEO, help or to report any -problem : paradiseo-help@lists.gforge.inria.fr - diff --git a/README.md b/README.md index d7487ae83..ee2ec7198 100644 --- a/README.md +++ b/README.md @@ -30,3 +30,22 @@ Please refer to paradisEO website or INSTALL file for further information about ## Directory Structure +* __AUTHORS__: Authors list; + +* __cmake__: Directory of cmake files; + +* __CMakeLists.txt__: Definitions for building process; + +* __CTestConfig.cmake__: Definitions for testing process; + +* __INSTALL__: Steps and options of the installation process; + +* __LICENSE__: License contents; + +* __eo__: Specific directory of the EO (Evolving Objects) module; + +* __mo__: Specific directory of the MO (Moving Objects) module; + +* __moeo__: Specific directory of the MOEO (Multi-Objective Optimization) module; + +* __problems__: classical problems evaluation functions; \ No newline at end of file From bedb18ff3ede40a95abbfd256f1b8ca2125382fc Mon Sep 17 00:00:00 2001 From: Ronaldd Pinho Date: Fri, 12 Apr 2019 23:20:34 -0300 Subject: [PATCH 003/296] README file adapted to Markdown file README.md finished --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ee2ec7198..cdba1774b 100644 --- a/README.md +++ b/README.md @@ -48,4 +48,22 @@ Please refer to paradisEO website or INSTALL file for further information about * __moeo__: Specific directory of the MOEO (Multi-Objective Optimization) module; -* __problems__: classical problems evaluation functions; \ No newline at end of file +* __problems__: classical problems evaluation functions. + +--- +## Notes + +ParadisEO uses EO, a templates-based, ANSI-C++ compliant evolutionary computation library. It contains classes for almost any kind of evolutionary computation you might come up to - at least for the ones we could think of. + +EO Website: http://eodev.sourceforge.net/. + +ParadisEO Website: http://paradiseo.gforge.inria.fr/ + +EO is distributed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html + +Please read README file of each extracted directory if you have problems for the installation. + +--- +**Contact** + +For further information about ParadisEO, help or to report any problem : paradiseo-help@lists.gforge.inria.fr \ No newline at end of file From f88edf0dabaefa6501ab56bde7f449a259969b60 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 19 Apr 2019 06:52:15 +0200 Subject: [PATCH 004/296] deactivate moeo2DMinHypervolumeArchive which has a missing header --- moeo/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moeo/test/CMakeLists.txt b/moeo/test/CMakeLists.txt index ce5b932e0..3c1d5af28 100644 --- a/moeo/test/CMakeLists.txt +++ b/moeo/test/CMakeLists.txt @@ -71,7 +71,7 @@ set(TEST_LIST t-moeoNumberUnvisitedSelect t-moeoDMLSMonOp t-moeoDMLSGenUpdater - t-moeo2DMinHypervolumeArchive + # t-moeo2DMinHypervolumeArchive ) ###################################################################################### From ff322ba27bd0f698fe57c1c676a043e11d7917e0 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 19 Apr 2019 06:52:38 +0200 Subject: [PATCH 005/296] fix missing API update - tutorial/Lesson3 was still using the old eoStdoutMonitor interface --- eo/tutorial/Lesson3/exercise3.1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/tutorial/Lesson3/exercise3.1.cpp b/eo/tutorial/Lesson3/exercise3.1.cpp index dc37479d4..d178941c5 100644 --- a/eo/tutorial/Lesson3/exercise3.1.cpp +++ b/eo/tutorial/Lesson3/exercise3.1.cpp @@ -289,7 +289,7 @@ void main_function(int argc, char **argv) checkpoint.add(fdcStat); // The Stdout monitor will print parameters to the screen ... - eoStdoutMonitor monitor(false); + eoStdoutMonitor monitor; // when called by the checkpoint (i.e. at every generation) checkpoint.add(monitor); From d83681d6facb0c504af15dd2ef83a0cd90e8f32e Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 29 Sep 2019 21:14:30 +0200 Subject: [PATCH 006/296] add cmake export to all targets & bugfix Find module - Add "EXPORT paradiseo-targets" to cmake's "install" commands. - Export those targets in "paradiseo-config.cmake", which is needed by FindParadiseo.cmake script. - Bugfix "FindParadiseo.cmake" script: - document PARADISEO_ROOT input, - add PARADISEO_DIR to specify a bin dir (try build, debug and release as defaults), - bugfix bad copy pastes involving edo and peo, - default messages only for eo, mo and meo. --- CMakeLists.txt | 9 +++++ cmake/module/FindParadiseo.cmake | 61 +++++++++++++++++++++----------- edo/src/utils/CMakeLists.txt | 2 +- eo/src/CMakeLists.txt | 2 +- eo/src/es/CMakeLists.txt | 4 +-- eo/src/ga/CMakeLists.txt | 2 +- eo/src/mpi/CMakeLists.txt | 2 +- eo/src/pyeo/CMakeLists.txt | 2 +- eo/src/serial/CMakeLists.txt | 2 +- eo/src/utils/CMakeLists.txt | 2 +- moeo/src/CMakeLists.txt | 2 +- smp/src/CMakeLists.txt | 2 +- 12 files changed, 61 insertions(+), 31 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bbb8de3e..8bb3a2c4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,3 +137,12 @@ endif() if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Package.cmake) endif() + + +# Add all targets to the build-tree export set +export(TARGETS eo FILE "${PROJECT_BINARY_DIR}/paradiseo-config.cmake") + +# Export the package for use from the build-tree +# (this registers the build-tree with a global CMake-registry) +export(PACKAGE paradiseo) + diff --git a/cmake/module/FindParadiseo.cmake b/cmake/module/FindParadiseo.cmake index 59b85a864..ecbd9ab79 100644 --- a/cmake/module/FindParadiseo.cmake +++ b/cmake/module/FindParadiseo.cmake @@ -1,3 +1,6 @@ +# The script use the following variables as search paths, if they are defined: +# - PARADISEO_ROOT : the project root +# - PARADISEO_DIR : the build/install directory with libraries binaries # # The following variables are filled out: # - PARADISEO_INCLUDE_DIR : EO, MO and MOEO source dir @@ -36,15 +39,21 @@ if(UNIX) set(INSTALL_SUB_DIR /paradiseo) endif() +if(PARADISEO_DIR) + # CMake config module is case sensitive + set(Paradiseo_DIR ${PARADISEO_DIR}) +endif() + # enabled components -if ("${Paradiseo_FIND_COMPONENTS}" STREQUAL "") +if (Paradiseo_FIND_COMPONENTS STREQUAL "") set(PARADISEO_LIBRARIES_TO_FIND eo eoutils cma es flowshop ga moeo) else() set(PARADISEO_LIBRARIES_TO_FIND ${Paradiseo_FIND_COMPONENTS}) endif() +message(STATUS "${PARADISEO_LIBRARIES_TO_FIND}") #set the build directory -set(BUILD_DIR build) +#set(BUILD_DIR build) # Path set(PARADISEO_SRC_PATHS @@ -72,32 +81,36 @@ find_path(MOEO_INCLUDE_DIR moeo PATH_SUFFIXES include${INSTALL_SUB_DIR}/moeo moeo/src PATHS ${PARADISEO_SRC_PATHS}) -# Specific for SMP and PEO +set(PARADISEO_INCLUDE_DIR ${EO_INCLUDE_DIR} ${MO_INCLUDE_DIR} ${MOEO_INCLUDE_DIR}) + +# Specific for SMP, EDO and PEO foreach(COMP ${PARADISEO_LIBRARIES_TO_FIND}) if(${COMP} STREQUAL "smp") set(SMP_FOUND true) find_path(SMP_INCLUDE_DIR smp PATH_SUFFIXES include${INSTALL_SUB_DIR}/smp smp/src PATHS ${PARADISEO_SRC_PATHS}) - elseif(${COMP} STREQUAL "peo") - set(PEO_FOUND true) + elseif(${COMP} STREQUAL "edo") + set(EDO_FOUND true) find_path(EDO_INCLUDE_DIR edo PATH_SUFFIXES include${INSTALL_SUB_DIR}/edo edo/src PATHS ${PARADISEO_SRC_PATHS}) - elseif(${COMP} STREQUAL "edo") - set(EDO_FOUND true) - find_path(EDO_INCLUDE_DIR peo + elseif(${COMP} STREQUAL "peo") + set(PEO_FOUND true) + find_path(PEO_INCLUDE_DIR peo PATH_SUFFIXES include${INSTALL_SUB_DIR}/peo peo/src PATHS ${PARADISEO_SRC_PATHS}) endif() endforeach() -set(PARADISEO_INCLUDE_DIR ${EO_INCLUDE_DIR} ${EDO_INCLUDE_DIR} ${MO_INCLUDE_DIR} ${MOEO_INCLUDE_DIR}) - if(SMP_FOUND) set(PARADISEO_INCLUDE_DIR ${PARADISEO_INCLUDE_DIR} ${SMP_INCLUDE_DIR}) endif() +if(EDO_FOUND) + set(PARADISEO_INCLUDE_DIR ${PARADISEO_INCLUDE_DIR} ${EDO_INCLUDE_DIR}) +endif() + if(PEO_FOUND) set(PARADISEO_INCLUDE_DIR ${PARADISEO_INCLUDE_DIR} ${PEO_INCLUDE_DIR}) endif() @@ -106,8 +119,14 @@ endif() set(PARADISEO_FOUND true) # will be set to false if one of the required modules is not found set(FIND_PARADISEO_LIB_PATHS - ${PARADISEO_ROOT}/${BUILD_DIR} - $ENV{PARADISEO_ROOT} + # ${PARADISEO_ROOT}/${BUILD_DIR} + ${Paradiseo_DIR} + $ENV{PARADISEO_ROOT}/build + $ENV{PARADISEO_ROOT}/release + $ENV{PARADISEO_ROOT}/debug + ${PARADISEO_ROOT}/build + ${PARADISEO_ROOT}/release + ${PARADISEO_ROOT}/debug /usr/local/ /usr/ /sw # Fink @@ -153,18 +172,20 @@ endforeach() # handle result if(PARADISEO_FOUND) - message(STATUS "Found ParadisEO includes :") - message(${EO_INCLUDE_DIR}) - message(${EDO_INCLUDE_DIR}) - message(${MO_INCLUDE_DIR}) - message(${MOEO_INCLUDE_DIR}) + message(STATUS "Found the following ParadisEO include directories:") + message(STATUS "\tEO\t: " ${EO_INCLUDE_DIR}) + message(STATUS "\tMO\t: " ${MO_INCLUDE_DIR}) + message(STATUS "\tMOEO\t: " ${MOEO_INCLUDE_DIR}) if(SMP_FOUND) - message(${SMP_INCLUDE_DIR}) + message(STATUS "\tSMP\t: " ${SMP_INCLUDE_DIR}) + endif() + if(EDO_FOUND) + message(STATUS "\tEDO\t: " ${EDO_INCLUDE_DIR}) endif() if(PEO_FOUND) - message(${PEO_INCLUDE_DIR}) + message(STATUS "\tPEO\t: " ${PEO_INCLUDE_DIR}) endif() else() # include directory or library not found - message(FATAL_ERROR "Could NOT find ParadisEO (missing : ${FIND_PARADISEO_MISSING})") + message(FATAL_ERROR "Could NOT find ParadisEO (missing \t: ${FIND_PARADISEO_MISSING})") endif() diff --git a/edo/src/utils/CMakeLists.txt b/edo/src/utils/CMakeLists.txt index a6fc4d067..01c928a66 100644 --- a/edo/src/utils/CMakeLists.txt +++ b/edo/src/utils/CMakeLists.txt @@ -14,7 +14,7 @@ set(LIBRARY_OUTPUT_PATH ${EDOUTILS_LIB_OUTPUT_PATH}) file(GLOB SOURCES *.cpp) add_library(edoutils ${SOURCES}) -install(TARGETS edoutils ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS edoutils EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) set(EDOUTILS_VERSION ${GLOBAL_VERSION}) set_target_properties(edoutils PROPERTIES VERSION "${EDOUTILS_VERSION}") diff --git a/eo/src/CMakeLists.txt b/eo/src/CMakeLists.txt index b2b445a93..76f26deae 100644 --- a/eo/src/CMakeLists.txt +++ b/eo/src/CMakeLists.txt @@ -29,7 +29,7 @@ add_library(eo STATIC ${EO_SOURCES}) set(EO_VERSION ${GLOBAL_VERSION}) set_target_properties(eo PROPERTIES VERSION "${EO_VERSION}") -install(TARGETS eo ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS eo EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) file(GLOB HDRS *.h eo) install(FILES ${HDRS} DESTINATION include${INSTALL_SUB_DIR}/eo COMPONENT headers) diff --git a/eo/src/es/CMakeLists.txt b/eo/src/es/CMakeLists.txt index 15a7f9f3b..55de761eb 100644 --- a/eo/src/es/CMakeLists.txt +++ b/eo/src/es/CMakeLists.txt @@ -38,10 +38,10 @@ set(CMA_SOURCES ) add_library(es STATIC ${ES_SOURCES}) -install(TARGETS es ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS es EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) add_library(cma STATIC ${CMA_SOURCES}) -install(TARGETS cma ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS cma EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) ###################################################################################### ### 3) Optionnal diff --git a/eo/src/ga/CMakeLists.txt b/eo/src/ga/CMakeLists.txt index 1a1cd656d..c03deed66 100644 --- a/eo/src/ga/CMakeLists.txt +++ b/eo/src/ga/CMakeLists.txt @@ -23,7 +23,7 @@ set(GA_SOURCES ) add_library(ga STATIC ${GA_SOURCES}) -install(TARGETS ga ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS ga EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) ###################################################################################### ### 3) Optionnal diff --git a/eo/src/mpi/CMakeLists.txt b/eo/src/mpi/CMakeLists.txt index ebf16335a..2c4eaf149 100644 --- a/eo/src/mpi/CMakeLists.txt +++ b/eo/src/mpi/CMakeLists.txt @@ -20,7 +20,7 @@ set(EOMPI_SOURCES ) add_library(eompi STATIC ${EOMPI_SOURCES}) -install(TARGETS eompi ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS eompi EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) file(GLOB HDRS *.h) install(FILES ${HDRS} DESTINATION include${INSTALL_SUB_DIR}/eo/mpi COMPONENT headers) diff --git a/eo/src/pyeo/CMakeLists.txt b/eo/src/pyeo/CMakeLists.txt index a8f6c8d54..3e057d924 100644 --- a/eo/src/pyeo/CMakeLists.txt +++ b/eo/src/pyeo/CMakeLists.txt @@ -48,7 +48,7 @@ set(EO_SOURCES # shared library add_library(PyEO MODULE ${SOURCES} ${EO_SOURCES}) -install(TARGETS PyEO LIBRARY DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS PyEO EXPORT paradiseo-targets LIBRARY DESTINATION ${LIB} COMPONENT libraries) # python 2.5 must have pyd if(WIN32 AND NOT CYGWIN) diff --git a/eo/src/serial/CMakeLists.txt b/eo/src/serial/CMakeLists.txt index d7a6fb574..a1f3578a8 100644 --- a/eo/src/serial/CMakeLists.txt +++ b/eo/src/serial/CMakeLists.txt @@ -20,7 +20,7 @@ set(EOSERIAL_SOURCES ) add_library(eoserial STATIC ${EOSERIAL_SOURCES}) -install(TARGETS eoserial ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS eoserial EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) file(GLOB HDRS *.h) install(FILES ${HDRS} DESTINATION include${INSTALL_SUB_DIR}/eo/serial COMPONENT headers) diff --git a/eo/src/utils/CMakeLists.txt b/eo/src/utils/CMakeLists.txt index 8e927dd4f..649344b0e 100644 --- a/eo/src/utils/CMakeLists.txt +++ b/eo/src/utils/CMakeLists.txt @@ -33,7 +33,7 @@ set(EOUTILS_SOURCES ) add_library(eoutils STATIC ${EOUTILS_SOURCES}) -install(TARGETS eoutils ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS eoutils EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) ###################################################################################### diff --git a/moeo/src/CMakeLists.txt b/moeo/src/CMakeLists.txt index a696cdbb5..c06351346 100644 --- a/moeo/src/CMakeLists.txt +++ b/moeo/src/CMakeLists.txt @@ -23,7 +23,7 @@ add_library(moeo STATIC ${MOEO_CORE}) set(MOEO_VERSION ${GLOBAL_VERSION}) set_target_properties(moeo PROPERTIES VERSION "${MOEO_VERSION}") -install(TARGETS moeo ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS moeo EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) ###################################################################################### ### 3) Look for headers diff --git a/smp/src/CMakeLists.txt b/smp/src/CMakeLists.txt index 07cde8272..d8568f97d 100644 --- a/smp/src/CMakeLists.txt +++ b/smp/src/CMakeLists.txt @@ -37,7 +37,7 @@ set (SMP_FILE add_library(smp STATIC ${SMP_FILE}) -install(TARGETS smp ARCHIVE DESTINATION ${LIB} COMPONENT libraries) +install(TARGETS smp EXPORT paradiseo-targets ARCHIVE DESTINATION ${LIB} COMPONENT libraries) ###################################################################################### ### 3) Look for headers From aa5dbe82c6e0930f1b4dd3289492e4755d188d87 Mon Sep 17 00:00:00 2001 From: Ronaldd Pinho Date: Sat, 29 Jun 2019 18:44:27 -0300 Subject: [PATCH 007/296] Use relative includes in headers and absolute in code - relative includes in headers - absolute includes in exe code - include sstream lib in eoExceptions.h - fix ga/make_op_ga.cpp - fix eoSGATransform.h --- eo/src/EO.h | 4 +- eo/src/PO.h | 2 +- eo/src/apply.h | 8 +- eo/src/do/make_algo_easea.h | 28 +-- eo/src/do/make_algo_scalar.h | 36 ++-- eo/src/do/make_checkpoint.h | 10 +- eo/src/do/make_checkpoint_FDC.h | 10 +- eo/src/do/make_checkpoint_assembled.h | 10 +- eo/src/do/make_continue.h | 16 +- eo/src/do/make_general_replacement.h | 8 +- eo/src/do/make_pop.h | 10 +- eo/src/do/make_run.h | 2 +- eo/src/eo | 206 ++++++++++--------- eo/src/eoAlgo.h | 4 +- eo/src/eoBinaryFlight.h | 2 +- eo/src/eoBitParticle.h | 2 +- eo/src/eoBreed.h | 8 +- eo/src/eoCellularEasyEA.h | 12 +- eo/src/eoCloneOps.h | 2 +- eo/src/eoCombinedContinue.h | 8 +- eo/src/eoCombinedInit.h | 2 +- eo/src/eoConstrictedVariableWeightVelocity.h | 10 +- eo/src/eoConstrictedVelocity.h | 10 +- eo/src/eoContinue.h | 6 +- eo/src/eoCounter.h | 6 +- eo/src/eoCtrlCContinue.cpp | 2 +- eo/src/eoCtrlCContinue.h | 2 +- eo/src/eoDetSelect.h | 4 +- eo/src/eoDetTournamentSelect.h | 8 +- eo/src/eoDistribUpdater.h | 4 +- eo/src/eoDistribution.h | 4 +- eo/src/eoDualFitness.h | 4 +- eo/src/eoEDA.h | 2 +- eo/src/eoEasyEA.h | 18 +- eo/src/eoEasyPSO.h | 8 +- eo/src/eoEvalContinue.h | 4 +- eo/src/eoEvalCounterThrowException.h | 6 +- eo/src/eoEvalDump.h | 2 +- eo/src/eoEvalFunc.h | 2 +- eo/src/eoEvalFuncCounter.h | 4 +- eo/src/eoEvalFuncCounterBounder.h | 4 +- eo/src/eoEvalFuncPtr.h | 2 +- eo/src/eoEvalKeepBest.h | 4 +- eo/src/eoEvalTimeThrowException.h | 2 +- eo/src/eoEvalUserTimeThrowException.h | 2 +- eo/src/eoExceptions.h | 1 + eo/src/eoExtendedVelocity.h | 12 +- eo/src/eoFactory.h | 4 +- eo/src/eoFitContinue.h | 4 +- eo/src/eoFitnessScalingSelect.h | 4 +- eo/src/eoFixedInertiaWeightedVelocity.h | 10 +- eo/src/eoFlOrBinOp.h | 4 +- eo/src/eoFlOrMonOp.h | 6 +- eo/src/eoFlOrQuadOp.h | 4 +- eo/src/eoFlight.h | 4 +- eo/src/eoFunctorStore.cpp | 4 +- eo/src/eoFunctorStore.h | 2 +- eo/src/eoG3Replacement.h | 12 +- eo/src/eoGaussRealWeightUp.h | 4 +- eo/src/eoGenContinue.h | 6 +- eo/src/eoGenOp.h | 6 +- eo/src/eoGeneralBreeder.h | 12 +- eo/src/eoInit.h | 8 +- eo/src/eoInitializer.h | 10 +- eo/src/eoInt.h | 2 +- eo/src/eoIntegerVelocity.h | 12 +- eo/src/eoInvalidateOps.h | 2 +- eo/src/eoInvertedContinue.h | 2 +- eo/src/eoLinearDecreasingWeightUp.h | 2 +- eo/src/eoLinearFitScaling.h | 4 +- eo/src/eoLinearTopology.h | 6 +- eo/src/eoMGGReplacement.h | 12 +- eo/src/eoMerge.h | 6 +- eo/src/eoMergeReduce.h | 12 +- eo/src/eoNDSorting.h | 6 +- eo/src/eoObject.h | 6 +- eo/src/eoOneToOneBreeder.h | 18 +- eo/src/eoOp.h | 8 +- eo/src/eoOpContainer.h | 2 +- eo/src/eoOpSelMason.h | 6 +- eo/src/eoOrderXover.h | 4 +- eo/src/eoPSO.h | 2 +- eo/src/eoPartiallyMappedXover.h | 2 +- eo/src/eoParticleBestInit.h | 2 +- eo/src/eoParticleFullInitializer.h | 10 +- eo/src/eoPerf2Worth.h | 6 +- eo/src/eoPeriodicContinue.h | 4 +- eo/src/eoPersistent.cpp | 2 +- eo/src/eoPop.h | 8 +- eo/src/eoPopEvalFunc.h | 14 +- eo/src/eoPopulator.h | 4 +- eo/src/eoPrintable.cpp | 2 +- eo/src/eoPrintable.h | 4 +- eo/src/eoProportionalCombinedOp.h | 12 +- eo/src/eoProportionalSelect.h | 8 +- eo/src/eoRandomRealWeightUp.h | 4 +- eo/src/eoRandomSelect.h | 4 +- eo/src/eoRanking.h | 2 +- eo/src/eoRankingSelect.h | 4 +- eo/src/eoRealBoundModifier.h | 4 +- eo/src/eoRealParticle.h | 2 +- eo/src/eoReduce.h | 8 +- eo/src/eoReduceMerge.h | 12 +- eo/src/eoReduceMergeReduce.h | 10 +- eo/src/eoReduceSplit.h | 6 +- eo/src/eoReplacement.h | 10 +- eo/src/eoRingTopology.h | 4 +- eo/src/eoSGA.h | 16 +- eo/src/eoSGATransform.h | 8 +- eo/src/eoSIGContinue.h | 2 +- eo/src/eoSecondsElapsedContinue.h | 2 +- eo/src/eoSelect.h | 2 +- eo/src/eoSelectFactory.h | 6 +- eo/src/eoSelectFromWorth.h | 6 +- eo/src/eoSelectMany.h | 6 +- eo/src/eoSelectNumber.h | 4 +- eo/src/eoSelectOne.h | 4 +- eo/src/eoSelectPerc.h | 4 +- eo/src/eoSharing.h | 4 +- eo/src/eoSharingSelect.h | 4 +- eo/src/eoSigBinaryFlight.h | 2 +- eo/src/eoSimpleEDA.h | 10 +- eo/src/eoSocialNeighborhood.h | 2 +- eo/src/eoStandardFlight.h | 2 +- eo/src/eoStandardVelocity.h | 12 +- eo/src/eoStarTopology.h | 4 +- eo/src/eoSteadyFitContinue.h | 4 +- eo/src/eoStochTournamentSelect.h | 4 +- eo/src/eoStochasticUniversalSelect.h | 8 +- eo/src/eoSurviveAndDie.h | 10 +- eo/src/eoSyncEasyPSO.h | 10 +- eo/src/eoTimeContinue.h | 4 +- eo/src/eoTopology.h | 2 +- eo/src/eoTransform.h | 2 +- eo/src/eoTruncSelect.h | 4 +- eo/src/eoTruncatedSelectMany.h | 6 +- eo/src/eoTruncatedSelectOne.h | 6 +- eo/src/eoVariableInertiaWeightedVelocity.h | 10 +- eo/src/eoVariableLengthCrossover.h | 4 +- eo/src/eoVariableLengthMutation.h | 6 +- eo/src/eoVector.h | 4 +- eo/src/eoVectorParticle.h | 2 +- eo/src/eoVelocity.h | 8 +- eo/src/eoVelocityInit.h | 6 +- eo/src/eoWeightUpdater.h | 2 +- eo/src/es.h | 26 +-- eo/src/es/CMAParams.cpp | 4 +- eo/src/es/CMAState.cpp | 11 +- eo/src/es/eoCMABreed.h | 6 +- eo/src/es/eoCMAInit.h | 6 +- eo/src/es/eoEsChromInit.h | 8 +- eo/src/es/eoEsFull.h | 2 +- eo/src/es/eoEsGlobalXover.h | 12 +- eo/src/es/eoEsMutate.h | 20 +- eo/src/es/eoEsMutationInit.h | 2 +- eo/src/es/eoEsSimple.h | 4 +- eo/src/es/eoEsStandardXover.h | 12 +- eo/src/es/eoEsStdev.h | 2 +- eo/src/es/eoNormalMutation.h | 10 +- eo/src/es/eoReal.h | 2 +- eo/src/es/eoRealAtomXover.h | 4 +- eo/src/es/eoRealInitBounded.h | 8 +- eo/src/es/eoRealOp.h | 6 +- eo/src/es/eoSBXcross.h | 10 +- eo/src/es/make_algo_scalar_es.cpp | 8 +- eo/src/es/make_algo_scalar_real.cpp | 4 +- eo/src/es/make_checkpoint_es.cpp | 8 +- eo/src/es/make_checkpoint_real.cpp | 4 +- eo/src/es/make_continue_es.cpp | 8 +- eo/src/es/make_continue_real.cpp | 4 +- eo/src/es/make_es.h | 26 +-- eo/src/es/make_genotype_es.cpp | 2 +- eo/src/es/make_genotype_real.cpp | 2 +- eo/src/es/make_genotype_real.h | 10 +- eo/src/es/make_op.h | 22 +- eo/src/es/make_op_es.cpp | 2 +- eo/src/es/make_op_es.h | 28 +-- eo/src/es/make_op_real.cpp | 2 +- eo/src/es/make_op_real.h | 22 +- eo/src/es/make_pop_es.cpp | 8 +- eo/src/es/make_pop_real.cpp | 4 +- eo/src/es/make_real.h | 22 +- eo/src/es/make_run_es.cpp | 10 +- eo/src/es/make_run_real.cpp | 6 +- eo/src/ga.h | 4 +- eo/src/ga/ChangeLog | 6 +- eo/src/ga/eoBit.h | 2 +- eo/src/ga/eoBitOp.h | 8 +- eo/src/ga/eoBitOpFactory.h | 4 +- eo/src/ga/eoBoolFlip.h | 2 +- eo/src/ga/eoPBILAdditive.h | 4 +- eo/src/ga/eoPBILDistrib.h | 2 +- eo/src/ga/eoPBILOrg.h | 4 +- eo/src/ga/make_PBILdistrib.h | 8 +- eo/src/ga/make_PBILupdate.h | 8 +- eo/src/ga/make_algo_scalar_ga.cpp | 4 +- eo/src/ga/make_checkpoint_ga.cpp | 4 +- eo/src/ga/make_continue_ga.cpp | 4 +- eo/src/ga/make_ga.h | 18 +- eo/src/ga/make_genotype_ga.cpp | 2 +- eo/src/ga/make_genotype_ga.h | 8 +- eo/src/ga/make_op.h | 18 +- eo/src/ga/make_op_ga.cpp | 2 +- eo/src/ga/make_pop_ga.cpp | 4 +- eo/src/ga/make_run_ga.cpp | 6 +- eo/src/gp/eoParseTree.h | 8 +- eo/src/gp/eoParseTreeDepthInit.h | 10 +- eo/src/gp/eoParseTreeOp.h | 6 +- eo/src/gp/eoStParseTreeDepthInit.h | 8 +- eo/src/gp/eoStParseTreeOp.h | 6 +- eo/src/mpi/eoMpi.h | 8 +- eo/src/mpi/eoMpiNode.cpp | 2 +- eo/src/mpi/eoMultiStart.h | 2 +- eo/src/mpi/eoParallelApply.h | 2 +- eo/src/mpi/eoTerminateJob.h | 6 +- eo/src/mpi/implMpi.cpp | 2 +- eo/src/mpi/implMpi.h | 8 +- eo/src/other/eoExternalEO.h | 2 +- eo/src/other/eoExternalOpFunctions.h | 8 +- eo/src/other/eoString.h | 3 +- eo/src/other/external_eo | 4 +- eo/src/pyeo/PyEO.cpp | 2 +- eo/src/pyeo/PyEO.h | 2 +- eo/src/pyeo/abstract1.cpp | 10 +- eo/src/pyeo/algos.cpp | 8 +- eo/src/pyeo/breeders.cpp | 6 +- eo/src/pyeo/continuators.cpp | 14 +- eo/src/pyeo/def_abstract_functor.h | 2 +- eo/src/pyeo/geneticOps.cpp | 10 +- eo/src/pyeo/mergers.cpp | 2 +- eo/src/pyeo/monitors.cpp | 4 +- eo/src/pyeo/perf2worth.cpp | 2 +- eo/src/pyeo/random_numbers.cpp | 2 +- eo/src/pyeo/reduce.cpp | 2 +- eo/src/pyeo/replacement.cpp | 10 +- eo/src/pyeo/selectOne.cpp | 12 +- eo/src/pyeo/selectors.cpp | 14 +- eo/src/pyeo/statistics.cpp | 2 +- eo/src/pyeo/valueParam.cpp | 2 +- eo/src/utils/checkpointing | 38 ++-- eo/src/utils/eoAssembledFitnessStat.h | 4 +- eo/src/utils/eoCheckPoint.h | 8 +- eo/src/utils/eoDistance.h | 2 +- eo/src/utils/eoFDCStat.h | 6 +- eo/src/utils/eoFileMonitor.cpp | 6 +- eo/src/utils/eoFileMonitor.h | 4 +- eo/src/utils/eoFileSnapshot.h | 6 +- eo/src/utils/eoFuncPtrStat.h | 4 +- eo/src/utils/eoGenCounter.h | 2 +- eo/src/utils/eoGnuplot1DMonitor.cpp | 4 +- eo/src/utils/eoGnuplot1DMonitor.h | 8 +- eo/src/utils/eoGnuplot1DSnapshot.h | 8 +- eo/src/utils/eoHowMany.h | 2 +- eo/src/utils/eoIntBounds.h | 2 +- eo/src/utils/eoLogger.h | 2 +- eo/src/utils/eoMOFitnessStat.h | 2 +- eo/src/utils/eoMonitor.h | 2 +- eo/src/utils/eoOStreamMonitor.cpp | 8 +- eo/src/utils/eoOStreamMonitor.h | 6 +- eo/src/utils/eoParallel.h | 2 +- eo/src/utils/eoParam.h | 2 +- eo/src/utils/eoParser.cpp | 6 +- eo/src/utils/eoParser.h | 6 +- eo/src/utils/eoPopStat.h | 2 +- eo/src/utils/eoRNG.h | 5 +- eo/src/utils/eoRealBounds.h | 2 +- eo/src/utils/eoRealVectorBounds.h | 4 +- eo/src/utils/eoRndGenerators.h | 2 +- eo/src/utils/eoScalarFitnessStat.h | 4 +- eo/src/utils/eoSignal.cpp | 2 +- eo/src/utils/eoSignal.h | 4 +- eo/src/utils/eoStat.h | 12 +- eo/src/utils/eoState.cpp | 4 +- eo/src/utils/eoState.h | 2 +- eo/src/utils/eoStdoutMonitor.h | 4 +- eo/src/utils/eoTimeCounter.h | 3 +- eo/src/utils/eoTimedMonitor.h | 4 +- eo/src/utils/eoTimer.h | 4 +- eo/src/utils/eoUniformInit.h | 2 +- eo/src/utils/eoUpdatable.h | 2 +- eo/src/utils/eoUpdater.cpp | 4 +- eo/src/utils/eoUpdater.h | 6 +- eo/src/utils/make_help.cpp | 2 +- eo/src/utils/selectors.h | 2 +- 284 files changed, 991 insertions(+), 984 deletions(-) diff --git a/eo/src/EO.h b/eo/src/EO.h index f904559d4..19708314f 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -28,8 +28,8 @@ //----------------------------------------------------------------------------- #include // std::runtime_error -#include // eoObject -#include // eoPersistent +#include "eoObject.h" // eoObject +#include "eoPersistent.h" // eoPersistent /** @defgroup Core Core components diff --git a/eo/src/PO.h b/eo/src/PO.h index 0c246135e..c4225cf61 100644 --- a/eo/src/PO.h +++ b/eo/src/PO.h @@ -27,7 +27,7 @@ //----------------------------------------------------------------------------- #include -#include +#include "EO.h" //----------------------------------------------------------------------------- /** PO inheriting from EO is specially designed for particle swarm optimization particle.POs have got a fitness, diff --git a/eo/src/apply.h b/eo/src/apply.h index 45c4cfc2d..71cf892fc 100644 --- a/eo/src/apply.h +++ b/eo/src/apply.h @@ -26,10 +26,10 @@ #ifndef _apply_h #define _apply_h -#include -#include -#include -#include +#include "utils/eoParallel.h" +#include "utils/eoParser.h" +#include "utils/eoLogger.h" +#include "eoFunctor.h" #include #ifdef _OPENMP diff --git a/eo/src/do/make_algo_easea.h b/eo/src/do/make_algo_easea.h index c432c1e82..3fadf05ec 100644 --- a/eo/src/do/make_algo_easea.h +++ b/eo/src/do/make_algo_easea.h @@ -27,35 +27,35 @@ #ifndef _make_algo_easea_h #define _make_algo_easea_h -#include // for eo_is_a_rate +#include "../utils/eoData.h" // for eo_is_a_rate // everything tha's needed for the algorithms - SCALAR fitness // Selection // the eoSelectOne's -#include -#include -#include -#include -#include -#include -#include +#include "../eoRandomSelect.h" +#include "../eoSequentialSelect.h" +#include "../eoDetTournamentSelect.h" +#include "../eoProportionalSelect.h" +#include "../eoFitnessScalingSelect.h" +#include "../eoRankingSelect.h" +#include "../eoStochTournamentSelect.h" // #include included in all others // Breeders -#include +#include "../eoGeneralBreeder.h" // Replacement #include "make_general_replacement.h" -#include "eoMGGReplacement.h" -#include "eoG3Replacement.h" +#include "../eoMGGReplacement.h" +#include "../eoG3Replacement.h" // Algorithm (only this one needed) -#include +#include "../eoEasyEA.h" // also need the parser and param includes -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /* * This function builds the algorithm (i.e. selection and replacement) diff --git a/eo/src/do/make_algo_scalar.h b/eo/src/do/make_algo_scalar.h index 52df8f4f4..92e16d2f2 100644 --- a/eo/src/do/make_algo_scalar.h +++ b/eo/src/do/make_algo_scalar.h @@ -27,39 +27,39 @@ #ifndef _make_algo_scalar_h #define _make_algo_scalar_h -#include // for eo_is_a_rate +#include "../utils/eoData.h" // for eo_is_a_rate // everything tha's needed for the algorithms - SCALAR fitness // Selection // the eoSelectOne's -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "../eoRandomSelect.h" +#include "../eoSequentialSelect.h" +#include "../eoDetTournamentSelect.h" +#include "../eoProportionalSelect.h" +#include "../eoFitnessScalingSelect.h" +#include "../eoRankingSelect.h" +#include "../eoStochTournamentSelect.h" +#include "../eoSharingSelect.h" +#include "../utils/eoDistance.h" // Breeders -#include +#include "../eoGeneralBreeder.h" // Replacement // #include -#include -#include -#include +#include "../eoMergeReduce.h" +#include "../eoReduceMerge.h" +#include "../eoSurviveAndDie.h" // distance -#include +#include "../utils/eoDistance.h" // Algorithm (only this one needed) -#include +#include "../eoEasyEA.h" // also need the parser and param includes -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /* diff --git a/eo/src/do/make_checkpoint.h b/eo/src/do/make_checkpoint.h index cc0746ddb..c06773480 100644 --- a/eo/src/do/make_checkpoint.h +++ b/eo/src/do/make_checkpoint.h @@ -33,11 +33,11 @@ #include -#include -#include // for minimizing_fitness() -#include -#include -#include +#include "../eoScalarFitness.h" +#include "../utils/selectors.h" // for minimizing_fitness() +#include "../EO.h" +#include "../eoEvalFuncCounter.h" +#include "../utils/checkpointing" // at the moment, in utils/make_help.cpp // this should become some eoUtils.cpp with corresponding eoUtils.h diff --git a/eo/src/do/make_checkpoint_FDC.h b/eo/src/do/make_checkpoint_FDC.h index f241667f7..601f94a12 100644 --- a/eo/src/do/make_checkpoint_FDC.h +++ b/eo/src/do/make_checkpoint_FDC.h @@ -29,11 +29,11 @@ #include -#include -#include // for minimizing_fitness() -#include -#include -#include +#include "../eoScalarFitness.h" +#include "../utils/selectors.h" // for minimizing_fitness() +#include "../EO.h" +#include "../eoEvalFuncCounter.h" +#include "../utils/checkpointing" // at the moment, in utils/make_help.cpp // this should become some eoUtils.cpp with corresponding eoUtils.h diff --git a/eo/src/do/make_checkpoint_assembled.h b/eo/src/do/make_checkpoint_assembled.h index 27d050ada..6b2bb5164 100644 --- a/eo/src/do/make_checkpoint_assembled.h +++ b/eo/src/do/make_checkpoint_assembled.h @@ -38,11 +38,11 @@ #include #include -#include -#include -#include -#include -#include +#include "../eoScalarFitnessAssembled.h" +#include "../utils/selectors.h" +#include "../EO.h" +#include "../eoEvalFuncCounter.h" +#include "../utils/checkpointing" // at the moment, in utils/make_help.cpp // this should become some eoUtils.cpp with corresponding eoUtils.h diff --git a/eo/src/do/make_continue.h b/eo/src/do/make_continue.h index 27b4e9450..f09bf8642 100644 --- a/eo/src/do/make_continue.h +++ b/eo/src/do/make_continue.h @@ -34,18 +34,18 @@ It can then be instantiated, and compiled on its own for a given EOType */ // Continuators - all include eoContinue.h -#include -#include -#include -#include -#include +#include "../eoCombinedContinue.h" +#include "../eoGenContinue.h" +#include "../eoSteadyFitContinue.h" +#include "../eoEvalContinue.h" +#include "../eoFitContinue.h" #ifndef _MSC_VER -#include // CtrlC handling (using 2 global variables!) +#include "../eoCtrlCContinue.h" // CtrlC handling (using 2 global variables!) #endif // also need the parser and param includes -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /////////////////// the stopping criterion //////////////// diff --git a/eo/src/do/make_general_replacement.h b/eo/src/do/make_general_replacement.h index 1d42345c8..52c54ff6f 100644 --- a/eo/src/do/make_general_replacement.h +++ b/eo/src/do/make_general_replacement.h @@ -27,14 +27,14 @@ #ifndef _make_general_replacement_h #define _make_general_replacement_h -#include // for eo_is_a_rate +#include "../utils/eoData.h" // for eo_is_a_rate // Replacement -#include +#include "../eoReduceMergeReduce.h" // also need the parser and param includes -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /** a helper function that decodes a parameter read by the parser into an diff --git a/eo/src/do/make_pop.h b/eo/src/do/make_pop.h index c2a1d1a84..516d7a770 100644 --- a/eo/src/do/make_pop.h +++ b/eo/src/do/make_pop.h @@ -28,11 +28,11 @@ #define _make_pop_h #include // for time(0) for random seeding -#include -#include -#include -#include -#include +#include "../eoPop.h" +#include "../eoInit.h" +#include "../utils/eoRNG.h" +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /** @defgroup Builders Automatic builders * diff --git a/eo/src/do/make_run.h b/eo/src/do/make_run.h index 485cb8700..e53831f80 100644 --- a/eo/src/do/make_run.h +++ b/eo/src/do/make_run.h @@ -28,7 +28,7 @@ #define _make_run_h // Algorithm (only this one needed) -#include +#include "../eoAlgo.h" /* * A trivial function - only here to allow instanciation with a give EOType diff --git a/eo/src/eo b/eo/src/eo index 8196e2b14..39109bdb6 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -33,118 +33,120 @@ #endif // general purpose -#include -#include -#include -#include -#include -#include -#include +#include "utils/eoData.h" +#include "eoObject.h" +#include "eoPrintable.h" +#include "eoPersistent.h" +#include "eoScalarFitness.h" +#include "eoDualFitness.h" +#include "EO.h" -#include -#include -#include +#include "utils/rnd_generators.h" +#include "eoFunctor.h" +#include "apply.h" // eo's -#include +#include "eoVector.h" -#include +#include "other/eoString.h" -#include -#include -#include +#include "utils/eoRndGenerators.h" +#include "eoInit.h" +#include "utils/eoUniformInit.h" // the variation operators -#include -#include -#include -#include +#include "eoOp.h" +#include "eoGenOp.h" +#include "eoCloneOps.h" +#include "eoOpContainer.h" // combinations of simple eoOps (eoMonOp and eoQuadOp) -#include +#include "eoProportionalCombinedOp.h" // didactic (mimics SGA-like variation into an eoGenOp) // calls crossover and mutation sequentially, // with their respective mutation rates -#include +#include "eoSGAGenOp.h" // its dual: crossover, mutation (and copy) - proportional choice // w.r.t. given relative weights -#include +#include "eoPropGAGenOp.h" // population -#include +#include "eoPop.h" // Evaluation functions (all include eoEvalFunc.h) -#include -#include -#include -#include -#include +#include "eoPopEvalFunc.h" +#include "eoEvalFuncPtr.h" +#include "eoEvalCounterThrowException.h" +#include "eoEvalTimeThrowException.h" +#include "eoEvalUserTimeThrowException.h" // Continuators - all include eoContinue.h -#include -#include -#include -#include -#include -#include -#include // added th T.Legrand +#include "eoCombinedContinue.h" +#include "eoGenContinue.h" +#include "eoSteadyFitContinue.h" +#include "eoEvalContinue.h" +#include "eoFitContinue.h" +#include "eoPeriodicContinue.h" +#include "eoTimeContinue.h" // added th T.Legrand #ifndef _MSC_VER -#include // CtrlC handling (using 2 global variables!) +#include "eoCtrlCContinue.h" // CtrlC handling (using 2 global variables!) #endif + // Selection // the eoSelectOne's -#include -#include -#include -#include -#include // also contains eoLinearFitScaling.h -#include -#include -#include +#include "eoRandomSelect.h" +#include "eoSequentialSelect.h" +#include "eoDetTournamentSelect.h" +#include "eoProportionalSelect.h" +#include "eoFitnessScalingSelect.h" // also contains eoLinearFitScaling.h +#include "eoRankingSelect.h" +#include "eoStochTournamentSelect.h" +#include "eoSharingSelect.h" + // Embedding truncation selection -#include +#include "eoTruncatedSelectOne.h" // the batch selection - from an eoSelectOne -#include -#include -#include -#include +#include "eoSelectPerc.h" +#include "eoSelectNumber.h" +#include "eoSelectMany.h" +#include "eoTruncatedSelectMany.h" // other batch selections // DetSelect can also be obtained as eoSequentialSelect, an eoSelectOne // (using setup and an index) -#include -#include +#include "eoDetSelect.h" +#include "eoRankMuSelect.h" // Breeders -#include // applies one eoGenOp, stop on offspring count -// #include // parent + SINGLE offspring compete (e.g. DE) - not ready yet... +#include "eoGeneralBreeder.h" // applies one eoGenOp, stop on offspring count +// #include "eoOneToOneBreeder.h" // parent + SINGLE offspring compete (e.g. DE) - not ready yet... // Replacement -// #include -#include -#include -#include +// #include "eoReplacement.h" +#include "eoMergeReduce.h" +#include "eoReduceMerge.h" +#include "eoSurviveAndDie.h" // a simple transformer -#include +#include "eoSGATransform.h" // Perf2Worth stuff - includes eoSelectFromWorth.h -#include +#include "eoNDSorting.h" // Algorithms -#include -#include -// #include removed for a while - until eoGenOp is done +#include "eoEasyEA.h" +#include "eoSGA.h" +// #include "eoEvolutionStrategy.h" removed for a while - until eoGenOp is done // Utils -#include -#include // includes eoRealBounds.h -#include // no eoIntVectorBounds +#include "utils/checkpointing" +#include "utils/eoRealVectorBounds.h" // includes eoRealBounds.h +#include "utils/eoIntBounds.h" // no eoIntVectorBounds // aliens -#include -#include +#include "other/external_eo" +#include "eoCounter.h" //----------------------------------------------------------------------------- @@ -154,54 +156,54 @@ /*** Particle Swarm Optimization stuff ***/ // basic particle definitions -#include -#include -#include -#include +#include "PO.h" +#include "eoVectorParticle.h" +#include "eoBitParticle.h" +#include "eoRealParticle.h" // initialization -#include -#include +#include "eoParticleBestInit.h" +#include "eoInitializer.h" // velocities -#include -#include -#include -#include -#include -#include -#include -#include +#include "eoVelocity.h" +#include "eoStandardVelocity.h" +#include "eoExtendedVelocity.h" +#include "eoIntegerVelocity.h" +#include "eoConstrictedVelocity.h" +#include "eoFixedInertiaWeightedVelocity.h" +#include "eoVariableInertiaWeightedVelocity.h" +#include "eoConstrictedVariableWeightVelocity.h" // flights -#include -#include -#include -#include -#include +#include "eoFlight.h" +#include "eoStandardFlight.h" +#include "eoVelocityInit.h" +#include "eoBinaryFlight.h" +#include "eoSigBinaryFlight.h" // topologies -#include -#include -#include -#include -#include -#include +#include "eoTopology.h" +#include "eoStarTopology.h" +#include "eoLinearTopology.h" +#include "eoRingTopology.h" +#include "eoNeighborhood.h" +#include "eoSocialNeighborhood.h" // PS algorithms -#include -#include -#include +#include "eoPSO.h" +#include "eoEasyPSO.h" +#include "eoSyncEasyPSO.h" // utils -#include -#include -#include -#include -#include +#include "eoRealBoundModifier.h" +#include "eoRandomRealWeightUp.h" +#include "eoWeightUpdater.h" +#include "eoLinearDecreasingWeightUp.h" +#include "eoGaussRealWeightUp.h" -#include -#include +#include "utils/eoLogger.h" +#include "utils/eoParallel.h" #endif diff --git a/eo/src/eoAlgo.h b/eo/src/eoAlgo.h index 494b7b76c..b19b7a0e6 100644 --- a/eo/src/eoAlgo.h +++ b/eo/src/eoAlgo.h @@ -25,8 +25,8 @@ #ifndef _EOALGO_H #define _EOALGO_H -#include // for population -#include +#include "eoPop.h" // for population +#include "eoFunctor.h" /** @defgroup Algorithms Algorithms diff --git a/eo/src/eoBinaryFlight.h b/eo/src/eoBinaryFlight.h index 9672bd3f3..34517c553 100644 --- a/eo/src/eoBinaryFlight.h +++ b/eo/src/eoBinaryFlight.h @@ -26,7 +26,7 @@ #define EOBINARYFLIGHT_H //----------------------------------------------------------------------------- -#include +#include "eoFlight.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoBitParticle.h b/eo/src/eoBitParticle.h index 87f98aa1b..9d03ef0cb 100644 --- a/eo/src/eoBitParticle.h +++ b/eo/src/eoBitParticle.h @@ -26,7 +26,7 @@ #define _EOBITPARTICLE_H -#include +#include "eoVectorParticle.h" /** eoBitParticle: Implementation of a bit-coded particle (swarm optimization). diff --git a/eo/src/eoBreed.h b/eo/src/eoBreed.h index 0b00ec584..fd8448543 100644 --- a/eo/src/eoBreed.h +++ b/eo/src/eoBreed.h @@ -27,10 +27,10 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include +#include "eoPop.h" +#include "eoFunctor.h" +#include "eoSelect.h" +#include "eoTransform.h" //----------------------------------------------------------------------------- /** Breeding: combination of selecting and transforming a population diff --git a/eo/src/eoCellularEasyEA.h b/eo/src/eoCellularEasyEA.h index fbf3085fc..37e4ec009 100644 --- a/eo/src/eoCellularEasyEA.h +++ b/eo/src/eoCellularEasyEA.h @@ -24,12 +24,12 @@ #ifndef eoCellularEasyEA_h #define eoCellularEasyEA_h -#include -#include -#include -#include -#include -#include +#include "eoContinue.h" +#include "eoEvalFunc.h" +#include "eoSelectOne.h" +#include "eoPopEvalFunc.h" +#include "eoAlgo.h" +#include "eoOp.h" /** The abstract cellular easy algorithm. diff --git a/eo/src/eoCloneOps.h b/eo/src/eoCloneOps.h index e53cbd749..2093fd632 100644 --- a/eo/src/eoCloneOps.h +++ b/eo/src/eoCloneOps.h @@ -25,7 +25,7 @@ #ifndef _eoCloneOps_H #define _eoCloneOps_H -#include +#include "eoOp.h" /** * The different null-variation operators (i.e. they do nothing) diff --git a/eo/src/eoCombinedContinue.h b/eo/src/eoCombinedContinue.h index 5162ffaa9..96878b4ea 100644 --- a/eo/src/eoCombinedContinue.h +++ b/eo/src/eoCombinedContinue.h @@ -22,15 +22,15 @@ Authors : todos@geneura.ugr.es Marc Schoenauer - Ramón Casero Cañas - Johann Dréo + Ram�n Casero Ca�as + Johann Dr�o */ //----------------------------------------------------------------------------- #ifndef _eoCombinedContinue_h #define _eoCombinedContinue_h -#include +#include "eoContinue.h" /** Combined continuators - logical AND: @@ -40,7 +40,7 @@ Authors : to be consistent with other Combined constructs and allow to easily handle more than 2 continuators -02/2003 Ramón Casero Cañas - added the removeLast() method +02/2003 Ram�n Casero Ca�as - added the removeLast() method @ingroup Combination */ diff --git a/eo/src/eoCombinedInit.h b/eo/src/eoCombinedInit.h index cc93620d3..98bc05d12 100644 --- a/eo/src/eoCombinedInit.h +++ b/eo/src/eoCombinedInit.h @@ -25,7 +25,7 @@ #ifndef _eoCombinedInit_h #define _eoCombinedInit_h -#include +#include "eoInit.h" /** Combined INIT: a proportional recombination of eoInit objects diff --git a/eo/src/eoConstrictedVariableWeightVelocity.h b/eo/src/eoConstrictedVariableWeightVelocity.h index 9e96d7ef3..cff14bc44 100644 --- a/eo/src/eoConstrictedVariableWeightVelocity.h +++ b/eo/src/eoConstrictedVariableWeightVelocity.h @@ -26,11 +26,11 @@ #define EOCONSTRICTEDVARIABLEWEIGHTVELOCITY_H //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include +#include "eoVelocity.h" +#include "eoTopology.h" +#include "eoWeightUpdater.h" +#include "utils/eoRealVectorBounds.h" +#include "eoRealBoundModifier.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoConstrictedVelocity.h b/eo/src/eoConstrictedVelocity.h index 45f6e03d6..2e13bc1ef 100644 --- a/eo/src/eoConstrictedVelocity.h +++ b/eo/src/eoConstrictedVelocity.h @@ -27,11 +27,11 @@ #define EOCONSTRICTEDVELOCITY_H //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include +#include "eoFunctor.h" +#include "utils/eoRNG.h" +#include "eoPop.h" +#include "utils/eoRealVectorBounds.h" +#include "eoTopology.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoContinue.h b/eo/src/eoContinue.h index 82544115b..429ea58b7 100644 --- a/eo/src/eoContinue.h +++ b/eo/src/eoContinue.h @@ -25,9 +25,9 @@ #ifndef _eoContinue_h #define _eoContinue_h -#include -#include -#include +#include "eoFunctor.h" +#include "eoPop.h" +#include "eoPersistent.h" /** @defgroup Continuators Stopping criteria * diff --git a/eo/src/eoCounter.h b/eo/src/eoCounter.h index afd7fd2ee..d2f0f90d3 100644 --- a/eo/src/eoCounter.h +++ b/eo/src/eoCounter.h @@ -26,9 +26,9 @@ #ifndef _eoCounter_h #define _eoCounter_h -#include -#include -#include +#include "eoFunctor.h" +#include "eoFunctorStore.h" +#include "utils/eoParam.h" /** Generic counter class that counts the number of times diff --git a/eo/src/eoCtrlCContinue.cpp b/eo/src/eoCtrlCContinue.cpp index b7ee7fea3..8d2c32de2 100644 --- a/eo/src/eoCtrlCContinue.cpp +++ b/eo/src/eoCtrlCContinue.cpp @@ -28,7 +28,7 @@ #pragma warning(disable:4786) #endif -#include +#include "utils/eoLogger.h" #include #include diff --git a/eo/src/eoCtrlCContinue.h b/eo/src/eoCtrlCContinue.h index e239f7367..37b665a10 100644 --- a/eo/src/eoCtrlCContinue.h +++ b/eo/src/eoCtrlCContinue.h @@ -31,7 +31,7 @@ #define eoCtrlCContinue_h #include -#include +#include "eoContinue.h" /** * @addtogroup Continuators diff --git a/eo/src/eoDetSelect.h b/eo/src/eoDetSelect.h index c89f41f69..dce958a46 100644 --- a/eo/src/eoDetSelect.h +++ b/eo/src/eoDetSelect.h @@ -29,8 +29,8 @@ //----------------------------------------------------------------------------- -#include -#include +#include "eoSelect.h" +#include "utils/eoHowMany.h" #include //----------------------------------------------------------------------------- diff --git a/eo/src/eoDetTournamentSelect.h b/eo/src/eoDetTournamentSelect.h index c7ecf8b16..8026f7a9b 100644 --- a/eo/src/eoDetTournamentSelect.h +++ b/eo/src/eoDetTournamentSelect.h @@ -31,10 +31,10 @@ #include // #include // accumulate -#include -#include -#include -#include +#include "eoFunctor.h" +#include "eoPop.h" +#include "utils/eoLogger.h" +#include "utils/selectors.h" /** eoDetTournamentSelect: a selection method that selects ONE individual by deterministic tournament diff --git a/eo/src/eoDistribUpdater.h b/eo/src/eoDistribUpdater.h index 79b22814a..05a52c67f 100644 --- a/eo/src/eoDistribUpdater.h +++ b/eo/src/eoDistribUpdater.h @@ -28,8 +28,8 @@ #include -#include -#include +#include "eoDistribution.h" +#include "eoPop.h" /** * Base class for Distribution Evolution Algorithms within EO: diff --git a/eo/src/eoDistribution.h b/eo/src/eoDistribution.h index 6ca90fe42..1f02fe1bb 100644 --- a/eo/src/eoDistribution.h +++ b/eo/src/eoDistribution.h @@ -28,8 +28,8 @@ #include -#include -#include +#include "eoInit.h" +#include "eoPop.h" /** * Abstract class for Distribution Evolution Algorithms within EO: diff --git a/eo/src/eoDualFitness.h b/eo/src/eoDualFitness.h index 44839ed67..7fdf402d3 100644 --- a/eo/src/eoDualFitness.h +++ b/eo/src/eoDualFitness.h @@ -31,8 +31,8 @@ Authors: #include // for std::pair #include -#include -#include +#include "utils/eoStat.h" +#include "utils/eoLogger.h" /** @addtogroup Evaluation * @{ diff --git a/eo/src/eoEDA.h b/eo/src/eoEDA.h index 553b751f3..8d8a3992b 100644 --- a/eo/src/eoEDA.h +++ b/eo/src/eoEDA.h @@ -28,7 +28,7 @@ //----------------------------------------------------------------------------- -#include +#include "eoDistribution.h" /** The abstract class for estimation of disribution algorithms. * This design evolve a probability distribution diff --git a/eo/src/eoEasyEA.h b/eo/src/eoEasyEA.h index f5fc534a2..d3fd2825a 100644 --- a/eo/src/eoEasyEA.h +++ b/eo/src/eoEasyEA.h @@ -27,15 +27,15 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "apply.h" +#include "eoAlgo.h" +#include "eoPopEvalFunc.h" +#include "eoContinue.h" +#include "eoSelect.h" +#include "eoTransform.h" +#include "eoBreed.h" +#include "eoMergeReduce.h" +#include "eoReplacement.h" diff --git a/eo/src/eoEasyPSO.h b/eo/src/eoEasyPSO.h index da071bc02..3e9997e3a 100644 --- a/eo/src/eoEasyPSO.h +++ b/eo/src/eoEasyPSO.h @@ -26,10 +26,10 @@ #define _EOEASYPSO_H //----------------------------------------------------------------------------- -#include -#include -#include -#include +#include "eoContinue.h" +#include "eoPSO.h" +#include "eoVelocity.h" +#include "eoFlight.h" //----------------------------------------------------------------------------- /** An easy-to-use particle swarm algorithm. diff --git a/eo/src/eoEvalContinue.h b/eo/src/eoEvalContinue.h index ef74e0758..1933be7b7 100644 --- a/eo/src/eoEvalContinue.h +++ b/eo/src/eoEvalContinue.h @@ -26,8 +26,8 @@ #ifndef _eoEvalContinue_h #define _eoEvalContinue_h -#include -#include +#include "eoContinue.h" +#include "eoEvalFuncCounter.h" /** * Continues until a number of evaluations has been made diff --git a/eo/src/eoEvalCounterThrowException.h b/eo/src/eoEvalCounterThrowException.h index 4eb4fccc4..8b38908e4 100644 --- a/eo/src/eoEvalCounterThrowException.h +++ b/eo/src/eoEvalCounterThrowException.h @@ -26,9 +26,9 @@ Caner Candan #ifndef __eoEvalCounterThrowException_h__ #define __eoEvalCounterThrowException_h__ -#include -#include -#include +#include "eoEvalFuncCounter.h" +#include "utils/eoParam.h" +#include "eoExceptions.h" /*! Wrap an evaluation function so that an exception may be thrown when the diff --git a/eo/src/eoEvalDump.h b/eo/src/eoEvalDump.h index 78630bee7..a5ad8e3fb 100644 --- a/eo/src/eoEvalDump.h +++ b/eo/src/eoEvalDump.h @@ -25,7 +25,7 @@ #include -#include +#include "eoEvalFunc.h" /** Dump an evaluated individual to a given file. diff --git a/eo/src/eoEvalFunc.h b/eo/src/eoEvalFunc.h index b05b667b2..301cdb509 100644 --- a/eo/src/eoEvalFunc.h +++ b/eo/src/eoEvalFunc.h @@ -25,7 +25,7 @@ #ifndef eoEvalFunc_H #define eoEvalFunc_H -#include +#include "eoFunctor.h" /** @defgroup Evaluation Evaluation * @ingroup Operators diff --git a/eo/src/eoEvalFuncCounter.h b/eo/src/eoEvalFuncCounter.h index a63821d61..0641250fa 100644 --- a/eo/src/eoEvalFuncCounter.h +++ b/eo/src/eoEvalFuncCounter.h @@ -27,8 +27,8 @@ #ifndef eoEvalFuncCounter_H #define eoEvalFuncCounter_H -#include -#include +#include "eoEvalFunc.h" +#include "utils/eoParam.h" /** Counts the number of evaluations actually performed. diff --git a/eo/src/eoEvalFuncCounterBounder.h b/eo/src/eoEvalFuncCounterBounder.h index 7114e7f37..30ac03473 100644 --- a/eo/src/eoEvalFuncCounterBounder.h +++ b/eo/src/eoEvalFuncCounterBounder.h @@ -1,8 +1,8 @@ #ifndef eoEvalFuncCounterBounder_H #define eoEvalFuncCounterBounder_H -#include -#include +#include "eoEvalFunc.h" +#include "utils/eoParam.h" /** @addtogroup Evaluation * @{ diff --git a/eo/src/eoEvalFuncPtr.h b/eo/src/eoEvalFuncPtr.h index f4952c212..b0f8b01e1 100644 --- a/eo/src/eoEvalFuncPtr.h +++ b/eo/src/eoEvalFuncPtr.h @@ -28,7 +28,7 @@ #ifndef EOEVALFUNCPTR_H #define EOEVALFUNCPTR_H -#include +#include "eoEvalFunc.h" /** EOEvalFuncPtr: This class * takes an existing function pointer and converts it into a evaluation diff --git a/eo/src/eoEvalKeepBest.h b/eo/src/eoEvalKeepBest.h index 12a9a978f..133e01b87 100644 --- a/eo/src/eoEvalKeepBest.h +++ b/eo/src/eoEvalKeepBest.h @@ -25,8 +25,8 @@ #include -#include -#include +#include "eoEvalFunc.h" +#include "utils/eoParam.h" /** Evaluate with the given evaluator and keep the best individual found so far. diff --git a/eo/src/eoEvalTimeThrowException.h b/eo/src/eoEvalTimeThrowException.h index be0e149a2..3cff76512 100644 --- a/eo/src/eoEvalTimeThrowException.h +++ b/eo/src/eoEvalTimeThrowException.h @@ -23,7 +23,7 @@ Johann Dréo #include -#include +#include "eoExceptions.h" /** Check at each evaluation if a given tie contract has been reached. * diff --git a/eo/src/eoEvalUserTimeThrowException.h b/eo/src/eoEvalUserTimeThrowException.h index 2d9ccadd6..1e2edda6f 100644 --- a/eo/src/eoEvalUserTimeThrowException.h +++ b/eo/src/eoEvalUserTimeThrowException.h @@ -38,7 +38,7 @@ Johann Dréo * @ingroup Evaluation */ -#include +#include "eoExceptions.h" #ifdef __unix__ diff --git a/eo/src/eoExceptions.h b/eo/src/eoExceptions.h index 4d56ddb95..56b5fbfd8 100644 --- a/eo/src/eoExceptions.h +++ b/eo/src/eoExceptions.h @@ -26,6 +26,7 @@ Johann Dréo #include #include +#include class eoMaxException : public std::exception {}; diff --git a/eo/src/eoExtendedVelocity.h b/eo/src/eoExtendedVelocity.h index e7667204c..bcbd51c3a 100644 --- a/eo/src/eoExtendedVelocity.h +++ b/eo/src/eoExtendedVelocity.h @@ -26,12 +26,12 @@ #define eoExtendedVelocity_H //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include +#include "eoFunctor.h" +#include "utils/eoRNG.h" +#include "eoPop.h" +#include "utils/eoRealVectorBounds.h" +#include "eoRealBoundModifier.h" +#include "eoTopology.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoFactory.h b/eo/src/eoFactory.h index 73a8faf1b..51cbc678b 100644 --- a/eo/src/eoFactory.h +++ b/eo/src/eoFactory.h @@ -26,12 +26,12 @@ #define _EOFACTORY_H //----------------------------------------------------------------------------- -#include +#include "eoObject.h" //----------------------------------------------------------------------------- /** EO Factory. A factory is used to create other objects. In particular, -it can be used so that objects of that kind can´t be created in any other +it can be used so that objects of that kind can�t be created in any other way. It should be instantiated with anything that needs a factory, like selectors or whatever; but the instance class should be the parent class from which all the object that are going to be created descend. This class basically defines an interface, diff --git a/eo/src/eoFitContinue.h b/eo/src/eoFitContinue.h index 2db88f80b..9725008ed 100644 --- a/eo/src/eoFitContinue.h +++ b/eo/src/eoFitContinue.h @@ -25,8 +25,8 @@ #ifndef _eoFitContinue_h #define _eoFitContinue_h -#include -#include +#include "eoContinue.h" +#include "utils/eoLogger.h" /** Continues until the optimum fitness level is reached. diff --git a/eo/src/eoFitnessScalingSelect.h b/eo/src/eoFitnessScalingSelect.h index c17532019..f4216c20f 100644 --- a/eo/src/eoFitnessScalingSelect.h +++ b/eo/src/eoFitnessScalingSelect.h @@ -29,8 +29,8 @@ //----------------------------------------------------------------------------- -#include -#include +#include "eoSelectFromWorth.h" +#include "eoLinearFitScaling.h" /** eoFitnessScalingSelect: select an individual proportional to the * linearly scaled fitness that is computed by the private diff --git a/eo/src/eoFixedInertiaWeightedVelocity.h b/eo/src/eoFixedInertiaWeightedVelocity.h index 291c85a09..996845c01 100644 --- a/eo/src/eoFixedInertiaWeightedVelocity.h +++ b/eo/src/eoFixedInertiaWeightedVelocity.h @@ -26,11 +26,11 @@ #define EOFIXEDINERTIAWEIGHTEDVELOCITY_H //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include +#include "eoFunctor.h" +#include "utils/eoRNG.h" +#include "eoPop.h" +#include "utils/eoRealVectorBounds.h" +#include "eoTopology.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoFlOrBinOp.h b/eo/src/eoFlOrBinOp.h index bcdc9c5c1..343b2c738 100644 --- a/eo/src/eoFlOrBinOp.h +++ b/eo/src/eoFlOrBinOp.h @@ -26,8 +26,8 @@ #ifndef _eoFlOrBinOp_h #define _eoFlOrBinOp_h -#include -#include +#include "eoFunctor.h" +#include "eoOp.h" /** @addtogroup Variators * @{ diff --git a/eo/src/eoFlOrMonOp.h b/eo/src/eoFlOrMonOp.h index 63dae9cba..8ef903b1f 100644 --- a/eo/src/eoFlOrMonOp.h +++ b/eo/src/eoFlOrMonOp.h @@ -26,9 +26,9 @@ #ifndef _eoFlOrMonOp_h #define _eoFlOrMonOp_h -#include -#include -#include +#include "eoFunctor.h" +#include "eoOp.h" +#include "eoInit.h" /** @addtogroup Variators * @{ diff --git a/eo/src/eoFlOrQuadOp.h b/eo/src/eoFlOrQuadOp.h index 91618aa53..1c0c805fd 100644 --- a/eo/src/eoFlOrQuadOp.h +++ b/eo/src/eoFlOrQuadOp.h @@ -26,8 +26,8 @@ #ifndef _eoFlOrQuadOp_h #define _eoFlOrQuadOp_h -#include -#include +#include "eoFunctor.h" +#include "eoOp.h" /** @addtogroup Variators * @{ diff --git a/eo/src/eoFlight.h b/eo/src/eoFlight.h index 4c46d8e94..83f7d6e5f 100644 --- a/eo/src/eoFlight.h +++ b/eo/src/eoFlight.h @@ -26,8 +26,8 @@ #define EOFLIGHT_H //----------------------------------------------------------------------------- -#include -#include +#include "eoFunctor.h" +#include "utils/eoRealVectorBounds.h" //----------------------------------------------------------------------------- /** Abstract class for particle swarm optimization flight. diff --git a/eo/src/eoFunctorStore.cpp b/eo/src/eoFunctorStore.cpp index 43cd778cd..fe3137ada 100644 --- a/eo/src/eoFunctorStore.cpp +++ b/eo/src/eoFunctorStore.cpp @@ -5,8 +5,8 @@ #include -#include -#include +#include "eoFunctorStore.h" +#include "eoFunctor.h" /// clears the memory diff --git a/eo/src/eoFunctorStore.h b/eo/src/eoFunctorStore.h index 051daf2ae..ffcbe90d7 100644 --- a/eo/src/eoFunctorStore.h +++ b/eo/src/eoFunctorStore.h @@ -28,7 +28,7 @@ #define _eoFunctorStore_h #include -#include +#include #include "utils/eoLogger.h" diff --git a/eo/src/eoG3Replacement.h b/eo/src/eoG3Replacement.h index a235244f8..c7cf20178 100644 --- a/eo/src/eoG3Replacement.h +++ b/eo/src/eoG3Replacement.h @@ -28,12 +28,12 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include +#include "eoPop.h" +#include "eoFunctor.h" +#include "eoMerge.h" +#include "eoReduce.h" +#include "utils/eoHowMany.h" +#include "eoReduceSplit.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoGaussRealWeightUp.h b/eo/src/eoGaussRealWeightUp.h index 47edc321b..28affcad5 100644 --- a/eo/src/eoGaussRealWeightUp.h +++ b/eo/src/eoGaussRealWeightUp.h @@ -26,8 +26,8 @@ #define EOGAUSSREALWEIGHTUP_H //----------------------------------------------------------------------------- -#include -#include +#include "eoWeightUpdater.h" +#include "utils/eoRNG.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoGenContinue.h b/eo/src/eoGenContinue.h index dc756795d..bfe68c60d 100644 --- a/eo/src/eoGenContinue.h +++ b/eo/src/eoGenContinue.h @@ -25,9 +25,9 @@ #ifndef _eoGenContinue_h #define _eoGenContinue_h -#include -#include -#include +#include "eoContinue.h" +#include "utils/eoParam.h" +#include "utils/eoLogger.h" /** Generational continuator: continues until a number of generations is reached diff --git a/eo/src/eoGenOp.h b/eo/src/eoGenOp.h index f0d70c7ba..deb5c27bd 100644 --- a/eo/src/eoGenOp.h +++ b/eo/src/eoGenOp.h @@ -26,9 +26,9 @@ #ifndef _eoGenOp_H #define _eoGenOp_H -#include -#include -#include +#include "eoOp.h" +#include "eoPopulator.h" +#include "eoFunctorStore.h" #include /** @name General variation operators diff --git a/eo/src/eoGeneralBreeder.h b/eo/src/eoGeneralBreeder.h index dc598ba7e..1fdbd5c40 100644 --- a/eo/src/eoGeneralBreeder.h +++ b/eo/src/eoGeneralBreeder.h @@ -32,12 +32,12 @@ * eoGeneralBreeder: transforms a population using the generalOp construct. *****************************************************************************/ -#include -#include -#include -#include -#include -#include +#include "eoOp.h" +#include "eoGenOp.h" +#include "eoPopulator.h" +#include "eoSelectOne.h" +#include "eoBreed.h" +#include "utils/eoHowMany.h" /** Base class for breeders using generalized operators. diff --git a/eo/src/eoInit.h b/eo/src/eoInit.h index 7b460d94b..9230f4b64 100644 --- a/eo/src/eoInit.h +++ b/eo/src/eoInit.h @@ -29,10 +29,10 @@ #include -#include -#include -#include -#include // for shuffle method +#include "eoOp.h" +#include "eoSTLFunctor.h" +#include "utils/eoRndGenerators.h" +#include "utils/rnd_generators.h" // for shuffle method /** diff --git a/eo/src/eoInitializer.h b/eo/src/eoInitializer.h index 9e5cd5caf..3349768b2 100644 --- a/eo/src/eoInitializer.h +++ b/eo/src/eoInitializer.h @@ -27,11 +27,11 @@ #ifndef _eoInitializer_H #define _eoInitializer_H -#include -#include -#include -#include -#include +#include "utils/eoRealVectorBounds.h" +#include "eoVelocityInit.h" +#include "eoPop.h" +#include "eoParticleBestInit.h" +#include "eoTopology.h" /** @addtogroup Initializators diff --git a/eo/src/eoInt.h b/eo/src/eoInt.h index 41c877247..8dc318e2c 100644 --- a/eo/src/eoInt.h +++ b/eo/src/eoInt.h @@ -29,7 +29,7 @@ #include // std::ostream, std::istream #include // std::string -#include +#include "eoVector.h" /** eoInt: implementation of simple integer-valued chromosome. * based on eoVector class diff --git a/eo/src/eoIntegerVelocity.h b/eo/src/eoIntegerVelocity.h index b00b17bf3..2ff8108a4 100644 --- a/eo/src/eoIntegerVelocity.h +++ b/eo/src/eoIntegerVelocity.h @@ -27,12 +27,12 @@ #define EOINTEGERVELOCITY_H //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include +#include "eoFunctor.h" +#include "utils/eoRNG.h" +#include "eoPop.h" +#include "utils/eoRealVectorBounds.h" +#include "eoRealBoundModifier.h" +#include "eoTopology.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoInvalidateOps.h b/eo/src/eoInvalidateOps.h index 97dd39f55..d4a558182 100644 --- a/eo/src/eoInvalidateOps.h +++ b/eo/src/eoInvalidateOps.h @@ -27,7 +27,7 @@ #ifndef _eoInvalidateOps_h #define _eoInvalidateOps_h -#include +#include "eoOp.h" /** @addtogroup Utilities diff --git a/eo/src/eoInvertedContinue.h b/eo/src/eoInvertedContinue.h index 0f677cc08..9b723a5ec 100644 --- a/eo/src/eoInvertedContinue.h +++ b/eo/src/eoInvertedContinue.h @@ -30,7 +30,7 @@ Contact: paradiseo-help@lists.gforge.inria.fr #ifndef _eoInvertedContinue_h #define _eoInvertedContinue_h -#include +#include "eoContinue.h" /** * Return the opposite of the wrapped continuator diff --git a/eo/src/eoLinearDecreasingWeightUp.h b/eo/src/eoLinearDecreasingWeightUp.h index 87f489423..e6a1b315b 100644 --- a/eo/src/eoLinearDecreasingWeightUp.h +++ b/eo/src/eoLinearDecreasingWeightUp.h @@ -26,7 +26,7 @@ #define EOLINEARDECREASINGWEIGHTUP_H //----------------------------------------------------------------------------- -#include +#include "eoWeightUpdater.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoLinearFitScaling.h b/eo/src/eoLinearFitScaling.h index 75598c934..269518f05 100644 --- a/eo/src/eoLinearFitScaling.h +++ b/eo/src/eoLinearFitScaling.h @@ -27,8 +27,8 @@ #ifndef eoLinearFitScaling_h #define eoLinearFitScaling_h -#include -#include +#include "eoSelectFromWorth.h" +#include "eoPerf2Worth.h" /** An instance of eoPerf2Worth * COmputes the linearly scaled fitnesses diff --git a/eo/src/eoLinearTopology.h b/eo/src/eoLinearTopology.h index 813e99b93..027be1871 100644 --- a/eo/src/eoLinearTopology.h +++ b/eo/src/eoLinearTopology.h @@ -27,9 +27,9 @@ #define EOLINEARTOPOLOGY_H_ //----------------------------------------------------------------------------- -#include -#include -#include +#include "eoPop.h" +#include "eoTopology.h" +#include "eoSocialNeighborhood.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoMGGReplacement.h b/eo/src/eoMGGReplacement.h index e2eebbfa5..1e4c40f2d 100644 --- a/eo/src/eoMGGReplacement.h +++ b/eo/src/eoMGGReplacement.h @@ -28,12 +28,12 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include +#include "eoPop.h" +#include "eoFunctor.h" +#include "eoMerge.h" +#include "eoReduce.h" +#include "utils/eoHowMany.h" +#include "eoReduceSplit.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoMerge.h b/eo/src/eoMerge.h index 31da70f08..5870849cf 100644 --- a/eo/src/eoMerge.h +++ b/eo/src/eoMerge.h @@ -31,9 +31,9 @@ #include // EO includes -#include // eoPop -#include // eoMerge -#include +#include "eoPop.h" // eoPop +#include "eoFunctor.h" // eoMerge +#include "utils/eoLogger.h" /** * eoMerge: Base class for elitist replacement algorithms. diff --git a/eo/src/eoMergeReduce.h b/eo/src/eoMergeReduce.h index 6a2618d9d..e5e8c2bcc 100644 --- a/eo/src/eoMergeReduce.h +++ b/eo/src/eoMergeReduce.h @@ -27,12 +27,12 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include +#include "eoPop.h" +#include "eoFunctor.h" +#include "eoMerge.h" +#include "eoReduce.h" +#include "eoReplacement.h" +#include "utils/eoHowMany.h" //----------------------------------------------------------------------------- /** Replacement strategies that combine en eoMerge and an eoReduce. diff --git a/eo/src/eoNDSorting.h b/eo/src/eoNDSorting.h index bb2e94fcc..b8315b458 100644 --- a/eo/src/eoNDSorting.h +++ b/eo/src/eoNDSorting.h @@ -27,10 +27,10 @@ #ifndef eoNDSorting_h #define eoNDSorting_h -#include +#include "EO.h" #include -#include -#include +#include "eoPop.h" +#include "eoPerf2Worth.h" #include /** diff --git a/eo/src/eoObject.h b/eo/src/eoObject.h index bac2f4737..1e119b988 100644 --- a/eo/src/eoObject.h +++ b/eo/src/eoObject.h @@ -27,11 +27,11 @@ //----------------------------------------------------------------------------- -#include // For limits definition +#include "utils/eoData.h" // For limits definition #include // std::istream, std::ostream #include // std::string -#include +#include "utils/compatibility.h" /* eoObject used to be the base class for the whole hierarchy, but this has @@ -39,7 +39,7 @@ changed. eoObject is used to define a name (#className#) that is used when loading or saving the state. Previously, this object also defined a print and read -interface, but it´s been moved to eoPrintable and eoPersistent. +interface, but it�s been moved to eoPrintable and eoPersistent. */ /** Defines a name (#className#), used when loading or saving a state. diff --git a/eo/src/eoOneToOneBreeder.h b/eo/src/eoOneToOneBreeder.h index a4c18c0b4..587dbce19 100644 --- a/eo/src/eoOneToOneBreeder.h +++ b/eo/src/eoOneToOneBreeder.h @@ -28,15 +28,15 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "eoOp.h" +#include "eoGenOp.h" +#include "eoPopulator.h" +#include "eoSelectOne.h" +#include "eoSequentialSelect.h" +#include "eoBreed.h" +#include "eoEvalFunc.h" +#include "eoPopulator.h" +#include "utils/eoHowMany.h" /** eoOneToOneBreeder: transforms a population using * - an operator that MODIFIES only one parent from the populator diff --git a/eo/src/eoOp.h b/eo/src/eoOp.h index b6ad783c2..5351b9d86 100644 --- a/eo/src/eoOp.h +++ b/eo/src/eoOp.h @@ -25,10 +25,10 @@ #ifndef _eoOp_H #define _eoOp_H -#include -#include -#include -#include +#include "eoObject.h" +#include "eoPrintable.h" +#include "eoFunctor.h" +#include "utils/eoRNG.h" /** @defgroup Operators Evolutionary Operators diff --git a/eo/src/eoOpContainer.h b/eo/src/eoOpContainer.h index e1f43bdf6..41e8b74b8 100644 --- a/eo/src/eoOpContainer.h +++ b/eo/src/eoOpContainer.h @@ -26,7 +26,7 @@ #ifndef _eoOpContainer_H #define _eoOpContainer_H -#include +#include "eoGenOp.h" /** eoOpContainer is a base class for the sequential and proportional selectors * It takes care of wrapping the other operators, diff --git a/eo/src/eoOpSelMason.h b/eo/src/eoOpSelMason.h index 577b5b56f..377de0c95 100644 --- a/eo/src/eoOpSelMason.h +++ b/eo/src/eoOpSelMason.h @@ -24,7 +24,7 @@ #ifndef _EOOPSELMASON_H #define _EOOPSELMASON_H -#include // for eoFactory and eoOpFactory +#include "eoFactory.h" // for eoFactory and eoOpFactory #include @@ -58,7 +58,7 @@ public: ...\\ Stores all operators built in a database (#allocMap#), so that somebody can destroy them later. The Mason is in charge or destroying the operators, - since the built object can´t do it itself. The objects built must be destroyed + since the built object can�t do it itself. The objects built must be destroyed from outside, using the "destroy" method */ virtual eoOpSelector* make(std::istream& _is) { @@ -79,7 +79,7 @@ public: _is >> rate; if ( _is ) { eoOp* op = operatorFactory.make( _is ); // This reads the rest of the line - // Add the operators to the selector, don´t pay attention to the IDs + // Add the operators to the selector, don�t pay attention to the IDs opSelectorP->addOp( *op, rate ); // Keep it in the store, to destroy later tmpPVec.push_back( op ); diff --git a/eo/src/eoOrderXover.h b/eo/src/eoOrderXover.h index daaf52e0c..4efc8ea6b 100644 --- a/eo/src/eoOrderXover.h +++ b/eo/src/eoOrderXover.h @@ -9,8 +9,8 @@ //----------------------------------------------------------------------------- #include -#include -#include +#include "utils/eoRNG.h" +#include "eoInit.h" /** * apply orderXover on two chromosomes. diff --git a/eo/src/eoPSO.h b/eo/src/eoPSO.h index 16d2c9b58..869ac43c2 100644 --- a/eo/src/eoPSO.h +++ b/eo/src/eoPSO.h @@ -26,7 +26,7 @@ #define _EOPSO_H //----------------------------------------------------------------------------- -#include +#include "eoAlgo.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoPartiallyMappedXover.h b/eo/src/eoPartiallyMappedXover.h index 16b23f6c9..f88a469be 100644 --- a/eo/src/eoPartiallyMappedXover.h +++ b/eo/src/eoPartiallyMappedXover.h @@ -32,7 +32,7 @@ //----------------------------------------------------------------------------- #include -#include +#include "utils/eoRNG.h" /** * diff --git a/eo/src/eoParticleBestInit.h b/eo/src/eoParticleBestInit.h index b203c8246..d179e6c75 100644 --- a/eo/src/eoParticleBestInit.h +++ b/eo/src/eoParticleBestInit.h @@ -26,7 +26,7 @@ #define _EOPARTICLEBESTINIT_H //----------------------------------------------------------------------------- -#include +#include "eoFunctor.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoParticleFullInitializer.h b/eo/src/eoParticleFullInitializer.h index 96bebb579..06503497a 100644 --- a/eo/src/eoParticleFullInitializer.h +++ b/eo/src/eoParticleFullInitializer.h @@ -27,11 +27,11 @@ #ifndef _eoParticleFullInitializer_H #define _eoParticleFullInitializer_H -#include -#include -#include -#include -#include +#include "utils/eoRealVectorBounds.h" +#include "eoVelocityInit.h" +#include "eoPop.h" +#include "eoParticleBestInit.h" +#include "eoTopology.h" /** @addtogroup Initializators diff --git a/eo/src/eoPerf2Worth.h b/eo/src/eoPerf2Worth.h index 9f1746ecf..f7d08f512 100644 --- a/eo/src/eoPerf2Worth.h +++ b/eo/src/eoPerf2Worth.h @@ -27,9 +27,9 @@ #ifndef eoPerf2Worth_h #define eoPerf2Worth_h -#include -#include -#include +#include "utils/eoParam.h" +#include "eoPop.h" +#include "eoFunctor.h" #include #include diff --git a/eo/src/eoPeriodicContinue.h b/eo/src/eoPeriodicContinue.h index 1a3f9d0de..3aac35bed 100644 --- a/eo/src/eoPeriodicContinue.h +++ b/eo/src/eoPeriodicContinue.h @@ -22,8 +22,8 @@ #ifndef __eoPeriodicContinue_h #define __eoPeriodicContinue_h -#include -#include +#include "eoContinue.h" +#include "eoPop.h" /** A continue that becomes true periodically. */ diff --git a/eo/src/eoPersistent.cpp b/eo/src/eoPersistent.cpp index c1334ebc4..4be731f94 100644 --- a/eo/src/eoPersistent.cpp +++ b/eo/src/eoPersistent.cpp @@ -3,7 +3,7 @@ #pragma warning(disable:4786) #endif -#include +#include "eoPersistent.h" //Implementation of these objects diff --git a/eo/src/eoPop.h b/eo/src/eoPop.h index eb6be46fb..9213bca5c 100644 --- a/eo/src/eoPop.h +++ b/eo/src/eoPop.h @@ -41,10 +41,10 @@ Authors: #include // EO includes -#include // for eoInit -#include -#include -#include // for shuffle method +#include "eoOp.h" // for eoInit +#include "eoPersistent.h" +#include "eoInit.h" +#include "utils/rnd_generators.h" // for shuffle method /** A std::vector of EO object, to be used in all algorithms * (selectors, operators, replacements, ...). diff --git a/eo/src/eoPopEvalFunc.h b/eo/src/eoPopEvalFunc.h index 7fcad1467..c3037c20d 100644 --- a/eo/src/eoPopEvalFunc.h +++ b/eo/src/eoPopEvalFunc.h @@ -27,15 +27,15 @@ #ifndef eoPopEvalFunc_H #define eoPopEvalFunc_H -#include -#include +#include "eoEvalFunc.h" +#include "apply.h" # ifdef WITH_MPI -#include -#include -#include -#include -#include +#include "mpi/eoMpi.h" +#include "mpi/eoTerminateJob.h" +#include "mpi/eoMpiAssignmentAlgorithm.h" +#include "mpi/eoParallelApply.h" +#include "utils/eoParallel.h" #include // ceil # endif // WITH_MPI diff --git a/eo/src/eoPopulator.h b/eo/src/eoPopulator.h index 104aafe5e..9c8d28af9 100644 --- a/eo/src/eoPopulator.h +++ b/eo/src/eoPopulator.h @@ -26,8 +26,8 @@ #ifndef _eoPopulator_H #define _eoPopulator_H -#include -#include +#include "eoPop.h" +#include "eoSelectOne.h" /** eoPopulator is a helper class for general operators eoGenOp It is an eoPop but also behaves like an eoPop::iterator diff --git a/eo/src/eoPrintable.cpp b/eo/src/eoPrintable.cpp index ec6e32462..1f0b4ab4a 100644 --- a/eo/src/eoPrintable.cpp +++ b/eo/src/eoPrintable.cpp @@ -7,7 +7,7 @@ // eoPrintable.cpp //----------------------------------------------------------------------------- -#include +#include "eoPrintable.h" //----------------------------------------------------------------------------- //Implementation of these objects diff --git a/eo/src/eoPrintable.h b/eo/src/eoPrintable.h index 1f2404a89..f04f50fb6 100644 --- a/eo/src/eoPrintable.h +++ b/eo/src/eoPrintable.h @@ -27,8 +27,8 @@ //----------------------------------------------------------------------------- -#include // std::istream, std::ostream -#include // para std::string +#include "iostream" // std::istream, std::ostream +#include "string" // para std::string /* This functionality was separated from eoObject, since it makes no sense to print diff --git a/eo/src/eoProportionalCombinedOp.h b/eo/src/eoProportionalCombinedOp.h index 823ac79c9..0dce5b0fc 100644 --- a/eo/src/eoProportionalCombinedOp.h +++ b/eo/src/eoProportionalCombinedOp.h @@ -24,12 +24,12 @@ #ifndef _eoCombinedOp_H #define _eoCombinedOp_H -#include -#include -#include -#include -#include -#include +#include "eoObject.h" +#include "eoPrintable.h" +#include "eoFunctor.h" +#include "eoOp.h" +#include "utils/eoRNG.h" +#include "utils/eoLogger.h" /** \defgroup Utilities Utilities diff --git a/eo/src/eoProportionalSelect.h b/eo/src/eoProportionalSelect.h index ec1243cee..35dd3065c 100644 --- a/eo/src/eoProportionalSelect.h +++ b/eo/src/eoProportionalSelect.h @@ -29,10 +29,10 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include +#include "utils/eoRNG.h" +#include "utils/selectors.h" +#include "eoSelectOne.h" +#include "eoPop.h" /** eoProportionalSelect: select an individual proportional to her stored fitness value diff --git a/eo/src/eoRandomRealWeightUp.h b/eo/src/eoRandomRealWeightUp.h index 81521b512..d135af93f 100644 --- a/eo/src/eoRandomRealWeightUp.h +++ b/eo/src/eoRandomRealWeightUp.h @@ -26,8 +26,8 @@ #define EORANDOMREALWEIGHTUP_H //----------------------------------------------------------------------------- -#include -#include +#include "eoWeightUpdater.h" +#include "utils/eoRNG.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoRandomSelect.h b/eo/src/eoRandomSelect.h index 065f050f9..1b15bbffa 100644 --- a/eo/src/eoRandomSelect.h +++ b/eo/src/eoRandomSelect.h @@ -32,8 +32,8 @@ * eoSequentialSelect returns all individuals in turn */ -#include -#include +#include "utils/eoRNG.h" +#include "eoSelectOne.h" /** eoRandomSelect: a selection method that selects ONE individual randomly * diff --git a/eo/src/eoRanking.h b/eo/src/eoRanking.h index 5e7342911..65fbe87a4 100644 --- a/eo/src/eoRanking.h +++ b/eo/src/eoRanking.h @@ -27,7 +27,7 @@ #ifndef eoRanking_h #define eoRanking_h -#include +#include "eoPerf2Worth.h" /** An instance of eoPerfFromWorth * COmputes the ranked fitness: fitnesses range in [m,M] diff --git a/eo/src/eoRankingSelect.h b/eo/src/eoRankingSelect.h index 70a2e44c0..1a3b9a254 100644 --- a/eo/src/eoRankingSelect.h +++ b/eo/src/eoRankingSelect.h @@ -28,8 +28,8 @@ //----------------------------------------------------------------------------- -#include -#include +#include "eoSelectFromWorth.h" +#include "eoRanking.h" /** eoRankingSelect: select an individual by roulette wheel on its rank * is an eoRouletteWorthSelect, i.e. a selector using a std::vector of worthes diff --git a/eo/src/eoRealBoundModifier.h b/eo/src/eoRealBoundModifier.h index 9a9e032bc..1b4405737 100644 --- a/eo/src/eoRealBoundModifier.h +++ b/eo/src/eoRealBoundModifier.h @@ -24,8 +24,8 @@ #ifndef EOREALBOUNDMODIFIER_H #define EOREALBOUNDMODIFIER_H -#include -#include +#include "eoFunctor.h" +#include "utils/eoRealVectorBounds.h" /** @defgroup Bounds Bounds management * diff --git a/eo/src/eoRealParticle.h b/eo/src/eoRealParticle.h index 14326558c..f7e758173 100644 --- a/eo/src/eoRealParticle.h +++ b/eo/src/eoRealParticle.h @@ -26,7 +26,7 @@ #define _EOREALPARTICLE_H -#include +#include "eoVectorParticle.h" /** eoRealParticle: Implementation of a real-coded particle for diff --git a/eo/src/eoReduce.h b/eo/src/eoReduce.h index 7f0c17729..c1039e47b 100644 --- a/eo/src/eoReduce.h +++ b/eo/src/eoReduce.h @@ -31,10 +31,10 @@ #include // EO includes -#include // eoPop -#include // eoReduce -#include -#include +#include "eoPop.h" // eoPop +#include "eoFunctor.h" // eoReduce +#include "utils/selectors.h" +#include "utils/eoLogger.h" /** * eoReduce: .reduce the new generation to the specified size diff --git a/eo/src/eoReduceMerge.h b/eo/src/eoReduceMerge.h index 02933b404..a9f6c82fa 100644 --- a/eo/src/eoReduceMerge.h +++ b/eo/src/eoReduceMerge.h @@ -29,12 +29,12 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include +#include "eoPop.h" +#include "eoFunctor.h" +#include "eoMerge.h" +#include "eoReduce.h" +#include "eoReplacement.h" +#include "utils/eoHowMany.h" //----------------------------------------------------------------------------- /** @addtogroup Replacors diff --git a/eo/src/eoReduceMergeReduce.h b/eo/src/eoReduceMergeReduce.h index 17721f733..0f7f0ad4c 100644 --- a/eo/src/eoReduceMergeReduce.h +++ b/eo/src/eoReduceMergeReduce.h @@ -28,11 +28,11 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include +#include "eoPop.h" +#include "eoFunctor.h" +#include "eoMerge.h" +#include "eoReduce.h" +#include "utils/eoHowMany.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoReduceSplit.h b/eo/src/eoReduceSplit.h index 4b21aa25e..a8640c039 100644 --- a/eo/src/eoReduceSplit.h +++ b/eo/src/eoReduceSplit.h @@ -31,9 +31,9 @@ #include // EO includes -#include // eoPop -#include // eoReduce -#include +#include "eoPop.h" // eoPop +#include "eoFunctor.h" // eoReduce +#include "utils/selectors.h" /** @addtogroup Replacors * @{ diff --git a/eo/src/eoReplacement.h b/eo/src/eoReplacement.h index 033d441cb..a705f5254 100644 --- a/eo/src/eoReplacement.h +++ b/eo/src/eoReplacement.h @@ -29,11 +29,11 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include +#include "eoPop.h" +#include "eoFunctor.h" +#include "eoMerge.h" +#include "eoReduce.h" +#include "utils/eoHowMany.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoRingTopology.h b/eo/src/eoRingTopology.h index 6bad13cd7..615227909 100644 --- a/eo/src/eoRingTopology.h +++ b/eo/src/eoRingTopology.h @@ -29,8 +29,8 @@ #define EORINGTOPOLOGY_H_ //----------------------------------------------------------------------------- -#include -#include +#include "eoTopology.h" +#include "eoSocialNeighborhood.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoSGA.h b/eo/src/eoSGA.h index b31dff04e..bfbee45b6 100644 --- a/eo/src/eoSGA.h +++ b/eo/src/eoSGA.h @@ -27,14 +27,14 @@ #ifndef _eoSGA_h #define _eoSGA_h -#include -#include -#include -#include -#include -#include -#include -#include +#include "eoInvalidateOps.h" +#include "eoContinue.h" +#include "eoPop.h" +#include "eoSelectOne.h" +#include "eoSelectPerc.h" +#include "eoEvalFunc.h" +#include "eoAlgo.h" +#include "apply.h" /** The Simple Genetic Algorithm, following Holland and Goldberg * diff --git a/eo/src/eoSGATransform.h b/eo/src/eoSGATransform.h index 55b5e5eda..e9284aa0a 100644 --- a/eo/src/eoSGATransform.h +++ b/eo/src/eoSGATransform.h @@ -27,15 +27,15 @@ #ifndef _eoSGATransform_h #define _eoSGATransform_h -#include -#include +#include "eoInvalidateOps.h" +#include "eoPop.h" /////////////////////////////////////////////////////////////////////////////// // class eoSGATransform /////////////////////////////////////////////////////////////////////////////// #include // std::vector -#include -#include +#include "utils/eoRNG.h" +#include "eoTransform.h" /** eoSGATransform: transforms a population using genetic operators. * It does it exactly as class eoSGA, i.e. only accepts diff --git a/eo/src/eoSIGContinue.h b/eo/src/eoSIGContinue.h index 2199b49ef..32e7c1857 100644 --- a/eo/src/eoSIGContinue.h +++ b/eo/src/eoSIGContinue.h @@ -33,7 +33,7 @@ #define eoSIGContinue_h #include -#include +#include "eoContinue.h" /** @addtogroup Continuators * @{ diff --git a/eo/src/eoSecondsElapsedContinue.h b/eo/src/eoSecondsElapsedContinue.h index e29aeefb5..a580b7f42 100644 --- a/eo/src/eoSecondsElapsedContinue.h +++ b/eo/src/eoSecondsElapsedContinue.h @@ -25,7 +25,7 @@ #ifndef _eoSecondsElapsedContinue_h #define _eoSecondsElapsedContinue_h -#include +#include "eoContinue.h" /** Timed continuator: continues until a number of seconds is used diff --git a/eo/src/eoSelect.h b/eo/src/eoSelect.h index aae338434..e48f9051f 100644 --- a/eo/src/eoSelect.h +++ b/eo/src/eoSelect.h @@ -27,7 +27,7 @@ //----------------------------------------------------------------------------- -#include +#include "eoPop.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoSelectFactory.h b/eo/src/eoSelectFactory.h index 9dc19dabf..65818a64d 100644 --- a/eo/src/eoSelectFactory.h +++ b/eo/src/eoSelectFactory.h @@ -26,9 +26,9 @@ #ifndef _EOSELECTFACTORY_H #define _EOSELECTFACTORY_H -#include -#include -#include +#include "eoFactory.h" +#include "eoRandomSelect.h" +#include "eoTournament.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoSelectFromWorth.h b/eo/src/eoSelectFromWorth.h index 342be9da7..c6ba5c1e5 100644 --- a/eo/src/eoSelectFromWorth.h +++ b/eo/src/eoSelectFromWorth.h @@ -28,9 +28,9 @@ #include //----------------------------------------------------------------------------- -#include -#include -#include +#include "eoSelectOne.h" +#include "eoPerf2Worth.h" +#include "utils/selectors.h" //----------------------------------------------------------------------------- /** selects one element from a population (is an eoSelectOne) diff --git a/eo/src/eoSelectMany.h b/eo/src/eoSelectMany.h index 63da51503..6fb7da6e2 100644 --- a/eo/src/eoSelectMany.h +++ b/eo/src/eoSelectMany.h @@ -29,9 +29,9 @@ //----------------------------------------------------------------------------- -#include -#include -#include +#include "eoSelect.h" +#include "eoSelectOne.h" +#include "utils/eoHowMany.h" #include //----------------------------------------------------------------------------- diff --git a/eo/src/eoSelectNumber.h b/eo/src/eoSelectNumber.h index f6f094ef2..242db4daf 100644 --- a/eo/src/eoSelectNumber.h +++ b/eo/src/eoSelectNumber.h @@ -27,8 +27,8 @@ //----------------------------------------------------------------------------- -#include -#include +#include "eoSelect.h" +#include "eoSelectOne.h" #include //----------------------------------------------------------------------------- diff --git a/eo/src/eoSelectOne.h b/eo/src/eoSelectOne.h index 5afdd1404..fc4ed0982 100644 --- a/eo/src/eoSelectOne.h +++ b/eo/src/eoSelectOne.h @@ -27,8 +27,8 @@ //----------------------------------------------------------------------------- -#include -#include +#include "eoPop.h" +#include "eoFunctor.h" //----------------------------------------------------------------------------- /** eoSelectOne selects only one element from a whole population. diff --git a/eo/src/eoSelectPerc.h b/eo/src/eoSelectPerc.h index 131a3d591..9693f7870 100644 --- a/eo/src/eoSelectPerc.h +++ b/eo/src/eoSelectPerc.h @@ -27,8 +27,8 @@ //----------------------------------------------------------------------------- -#include -#include +#include "eoSelect.h" +#include "eoSelectOne.h" #include //----------------------------------------------------------------------------- diff --git a/eo/src/eoSharing.h b/eo/src/eoSharing.h index 170a03b9e..fa7583030 100644 --- a/eo/src/eoSharing.h +++ b/eo/src/eoSharing.h @@ -26,8 +26,8 @@ #ifndef eoSharing_h #define eoSharing_h -#include -#include +#include "eoPerf2Worth.h" +#include "utils/eoDistance.h" /** Sharing is a perf2worth class that implements * Goldberg and Richardson's basic sharing diff --git a/eo/src/eoSharingSelect.h b/eo/src/eoSharingSelect.h index 0754cdd08..523d18426 100644 --- a/eo/src/eoSharingSelect.h +++ b/eo/src/eoSharingSelect.h @@ -28,8 +28,8 @@ //----------------------------------------------------------------------------- -#include -#include +#include "eoSelectFromWorth.h" +#include "eoSharing.h" /** eoSharingSelect: select an individual by roulette wheel * on its SHARED fitness. It is an eoRouletteWorthSelect, diff --git a/eo/src/eoSigBinaryFlight.h b/eo/src/eoSigBinaryFlight.h index dccf2e5f6..e55423bd8 100644 --- a/eo/src/eoSigBinaryFlight.h +++ b/eo/src/eoSigBinaryFlight.h @@ -27,7 +27,7 @@ #define EOSIGBINARYFLIGHT_H //----------------------------------------------------------------------------- -#include +#include "eoBinaryFlight.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoSimpleEDA.h b/eo/src/eoSimpleEDA.h index afbf152f0..0704b5722 100644 --- a/eo/src/eoSimpleEDA.h +++ b/eo/src/eoSimpleEDA.h @@ -28,11 +28,11 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include +#include "apply.h" +#include "eoEDA.h" +#include "eoContinue.h" +#include "eoDistribUpdater.h" +#include "eoEvalFunc.h" /** A very simple Estimation of Distribution Algorithm * diff --git a/eo/src/eoSocialNeighborhood.h b/eo/src/eoSocialNeighborhood.h index 944031f9d..3f46b4a4e 100644 --- a/eo/src/eoSocialNeighborhood.h +++ b/eo/src/eoSocialNeighborhood.h @@ -26,7 +26,7 @@ #define EOSOCIALNEIGHBORHOOD_H_ //----------------------------------------------------------------------------- -#include +#include "eoNeighborhood.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoStandardFlight.h b/eo/src/eoStandardFlight.h index 228839eb7..eae90a63a 100644 --- a/eo/src/eoStandardFlight.h +++ b/eo/src/eoStandardFlight.h @@ -26,7 +26,7 @@ #define EOSTANDARDFLIGHT_H //----------------------------------------------------------------------------- -#include +#include "eoFlight.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoStandardVelocity.h b/eo/src/eoStandardVelocity.h index 62abd487b..3f67eec91 100644 --- a/eo/src/eoStandardVelocity.h +++ b/eo/src/eoStandardVelocity.h @@ -27,12 +27,12 @@ #define EOSTANDARDVELOCITY_H //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include +#include "eoFunctor.h" +#include "utils/eoRNG.h" +#include "eoPop.h" +#include "utils/eoRealVectorBounds.h" +#include "eoRealBoundModifier.h" +#include "eoTopology.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoStarTopology.h b/eo/src/eoStarTopology.h index 02df64a98..a345c8bc3 100644 --- a/eo/src/eoStarTopology.h +++ b/eo/src/eoStarTopology.h @@ -27,8 +27,8 @@ #define EOSTARTOPOLOGY_H_ //----------------------------------------------------------------------------- -#include -#include +#include "eoTopology.h" +#include "eoSocialNeighborhood.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoSteadyFitContinue.h b/eo/src/eoSteadyFitContinue.h index f05697b50..0b63c5e87 100644 --- a/eo/src/eoSteadyFitContinue.h +++ b/eo/src/eoSteadyFitContinue.h @@ -25,8 +25,8 @@ #ifndef _eoSteadyFitContinue_h #define _eoSteadyFitContinue_h -#include -#include +#include "eoContinue.h" +#include "utils/eoLogger.h" /** A continuator: does a minimum number of generations, then diff --git a/eo/src/eoStochTournamentSelect.h b/eo/src/eoStochTournamentSelect.h index 650041296..c3b6b2d21 100644 --- a/eo/src/eoStochTournamentSelect.h +++ b/eo/src/eoStochTournamentSelect.h @@ -27,8 +27,8 @@ #include #include // accumulate -#include // eoSelectOne -#include // stochastic_tournament +#include "eoSelectOne.h" // eoSelectOne +#include "utils/selectors.h" // stochastic_tournament /** eoStochTournamentSelect: a selection method that selects ONE individual by binary stochastic tournament diff --git a/eo/src/eoStochasticUniversalSelect.h b/eo/src/eoStochasticUniversalSelect.h index fb1669ecc..956bf62c7 100644 --- a/eo/src/eoStochasticUniversalSelect.h +++ b/eo/src/eoStochasticUniversalSelect.h @@ -29,10 +29,10 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include +#include "utils/eoRNG.h" +#include "eoSelectOne.h" +#include "utils/selectors.h" +#include "eoPop.h" /** eoStochasticUniversalSelect: select an individual proportional to her stored fitness value, but in contrast with eoStochasticUniversalSelect, get rid of most finite sampling effects diff --git a/eo/src/eoSurviveAndDie.h b/eo/src/eoSurviveAndDie.h index 63cf22197..2ca4a3833 100644 --- a/eo/src/eoSurviveAndDie.h +++ b/eo/src/eoSurviveAndDie.h @@ -29,11 +29,11 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include +#include "eoPop.h" +#include "eoFunctor.h" +#include "eoMerge.h" +#include "eoReduce.h" +#include "utils/eoHowMany.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoSyncEasyPSO.h b/eo/src/eoSyncEasyPSO.h index d0a82059a..0fc7a2492 100644 --- a/eo/src/eoSyncEasyPSO.h +++ b/eo/src/eoSyncEasyPSO.h @@ -26,11 +26,11 @@ #define _EOSYNCEASYPSO_H //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include +#include "eoContinue.h" +#include "eoPopEvalFunc.h" +#include "eoPSO.h" +#include "eoVelocity.h" +#include "eoFlight.h" //----------------------------------------------------------------------------- /** An easy-to-use synchronous particle swarm algorithm; you can use any particle, diff --git a/eo/src/eoTimeContinue.h b/eo/src/eoTimeContinue.h index c0fcc3fe5..3d086e571 100644 --- a/eo/src/eoTimeContinue.h +++ b/eo/src/eoTimeContinue.h @@ -27,8 +27,8 @@ #include -#include -#include +#include "eoContinue.h" +#include "utils/eoLogger.h" /** * Termination condition until a running time is reached. diff --git a/eo/src/eoTopology.h b/eo/src/eoTopology.h index a12bf43dc..86fd214f3 100644 --- a/eo/src/eoTopology.h +++ b/eo/src/eoTopology.h @@ -27,7 +27,7 @@ #define EOTOPOLOGY_H_ //----------------------------------------------------------------------------- -#include +#include "eoNeighborhood.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoTransform.h b/eo/src/eoTransform.h index f8823382a..5ee23a4ad 100644 --- a/eo/src/eoTransform.h +++ b/eo/src/eoTransform.h @@ -27,7 +27,7 @@ //----------------------------------------------------------------------------- -#include +#include "eoPop.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoTruncSelect.h b/eo/src/eoTruncSelect.h index e46b39bc3..f469e02b6 100644 --- a/eo/src/eoTruncSelect.h +++ b/eo/src/eoTruncSelect.h @@ -29,8 +29,8 @@ //----------------------------------------------------------------------------- -#include -#include +#include "eoSelect.h" +#include "utils/eoHowMany.h" #include //----------------------------------------------------------------------------- diff --git a/eo/src/eoTruncatedSelectMany.h b/eo/src/eoTruncatedSelectMany.h index 1b3bad726..d5ab0f01b 100644 --- a/eo/src/eoTruncatedSelectMany.h +++ b/eo/src/eoTruncatedSelectMany.h @@ -29,9 +29,9 @@ //----------------------------------------------------------------------------- -#include -#include -#include +#include "eoSelect.h" +#include "eoSelectOne.h" +#include "utils/eoHowMany.h" #include //----------------------------------------------------------------------------- diff --git a/eo/src/eoTruncatedSelectOne.h b/eo/src/eoTruncatedSelectOne.h index e86cce81d..431f7465a 100644 --- a/eo/src/eoTruncatedSelectOne.h +++ b/eo/src/eoTruncatedSelectOne.h @@ -29,9 +29,9 @@ //----------------------------------------------------------------------------- -#include -#include -#include +#include "eoSelect.h" +#include "eoSelectOne.h" +#include "utils/eoHowMany.h" #include //----------------------------------------------------------------------------- diff --git a/eo/src/eoVariableInertiaWeightedVelocity.h b/eo/src/eoVariableInertiaWeightedVelocity.h index a926feee8..33bbe4f43 100644 --- a/eo/src/eoVariableInertiaWeightedVelocity.h +++ b/eo/src/eoVariableInertiaWeightedVelocity.h @@ -26,11 +26,11 @@ #define EOVARIABLEINERTIAWEIGHTEDVELOCITY_H //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include +#include "eoVelocity.h" +#include "eoTopology.h" +#include "eoWeightUpdater.h" +#include "utils/eoRealVectorBounds.h" +#include "eoRealBoundModifier.h" //----------------------------------------------------------------------------- diff --git a/eo/src/eoVariableLengthCrossover.h b/eo/src/eoVariableLengthCrossover.h index 510fc9b03..c61f91651 100644 --- a/eo/src/eoVariableLengthCrossover.h +++ b/eo/src/eoVariableLengthCrossover.h @@ -26,8 +26,8 @@ #ifndef _eoVariableLengthCrossover_h #define _eoVariableLengthCrossover_h -#include -#include +#include "eoFunctor.h" +#include "eoOp.h" /** Base classes for generic crossovers on variable length chromosomes. diff --git a/eo/src/eoVariableLengthMutation.h b/eo/src/eoVariableLengthMutation.h index 542541d70..a3bdfac19 100644 --- a/eo/src/eoVariableLengthMutation.h +++ b/eo/src/eoVariableLengthMutation.h @@ -26,9 +26,9 @@ #ifndef _eoVariableLengthMutation_h #define _eoVariableLengthMutation_h -#include -#include -#include +#include "eoFunctor.h" +#include "eoOp.h" +#include "eoInit.h" /** Base classes for generic mutations on variable length chromosomes. diff --git a/eo/src/eoVector.h b/eo/src/eoVector.h index fce05d117..bdedd5e94 100644 --- a/eo/src/eoVector.h +++ b/eo/src/eoVector.h @@ -25,8 +25,8 @@ Old contact: todos@geneura.ugr.es, http://geneura.ugr.es #include #include -#include -#include +#include "EO.h" +#include "utils/eoLogger.h" /** diff --git a/eo/src/eoVectorParticle.h b/eo/src/eoVectorParticle.h index 25cfcc9fa..773234752 100644 --- a/eo/src/eoVectorParticle.h +++ b/eo/src/eoVectorParticle.h @@ -25,7 +25,7 @@ #ifndef _EOVECTORPARTICLE_H #define _EOVECTORPARTICLE_H -#include +#include "PO.h" /** diff --git a/eo/src/eoVelocity.h b/eo/src/eoVelocity.h index e388078c1..ef9b695d6 100644 --- a/eo/src/eoVelocity.h +++ b/eo/src/eoVelocity.h @@ -26,10 +26,10 @@ #define EOVELOCITY_H //----------------------------------------------------------------------------- -#include -#include -#include -#include +#include "eoFunctor.h" +#include "utils/eoRNG.h" +#include "eoPop.h" +#include "eoTopology.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/eoVelocityInit.h b/eo/src/eoVelocityInit.h index 8c57a6891..9c271b004 100644 --- a/eo/src/eoVelocityInit.h +++ b/eo/src/eoVelocityInit.h @@ -28,9 +28,9 @@ #include -#include -#include -#include +#include "eoOp.h" +#include "eoSTLFunctor.h" +#include "utils/eoRndGenerators.h" /** @addtogroup Initializators diff --git a/eo/src/eoWeightUpdater.h b/eo/src/eoWeightUpdater.h index d4970eca4..eee5d6309 100644 --- a/eo/src/eoWeightUpdater.h +++ b/eo/src/eoWeightUpdater.h @@ -26,7 +26,7 @@ #define EOWEIGHTUPDATER_H //----------------------------------------------------------------------------- -#include +#include "eoFunctor.h" //----------------------------------------------------------------------------- /** diff --git a/eo/src/es.h b/eo/src/es.h index d5dffc2f3..9e2fd78f9 100644 --- a/eo/src/es.h +++ b/eo/src/es.h @@ -36,28 +36,28 @@ //----------------------------------------------------------------------------- // the genotypes - from plain std::vector to full correlated mutation -#include -#include -#include -#include +#include "eoReal.h" +#include "eoEsSimple.h" +#include "eoEsStdev.h" +#include "eoEsFull.h" // the initialization -#include +#include "eoEsChromInit.h" // general operators -#include -#include -#include // for generic operators +#include "eoRealOp.h" +#include "eoNormalMutation.h" +#include "eoRealAtomXover.h" // for generic operators // SBX crossover (following Deb) -#include +#include "eoSBXcross.h" // ES specific operators -#include // Global ES Xover -#include // 2-parents ES Xover +#include "eoEsGlobalXover.h" // Global ES Xover +#include "eoEsStandardXover.h" // 2-parents ES Xover // the ES-mutations -#include -#include +#include "eoEsMutationInit.h" +#include "eoEsMutate.h" #endif diff --git a/eo/src/es/CMAParams.cpp b/eo/src/es/CMAParams.cpp index 131edb72f..2862cdd1a 100644 --- a/eo/src/es/CMAParams.cpp +++ b/eo/src/es/CMAParams.cpp @@ -43,8 +43,8 @@ * Version 2.23. * */ -#include -#include +#include "CMAParams.h" +#include "../utils/eoParser.h" #include diff --git a/eo/src/es/CMAState.cpp b/eo/src/es/CMAState.cpp index 328552434..897b32f0f 100644 --- a/eo/src/es/CMAState.cpp +++ b/eo/src/es/CMAState.cpp @@ -56,12 +56,11 @@ #include #include -#include - -#include -#include -#include -#include +#include "../utils/eoRNG.h" +#include "CMAState.h" +#include "CMAParams.h" +#include "matrices.h" +#include "eig.h" using namespace std; diff --git a/eo/src/es/eoCMABreed.h b/eo/src/es/eoCMABreed.h index 450654a7f..37f0389fb 100644 --- a/eo/src/es/eoCMABreed.h +++ b/eo/src/es/eoCMABreed.h @@ -25,9 +25,9 @@ #ifndef _EOCMABREED_H #define _EOCMABREED_H -#include -#include -#include +#include "../eoBreed.h" +#include "../eoVector.h" +#include "CMAState.h" #include diff --git a/eo/src/es/eoCMAInit.h b/eo/src/es/eoCMAInit.h index 2fdb967e0..73c63122d 100644 --- a/eo/src/es/eoCMAInit.h +++ b/eo/src/es/eoCMAInit.h @@ -28,9 +28,9 @@ #ifndef _EOCMAINIT_H #define _EOCMAINIT_H -#include -#include -#include +#include "../eoInit.h" +#include "../eoVector.h" +#include "CMAState.h" /// @todo handle bounds template diff --git a/eo/src/es/eoEsChromInit.h b/eo/src/es/eoEsChromInit.h index c5382890b..2d4b7b8a1 100644 --- a/eo/src/es/eoEsChromInit.h +++ b/eo/src/es/eoEsChromInit.h @@ -29,10 +29,10 @@ Contact: http://eodev.sourceforge.net #include #include -#include -#include -#include -#include +#include "eoRealInitBounded.h" +#include "eoEsSimple.h" +#include "eoEsStdev.h" +#include "eoEsFull.h" #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 diff --git a/eo/src/es/eoEsFull.h b/eo/src/es/eoEsFull.h index a1091c83d..1dfdc58b6 100644 --- a/eo/src/es/eoEsFull.h +++ b/eo/src/es/eoEsFull.h @@ -27,7 +27,7 @@ #ifndef _eoEsFull_h #define _eoEsFull_h -#include +#include "../eoVector.h" /** \ingroup Real diff --git a/eo/src/es/eoEsGlobalXover.h b/eo/src/es/eoEsGlobalXover.h index 5be4b5061..3e25370be 100644 --- a/eo/src/es/eoEsGlobalXover.h +++ b/eo/src/es/eoEsGlobalXover.h @@ -26,15 +26,15 @@ #ifndef _eoEsGlobalXover_H #define _eoEsGlobalXover_H -#include +#include "../utils/eoRNG.h" -#include -#include -#include +#include "eoEsSimple.h" +#include "eoEsStdev.h" +#include "eoEsFull.h" -#include +#include "../eoGenOp.h" // needs a selector - here random -#include +#include "../eoRandomSelect.h" /** Global crossover operator for ES genotypes. * Uses some Atom crossovers to handle both the object variables diff --git a/eo/src/es/eoEsMutate.h b/eo/src/es/eoEsMutate.h index fd1152685..1b2bd5580 100644 --- a/eo/src/es/eoEsMutate.h +++ b/eo/src/es/eoEsMutate.h @@ -30,14 +30,14 @@ #define _EOESMUTATE_H #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "../eoInit.h" +#include "../eoOp.h" +#include "eoEsMutationInit.h" +#include "eoEsSimple.h" +#include "eoEsStdev.h" +#include "eoEsFull.h" +#include "../utils/eoRealBounds.h" +#include "../utils/eoRNG.h" #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 @@ -158,7 +158,7 @@ public: Diploma Thesis, University of Dortmund, 1990. */ virtual bool operator()( eoEsFull & _eo ) - // Code originally from Thomas Bäck + // Code originally from Thomas B�ck { // First: mutate standard deviations (as for eoEsStdev). double global = TauGlb * rng.normal(); @@ -268,7 +268,7 @@ public: lower bound. The actual value used is somewhat arbitrary and the is no theoretical reasoning known for it (Sep 2005). - The code that we have in EO is a port from a C code that Thomas Bäck kindly + The code that we have in EO is a port from a C code that Thomas B�ck kindly donated to the community some years ago. It has been modified by Marc Schoenauer for inclusion in EvolC, than by Maarten Keijzer into EO. The exact value was adjusted based on practice. diff --git a/eo/src/es/eoEsMutationInit.h b/eo/src/es/eoEsMutationInit.h index 987de86bd..b33dadb20 100644 --- a/eo/src/es/eoEsMutationInit.h +++ b/eo/src/es/eoEsMutationInit.h @@ -27,7 +27,7 @@ #ifndef _eoEsMutationInit_h #define _eoEsMutationInit_h -#include +#include "../utils/eoParser.h" /** Initialize Mutation operator diff --git a/eo/src/es/eoEsSimple.h b/eo/src/es/eoEsSimple.h index ac93ab4b6..812b9936b 100644 --- a/eo/src/es/eoEsSimple.h +++ b/eo/src/es/eoEsSimple.h @@ -23,10 +23,10 @@ Contact: http://eodev.sourceforge.net #ifndef _eoEsSimple_h #define _eoEsSimple_h -#include +#include "../EO.h" #include -#include +#include "../eoVector.h" /** Simple Evolution Strategy diff --git a/eo/src/es/eoEsStandardXover.h b/eo/src/es/eoEsStandardXover.h index 34739693c..ce00a0674 100644 --- a/eo/src/es/eoEsStandardXover.h +++ b/eo/src/es/eoEsStandardXover.h @@ -26,15 +26,15 @@ #ifndef _eoEsLocalXover_H #define _eoEsLocalXover_H -#include +#include "../utils/eoRNG.h" -#include -#include -#include +#include "eoEsSimple.h" +#include "eoEsStdev.h" +#include "eoEsFull.h" -#include +#include "../eoGenOp.h" // needs a selector - here random -#include +#include "../eoRandomSelect.h" /** Standard (i.e. eoBinOp) crossover operator for ES genotypes. * Uses some Atom crossovers to handle both the object variables diff --git a/eo/src/es/eoEsStdev.h b/eo/src/es/eoEsStdev.h index b8910512c..ad8ffb26f 100644 --- a/eo/src/es/eoEsStdev.h +++ b/eo/src/es/eoEsStdev.h @@ -23,7 +23,7 @@ Contact: http://eodev.sourceforge.net #ifndef _eoEsStdev_h #define _eoEsStdev_h -#include +#include "../eoVector.h" /** Evolutionary Strategy with a standard deviation per parameter diff --git a/eo/src/es/eoNormalMutation.h b/eo/src/es/eoNormalMutation.h index fd3916c22..48d09c6d5 100644 --- a/eo/src/es/eoNormalMutation.h +++ b/eo/src/es/eoNormalMutation.h @@ -29,11 +29,11 @@ //----------------------------------------------------------------------------- #include // swap_ranges -#include -#include -#include -#include -#include +#include "../utils/eoRNG.h" +#include "../utils/eoUpdatable.h" +#include "../eoEvalFunc.h" +#include "eoReal.h" +#include "../utils/eoRealBounds.h" //----------------------------------------------------------------------------- /** Simple normal mutation of a std::vector of real values. diff --git a/eo/src/es/eoReal.h b/eo/src/es/eoReal.h index ff1908a0c..dc6d51126 100644 --- a/eo/src/es/eoReal.h +++ b/eo/src/es/eoReal.h @@ -29,7 +29,7 @@ #include // std::ostream, std::istream #include // std::string -#include +#include "../eoVector.h" /** eoReal: implementation of simple real-valued chromosome. * based on eoVector class diff --git a/eo/src/es/eoRealAtomXover.h b/eo/src/es/eoRealAtomXover.h index 4d4244dd2..47e713386 100644 --- a/eo/src/es/eoRealAtomXover.h +++ b/eo/src/es/eoRealAtomXover.h @@ -31,9 +31,9 @@ #ifndef _eoRealAtomXover_H #define _eoRealAtomXover_H -#include +#include "../utils/eoRNG.h" -#include +#include "../eoOp.h" /** Discrete crossover == exchange of values diff --git a/eo/src/es/eoRealInitBounded.h b/eo/src/es/eoRealInitBounded.h index 6488dd056..fa0259ec4 100644 --- a/eo/src/es/eoRealInitBounded.h +++ b/eo/src/es/eoRealInitBounded.h @@ -28,10 +28,10 @@ //----------------------------------------------------------------------------- -#include -#include -#include -#include +#include "../utils/eoRNG.h" +#include "../eoInit.h" +#include "eoReal.h" +#include "../utils/eoRealVectorBounds.h" /** Simple initialization for any EOT that derives from std::vector * uniformly in some bounds diff --git a/eo/src/es/eoRealOp.h b/eo/src/es/eoRealOp.h index c8c6471a5..64b64101d 100644 --- a/eo/src/es/eoRealOp.h +++ b/eo/src/es/eoRealOp.h @@ -29,9 +29,9 @@ //----------------------------------------------------------------------------- #include // swap_ranges -#include -#include -#include +#include "../utils/eoRNG.h" +#include "eoReal.h" +#include "../utils/eoRealVectorBounds.h" //----------------------------------------------------------------------------- diff --git a/eo/src/es/eoSBXcross.h b/eo/src/es/eoSBXcross.h index 40f8ac360..c13369f01 100644 --- a/eo/src/es/eoSBXcross.h +++ b/eo/src/es/eoSBXcross.h @@ -24,11 +24,11 @@ //----------------------------------------------------------------------------- #include // swap_ranges -#include -#include -#include -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoRNG.h" +#include "eoReal.h" +#include "../utils/eoRealBounds.h" +#include "../utils/eoRealVectorBounds.h" diff --git a/eo/src/es/make_algo_scalar_es.cpp b/eo/src/es/make_algo_scalar_es.cpp index 47585a78c..e1bd1fb9d 100644 --- a/eo/src/es/make_algo_scalar_es.cpp +++ b/eo/src/es/make_algo_scalar_es.cpp @@ -41,11 +41,11 @@ */ // The templatized code -#include +#include "../do/make_algo_scalar.h" // the instanciating EOType(s) -#include // one Sigma per individual -#include // one sigmal per object variable -#include // full correlation matrix per indi +#include "eoEsSimple.h" // one Sigma per individual +#include "eoEsStdev.h" // one sigmal per object variable +#include "eoEsFull.h" // full correlation matrix per indi /// The following function merely call the templatized do_* functions above diff --git a/eo/src/es/make_algo_scalar_real.cpp b/eo/src/es/make_algo_scalar_real.cpp index 1a1796bed..fd8fe7dd7 100644 --- a/eo/src/es/make_algo_scalar_real.cpp +++ b/eo/src/es/make_algo_scalar_real.cpp @@ -41,9 +41,9 @@ */ // The templatized code -#include +#include "../do/make_algo_scalar.h" // the instanciating EOType -#include +#include "eoReal.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/es/make_checkpoint_es.cpp b/eo/src/es/make_checkpoint_es.cpp index 12bc78605..3f4329cf4 100644 --- a/eo/src/es/make_checkpoint_es.cpp +++ b/eo/src/es/make_checkpoint_es.cpp @@ -41,11 +41,11 @@ */ // The templatized code -#include +#include "../do/make_checkpoint.h" // the instanciating EOType(s) -#include // one Sigma per individual -#include // one sigmal per object variable -#include // full correlation matrix per indi +#include "eoEsSimple.h" // one Sigma per individual +#include "eoEsStdev.h" // one sigmal per object variable +#include "eoEsFull.h" // full correlation matrix per indi /// The following function merely call the templatized do_* functions diff --git a/eo/src/es/make_checkpoint_real.cpp b/eo/src/es/make_checkpoint_real.cpp index a1cf6d4f3..f73c8a3c4 100644 --- a/eo/src/es/make_checkpoint_real.cpp +++ b/eo/src/es/make_checkpoint_real.cpp @@ -41,9 +41,9 @@ */ // The templatized code -#include +#include "../do/make_checkpoint.h" // the instanciating EOType -#include +#include "eoReal.h" /// The following function merely call the templatized do_* functions diff --git a/eo/src/es/make_continue_es.cpp b/eo/src/es/make_continue_es.cpp index e50167959..f270e0244 100644 --- a/eo/src/es/make_continue_es.cpp +++ b/eo/src/es/make_continue_es.cpp @@ -41,11 +41,11 @@ */ // The templatized code -#include +#include "../do/make_continue.h" // the instanciating EOType(s) -#include // one Sigma per individual -#include // one sigmal per object variable -#include // full correlation matrix per indi +#include "eoEsSimple.h" // one Sigma per individual +#include "eoEsStdev.h" // one sigmal per object variable +#include "eoEsFull.h" // full correlation matrix per indi /// The following function merely call the templatized do_* functions diff --git a/eo/src/es/make_continue_real.cpp b/eo/src/es/make_continue_real.cpp index 060852172..c326bb8d3 100644 --- a/eo/src/es/make_continue_real.cpp +++ b/eo/src/es/make_continue_real.cpp @@ -41,9 +41,9 @@ */ // The templatized code -#include +#include "../do/make_continue.h" // the instanciating EOType -#include +#include "eoReal.h" /// The following function merely call the templatized do_* functions diff --git a/eo/src/es/make_es.h b/eo/src/es/make_es.h index 46a4e23f6..b1a8801a5 100644 --- a/eo/src/es/make_es.h +++ b/eo/src/es/make_es.h @@ -44,23 +44,23 @@ #ifndef es_h #define es_h -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "../eoAlgo.h" +#include "../eoScalarFitness.h" +#include "../utils/eoParser.h" +#include "../eoEvalFuncPtr.h" +#include "../eoEvalFuncCounter.h" +#include "../utils/eoCheckPoint.h" +#include "../eoGenOp.h" +#include "../eoPop.h" +#include "../utils/eoDistance.h" -#include // one Sigma per individual -#include // one sigmal per object variable -#include // full correlation matrix per indi +#include "eoEsSimple.h" // one Sigma per individual +#include "eoEsStdev.h" // one sigmal per object variable +#include "eoEsFull.h" // full correlation matrix per indi // include all similar declaration for eoReal - i.e. real-valued genotyes // without self-adaptation -#include +#include "make_real.h" /** @addtogroup Builders * @{ diff --git a/eo/src/es/make_genotype_es.cpp b/eo/src/es/make_genotype_es.cpp index 41f764cdf..d0861c9fd 100644 --- a/eo/src/es/make_genotype_es.cpp +++ b/eo/src/es/make_genotype_es.cpp @@ -54,7 +54,7 @@ the default ctor of EOT, resulting in most cases in an EOT that is */ // the templatized code (same for real and es here) -#include +#include "make_genotype_real.h" /// The following function merely call the templatized do_* functions diff --git a/eo/src/es/make_genotype_real.cpp b/eo/src/es/make_genotype_real.cpp index d5ad238d4..e34b69598 100644 --- a/eo/src/es/make_genotype_real.cpp +++ b/eo/src/es/make_genotype_real.cpp @@ -53,7 +53,7 @@ */ // the templatized code -#include +#include "make_genotype_real.h" /// The following functions merely call the templatized do_* functions eoRealInitBounded > & make_genotype(eoParser& _parser, diff --git a/eo/src/es/make_genotype_real.h b/eo/src/es/make_genotype_real.h index 6ab62967f..82b07db8f 100644 --- a/eo/src/es/make_genotype_real.h +++ b/eo/src/es/make_genotype_real.h @@ -28,11 +28,11 @@ Contact: http://eodev.sourceforge.net #include #include -#include "es/eoReal.h" -#include "es/eoEsChromInit.h" -#include "utils/eoParser.h" -#include "utils/eoRealVectorBounds.h" -#include "utils/eoState.h" +#include "eoReal.h" +#include "eoEsChromInit.h" +#include "../utils/eoParser.h" +#include "../utils/eoRealVectorBounds.h" +#include "../utils/eoState.h" /** @addtogroup Builders diff --git a/eo/src/es/make_op.h b/eo/src/es/make_op.h index 1c7fe50e7..35767b5df 100644 --- a/eo/src/es/make_op.h +++ b/eo/src/es/make_op.h @@ -28,21 +28,21 @@ #define _make_op_h // the operators -#include -#include -#include -#include +#include "../eoOp.h" +#include "../eoGenOp.h" +#include "../eoCloneOps.h" +#include "../eoOpContainer.h" // combinations of simple eoOps (eoMonOp and eoQuadOp) -#include +#include "../eoProportionalCombinedOp.h" // the specialized Real stuff -#include -#include -#include -#include +#include "eoReal.h" +#include "eoRealInitBounded.h" +#include "eoRealOp.h" +#include "eoNormalMutation.h" // also need the parser and param includes -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /** @addtogroup Builders diff --git a/eo/src/es/make_op_es.cpp b/eo/src/es/make_op_es.cpp index 4dfbacf34..8da5c9fc8 100644 --- a/eo/src/es/make_op_es.cpp +++ b/eo/src/es/make_op_es.cpp @@ -42,7 +42,7 @@ */ // Templatized code -#include +#include "make_op_es.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/es/make_op_es.h b/eo/src/es/make_op_es.h index 00a3373f9..0b78a724f 100644 --- a/eo/src/es/make_op_es.h +++ b/eo/src/es/make_op_es.h @@ -24,24 +24,24 @@ Contact: http://eodev.sourceforge.net #define EO_make_op_h // the operators -#include -#include -#include -#include +#include "../eoOp.h" +#include "../eoGenOp.h" +#include "../eoCloneOps.h" +#include "../eoOpContainer.h" // combinations of simple eoOps (eoMonOp and eoQuadOp) -#include +#include "../eoProportionalCombinedOp.h" // the specialized Real stuff -#include -#include -#include -#include -#include -#include -#include +#include "eoReal.h" +#include "eoRealAtomXover.h" +#include "eoEsChromInit.h" +#include "eoEsMutationInit.h" +#include "eoEsMutate.h" +#include "eoEsGlobalXover.h" +#include "eoEsStandardXover.h" // also need the parser and param includes -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /** @addtogroup Builders diff --git a/eo/src/es/make_op_real.cpp b/eo/src/es/make_op_real.cpp index b429cd411..2748470ec 100644 --- a/eo/src/es/make_op_real.cpp +++ b/eo/src/es/make_op_real.cpp @@ -42,7 +42,7 @@ */ // Templatized code -#include +#include "make_op_real.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/es/make_op_real.h b/eo/src/es/make_op_real.h index 19a8b16b6..198483a5a 100644 --- a/eo/src/es/make_op_real.h +++ b/eo/src/es/make_op_real.h @@ -28,21 +28,21 @@ #define _make_op_h // the operators -#include -#include -#include -#include +#include "../eoOp.h" +#include "../eoGenOp.h" +#include "../eoCloneOps.h" +#include "../eoOpContainer.h" // combinations of simple eoOps (eoMonOp and eoQuadOp) -#include +#include "../eoProportionalCombinedOp.h" // the specialized Real stuff -#include -#include -#include -#include +#include "../es/eoReal.h" +#include "../es/eoEsChromInit.h" +#include "../es/eoRealOp.h" +#include "../es/eoNormalMutation.h" // also need the parser and param includes -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /** @addtogroup Builders diff --git a/eo/src/es/make_pop_es.cpp b/eo/src/es/make_pop_es.cpp index 4f72e3441..a4c17fe04 100644 --- a/eo/src/es/make_pop_es.cpp +++ b/eo/src/es/make_pop_es.cpp @@ -41,11 +41,11 @@ */ // The templatized code -#include +#include "../do/make_pop.h" // the instanciating EOType(s) -#include // one Sigma per individual -#include // one sigmal per object variable -#include // full correlation matrix per indi +#include "eoEsSimple.h" // one Sigma per individual +#include "eoEsStdev.h" // one sigmal per object variable +#include "eoEsFull.h" // full correlation matrix per indi /// The following function merely call the templatized do_* functions above diff --git a/eo/src/es/make_pop_real.cpp b/eo/src/es/make_pop_real.cpp index 968e7251e..cc137f531 100644 --- a/eo/src/es/make_pop_real.cpp +++ b/eo/src/es/make_pop_real.cpp @@ -41,9 +41,9 @@ */ // The templatized code -#include +#include "../do/make_pop.h" // the instanciating EOType -#include +#include "eoReal.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/es/make_real.h b/eo/src/es/make_real.h index bc04ba1f1..0c54b6c39 100644 --- a/eo/src/es/make_real.h +++ b/eo/src/es/make_real.h @@ -44,18 +44,18 @@ #ifndef real_h #define real_h -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "../eoAlgo.h" +#include "../eoScalarFitness.h" +#include "../utils/eoParser.h" +#include "../eoEvalFuncPtr.h" +#include "../eoEvalFuncCounter.h" +#include "../utils/eoCheckPoint.h" +#include "../eoGenOp.h" +#include "../eoPop.h" +#include "../utils/eoDistance.h" -#include -#include +#include "eoRealInitBounded.h" +#include "eoReal.h" //Representation dependent - rewrite everything anew for each representation ////////////////////////// diff --git a/eo/src/es/make_run_es.cpp b/eo/src/es/make_run_es.cpp index 59912a7f8..64b4ad659 100644 --- a/eo/src/es/make_run_es.cpp +++ b/eo/src/es/make_run_es.cpp @@ -41,13 +41,13 @@ */ // The templatized code -#include +#include"../do/make_run.h" // the instanciating EOType(s) -#include // one Sigma per individual -#include // one sigmal per object variable -#include // full correlation matrix per indi +#include "eoEsSimple.h" // one Sigma per individual +#include "eoEsStdev.h" // one sigmal per object variable +#include "eoEsFull.h" // full correlation matrix per indi // the instanciating fitnesses -#include +#include "eoScalarFitness.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/es/make_run_real.cpp b/eo/src/es/make_run_real.cpp index 2c61963c6..ee6732773 100644 --- a/eo/src/es/make_run_real.cpp +++ b/eo/src/es/make_run_real.cpp @@ -41,11 +41,11 @@ */ // The templatized code -#include +#include "../do/make_run.h" // the instanciating EOType -#include +#include "eoReal.h" // the instanciating fitnesses -#include +#include "../eoScalarFitness.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/ga.h b/eo/src/ga.h index 6abb0181a..2f20dc879 100644 --- a/eo/src/ga.h +++ b/eo/src/ga.h @@ -30,10 +30,10 @@ #define _ga_h // all bitstring-specific files -#include +#include "ga/eoBit.h" // the operators -#include +#include "ga/eoBitOp.h" // #include to be corrected - thanks someone! diff --git a/eo/src/ga/ChangeLog b/eo/src/ga/ChangeLog index 56ed12d06..b8ba4afa0 100644 --- a/eo/src/ga/ChangeLog +++ b/eo/src/ga/ChangeLog @@ -1,4 +1,8 @@ -2007-08-21 Jochen Küpper +2019-06-29 Ronaldd Pinho + + * all files: Change from absolute to relative include. + +2007-08-21 Jochen K�pper * eoBitOp.h (eoNPtsBitXover::operator()): Make sure bit is within allocated length of vector points: [0, max_size). diff --git a/eo/src/ga/eoBit.h b/eo/src/ga/eoBit.h index c1bc9c75e..040e57418 100644 --- a/eo/src/ga/eoBit.h +++ b/eo/src/ga/eoBit.h @@ -40,7 +40,7 @@ #include #include -#include "eoVector.h" +#include "../eoVector.h" /** @defgroup bitstring Bit strings diff --git a/eo/src/ga/eoBitOp.h b/eo/src/ga/eoBitOp.h index 15d77434d..a95ec58f4 100644 --- a/eo/src/ga/eoBitOp.h +++ b/eo/src/ga/eoBitOp.h @@ -30,10 +30,10 @@ //----------------------------------------------------------------------------- -#include // swap_ranges -#include -#include // eoMonOp -#include +#include // swap_ranges +#include "../utils/eoRNG.h" +#include "../eoInit.h" // eoMonOp +#include "eoBit.h" /** eoOneBitFlip --> changes 1 bit diff --git a/eo/src/ga/eoBitOpFactory.h b/eo/src/ga/eoBitOpFactory.h index 6511f9375..91168d3e5 100644 --- a/eo/src/ga/eoBitOpFactory.h +++ b/eo/src/ga/eoBitOpFactory.h @@ -26,8 +26,8 @@ #ifndef _EOBITOPFACTORY_H #define _EOBITOPFACTORY_H -#include -#include +#include "../eoFactory.h" +#include "eoBitOp.h" //----------------------------------------------------------------------------- diff --git a/eo/src/ga/eoBoolFlip.h b/eo/src/ga/eoBoolFlip.h index 47c43ee06..119952863 100644 --- a/eo/src/ga/eoBoolFlip.h +++ b/eo/src/ga/eoBoolFlip.h @@ -25,7 +25,7 @@ #ifndef _eoBoolFlip_h #define _eoBoolFlip_h -#include +#include "../eoOp.h" /** a simple boolean mutation - to be used in generic eoOp's * diff --git a/eo/src/ga/eoPBILAdditive.h b/eo/src/ga/eoPBILAdditive.h index e57a05a2b..2f3aea944 100644 --- a/eo/src/ga/eoPBILAdditive.h +++ b/eo/src/ga/eoPBILAdditive.h @@ -26,8 +26,8 @@ #ifndef _eoPBILAdditive_H #define _eoPBILAdditive_H -#include -#include +#include "../eoDistribUpdater.h" +#include "eoPBILDistrib.h" /** * Distribution Class for PBIL algorithm diff --git a/eo/src/ga/eoPBILDistrib.h b/eo/src/ga/eoPBILDistrib.h index 56556ba05..f85c143b5 100644 --- a/eo/src/ga/eoPBILDistrib.h +++ b/eo/src/ga/eoPBILDistrib.h @@ -25,7 +25,7 @@ #ifndef _eoPBILDistrib_H #define _eoPBILDistrib_H -#include +#include "../eoDistribution.h" /** * Distribution Class for PBIL algorithm diff --git a/eo/src/ga/eoPBILOrg.h b/eo/src/ga/eoPBILOrg.h index 45b95c843..865d95727 100644 --- a/eo/src/ga/eoPBILOrg.h +++ b/eo/src/ga/eoPBILOrg.h @@ -26,8 +26,8 @@ #ifndef _eoPBILOrg_H #define _eoPBILOrg_H -#include -#include +#include "eoDistribUpdater.h" +#include "../eoPBILDistrib.h" /** * Distribution Class for PBIL algorithm diff --git a/eo/src/ga/make_PBILdistrib.h b/eo/src/ga/make_PBILdistrib.h index b3c725d6d..cef9765f5 100644 --- a/eo/src/ga/make_PBILdistrib.h +++ b/eo/src/ga/make_PBILdistrib.h @@ -27,10 +27,10 @@ #define _make_PBILdistrib_h #include // for time(0) for random seeding -#include -#include -#include -#include +#include "eoPBILOrg.h" +#include "../utils/eoRNG.h" +#include "../utils/eoParser.h" +#include "../utils/eoState.h" //////////////////////////DISTRIB CONSTRUCTION /////////////////////////////// diff --git a/eo/src/ga/make_PBILupdate.h b/eo/src/ga/make_PBILupdate.h index a8572136d..34a062a96 100644 --- a/eo/src/ga/make_PBILupdate.h +++ b/eo/src/ga/make_PBILupdate.h @@ -26,10 +26,10 @@ #ifndef _make_PBILupdate_h #define _make_PBILupdate_h -#include -#include -#include -#include +#include "eoPBILOrg.h" +#include "../utils/eoRNG.h" +#include "../utils/eoParser.h" +#include "../utils/eoState.h" ///////CONSTRUCTION of PBIL distribution updaters///////////////// diff --git a/eo/src/ga/make_algo_scalar_ga.cpp b/eo/src/ga/make_algo_scalar_ga.cpp index 631e6dadf..df8926c88 100644 --- a/eo/src/ga/make_algo_scalar_ga.cpp +++ b/eo/src/ga/make_algo_scalar_ga.cpp @@ -44,9 +44,9 @@ */ // The templatized code -#include +#include "../do/make_algo_scalar.h" // the instanciating EOType -#include +#include "eoBit.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/ga/make_checkpoint_ga.cpp b/eo/src/ga/make_checkpoint_ga.cpp index eecc40caa..ffd0c54cf 100644 --- a/eo/src/ga/make_checkpoint_ga.cpp +++ b/eo/src/ga/make_checkpoint_ga.cpp @@ -44,9 +44,9 @@ */ // The templatized code -#include +#include "../do/make_checkpoint.h" // the instanciating EOType -#include +#include "eoBit.h" /// The following function merely call the templatized do_* functions diff --git a/eo/src/ga/make_continue_ga.cpp b/eo/src/ga/make_continue_ga.cpp index fb4662c32..b2c9a60ee 100644 --- a/eo/src/ga/make_continue_ga.cpp +++ b/eo/src/ga/make_continue_ga.cpp @@ -44,9 +44,9 @@ */ // The templatized code -#include +#include "../do/make_continue.h" // the instanciating EOType -#include +#include "eoBit.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/ga/make_ga.h b/eo/src/ga/make_ga.h index 206094881..6feacb6e2 100644 --- a/eo/src/ga/make_ga.h +++ b/eo/src/ga/make_ga.h @@ -38,16 +38,16 @@ #ifndef ga_h #define ga_h -#include -#include -#include -#include -#include -#include -#include -#include +#include "../eoAlgo.h" +#include "../eoScalarFitness.h" +#include "../utils/eoParser.h" +#include "../eoEvalFuncCounter.h" +#include "../utils/eoCheckPoint.h" +#include "../eoGenOp.h" +#include "../eoPop.h" +#include "../utils/eoDistance.h" -#include +#include "eoBit.h" //Representation dependent - rewrite everything anew for each representation ////////////////////////// diff --git a/eo/src/ga/make_genotype_ga.cpp b/eo/src/ga/make_genotype_ga.cpp index 3344a8d87..013f416c9 100644 --- a/eo/src/ga/make_genotype_ga.cpp +++ b/eo/src/ga/make_genotype_ga.cpp @@ -41,7 +41,7 @@ */ // the templatized code -#include +#include "make_genotype_ga.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/ga/make_genotype_ga.h b/eo/src/ga/make_genotype_ga.h index fad4f7563..93cab894d 100644 --- a/eo/src/ga/make_genotype_ga.h +++ b/eo/src/ga/make_genotype_ga.h @@ -27,11 +27,11 @@ #ifndef _make_genotype_h #define _make_genotype_h -#include -#include +#include "eoBit.h" +#include "../eoInit.h" // also need the parser and param includes -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /////////////////// the bitstring //////////////// diff --git a/eo/src/ga/make_op.h b/eo/src/ga/make_op.h index 2035a4f85..b8993f312 100644 --- a/eo/src/ga/make_op.h +++ b/eo/src/ga/make_op.h @@ -28,19 +28,19 @@ #define _make_op_h // the operators -#include -#include -#include -#include +#include "../eoOp.h" +#include "../eoGenOp.h" +#include "../eoCloneOps.h" +#include "../eoOpContainer.h" // combinations of simple eoOps (eoMonOp and eoQuadOp) -#include +#include "../eoProportionalCombinedOp.h" // the specialized GA stuff -#include -#include +#include "eoBit.h" +#include "eoBitOp.h" // also need the parser and param includes -#include -#include +#include "../utils/eoParser.h" +#include "../utils/eoState.h" /////////////////// bitstring operators /////////////// diff --git a/eo/src/ga/make_op_ga.cpp b/eo/src/ga/make_op_ga.cpp index e3a53d651..249b002a3 100644 --- a/eo/src/ga/make_op_ga.cpp +++ b/eo/src/ga/make_op_ga.cpp @@ -44,7 +44,7 @@ */ // Templatized code -#include +#include "make_op.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/ga/make_pop_ga.cpp b/eo/src/ga/make_pop_ga.cpp index 319279793..1ec32f6b5 100644 --- a/eo/src/ga/make_pop_ga.cpp +++ b/eo/src/ga/make_pop_ga.cpp @@ -42,9 +42,9 @@ */ // The templatized code -#include +#include "../do/make_pop.h" // the instanciating EOType -#include +#include "eoBit.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/ga/make_run_ga.cpp b/eo/src/ga/make_run_ga.cpp index d64d2b025..f9284b80f 100644 --- a/eo/src/ga/make_run_ga.cpp +++ b/eo/src/ga/make_run_ga.cpp @@ -44,11 +44,11 @@ */ // The templatized code -#include +#include "../do/make_run.h" // the instanciating EOType -#include +#include "eoBit.h" // the instanciating fitnesses -#include +#include "../eoScalarFitness.h" /// The following function merely call the templatized do_* functions above diff --git a/eo/src/gp/eoParseTree.h b/eo/src/gp/eoParseTree.h index 88737d919..666445fa3 100644 --- a/eo/src/gp/eoParseTree.h +++ b/eo/src/gp/eoParseTree.h @@ -30,10 +30,10 @@ #include #include -#include -#include -#include -#include +#include "../EO.h" +#include "../eoInit.h" +#include "../eoOp.h" +#include "parse_tree.h" using namespace gp_parse_tree; diff --git a/eo/src/gp/eoParseTreeDepthInit.h b/eo/src/gp/eoParseTreeDepthInit.h index 18dc55b91..6abe2e4ff 100644 --- a/eo/src/gp/eoParseTreeDepthInit.h +++ b/eo/src/gp/eoParseTreeDepthInit.h @@ -28,11 +28,11 @@ #ifndef eoParseTreeDepthInit_h #define eoParseTreeDepthInit_h -#include -#include -#include -#include -#include +#include "../EO.h" +#include "eoParseTree.h" +#include "eoInit.h" +#include "eoOp.h" +#include "eoPop.h" using namespace gp_parse_tree; diff --git a/eo/src/gp/eoParseTreeOp.h b/eo/src/gp/eoParseTreeOp.h index 0b623f3d8..37511963b 100644 --- a/eo/src/gp/eoParseTreeOp.h +++ b/eo/src/gp/eoParseTreeOp.h @@ -29,10 +29,10 @@ #ifndef eoParseTreeOp_h #define eoParseTreeOp_h -#include -#include +#include "../EO.h" +#include "../eoOp.h" -#include +#include "eoParseTree.h" /** eoSubtreeXOver --> subtree xover \class eoSubtreeXOver eoParseTreeOp.h gp/eoParseTreeOp.h diff --git a/eo/src/gp/eoStParseTreeDepthInit.h b/eo/src/gp/eoStParseTreeDepthInit.h index 37b178873..aa7247dd8 100644 --- a/eo/src/gp/eoStParseTreeDepthInit.h +++ b/eo/src/gp/eoStParseTreeDepthInit.h @@ -27,10 +27,10 @@ #ifndef eoStParseTreeDepthInit_h #define eoStParseTreeDepthInit_h -#include -#include -#include -#include +#include "../EO.h" +#include "eoParseTree.h" +#include "../eoInit.h" +#include "../eoOp.h" #include diff --git a/eo/src/gp/eoStParseTreeOp.h b/eo/src/gp/eoStParseTreeOp.h index 88020448d..d5b520beb 100644 --- a/eo/src/gp/eoStParseTreeOp.h +++ b/eo/src/gp/eoStParseTreeOp.h @@ -28,13 +28,13 @@ #ifndef eoStParseTreeOp_h #define eoStParseTreeOp_h -#include -#include +#include "../EO.h" +#include "../eoOp.h" #include #include #include -#include +#include "eoParseTree.h" // a help function template diff --git a/eo/src/mpi/eoMpi.h b/eo/src/mpi/eoMpi.h index a47ce8a33..0bef5fea8 100644 --- a/eo/src/mpi/eoMpi.h +++ b/eo/src/mpi/eoMpi.h @@ -24,10 +24,10 @@ Authors: # include // std::vector -# include -# include -# include -# include +# include "../utils/eoLogger.h" +# include "../utils/eoTimer.h" +# include "../eoFunctor.h" +# include "../eoExceptions.h" # include "eoMpiNode.h" # include "eoMpiAssignmentAlgorithm.h" diff --git a/eo/src/mpi/eoMpiNode.cpp b/eo/src/mpi/eoMpiNode.cpp index 69f06576b..ba6424bc4 100644 --- a/eo/src/mpi/eoMpiNode.cpp +++ b/eo/src/mpi/eoMpiNode.cpp @@ -19,7 +19,7 @@ Contact: http://eodev.sourceforge.net Authors: Benjamin Bouvier */ -# include "eoMpiNode.h" +#include "eoMpiNode.h" namespace eo { diff --git a/eo/src/mpi/eoMultiStart.h b/eo/src/mpi/eoMultiStart.h index 23a8cc04a..71e084bb4 100644 --- a/eo/src/mpi/eoMultiStart.h +++ b/eo/src/mpi/eoMultiStart.h @@ -1,7 +1,7 @@ # ifndef __EO_MULTISTART_H__ # define __EO_MULTISTART_H__ -# include +# include "../eo" # include "eoMpi.h" /** diff --git a/eo/src/mpi/eoParallelApply.h b/eo/src/mpi/eoParallelApply.h index 671c3843f..dfb66e027 100644 --- a/eo/src/mpi/eoParallelApply.h +++ b/eo/src/mpi/eoParallelApply.h @@ -24,7 +24,7 @@ Authors: # include "eoMpi.h" -# include // eoUF +# include "../eoFunctor.h" // eoUF # include // std::vector population /** diff --git a/eo/src/mpi/eoTerminateJob.h b/eo/src/mpi/eoTerminateJob.h index fe231f0e3..2f299916b 100644 --- a/eo/src/mpi/eoTerminateJob.h +++ b/eo/src/mpi/eoTerminateJob.h @@ -19,10 +19,10 @@ Contact: http://eodev.sourceforge.net Authors: Benjamin Bouvier */ -# ifndef __EO_TERMINATE_H__ -# define __EO_TERMINATE_H__ +#ifndef __EO_TERMINATE_H__ +#define __EO_TERMINATE_H__ -# include "eoMpi.h" +#include "eoMpi.h" namespace eo { diff --git a/eo/src/mpi/implMpi.cpp b/eo/src/mpi/implMpi.cpp index 6ae0c0996..16b9ea2ce 100644 --- a/eo/src/mpi/implMpi.cpp +++ b/eo/src/mpi/implMpi.cpp @@ -19,7 +19,7 @@ Contact: http://eodev.sourceforge.net Authors: Benjamin Bouvier */ -# include "implMpi.h" +#include "implMpi.h" namespace mpi { diff --git a/eo/src/mpi/implMpi.h b/eo/src/mpi/implMpi.h index b7c1cd4ba..c55cff6f8 100644 --- a/eo/src/mpi/implMpi.h +++ b/eo/src/mpi/implMpi.h @@ -19,11 +19,11 @@ Contact: http://eodev.sourceforge.net Authors: Benjamin Bouvier */ -# ifndef __EO_IMPL_MPI_HPP__ -# define __EO_IMPL_MPI_HPP__ +#ifndef __EO_IMPL_MPI_HPP__ +#define __EO_IMPL_MPI_HPP__ -# include -# include +#include "eoMpi.h" +#include "../serial/eoSerial.h" /** * This namespace contains reimplementations of some parts of the Boost::MPI API in C++, so as to be used in diff --git a/eo/src/other/eoExternalEO.h b/eo/src/other/eoExternalEO.h index 4440b428f..cb37206b8 100644 --- a/eo/src/other/eoExternalEO.h +++ b/eo/src/other/eoExternalEO.h @@ -26,7 +26,7 @@ #ifndef eoExternalEO_h #define eoExternalEO_h -#include // EO +#include "../EO.h" // EO /** * Definition of an object that allows an external struct diff --git a/eo/src/other/eoExternalOpFunctions.h b/eo/src/other/eoExternalOpFunctions.h index d86b49c45..75455f079 100644 --- a/eo/src/other/eoExternalOpFunctions.h +++ b/eo/src/other/eoExternalOpFunctions.h @@ -28,10 +28,10 @@ #ifndef eoExternalOpFunc_h #define eoExternalOpFunc_h -#include -#include -#include -#include +#include "eoExternalEO.h" +#include "../eoOp.h" +#include "../eoInit.h" +#include "../eoEvalFunc.h" /** Initialization of external struct, ctor expects a function of the following diff --git a/eo/src/other/eoString.h b/eo/src/other/eoString.h index 3071d1ee6..2fff076ee 100644 --- a/eo/src/other/eoString.h +++ b/eo/src/other/eoString.h @@ -30,8 +30,7 @@ #include #include - -#include +#include "../EO.h" //----------------------------------------------------------------------------- // eoString diff --git a/eo/src/other/external_eo b/eo/src/other/external_eo index aeaaaab6b..449053a05 100644 --- a/eo/src/other/external_eo +++ b/eo/src/other/external_eo @@ -1,2 +1,2 @@ -#include -#include +#include "eoExternalEO.h" +#include "eoExternalOpFunctions.h" diff --git a/eo/src/pyeo/PyEO.cpp b/eo/src/pyeo/PyEO.cpp index 7c3f1b93f..8517c9aad 100644 --- a/eo/src/pyeo/PyEO.cpp +++ b/eo/src/pyeo/PyEO.cpp @@ -21,7 +21,7 @@ #include #include "PyEO.h" -#include +#include "../eoPop.h" using namespace std; //using namespace boost::python; diff --git a/eo/src/pyeo/PyEO.h b/eo/src/pyeo/PyEO.h index 188b7f8da..e9452800e 100644 --- a/eo/src/pyeo/PyEO.h +++ b/eo/src/pyeo/PyEO.h @@ -26,7 +26,7 @@ #include #include -#include +#include "../EO.h" struct index_error : public std::exception { diff --git a/eo/src/pyeo/abstract1.cpp b/eo/src/pyeo/abstract1.cpp index 43c0dadb9..bb9097967 100644 --- a/eo/src/pyeo/abstract1.cpp +++ b/eo/src/pyeo/abstract1.cpp @@ -18,11 +18,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include +#include "../eoEvalFunc.h" +#include "../eoInit.h" +#include "../eoTransform.h" +#include "../eoSGATransform.h" +#include "../eoPopEvalFunc.h" #include "PyEO.h" #include "def_abstract_functor.h" diff --git a/eo/src/pyeo/algos.cpp b/eo/src/pyeo/algos.cpp index caa2fcd33..c95fc3319 100644 --- a/eo/src/pyeo/algos.cpp +++ b/eo/src/pyeo/algos.cpp @@ -18,10 +18,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include +#include "../eoSGA.h" +#include "../eoEasyEA.h" +#include "../eoDetSelect.h" +#include "../eoCellularEasyEA.h" #include "PyEO.h" #include "def_abstract_functor.h" diff --git a/eo/src/pyeo/breeders.cpp b/eo/src/pyeo/breeders.cpp index c66b6bccd..2adc55e16 100644 --- a/eo/src/pyeo/breeders.cpp +++ b/eo/src/pyeo/breeders.cpp @@ -18,9 +18,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include +#include "../eoBreed.h" +#include "../eoGeneralBreeder.h" +#include "../eoOneToOneBreeder.h" #include "PyEO.h" #include "def_abstract_functor.h" diff --git a/eo/src/pyeo/continuators.cpp b/eo/src/pyeo/continuators.cpp index d31613d2c..4d787a09a 100644 --- a/eo/src/pyeo/continuators.cpp +++ b/eo/src/pyeo/continuators.cpp @@ -18,13 +18,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include +#include "../eoGenContinue.h" +#include "../eoCombinedContinue.h" +#include "../eoEvalContinue.h" +#include "../eoFitContinue.h" +#include "../eoSteadyFitContinue.h" +#include "../utils/eoCheckPoint.h" +#include "../utils/eoStat.h" #include "PyEO.h" #include "def_abstract_functor.h" diff --git a/eo/src/pyeo/def_abstract_functor.h b/eo/src/pyeo/def_abstract_functor.h index 4c3101dfd..5bba6cb3d 100644 --- a/eo/src/pyeo/def_abstract_functor.h +++ b/eo/src/pyeo/def_abstract_functor.h @@ -21,7 +21,7 @@ #ifndef MAKE_ABSTRACT_FUNCTOR_H #define MAKE_ABSTRACT_FUNCTOR_H -#include +#include "../eoFunctor.h" // DEFINES for call #define WC1 boost::python::with_custodian_and_ward<1,2>() diff --git a/eo/src/pyeo/geneticOps.cpp b/eo/src/pyeo/geneticOps.cpp index 40617680e..a67108576 100644 --- a/eo/src/pyeo/geneticOps.cpp +++ b/eo/src/pyeo/geneticOps.cpp @@ -18,11 +18,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include +#include "../eoGenOp.h" +#include "../eoOp.h" +#include "../eoCloneOps.h" +#include "../eoPopulator.h" +#include "../eoOpContainer.h" #include "PyEO.h" #include "def_abstract_functor.h" diff --git a/eo/src/pyeo/mergers.cpp b/eo/src/pyeo/mergers.cpp index f41af0490..84e0970ba 100644 --- a/eo/src/pyeo/mergers.cpp +++ b/eo/src/pyeo/mergers.cpp @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include "../eoMerge.h" #include "PyEO.h" #include "def_abstract_functor.h" diff --git a/eo/src/pyeo/monitors.cpp b/eo/src/pyeo/monitors.cpp index 02d011d89..f64881659 100644 --- a/eo/src/pyeo/monitors.cpp +++ b/eo/src/pyeo/monitors.cpp @@ -18,8 +18,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include +#include "../utils/eoParam.h" +#include "../utils/eoMonitor.h" #include "PyEO.h" using namespace boost::python; diff --git a/eo/src/pyeo/perf2worth.cpp b/eo/src/pyeo/perf2worth.cpp index a257b0cd9..3c6cc0f04 100644 --- a/eo/src/pyeo/perf2worth.cpp +++ b/eo/src/pyeo/perf2worth.cpp @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include "../eoNDSorting.h" #include "PyEO.h" diff --git a/eo/src/pyeo/random_numbers.cpp b/eo/src/pyeo/random_numbers.cpp index c9047385d..01bb883b4 100644 --- a/eo/src/pyeo/random_numbers.cpp +++ b/eo/src/pyeo/random_numbers.cpp @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include "../utils/eoRNG.h" #include using namespace boost::python; diff --git a/eo/src/pyeo/reduce.cpp b/eo/src/pyeo/reduce.cpp index 6c9b78c64..031ff282a 100644 --- a/eo/src/pyeo/reduce.cpp +++ b/eo/src/pyeo/reduce.cpp @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include "../eoReduce.h" #include "PyEO.h" diff --git a/eo/src/pyeo/replacement.cpp b/eo/src/pyeo/replacement.cpp index eb1bc5d70..f85e4759b 100644 --- a/eo/src/pyeo/replacement.cpp +++ b/eo/src/pyeo/replacement.cpp @@ -18,11 +18,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include +#include "../eoReplacement.h" +#include "../eoMergeReduce.h" +#include "../eoReduceMerge.h" +#include "../eoReduceMergeReduce.h" +#include "../eoMGGReplacement.h" #include "PyEO.h" #include "def_abstract_functor.h" diff --git a/eo/src/pyeo/selectOne.cpp b/eo/src/pyeo/selectOne.cpp index 5a28fcff3..1adb7d15a 100644 --- a/eo/src/pyeo/selectOne.cpp +++ b/eo/src/pyeo/selectOne.cpp @@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include +#include "../eoSelectOne.h" +#include "../eoDetTournamentSelect.h" +#include "../eoRandomSelect.h" +#include "../eoStochTournamentSelect.h" +#include "../eoTruncatedSelectOne.h" +#include "../eoSequentialSelect.h" #include "PyEO.h" #include "pickle.h" diff --git a/eo/src/pyeo/selectors.cpp b/eo/src/pyeo/selectors.cpp index 7c8f4096a..23ce85ccd 100644 --- a/eo/src/pyeo/selectors.cpp +++ b/eo/src/pyeo/selectors.cpp @@ -18,13 +18,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include +#include "../eoSelect.h" +#include "../eoDetSelect.h" +#include "../eoSelectMany.h" +#include "../eoSelectNumber.h" +#include "../eoSelectPerc.h" +#include "../eoTruncSelect.h" +#include "../eoTruncatedSelectMany.h" #include "PyEO.h" #include "def_abstract_functor.h" diff --git a/eo/src/pyeo/statistics.cpp b/eo/src/pyeo/statistics.cpp index fbad92694..e48b6f2fa 100644 --- a/eo/src/pyeo/statistics.cpp +++ b/eo/src/pyeo/statistics.cpp @@ -1,4 +1,4 @@ -#include +#include "../utils/eoStat.h" #include "PyEO.h" #include "valueParam.h" diff --git a/eo/src/pyeo/valueParam.cpp b/eo/src/pyeo/valueParam.cpp index 59ed1a472..6e4b06218 100644 --- a/eo/src/pyeo/valueParam.cpp +++ b/eo/src/pyeo/valueParam.cpp @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include +#include "../utils/eoParam.h" #include // Here's 'len'. Why? dunno diff --git a/eo/src/utils/checkpointing b/eo/src/utils/checkpointing index f7fd0e55b..68c0c8856 100644 --- a/eo/src/utils/checkpointing +++ b/eo/src/utils/checkpointing @@ -24,27 +24,27 @@ #ifndef _CHECKPOINTING_ #define _CHECKPOINTING_ -#include -#include -#include -#include -#include -#include -#include +#include "eoParser.h" +#include "eoState.h" +#include "eoUpdater.h" +#include "eoMonitor.h" +#include "eoFileMonitor.h" +#include "eoStdoutMonitor.h" +#include "eoOStreamMonitor.h" #ifndef _MSC_VER -#include -#include +#include "eoGnuplot1DMonitor.h" +#include "eoGnuplot1DSnapshot.h" #endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "eoCheckPoint.h" +#include "eoSignal.h" +#include "eoStat.h" +#include "eoScalarFitnessStat.h" +#include "eoAssembledFitnessStat.h" +#include "eoFDCStat.h" +#include "eoMOFitnessStat.h" +#include "eoPopStat.h" +#include "eoTimeCounter.h" +#include "eoGenCounter.h" // and make_help - any better suggestion to include it? void make_help(eoParser & _parser); diff --git a/eo/src/utils/eoAssembledFitnessStat.h b/eo/src/utils/eoAssembledFitnessStat.h index 44586932b..43e922f3f 100644 --- a/eo/src/utils/eoAssembledFitnessStat.h +++ b/eo/src/utils/eoAssembledFitnessStat.h @@ -33,8 +33,8 @@ #ifndef _eoAssembledFitnessStat_h #define _eoAssembledFitnessStat_h -#include -#include +#include "eoStat.h" +#include "../eoScalarFitnessAssembled.h" /** @addtogroup Stats * @{ diff --git a/eo/src/utils/eoCheckPoint.h b/eo/src/utils/eoCheckPoint.h index ea562e8bf..ba540bf66 100644 --- a/eo/src/utils/eoCheckPoint.h +++ b/eo/src/utils/eoCheckPoint.h @@ -27,10 +27,10 @@ #ifndef _eoCheckPoint_h #define _eoCheckPoint_h -#include -#include -#include -#include +#include "../eoContinue.h" +#include "eoUpdater.h" +#include "eoMonitor.h" +#include "eoStat.h" /** @defgroup Checkpoints Checkpointing * diff --git a/eo/src/utils/eoDistance.h b/eo/src/utils/eoDistance.h index 35ce9a109..661b5f7cb 100644 --- a/eo/src/utils/eoDistance.h +++ b/eo/src/utils/eoDistance.h @@ -26,7 +26,7 @@ #ifndef _eoDistance_H #define _eoDistance_H -#include +#include "../eoFunctor.h" /** @addtogroup Stats * @{ diff --git a/eo/src/utils/eoFDCStat.h b/eo/src/utils/eoFDCStat.h index 1d2050b78..b8536db53 100644 --- a/eo/src/utils/eoFDCStat.h +++ b/eo/src/utils/eoFDCStat.h @@ -27,9 +27,9 @@ #ifndef _eoFDCStat_h #define _eoFDCStat_h -#include -#include -#include +#include "eoStat.h" +#include "eoDistance.h" +#include "eoFileSnapshot.h" /** The Fitness Distance Correlation computation. diff --git a/eo/src/utils/eoFileMonitor.cpp b/eo/src/utils/eoFileMonitor.cpp index 80b7afaff..e1e58ba21 100644 --- a/eo/src/utils/eoFileMonitor.cpp +++ b/eo/src/utils/eoFileMonitor.cpp @@ -7,9 +7,9 @@ #include #include -#include -#include -#include +#include "eoFileMonitor.h" +#include "compatibility.h" +#include "eoParam.h" using namespace std; diff --git a/eo/src/utils/eoFileMonitor.h b/eo/src/utils/eoFileMonitor.h index dcd48e4c4..0d23dcbf5 100644 --- a/eo/src/utils/eoFileMonitor.h +++ b/eo/src/utils/eoFileMonitor.h @@ -31,8 +31,8 @@ #include #include -#include "utils/eoMonitor.h" -#include "eoObject.h" +#include "eoMonitor.h" +#include "../eoObject.h" /** Prints statistics to file diff --git a/eo/src/utils/eoFileSnapshot.h b/eo/src/utils/eoFileSnapshot.h index cdd2e36cc..c474a9293 100644 --- a/eo/src/utils/eoFileSnapshot.h +++ b/eo/src/utils/eoFileSnapshot.h @@ -29,9 +29,9 @@ #include #include -#include -#include -#include +#include "eoParam.h" +#include "eoMonitor.h" +#include "../eoObject.h" /** diff --git a/eo/src/utils/eoFuncPtrStat.h b/eo/src/utils/eoFuncPtrStat.h index c77281577..b97e53105 100644 --- a/eo/src/utils/eoFuncPtrStat.h +++ b/eo/src/utils/eoFuncPtrStat.h @@ -1,8 +1,8 @@ #ifndef eoFuncPtrStat_h #define eoFuncPtrStat_h -#include -#include +#include "../eoFunctorStore.h" +#include "eoStat.h" diff --git a/eo/src/utils/eoGenCounter.h b/eo/src/utils/eoGenCounter.h index a06949c21..1ac9b8719 100644 --- a/eo/src/utils/eoGenCounter.h +++ b/eo/src/utils/eoGenCounter.h @@ -22,7 +22,7 @@ #define _eoGenCounter_h #include -#include +#include "eoStat.h" /** An eoStat that simply gives the current generation index diff --git a/eo/src/utils/eoGnuplot1DMonitor.cpp b/eo/src/utils/eoGnuplot1DMonitor.cpp index c0cff842c..ab54b1132 100644 --- a/eo/src/utils/eoGnuplot1DMonitor.cpp +++ b/eo/src/utils/eoGnuplot1DMonitor.cpp @@ -29,8 +29,8 @@ #include -#include "utils/eoGnuplot1DMonitor.h" -#include "utils/eoParam.h" +#include "eoGnuplot1DMonitor.h" +#include "eoParam.h" eoMonitor& eoGnuplot1DMonitor::operator() (void) diff --git a/eo/src/utils/eoGnuplot1DMonitor.h b/eo/src/utils/eoGnuplot1DMonitor.h index e32e22275..0d1dc8b37 100644 --- a/eo/src/utils/eoGnuplot1DMonitor.h +++ b/eo/src/utils/eoGnuplot1DMonitor.h @@ -27,10 +27,10 @@ #include #include -#include "eoObject.h" -#include "utils/eoFileMonitor.h" -#include "utils/eoGnuplot.h" -#include "utils/pipecom.h" +#include "../eoObject.h" +#include "eoFileMonitor.h" +#include "eoGnuplot.h" +#include "pipecom.h" /** Plot eoStat diff --git a/eo/src/utils/eoGnuplot1DSnapshot.h b/eo/src/utils/eoGnuplot1DSnapshot.h index 38c5af745..10519e26e 100644 --- a/eo/src/utils/eoGnuplot1DSnapshot.h +++ b/eo/src/utils/eoGnuplot1DSnapshot.h @@ -32,11 +32,11 @@ #include #include -#include +#include "../eoObject.h" #include "eoRealVectorBounds.h" -#include -#include -#include +#include "pipecom.h" +#include "eoFileSnapshot.h" +#include "eoGnuplot.h" /** Plot stats through gnuplot diff --git a/eo/src/utils/eoHowMany.h b/eo/src/utils/eoHowMany.h index 1105f3b73..bb47417a1 100644 --- a/eo/src/utils/eoHowMany.h +++ b/eo/src/utils/eoHowMany.h @@ -31,7 +31,7 @@ Contact: http://eodev.sourceforge.net #include -#include +#include "eoLogger.h" /** A helper class, to determine a number of individuals from another one diff --git a/eo/src/utils/eoIntBounds.h b/eo/src/utils/eoIntBounds.h index 2127c92f7..924d0e022 100644 --- a/eo/src/utils/eoIntBounds.h +++ b/eo/src/utils/eoIntBounds.h @@ -28,7 +28,7 @@ #define _eoIntBounds_h #include // std::exceptions! -#include +#include "eoRNG.h" /** \class eoIntBounds eoIntBounds.h es/eoIntBounds.h diff --git a/eo/src/utils/eoLogger.h b/eo/src/utils/eoLogger.h index 9ac1c2115..a3c377fed 100644 --- a/eo/src/utils/eoLogger.h +++ b/eo/src/utils/eoLogger.h @@ -92,7 +92,7 @@ Caner Candan #include #include -#include "eoObject.h" +#include "../eoObject.h" #include "eoParser.h" namespace eo diff --git a/eo/src/utils/eoMOFitnessStat.h b/eo/src/utils/eoMOFitnessStat.h index 8e1b2d3fd..3f7b14d00 100644 --- a/eo/src/utils/eoMOFitnessStat.h +++ b/eo/src/utils/eoMOFitnessStat.h @@ -27,7 +27,7 @@ #ifndef _eoFitnessStat_h #define _eoFitnessStat_h -#include +#include "eoStat.h" /** The fitnesses of a whole population, as a vector diff --git a/eo/src/utils/eoMonitor.h b/eo/src/utils/eoMonitor.h index 1c92e9c00..0a00f9ead 100644 --- a/eo/src/utils/eoMonitor.h +++ b/eo/src/utils/eoMonitor.h @@ -27,7 +27,7 @@ #include #include -#include +#include "../eoFunctor.h" /** @defgroup Monitors Monitoring * diff --git a/eo/src/utils/eoOStreamMonitor.cpp b/eo/src/utils/eoOStreamMonitor.cpp index b9e848c58..edb091690 100644 --- a/eo/src/utils/eoOStreamMonitor.cpp +++ b/eo/src/utils/eoOStreamMonitor.cpp @@ -9,10 +9,10 @@ #include #include -#include -#include -#include -#include +#include "eoOStreamMonitor.h" +#include "compatibility.h" +#include "eoParam.h" +#include "eoLogger.h" //using namespace std; diff --git a/eo/src/utils/eoOStreamMonitor.h b/eo/src/utils/eoOStreamMonitor.h index 032665224..dab0ea776 100644 --- a/eo/src/utils/eoOStreamMonitor.h +++ b/eo/src/utils/eoOStreamMonitor.h @@ -30,9 +30,9 @@ Authors: #include #include -#include -#include -#include +#include "eoMonitor.h" +#include "eoLogger.h" +#include "../eoObject.h" /** Prints statistics to a given ostream. diff --git a/eo/src/utils/eoParallel.h b/eo/src/utils/eoParallel.h index c7a15a4f9..6608706dc 100644 --- a/eo/src/utils/eoParallel.h +++ b/eo/src/utils/eoParallel.h @@ -31,7 +31,7 @@ Authors: #ifndef eoParallel_h #define eoParallel_h -#include "eoObject.h" +#include "../eoObject.h" #include "eoParser.h" /** diff --git a/eo/src/utils/eoParam.h b/eo/src/utils/eoParam.h index e3a09f215..d2c39efbd 100644 --- a/eo/src/utils/eoParam.h +++ b/eo/src/utils/eoParam.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include "../eoScalarFitness.h" /** @defgroup Parameters Parameters management * diff --git a/eo/src/utils/eoParser.cpp b/eo/src/utils/eoParser.cpp index cc306bf73..15a66105a 100644 --- a/eo/src/utils/eoParser.cpp +++ b/eo/src/utils/eoParser.cpp @@ -37,9 +37,9 @@ Authors: #include #include -#include -#include -#include +#include "compatibility.h" +#include "eoParser.h" +#include "eoLogger.h" using namespace std; diff --git a/eo/src/utils/eoParser.h b/eo/src/utils/eoParser.h index a53230da8..793da622c 100644 --- a/eo/src/utils/eoParser.h +++ b/eo/src/utils/eoParser.h @@ -30,9 +30,9 @@ Authors: #include #include "eoParam.h" -#include "eoObject.h" -#include "eoPersistent.h" -#include "eoExceptions.h" +#include "../eoObject.h" +#include "../eoPersistent.h" +#include "../eoExceptions.h" /** Parameter saving and loading diff --git a/eo/src/utils/eoPopStat.h b/eo/src/utils/eoPopStat.h index f3f091a6e..8102af087 100644 --- a/eo/src/utils/eoPopStat.h +++ b/eo/src/utils/eoPopStat.h @@ -35,7 +35,7 @@ that can be used to dump to the screen #ifndef _eoPopStat_h #define _eoPopStat_h -#include +#include "eoStat.h" /** Thanks to MS/VC++, eoParam mechanism is unable to handle std::vectors of stats. diff --git a/eo/src/utils/eoRNG.h b/eo/src/utils/eoRNG.h index ce648cabf..ad5c440bf 100644 --- a/eo/src/utils/eoRNG.h +++ b/eo/src/utils/eoRNG.h @@ -50,8 +50,9 @@ typedef unsigned long uint32_t; #include #include -#include "eoPersistent.h" -#include "eoObject.h" +// Relative includes +#include "../eoPersistent.h" +#include "../eoObject.h" /** Random Number Generator diff --git a/eo/src/utils/eoRealBounds.h b/eo/src/utils/eoRealBounds.h index 8d55d793a..5d28c1741 100644 --- a/eo/src/utils/eoRealBounds.h +++ b/eo/src/utils/eoRealBounds.h @@ -31,7 +31,7 @@ #include #include // std::exceptions! -#include +#include "eoRNG.h" #include "eoLogger.h" /** diff --git a/eo/src/utils/eoRealVectorBounds.h b/eo/src/utils/eoRealVectorBounds.h index 56feff345..7fb880f53 100644 --- a/eo/src/utils/eoRealVectorBounds.h +++ b/eo/src/utils/eoRealVectorBounds.h @@ -28,8 +28,8 @@ #define _eoRealVectorBounds_h #include // std::exceptions! -#include -#include +#include "eoRNG.h" +#include "eoRealBounds.h" /** Vector type for bounds (see eoRealBounds.h for scalar types) diff --git a/eo/src/utils/eoRndGenerators.h b/eo/src/utils/eoRndGenerators.h index 62e62ccff..454845b17 100644 --- a/eo/src/utils/eoRndGenerators.h +++ b/eo/src/utils/eoRndGenerators.h @@ -30,7 +30,7 @@ #define eoRndGenerators_h #include "eoRNG.h" -#include +#include "../eoFunctor.h" #include /** @defgroup Random Random number generation diff --git a/eo/src/utils/eoScalarFitnessStat.h b/eo/src/utils/eoScalarFitnessStat.h index e56e46822..0260baa2a 100644 --- a/eo/src/utils/eoScalarFitnessStat.h +++ b/eo/src/utils/eoScalarFitnessStat.h @@ -27,8 +27,8 @@ #ifndef _eoScalarFitnessStat_h #define _eoScalarFitnessStat_h -#include -#include +#include "eoRealVectorBounds.h" +#include "eoStat.h" /** The fitnesses of a whole population, as a std::vector diff --git a/eo/src/utils/eoSignal.cpp b/eo/src/utils/eoSignal.cpp index 745d21bd3..eb12382fd 100644 --- a/eo/src/utils/eoSignal.cpp +++ b/eo/src/utils/eoSignal.cpp @@ -23,7 +23,7 @@ Caner.Candan@univ-angers.fr */ -#include +#include "eoSignal.h" /** * @addtogroup Continuators diff --git a/eo/src/utils/eoSignal.h b/eo/src/utils/eoSignal.h index 9a89cb196..c9f7ecf57 100644 --- a/eo/src/utils/eoSignal.h +++ b/eo/src/utils/eoSignal.h @@ -27,8 +27,8 @@ #define _eoSignal_h #include -#include -#include +#include "eoCheckPoint.h" +#include "eoLogger.h" #include #include diff --git a/eo/src/utils/eoStat.h b/eo/src/utils/eoStat.h index 313426c3f..5610ecbee 100644 --- a/eo/src/utils/eoStat.h +++ b/eo/src/utils/eoStat.h @@ -35,12 +35,12 @@ Contact: http://eodev.sourceforge.net #include #include // accumulate -#include -#include -#include -#include -//#include -#include +#include "../eoFunctor.h" +#include "eoParam.h" +#include "../eoPop.h" +#include "eoMonitor.h" +//#include "eoCheckPoint.h" +#include "eoLogger.h" /** @defgroup Stats Statistics computation * diff --git a/eo/src/utils/eoState.cpp b/eo/src/utils/eoState.cpp index c6d385001..884549244 100644 --- a/eo/src/utils/eoState.cpp +++ b/eo/src/utils/eoState.cpp @@ -11,8 +11,8 @@ #include #include "eoState.h" -#include "eoObject.h" -#include "eoPersistent.h" +#include "../eoObject.h" +#include "../eoPersistent.h" using namespace std; diff --git a/eo/src/utils/eoState.h b/eo/src/utils/eoState.h index 256dcd965..e96917e9d 100644 --- a/eo/src/utils/eoState.h +++ b/eo/src/utils/eoState.h @@ -33,7 +33,7 @@ #include #include -#include +#include "../eoFunctorStore.h" class eoObject; class eoPersistent; diff --git a/eo/src/utils/eoStdoutMonitor.h b/eo/src/utils/eoStdoutMonitor.h index d886aed3a..dba8be98c 100644 --- a/eo/src/utils/eoStdoutMonitor.h +++ b/eo/src/utils/eoStdoutMonitor.h @@ -32,8 +32,8 @@ Authors: #include -#include -#include +#include "eoOStreamMonitor.h" +#include "../eoObject.h" /** Prints statistics to stdout diff --git a/eo/src/utils/eoTimeCounter.h b/eo/src/utils/eoTimeCounter.h index 623714156..e56ed1452 100644 --- a/eo/src/utils/eoTimeCounter.h +++ b/eo/src/utils/eoTimeCounter.h @@ -28,7 +28,8 @@ #define _eoTimeCounter_h #include -#include +#include "eoStat.h" +#include "eoUpdater.h" /** diff --git a/eo/src/utils/eoTimedMonitor.h b/eo/src/utils/eoTimedMonitor.h index a06ae6cce..93abc4aa3 100644 --- a/eo/src/utils/eoTimedMonitor.h +++ b/eo/src/utils/eoTimedMonitor.h @@ -30,8 +30,8 @@ #include #include -#include -#include +#include "eoMonitor.h" +#include "../eoObject.h" /** Holds a collection of monitors and only fires them when a time limit diff --git a/eo/src/utils/eoTimer.h b/eo/src/utils/eoTimer.h index 8a1fbb1a8..5ced8c6bd 100644 --- a/eo/src/utils/eoTimer.h +++ b/eo/src/utils/eoTimer.h @@ -28,9 +28,9 @@ Authors: # include // std::vector # include // std::map -# include "utils/eoParallel.h" // eo::parallel +# include "eoParallel.h" // eo::parallel -# include "serial/eoSerial.h" // eo::Persistent +# include "../serial/eoSerial.h" // eo::Persistent /** * @brief Timer allowing to measure time between a start point and a stop point. diff --git a/eo/src/utils/eoUniformInit.h b/eo/src/utils/eoUniformInit.h index cede61b73..8f4cd9d86 100644 --- a/eo/src/utils/eoUniformInit.h +++ b/eo/src/utils/eoUniformInit.h @@ -39,7 +39,7 @@ #define eoUniformInit_h #include "eoRNG.h" -#include "eoInit.h" +#include "../eoInit.h" #include "eoRealBounds.h" #include diff --git a/eo/src/utils/eoUpdatable.h b/eo/src/utils/eoUpdatable.h index 202ef962c..1c1103afc 100644 --- a/eo/src/utils/eoUpdatable.h +++ b/eo/src/utils/eoUpdatable.h @@ -27,7 +27,7 @@ #ifndef _eoUpdatable_h #define _eoUpdatable_h -#include +#include "eoUpdater.h" /** eoUpdatable is a generic class for adding updatation to an existing class diff --git a/eo/src/utils/eoUpdater.cpp b/eo/src/utils/eoUpdater.cpp index dd6a38960..de2d0ba8a 100644 --- a/eo/src/utils/eoUpdater.cpp +++ b/eo/src/utils/eoUpdater.cpp @@ -8,8 +8,8 @@ #include -#include -#include +#include "eoState.h" +#include "eoUpdater.h" using namespace std; diff --git a/eo/src/utils/eoUpdater.h b/eo/src/utils/eoUpdater.h index 072b9a9bb..0ae3b9c25 100644 --- a/eo/src/utils/eoUpdater.h +++ b/eo/src/utils/eoUpdater.h @@ -28,9 +28,9 @@ #define _eoUpdater_h #include -#include -#include -#include +#include "../eoFunctor.h" +#include "eoState.h" +#include "eoParam.h" template class eoCheckPoint; diff --git a/eo/src/utils/make_help.cpp b/eo/src/utils/make_help.cpp index a7ab040cd..fd2c5efb3 100644 --- a/eo/src/utils/make_help.cpp +++ b/eo/src/utils/make_help.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include "eoParser.h" using namespace std; diff --git a/eo/src/utils/selectors.h b/eo/src/utils/selectors.h index 37df7997b..43992ac3c 100644 --- a/eo/src/utils/selectors.h +++ b/eo/src/utils/selectors.h @@ -41,7 +41,7 @@ #include #include "eoRNG.h" -#include +#include "../eoPop.h" /** @addtogroup Selectors @{ From 646f20934e02c8c11ee12c8b8c7a98fdafca5072 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 6 Dec 2019 15:26:21 +0100 Subject: [PATCH 008/296] fix back some errors inserted by previous refactoring - move PBIL classes in deprecated/, superseeded by the EDO module --- .../ga => deprecated/eo/es}/eoPBILAdditive.h | 0 .../ga => deprecated/eo/es}/eoPBILDistrib.h | 0 {eo/src/ga => deprecated/eo/es}/eoPBILOrg.h | 0 {eo/test => deprecated/eo/es}/t-eoPBIL.cpp | 0 edo/test/t-bounderno.cpp | 2 +- edo/test/t-continue.cpp | 2 +- edo/test/t-edoEstimatorNormalMulti.cpp | 4 +-- edo/test/t-mean-distance.cpp | 4 +-- edo/test/t-uniform.cpp | 2 +- eo/src/eoCombinedContinue.h | 6 ++--- eo/src/eoFactory.h | 2 +- eo/src/eoObject.h | 2 +- eo/src/eoOpSelMason.h | 2 +- eo/src/eoPrintable.h | 4 +-- eo/src/es.h | 26 +++++++++---------- eo/src/ga/ChangeLog | 2 +- eo/test/CMakeLists.txt | 2 +- 17 files changed, 30 insertions(+), 30 deletions(-) rename {eo/src/ga => deprecated/eo/es}/eoPBILAdditive.h (100%) rename {eo/src/ga => deprecated/eo/es}/eoPBILDistrib.h (100%) rename {eo/src/ga => deprecated/eo/es}/eoPBILOrg.h (100%) rename {eo/test => deprecated/eo/es}/t-eoPBIL.cpp (100%) diff --git a/eo/src/ga/eoPBILAdditive.h b/deprecated/eo/es/eoPBILAdditive.h similarity index 100% rename from eo/src/ga/eoPBILAdditive.h rename to deprecated/eo/es/eoPBILAdditive.h diff --git a/eo/src/ga/eoPBILDistrib.h b/deprecated/eo/es/eoPBILDistrib.h similarity index 100% rename from eo/src/ga/eoPBILDistrib.h rename to deprecated/eo/es/eoPBILDistrib.h diff --git a/eo/src/ga/eoPBILOrg.h b/deprecated/eo/es/eoPBILOrg.h similarity index 100% rename from eo/src/ga/eoPBILOrg.h rename to deprecated/eo/es/eoPBILOrg.h diff --git a/eo/test/t-eoPBIL.cpp b/deprecated/eo/es/t-eoPBIL.cpp similarity index 100% rename from eo/test/t-eoPBIL.cpp rename to deprecated/eo/es/t-eoPBIL.cpp diff --git a/edo/test/t-bounderno.cpp b/edo/test/t-bounderno.cpp index ac294ce7d..8f7a49b0c 100644 --- a/edo/test/t-bounderno.cpp +++ b/edo/test/t-bounderno.cpp @@ -28,7 +28,7 @@ Authors: #include #include -#include "Rosenbrock.h" +#include "../application/common/Rosenbrock.h" typedef eoReal< eoMinimizingFitness > EOT; diff --git a/edo/test/t-continue.cpp b/edo/test/t-continue.cpp index 2f2bd3247..a5d661dac 100644 --- a/edo/test/t-continue.cpp +++ b/edo/test/t-continue.cpp @@ -28,7 +28,7 @@ Authors: #include #include -#include "Rosenbrock.h" +#include "../application/common/Rosenbrock.h" typedef eoReal< eoMinimizingFitness > EOT; typedef edoUniform< EOT > Distrib; diff --git a/edo/test/t-edoEstimatorNormalMulti.cpp b/edo/test/t-edoEstimatorNormalMulti.cpp index 6483a1062..4bc802fbd 100644 --- a/edo/test/t-edoEstimatorNormalMulti.cpp +++ b/edo/test/t-edoEstimatorNormalMulti.cpp @@ -33,8 +33,8 @@ Authors: #include -#include "Rosenbrock.h" -#include "Sphere.h" +#include "../application/common/Rosenbrock.h" +#include "../application/common/Sphere.h" typedef eoReal< eoMinimizingFitness > EOT; typedef edoNormalMulti< EOT > Distrib; diff --git a/edo/test/t-mean-distance.cpp b/edo/test/t-mean-distance.cpp index 59b1c8aa5..8c79bc037 100644 --- a/edo/test/t-mean-distance.cpp +++ b/edo/test/t-mean-distance.cpp @@ -38,8 +38,8 @@ Authors: #include -#include "Rosenbrock.h" -#include "Sphere.h" +#include "../application/common/Rosenbrock.h" +#include "../application/common/Sphere.h" typedef eoReal< eoMinimizingFitness > EOT; typedef edoNormalMulti< EOT > Distrib; diff --git a/edo/test/t-uniform.cpp b/edo/test/t-uniform.cpp index 228ce5e22..8496425b3 100644 --- a/edo/test/t-uniform.cpp +++ b/edo/test/t-uniform.cpp @@ -28,7 +28,7 @@ Authors: #include #include -#include "Rosenbrock.h" +#include "../application/common/Rosenbrock.h" typedef eoReal< eoMinimizingFitness > EOT; diff --git a/eo/src/eoCombinedContinue.h b/eo/src/eoCombinedContinue.h index 96878b4ea..756a44a89 100644 --- a/eo/src/eoCombinedContinue.h +++ b/eo/src/eoCombinedContinue.h @@ -22,8 +22,8 @@ Authors : todos@geneura.ugr.es Marc Schoenauer - Ram�n Casero Ca�as - Johann Dr�o + Ramón Casero Cañas + Johann Dreo */ //----------------------------------------------------------------------------- @@ -40,7 +40,7 @@ Authors : to be consistent with other Combined constructs and allow to easily handle more than 2 continuators -02/2003 Ram�n Casero Ca�as - added the removeLast() method +02/2003 Ramón Casero Cañas - added the removeLast() method @ingroup Combination */ diff --git a/eo/src/eoFactory.h b/eo/src/eoFactory.h index 51cbc678b..b6dd62de0 100644 --- a/eo/src/eoFactory.h +++ b/eo/src/eoFactory.h @@ -31,7 +31,7 @@ //----------------------------------------------------------------------------- /** EO Factory. A factory is used to create other objects. In particular, -it can be used so that objects of that kind can�t be created in any other +it can be used so that objects of that kind can't be created in any other way. It should be instantiated with anything that needs a factory, like selectors or whatever; but the instance class should be the parent class from which all the object that are going to be created descend. This class basically defines an interface, diff --git a/eo/src/eoObject.h b/eo/src/eoObject.h index 1e119b988..9744c35e7 100644 --- a/eo/src/eoObject.h +++ b/eo/src/eoObject.h @@ -39,7 +39,7 @@ changed. eoObject is used to define a name (#className#) that is used when loading or saving the state. Previously, this object also defined a print and read -interface, but it�s been moved to eoPrintable and eoPersistent. +interface, but it's been moved to eoPrintable and eoPersistent. */ /** Defines a name (#className#), used when loading or saving a state. diff --git a/eo/src/eoOpSelMason.h b/eo/src/eoOpSelMason.h index 377de0c95..7df95066f 100644 --- a/eo/src/eoOpSelMason.h +++ b/eo/src/eoOpSelMason.h @@ -79,7 +79,7 @@ public: _is >> rate; if ( _is ) { eoOp* op = operatorFactory.make( _is ); // This reads the rest of the line - // Add the operators to the selector, don�t pay attention to the IDs + // Add the operators to the selector, don't pay attention to the IDs opSelectorP->addOp( *op, rate ); // Keep it in the store, to destroy later tmpPVec.push_back( op ); diff --git a/eo/src/eoPrintable.h b/eo/src/eoPrintable.h index f04f50fb6..1f2404a89 100644 --- a/eo/src/eoPrintable.h +++ b/eo/src/eoPrintable.h @@ -27,8 +27,8 @@ //----------------------------------------------------------------------------- -#include "iostream" // std::istream, std::ostream -#include "string" // para std::string +#include // std::istream, std::ostream +#include // para std::string /* This functionality was separated from eoObject, since it makes no sense to print diff --git a/eo/src/es.h b/eo/src/es.h index 9e2fd78f9..d38485b69 100644 --- a/eo/src/es.h +++ b/eo/src/es.h @@ -36,28 +36,28 @@ //----------------------------------------------------------------------------- // the genotypes - from plain std::vector to full correlated mutation -#include "eoReal.h" -#include "eoEsSimple.h" -#include "eoEsStdev.h" -#include "eoEsFull.h" +#include "es/eoReal.h" +#include "es/eoEsSimple.h" +#include "es/eoEsStdev.h" +#include "es/eoEsFull.h" // the initialization -#include "eoEsChromInit.h" +#include "es/eoEsChromInit.h" // general operators -#include "eoRealOp.h" -#include "eoNormalMutation.h" -#include "eoRealAtomXover.h" // for generic operators +#include "es/eoRealOp.h" +#include "es/eoNormalMutation.h" +#include "es/eoRealAtomXover.h" // for generic operators // SBX crossover (following Deb) -#include "eoSBXcross.h" +#include "es/eoSBXcross.h" // ES specific operators -#include "eoEsGlobalXover.h" // Global ES Xover -#include "eoEsStandardXover.h" // 2-parents ES Xover +#include "es/eoEsGlobalXover.h" // Global ES Xover +#include "es/eoEsStandardXover.h" // 2-parents ES Xover // the ES-mutations -#include "eoEsMutationInit.h" -#include "eoEsMutate.h" +#include "es/eoEsMutationInit.h" +#include "es/eoEsMutate.h" #endif diff --git a/eo/src/ga/ChangeLog b/eo/src/ga/ChangeLog index b8ba4afa0..4d62600ed 100644 --- a/eo/src/ga/ChangeLog +++ b/eo/src/ga/ChangeLog @@ -2,7 +2,7 @@ * all files: Change from absolute to relative include. -2007-08-21 Jochen K�pper +2007-08-21 Jochen Küpper * eoBitOp.h (eoNPtsBitXover::operator()): Make sure bit is within allocated length of vector points: [0, max_size). diff --git a/eo/test/CMakeLists.txt b/eo/test/CMakeLists.txt index 4a0c74e43..aa4f17035 100644 --- a/eo/test/CMakeLists.txt +++ b/eo/test/CMakeLists.txt @@ -45,7 +45,7 @@ set (TEST_LIST t-eoReal t-eoVector t-eoESAll - t-eoPBIL + # t-eoPBIL # deprecated, see EDO module. t-eoFitnessAssembled t-eoFitnessAssembledEA t-eoRoulette From e64417f2a56ec86b5a13ecb5897a778edec788ee Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Dec 2019 11:11:47 +0100 Subject: [PATCH 009/296] BREAKING CHANGE: set standard to C++11, feat: accessor to breeder ops Give an access to the operators held by a breeder. This is needed to design algorithms that dynamically update their internal parameters during search. To simplify the interface, we use a returned tuple, and thus upgrade the C++ standard to C++11. --- CMakeLists.txt | 1 + eo/src/eoGeneralBreeder.h | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bb3a2c4e..b125b0966 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ project("ParadisEO") ## Language enable_language(CXX) +set(CMAKE_CXX_STANDARD 11) ## Test the presence of a compiler if("${CMAKE_CXX_COMPILER}" STREQUAL "" OR "${CMAKE_C_COMPILER}" STREQUAL "") diff --git a/eo/src/eoGeneralBreeder.h b/eo/src/eoGeneralBreeder.h index 1fdbd5c40..fb1bc88b8 100644 --- a/eo/src/eoGeneralBreeder.h +++ b/eo/src/eoGeneralBreeder.h @@ -32,6 +32,8 @@ * eoGeneralBreeder: transforms a population using the generalOp construct. *****************************************************************************/ +#include + #include "eoOp.h" #include "eoGenOp.h" #include "eoPopulator.h" @@ -58,9 +60,12 @@ class eoGeneralBreeder: public eoBreed eoGeneralBreeder( eoSelectOne& _select, eoGenOp& _op, - double _rate=1.0, + double _rate=1.0, bool _interpret_as_rate = true) : - select( _select ), op(_op), howMany(_rate, _interpret_as_rate) {} + select( _select ), op(_op), + local_howMany(_rate, _interpret_as_rate), + howMany(local_howMany) + {} /** Ctor: * @@ -71,8 +76,8 @@ class eoGeneralBreeder: public eoBreed eoGeneralBreeder( eoSelectOne& _select, eoGenOp& _op, - eoHowMany _howMany ) : - select( _select ), op(_op), howMany(_howMany) {} + eoHowMany& _howMany ) : + select( _select ), op(_op), howMany(_howMany) {} /** The breeder: simply calls the genOp on a selective populator! * @@ -82,7 +87,6 @@ class eoGeneralBreeder: public eoBreed void operator()(const eoPop& _parents, eoPop& _offspring) { unsigned target = howMany(_parents.size()); - _offspring.clear(); eoSelectivePopulator it(_parents, _offspring, select); @@ -98,10 +102,20 @@ class eoGeneralBreeder: public eoBreed /// The class name. virtual std::string className() const { return "eoGeneralBreeder"; } - private: + virtual std::tuple + &,eoGenOp&,eoHowMany&> + operators() + { + return std::forward_as_tuple + &,eoGenOp&,eoHowMany&> + (select, op, howMany); + } + + protected: eoSelectOne& select; eoGenOp& op; - eoHowMany howMany; + eoHowMany local_howMany; + eoHowMany& howMany; }; #endif From 87d4f082588ed906868ee922f6b7bdd178323ea8 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Dec 2019 11:18:09 +0100 Subject: [PATCH 010/296] eoBitOp feat: access to preference, fix: use doubles and swap - Makes the `preference` member protected instead of private, which may be used for algorithms managing their internal parameters during search. - Replace float parameter with double, used everywhere else in the framework. - use std::swap instead of handmade swap. --- eo/src/ga/eoBitOp.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/eo/src/ga/eoBitOp.h b/eo/src/ga/eoBitOp.h index a95ec58f4..b5436327f 100644 --- a/eo/src/ga/eoBitOp.h +++ b/eo/src/ga/eoBitOp.h @@ -30,9 +30,10 @@ //----------------------------------------------------------------------------- -#include // swap_ranges +#include // swap_ranges + #include "../utils/eoRNG.h" -#include "../eoInit.h" // eoMonOp +#include "../eoInit.h" // eoMonOp #include "eoBit.h" @@ -187,7 +188,7 @@ template class eoBitMutation: public eoMonOp return changed_something; } - private: + protected: double rate; bool normalize; // divide rate by chromSize }; @@ -330,7 +331,7 @@ template class eoUBitXover: public eoQuadOp { public: /// (Default) Constructor. - eoUBitXover(const float& _preference = 0.5): preference(_preference) + eoUBitXover(const double& _preference = 0.5): preference(_preference) { if ( (_preference <= 0.0) || (_preference >= 1.0) ) std::runtime_error("UxOver --> invalid preference"); @@ -353,16 +354,17 @@ template class eoUBitXover: public eoQuadOp { if (chrom1[i] != chrom2[i] && eo::rng.flip(preference)) { - bool tmp = chrom1[i]; - chrom1[i]=chrom2[i]; - chrom2[i] = tmp; + // bool tmp = chrom1[i]; + // chrom1[i]=chrom2[i]; + // chrom2[i] = tmp; + std::swap(chrom1[i], chrom2[i]); changed = true; } } return changed; } - private: - float preference; + protected: + double preference; }; From 9b887c83a616e1cdd5c06f669a91e9f2713af7ed Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Dec 2019 11:20:54 +0100 Subject: [PATCH 011/296] feat: class to wrap a eoMonOp into a eoQuadOp --- eo/src/eoOp.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/eo/src/eoOp.h b/eo/src/eoOp.h index 5351b9d86..bf0e24de9 100644 --- a/eo/src/eoOp.h +++ b/eo/src/eoOp.h @@ -184,6 +184,50 @@ private: eoQuadOp & quadOp; }; +/** Wrap eoMonOp into an eoQuadOp: simply don't touch the second arg. + */ +template +class eoMon2QuadOp1: public eoQuadOp +{ +public: + /** Ctor + * @param _monOp the eoMonOp to be transformed + */ + eoMon2QuadOp1(eoMonOp & _monOp) : monOp(_monOp) {} + + /** Call the eoMonOp on the first argument only. + */ + bool operator()(EOT & _eo1, EOT & /*_eo2*/) + { + return monOp(_eo1); + } + +private: + eoMonOp & monOp; +}; + +/** Wrap eoMonOp into an eoQuadOp: simply don't touch the first arg. + */ +template +class eoMon2QuadOp2: public eoQuadOp +{ +public: + /** Ctor + * @param _monOp the eoMonOp to be transformed + */ + eoMon2QuadOp2(eoMonOp & _monOp) : monOp(_monOp) {} + + /** Call the eoMonOp on the second argument only. + */ + bool operator()(EOT & /*_eo1*/, EOT & _eo2) + { + return monOp(_eo2); + } + +private: + eoMonOp & monOp; +}; + #endif //@} From be782f8cfbe024e4dea727f771da9dd356031bd6 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Dec 2019 11:24:39 +0100 Subject: [PATCH 012/296] feat: add a sequential select that returns the best individual --- eo/src/eoSequentialSelect.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/eo/src/eoSequentialSelect.h b/eo/src/eoSequentialSelect.h index 1a1f02e4e..adf3cf452 100644 --- a/eo/src/eoSequentialSelect.h +++ b/eo/src/eoSequentialSelect.h @@ -51,7 +51,8 @@ always returns individuals from best to worst @ingroup Selectors */ -template class eoSequentialSelect: public eoSelectOne +template +class eoSequentialSelect: public eoSelectOne { public: /** Ctor: sets the current pter to numeric_limits::max() so init will take place first time @@ -60,7 +61,7 @@ template class eoSequentialSelect: public eoSelectOne eoSequentialSelect(bool _ordered = true) : ordered(_ordered), current(std::numeric_limits::max()) {} - void setup(const eoPop& _pop) + virtual void setup(const eoPop& _pop) { eoPters.resize(_pop.size()); if (ordered) // probably we could have a marker to avoid re-sorting @@ -86,6 +87,24 @@ private: }; +/** An eoSelectOne that returns the best individual each time it's called. + +@ingroup Selectors +*/ +template +class eoEliteSelect: public eoSequentialSelect +{ + public: + eoEliteSelect() : + eoSequentialSelect(true) + {} + + virtual const EOT& operator()(const eoPop& pop) + { + this->setup(pop); + return pop[0]; // the best one + } +}; /** All Individuals in order From 728bc6e8978430f6eb78da5b8cedf7aea094d38b Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Dec 2019 11:26:09 +0100 Subject: [PATCH 013/296] feat: get a param handle from its name Useful for introspection and dynamic parameter management. --- eo/src/utils/eoParser.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/eo/src/utils/eoParser.h b/eo/src/utils/eoParser.h index 793da622c..8e1df04f5 100644 --- a/eo/src/utils/eoParser.h +++ b/eo/src/utils/eoParser.h @@ -29,10 +29,10 @@ Authors: #include #include -#include "eoParam.h" #include "../eoObject.h" #include "../eoPersistent.h" #include "../eoExceptions.h" +#include "eoParam.h" /** Parameter saving and loading @@ -195,13 +195,28 @@ public: */ eoParam * getParam(const std::string& _name) const; + /** + * Get a eoValueParam handle on a param from its long name + * If not found, raise an eoMissingParamException + */ + template + eoValueParam& getValueParam(const std::string& _name) + { + eoParam* p = getParamWithLongName( _name ); + if( p == NULL ) { + throw eoMissingParamException(_name ); + } else { + return dynamic_cast< eoValueParam& >(*p); + } + } + /** * Get the value of a param from its long name * If not found, raise an eoMissingParamException * * Remember to specify the expected return type with a templated call: - * unsigned int popSize = eoparser.value("popSize"); + * unsigned int popSize = eoparser.valueOf("popSize"); * * If the template type is not the good one, an eoWrongParamTypeException is raised. */ From 90c3e8ffa14268f99d9a0a0a3e554be4f40681f0 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Dec 2019 11:27:35 +0100 Subject: [PATCH 014/296] refactor: expose a eoHowMany::value function --- eo/src/utils/eoHowMany.h | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/eo/src/utils/eoHowMany.h b/eo/src/utils/eoHowMany.h index bb47417a1..56c730f17 100644 --- a/eo/src/utils/eoHowMany.h +++ b/eo/src/utils/eoHowMany.h @@ -83,22 +83,7 @@ public: eoHowMany(double _rate = 0.0, bool _interpret_as_rate = true): rate(_rate), count(0) { - if (_interpret_as_rate) - { - if (_rate<0) - { - rate = 1.0+_rate; - if (rate < 0) // was < -1 - throw std::logic_error("rate<-1 in eoHowMany!"); - } - } - else - { - rate = 0.0; // just in case, but shoud be unused - count = int(_rate); // negative values are allowed here - if (count != _rate) - eo::log << eo::warnings << "Number was rounded in eoHowMany"; - } + this->value(_rate, _interpret_as_rate); } /** Ctor from an int - both from int and unsigned int are needed @@ -195,6 +180,26 @@ public: return (*this); } + void value(double _rate, bool _interpret_as_rate) + { + if (_interpret_as_rate) + { + if (_rate<0) + { + rate = 1.0+_rate; + if (rate < 0) // was < -1 + throw std::logic_error("rate < -1 in eoHowMany!"); + } + } + else + { + rate = 0.0; // just in case, but shoud be unused + count = int(_rate); // negative values are allowed here + if (count != _rate) + eo::log << eo::warnings << "Number was rounded in eoHowMany"; + } + } + private : double rate; int count; From 9056ed898953108d7dfc3b3e35ee7a0d259e3659 Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 6 Feb 2020 21:55:12 +0100 Subject: [PATCH 015/296] add an eoSystemError exception - make members const in eoException.h classes --- eo/src/eoExceptions.h | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/eo/src/eoExceptions.h b/eo/src/eoExceptions.h index 56b5fbfd8..ef1a5c67e 100644 --- a/eo/src/eoExceptions.h +++ b/eo/src/eoExceptions.h @@ -52,7 +52,7 @@ public: } private: - time_t _elapsed; + const time_t _elapsed; }; @@ -76,7 +76,7 @@ public: } private: - unsigned long _threshold; + const unsigned long _threshold; }; @@ -102,7 +102,7 @@ public: ~eoMissingParamException() throw() {} private: - std::string _name; + const std::string _name; }; /*! @@ -127,7 +127,40 @@ public: ~eoWrongParamTypeException() throw() {} private: - std::string _name; + const std::string _name; +}; + + +class eoSystemError : public std::exception +{ +public: + eoSystemError(std::string cmd) + : _cmd(cmd), _has_pipe(false), _err_code(-1), _output("") + {} + + eoSystemError(std::string cmd, int err_code, std::string output) + : _cmd(cmd), _has_pipe(true), _err_code(err_code), _output(output) + {} + + virtual const char* what() const throw() + { + std::ostringstream ss; + ss << "System call: `" << _cmd << "` error"; + if(_has_pipe) { + ss << " code #" << _err_code + << " with the following output:" << std::endl << _output; + } + return ss.str().c_str(); + } + + ~eoSystemError() throw() {} + +private: + const std::string _cmd; + const bool _has_pipe; + const int _err_code; + const std::string _output; + }; #endif // __eoExceptions_h__ From ccb4b3787b05b134457199f57cbc1137de27d3b8 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sat, 8 Feb 2020 16:34:34 +0100 Subject: [PATCH 016/296] add eoEvalCmd, an eval that call a system command --- eo/src/eo | 1 + eo/src/eoEvalCmd.h | 142 ++++++++++++++++++++++++++++++++++++++++ eo/test/CMakeLists.txt | 1 + eo/test/t-eoEvalCmd.cpp | 29 ++++++++ 4 files changed, 173 insertions(+) create mode 100644 eo/src/eoEvalCmd.h create mode 100644 eo/test/t-eoEvalCmd.cpp diff --git a/eo/src/eo b/eo/src/eo index 39109bdb6..89fac3d0d 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -78,6 +78,7 @@ #include "eoEvalCounterThrowException.h" #include "eoEvalTimeThrowException.h" #include "eoEvalUserTimeThrowException.h" +#include "eoEvalCmd.h" // Continuators - all include eoContinue.h #include "eoCombinedContinue.h" diff --git a/eo/src/eoEvalCmd.h b/eo/src/eoEvalCmd.h new file mode 100644 index 000000000..57d9a9712 --- /dev/null +++ b/eo/src/eoEvalCmd.h @@ -0,0 +1,142 @@ +/* +(c) Thales group, 2020 + + 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; + version 2 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact: http://eodev.sourceforge.net + +Authors: +Johann Dréo +*/ + +#ifndef eoEvalCmd_H +#define eoEvalCmd_H + +#include +#include + +#include "eoEvalFunc.h" +#include "eoExceptions.h" + + +/** Call a system command to evaluate an individual. + * + * @note Tested only under Unix systems, may not be portable as is. + * + * Use the default string serialization of the EOT + * and pass it as command line arguments of the command. + * The command is expected to output on stdout a string + * that can be interpreted as a float by `atof`. + * + * @todo Use the serialization of fitness instead of atof. + * + * For example, an eoReal would lead to a call like: + * ```>&2 cmd INVALID 3 1.0 2.1 3.2``` + * + * Throw an eoSystemError exception if the command exited with + * a return code different from zero. + * + *@ingroup Evaluation + */ +template +class eoEvalCmd : public eoEvalFunc< EOT > +{ +public: + using Fitness = typename EOT::Fitness; + + /** Constructor + * + * @note The prefix and suffix are automatically + * separated from the command by a space. + * + * The formated command looks like: `prefix cmd infix sol suffix` + * + * The default prefix allows to redirect any output to stdout under Unix. + * + * @param cmd The command to run. + * @param prefix Inserted before the command + * @param suffix Inserted between cmd and the serialized solution. + * @param suffix Append after the solution. + */ + eoEvalCmd( const std::string cmd, + const std::string prefix = ">&1", + const std::string infix = "", + const std::string suffix = "" + ) : + _cmd(cmd), + _suffix(suffix), + _infix(infix), + _prefix(prefix), + _last_call("") + {} + + virtual void operator()( EOT& sol ) + { + // Any modification to sol would makes it invalid, + // it is thus useless to evaluate it, if it is not invalid. + if(not sol.invalid()) { + return; + } + + sol.fitness( call( sol ) ); + } + + //! Return the last command string that was called. + std::string last_call() const + { + return _last_call; + } + +private: + const std::string _cmd; + const std::string _prefix; + const std::string _infix; + const std::string _suffix; + std::string _last_call; + + Fitness call( EOT& sol ) + { + std::array buffer; + std::string result; + + std::ostringstream cmd; + + cmd << _prefix << " " << _cmd << " " + << _infix << " " << sol << " " << _suffix; + + // Keep track of the built command for debugging purpose. + _last_call = cmd.str(); + + FILE* pipe = popen(cmd.str().c_str(), "r"); + if(not pipe) { + throw eoSystemError(cmd.str()); + } + while(fgets(buffer.data(), BUFFER_SIZE, pipe) != NULL) { + result += buffer.data(); + } + auto return_code = pclose(pipe); + + if(return_code != 0) { + throw eoSystemError(cmd.str(), return_code, result); + } + + // FIXME Use serialized input for the fitness instead of atof. + Fitness f = std::atof(result.c_str()); + + return f; + } +}; + +#endif // eoEvalCmd_H diff --git a/eo/test/CMakeLists.txt b/eo/test/CMakeLists.txt index aa4f17035..d776237f6 100644 --- a/eo/test/CMakeLists.txt +++ b/eo/test/CMakeLists.txt @@ -70,6 +70,7 @@ set (TEST_LIST #t-eoDualFitness t-eoParser t-eoPartiallyMappedXover + t-eoEvalCmd ) diff --git a/eo/test/t-eoEvalCmd.cpp b/eo/test/t-eoEvalCmd.cpp new file mode 100644 index 000000000..d9e812275 --- /dev/null +++ b/eo/test/t-eoEvalCmd.cpp @@ -0,0 +1,29 @@ +#include + +#include +#include + +using namespace std; + +int main(int /*argc*/, char* /*argv[]*/) +{ + typedef eoReal EOT; + + // Build something like: ">&1 echo 1.2; # INVALID 2 1 2" + eoEvalCmd eval("echo 1.2", ">&1", "; #"); + + EOT sol = {1,2}; + std::clog << sol << std::endl; + + try { + eval(sol); + } catch(eoSystemError& e) { + std::cerr << e.what() << std::endl; + exit(1); + } + + std::clog << eval.last_call() << std::endl; + EOT::Fitness f = sol.fitness(); + std::clog << "fitness: " << f << std::endl; + assert(f = 1.2); +} From 2f5a00a7ac2680c7f5938406c5a042fb4b1ab7f3 Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 9 Feb 2020 05:43:32 +0100 Subject: [PATCH 017/296] fix: eoEvalCmd use serialized input for the fitness instead of atof --- eo/src/eoEvalCmd.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/eo/src/eoEvalCmd.h b/eo/src/eoEvalCmd.h index 57d9a9712..afc3d60fb 100644 --- a/eo/src/eoEvalCmd.h +++ b/eo/src/eoEvalCmd.h @@ -108,32 +108,35 @@ private: Fitness call( EOT& sol ) { - std::array buffer; - std::string result; - std::ostringstream cmd; - cmd << _prefix << " " << _cmd << " " << _infix << " " << sol << " " << _suffix; // Keep track of the built command for debugging purpose. _last_call = cmd.str(); + // Run the command and read its output. + std::array buffer; + std::string output; FILE* pipe = popen(cmd.str().c_str(), "r"); if(not pipe) { throw eoSystemError(cmd.str()); } while(fgets(buffer.data(), BUFFER_SIZE, pipe) != NULL) { - result += buffer.data(); + output += buffer.data(); } auto return_code = pclose(pipe); + // We want the evaluation to fail if the command failed + // (you can still catch the exception if you do not want your program to exit). if(return_code != 0) { - throw eoSystemError(cmd.str(), return_code, result); + throw eoSystemError(cmd.str(), return_code, output); } - // FIXME Use serialized input for the fitness instead of atof. - Fitness f = std::atof(result.c_str()); + // Convert the output string in a valid fitness object. + Fitness f; + std::istringstream result(output); + result >> f; return f; } From 9623f4d1f8db6843ac2f93541a1ec9aaf94e88ec Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 9 Feb 2020 06:53:36 +0100 Subject: [PATCH 018/296] add missing eoEval* headers in --- eo/src/eo | 9 +++++++-- eo/src/eoEvalTimeThrowException.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/eo/src/eo b/eo/src/eo index 89fac3d0d..35fa13d9a 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -74,11 +74,16 @@ // Evaluation functions (all include eoEvalFunc.h) #include "eoPopEvalFunc.h" -#include "eoEvalFuncPtr.h" +#include "eoEvalCmd.h" #include "eoEvalCounterThrowException.h" +#include "eoEvalDump.h" +#include "eoEvalFuncCounterBounder.h" +#include "eoEvalFuncCounter.h" +#include "eoEvalFunc.h" +#include "eoEvalFuncPtr.h" +#include "eoEvalKeepBest.h" #include "eoEvalTimeThrowException.h" #include "eoEvalUserTimeThrowException.h" -#include "eoEvalCmd.h" // Continuators - all include eoContinue.h #include "eoCombinedContinue.h" diff --git a/eo/src/eoEvalTimeThrowException.h b/eo/src/eoEvalTimeThrowException.h index 3cff76512..5b72de6bc 100644 --- a/eo/src/eoEvalTimeThrowException.h +++ b/eo/src/eoEvalTimeThrowException.h @@ -25,7 +25,7 @@ Johann Dréo #include "eoExceptions.h" -/** Check at each evaluation if a given tie contract has been reached. +/** Check at each evaluation if a given time contract has been reached. * * Throw an eoMaxTimeException if the given max time has been reached. * Usefull if you want to end the search independently of generations. From 6232ff2f2144290630dba9038ed37151f433b66d Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 8 Mar 2020 21:44:42 +0100 Subject: [PATCH 019/296] add eoEvalNamedPipe - a class to connect an external objective function through file(s) - fix doc error in eoEvalCmd --- eo/src/eo | 1 + eo/src/eoEvalCmd.h | 4 +- eo/src/eoEvalNamedPipe.h | 120 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 eo/src/eoEvalNamedPipe.h diff --git a/eo/src/eo b/eo/src/eo index 35fa13d9a..c415c214b 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -74,6 +74,7 @@ // Evaluation functions (all include eoEvalFunc.h) #include "eoPopEvalFunc.h" +#include "eoEvalNamedPipe.h" #include "eoEvalCmd.h" #include "eoEvalCounterThrowException.h" #include "eoEvalDump.h" diff --git a/eo/src/eoEvalCmd.h b/eo/src/eoEvalCmd.h index afc3d60fb..e34dd3eee 100644 --- a/eo/src/eoEvalCmd.h +++ b/eo/src/eoEvalCmd.h @@ -38,9 +38,7 @@ Johann Dréo * Use the default string serialization of the EOT * and pass it as command line arguments of the command. * The command is expected to output on stdout a string - * that can be interpreted as a float by `atof`. - * - * @todo Use the serialization of fitness instead of atof. + * that can be deserialized as a fitness. * * For example, an eoReal would lead to a call like: * ```>&2 cmd INVALID 3 1.0 2.1 3.2``` diff --git a/eo/src/eoEvalNamedPipe.h b/eo/src/eoEvalNamedPipe.h new file mode 100644 index 000000000..02d6dc67a --- /dev/null +++ b/eo/src/eoEvalNamedPipe.h @@ -0,0 +1,120 @@ +/* +(c) Thales group, 2020 + + 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; + version 2 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact: http://eodev.sourceforge.net + +Authors: +Johann Dréo +*/ + +#ifndef eoEvalNamedPipe_H +#define eoEvalNamedPipe_H + +#include +#include +#include +#include + +#include "eoEvalFunc.h" +#include "eoExceptions.h" + +/** Communicate through a named pipe FIFO to evaluate an individual. + * + * With this class, you can plug an external process computing the fitness + * of a serialized solution with a process hosting the EO algorithm. + * Both processes just have to read/write solutions/fitness in files. + * + * The code would work with any file, but it is actually only useful with + * FIFO pipes, which are blocking on I/O. + * Thus, the process actually computing the fitness will ait for the solution to be wrote, + * then compute and write the fitness back, waiting it to be read. + * Conversely, the EO process will wait after having wrote the solution, that the other process + * actually read it, then wait itself for the fitness to be read in the pipe. + * With pipes, the synchronization of the two processes is guaranteed. + * + * To create a named FIFO pipe under Linux, see the command `mkfifo`. + * + * @note: if you use a single pipe for input/output, take care + * of the synchronization with the process handling the fitness computation. + * In particular, the first call of eoEvalNamedPipe + * is to write the solution, THEN to read the fitness. + * + * @note Tested only under Unix systems, may not be portable as is. + * + * Use the default string serialization of the EOT and + * the default deserialization of the fitness. + * + *@ingroup Evaluation + */ +template +class eoEvalNamedPipe : public eoEvalFunc< EOT > +{ +public: + using Fitness = typename EOT::Fitness; + + /** Constructor + * + * @param output_pipe_name The named pipe in which to write the serialized solution. + * @param input_pipe_name The named pipe in which to read the serialized fitness. If it is "", use the output pipe. + */ + eoEvalNamedPipe( + const std::string output_pipe_name, + const std::string input_pipe_name = "" + ) : + _output_pipe_name(output_pipe_name), + _input_pipe_name(input_pipe_name) + { + if( _input_pipe_name == "") { + _input_pipe_name = _output_pipe_name; + } + } + + virtual void operator()( EOT& sol ) + { + // Any modification to sol would makes it invalid, + // it is thus useless to evaluate it, if it is not invalid. + if(not sol.invalid()) { + return; + } + + sol.fitness( call( sol ) ); + } + +private: + const std::string _output_pipe_name; + std::string _input_pipe_name; + + Fitness call( EOT& sol ) + { + // Write the passed solution. + std::ofstream out(_output_pipe_name); + out << sol << std::endl; + out.close(); + + // Read the output string in a valid fitness object. + Fitness fit; + std::ifstream if_fit(_input_pipe_name); + std::stringstream ss_fit; + ss_fit << if_fit.rdbuf(); + if_fit.close(); + ss_fit >> fit; + + return fit; + } +}; + +#endif // eoEvalNamedPipe_H From 2da161fc85d1c2394afbae1ceccbdc999a8d7a70 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Mar 2020 09:11:16 +0100 Subject: [PATCH 020/296] update eoRNG to fit C++17 standard ISO C++17 does not allow 'register' storage class specifier --- eo/src/utils/eoRNG.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/eo/src/utils/eoRNG.h b/eo/src/utils/eoRNG.h index ad5c440bf..0093d37da 100644 --- a/eo/src/utils/eoRNG.h +++ b/eo/src/utils/eoRNG.h @@ -483,9 +483,14 @@ inline void eoRng::initialize(uint32_t seed) { left = -1; + // ISO C++17 does not allow 'register' storage class specifier +#if __cplusplus < 201703L register uint32_t x = (seed | 1U) & 0xFFFFFFFFU, *s = state; register int j; - +#else + uint32_t x = (seed | 1U) & 0xFFFFFFFFU, *s = state; + int j; +#endif for(left=0, *s++=x, j=N; --j; *s++ = (x*=69069U) & 0xFFFFFFFFU) ; } @@ -494,8 +499,14 @@ inline void eoRng::initialize(uint32_t seed) inline uint32_t eoRng::restart() { + // ISO C++17 does not allow 'register' storage class specifier +#if __cplusplus < 201703L register uint32_t *p0=state, *p2=state+2, *pM=state+M, s0, s1; register int j; +#else + uint32_t *p0=state, *p2=state+2, *pM=state+M, s0, s1; + int j; +#endif left=N-1, next=state+1; From 124701a3648182c3fb8578796ad9def53b779ec5 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Mar 2020 09:12:01 +0100 Subject: [PATCH 021/296] expose ScalarType in eoScalarFitness --- eo/src/eoScalarFitness.h | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/eo/src/eoScalarFitness.h b/eo/src/eoScalarFitness.h index 31a9dbffe..6b09305ca 100644 --- a/eo/src/eoScalarFitness.h +++ b/eo/src/eoScalarFitness.h @@ -48,18 +48,19 @@ * Suitable constructors and assignments and casts are defined to work * with this quantity as if it were a ScalarType. */ -template +template class eoScalarFitness { public : + using ScalarType = SCALAR; eoScalarFitness() : value() {} eoScalarFitness(const eoScalarFitness& other) : value(other.value) {} - eoScalarFitness(const ScalarType& v) : value(v) {} + eoScalarFitness(const SCALAR& v) : value(v) {} eoScalarFitness& operator=(const eoScalarFitness& other) { value = other.value; return *this; } - eoScalarFitness& operator=(const ScalarType& v) + eoScalarFitness& operator=(const SCALAR& v) { value = v; return *this; } /** Conversion operator: it permits to use a fitness instance as its scalar @@ -69,27 +70,27 @@ class eoScalarFitness * fit = val; * val = fit; */ - operator ScalarType(void) const { return value; } + operator SCALAR(void) const { return value; } /// Comparison, using less by default bool operator<(const eoScalarFitness& other) const - { return Compare()(value, other.value); } + { return CMP()(value, other.value); } /// Comparison, using less by default // needed for MSVC 8 (MSVC 2005) added by J.Eggermont 20-11-2006 - bool operator<(const ScalarType& other) const - { return Compare()(value, other); } + bool operator<(const SCALAR& other) const + { return CMP()(value, other); } // implementation of the other operators - bool operator>( const eoScalarFitness& y ) const { return y < *this; } + bool operator>( const eoScalarFitness& y ) const { return y < *this; } // implementation of the other operators - bool operator<=( const eoScalarFitness& y ) const { return !(*this > y); } + bool operator<=( const eoScalarFitness& y ) const { return !(*this > y); } // implementation of the other operators - bool operator>=(const eoScalarFitness& y ) const { return !(*this < y); } + bool operator>=(const eoScalarFitness& y ) const { return !(*this < y); } private : - ScalarType value; + SCALAR value; }; /** @example t-eofitness.cpp * From 67aaf8b0255c1f3116c4861eeaabf51a7b83dc53 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 10 Mar 2020 09:12:39 +0100 Subject: [PATCH 022/296] add option to exit after make_help + fix exit code - Defaults to previous behaviour, which was to exit. - Fix the returned exit code: was 1, but should be 0, as asking for help is not an error. --- eo/src/es/make_es.h | 2 +- eo/src/es/make_real.h | 2 +- eo/src/ga/make_ga.h | 2 +- eo/src/utils/checkpointing | 2 +- eo/src/utils/make_help.cpp | 6 ++++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/eo/src/es/make_es.h b/eo/src/es/make_es.h index b1a8801a5..540609741 100644 --- a/eo/src/es/make_es.h +++ b/eo/src/es/make_es.h @@ -145,7 +145,7 @@ void run_ea(eoAlgo >& _ga, eoPop >& _ga, eoPop >& _ga, eoPop Date: Wed, 11 Mar 2020 11:39:38 +0100 Subject: [PATCH 023/296] make_checkpoint writes stats on clog by default Allow for separating logs from output of an algorithm. --- eo/src/do/make_checkpoint.h | 10 +++++----- eo/src/utils/eoOStreamMonitor.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eo/src/do/make_checkpoint.h b/eo/src/do/make_checkpoint.h index c06773480..84ef99961 100644 --- a/eo/src/do/make_checkpoint.h +++ b/eo/src/do/make_checkpoint.h @@ -194,14 +194,14 @@ eoCheckPoint& do_make_checkpoint(eoParser& _parser, eoState& _state, eoValu // The monitors /////////////// - // do we want an eoStdoutMonitor? - bool needStdoutMonitor = printBestParam.value() + // do we want an eoOStreamMonitor? + bool needOutMonitor = printBestParam.value() || printPopParam.value() ; - // The Stdout monitor will print parameters to the screen ... - if ( needStdoutMonitor ) + // The monitor will print parameters to the screen ... + if ( needOutMonitor ) { - eoStdoutMonitor *monitor = new eoStdoutMonitor(/*false FIXME remove this deprecated prototype*/); + eoMonitor *monitor = new eoOStreamMonitor(std::clog); _state.storeFunctor(monitor); // when called by the checkpoint (i.e. at every generation) diff --git a/eo/src/utils/eoOStreamMonitor.cpp b/eo/src/utils/eoOStreamMonitor.cpp index edb091690..af2bfcf63 100644 --- a/eo/src/utils/eoOStreamMonitor.cpp +++ b/eo/src/utils/eoOStreamMonitor.cpp @@ -19,7 +19,7 @@ eoMonitor& eoOStreamMonitor::operator()(void) { if (!out) { - std::string str = "eoOStreamMonitor: Could not write to the ooutput stream"; + std::string str = "eoOStreamMonitor: Could not write to the output stream"; throw std::runtime_error(str); } From 08bbf69f441dd886431f8fd478d76f477af5b910 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 16 Mar 2020 18:17:35 +0100 Subject: [PATCH 024/296] add EDO continuator checking matrices of adaptive distribution --- edo/src/edo | 3 + edo/src/edoCombinedContinue.h | 74 +++++++++++++++++++++++++ edo/src/edoContAdaptiveFinite.h | 95 ++++++++++++++++++++++++++++++++ edo/src/edoContAdaptiveIllCond.h | 83 ++++++++++++++++++++++++++++ edo/src/edoContinue.h | 18 +++--- 5 files changed, 263 insertions(+), 10 deletions(-) create mode 100644 edo/src/edoCombinedContinue.h create mode 100644 edo/src/edoContAdaptiveFinite.h create mode 100644 edo/src/edoContAdaptiveIllCond.h diff --git a/edo/src/edo b/edo/src/edo index 1668a2ee2..a6a0861b5 100644 --- a/edo/src/edo +++ b/edo/src/edo @@ -78,6 +78,9 @@ Authors: #include "edoBounderUniform.h" #include "edoContinue.h" +#include "edoCombinedContinue.h" +#include "edoContAdaptiveIllCond.h" +#include "edoContAdaptiveFinite.h" #include "utils/edoCheckPoint.h" #include "utils/edoStat.h" diff --git a/edo/src/edoCombinedContinue.h b/edo/src/edoCombinedContinue.h new file mode 100644 index 000000000..54aacc143 --- /dev/null +++ b/edo/src/edoCombinedContinue.h @@ -0,0 +1,74 @@ +/* +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) 2020 Thales group +*/ +/* +Authors: + Johann Dréo +*/ + +#ifndef _edoCombinedContinue_h +#define _edoCombinedContinue_h + +#include +#include + +/** Combine several EDO continuators in a single one. + * + * Return true if any of the managed continuator ask for a stop. + * + * @see edoContinue + * + * @ingroup Continuators + * @ingroup Core + */ +template +class edoCombinedContinue : public edoContinue, public std::vector*> +{ +public: + edoCombinedContinue( edoContinue& cont ) : + edoContinue(), + std::vector*>(1,&cont) + { } + + edoCombinedContinue( std::vector*> conts ) : + edoContinue(), + std::vector*>(conts) + { } + + void add( edoContinue& cont) + { + this->push_back(&cont); + } + + bool operator()(const D& distrib) + { + for(const auto cont : *this) { + if( not (*cont)(distrib)) { + return false; + } + } + return true; + } + + virtual std::string className() const { return "edoCombinedContinue"; } +}; + +#endif // !_edoCombinedContinue_h diff --git a/edo/src/edoContAdaptiveFinite.h b/edo/src/edoContAdaptiveFinite.h new file mode 100644 index 000000000..a01775759 --- /dev/null +++ b/edo/src/edoContAdaptiveFinite.h @@ -0,0 +1,95 @@ +/* +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) 2020 Thales group +*/ +/* +Authors: + Johann Dréo +*/ + +#ifndef _edoContAdaptiveFinite_h +#define _edoContAdaptiveFinite_h + +#include "edoContinue.h" + +/** A continuator that check if any element in the parameters + * of an edoNormalAdaptive distribution are finite + * + * If any element of any parameter is infinity or NaN (Not A Number), + * it will ask for a stop. + * + * @ingroup Continuators + */ +template +class edoContAdaptiveFinite : public edoContinue +{ +public: + using EOType = typename D::EOType; + using Matrix = typename D::Matrix; + using Vector = typename D::Vector; + + bool operator()(const D& d) + { + // Try to finite_check in most probably ill-conditioned order. + return finite_check(d.covar()) + and finite_check(d.path_covar()) + and finite_check(d.coord_sys()) + and finite_check(d.scaling()) + and finite_check(d.path_sigma()) + and finite_check(d.sigma()) + ; + } + + virtual std::string className() const { return "edoContAdaptiveFinite"; } + +protected: + bool finite_check(const Matrix& mat) const + { + for(long i=0; i +*/ + +#ifndef _edoContAdaptiveIllCond_h +#define _edoContAdaptiveIllCond_h + +#ifdef WITH_EIGEN + +#include + +#include "edoContinue.h" + +/** A continuator that check if any matrix among the parameters + * of an edoNormalAdaptive distribution are ill-conditioned. + * + * If the condition number of the covariance matrix + * or the coordinate system matrix are strictly greater + * than the threshold given at construction, it will ask for a stop. + * + * @ingroup Continuators + */ +template +class edoContAdaptiveIllCond : public edoContinue +{ +public: + using EOType = typename D::EOType; + using Matrix = typename D::Matrix; + using Vector = typename D::Vector; + + edoContAdaptiveIllCond( double threshold = 1e6) : + _threshold(threshold) + { } + + bool operator()(const D& d) + { + if( condition(d.covar()) > _threshold + or condition(d.coord_sys()) > _threshold ) { + return false; + } else { + return true; + } + } + + virtual std::string className() const { return "edoContAdaptiveIllCond"; } + +public: + // Public function in case someone would want to dimensionate the condition threshold. + //! Returns the condition number + bool condition(const Matrix& mat) const + { + Eigen::JacobiSVD svd(mat); + return svd.singularValues()(0) / svd.singularValues()(svd.singularValues().size()-1); + } + + const double _threshold; +}; + +#endif // WITH_EIGEN + +#endif diff --git a/edo/src/edoContinue.h b/edo/src/edoContinue.h index 8089601e2..6540b9b0b 100644 --- a/edo/src/edoContinue.h +++ b/edo/src/edoContinue.h @@ -25,8 +25,8 @@ Authors: Caner Candan */ -#ifndef _doContinue_h -#define _doContinue_h +#ifndef _edoContinue_h +#define _edoContinue_h #include #include @@ -44,20 +44,18 @@ class edoContinue : public eoUF< const D&, bool >, public eoPersistent public: virtual std::string className(void) const { return "edoContinue"; } - void readFrom(std::istream&) - { - /* It should be implemented by subclasses ! */ - } + // May be implemented by subclasses if persistent interface needed + virtual void readFrom(std::istream&) + { } - void printOn(std::ostream&) const - { - /* It should be implemented by subclasses ! */ - } + virtual void printOn(std::ostream&) const + { } }; template < typename D > class edoDummyContinue : public edoContinue< D > { +public: bool operator()(const D&){ return true; } virtual std::string className() const { return "edoDummyContinue"; } From c99ed01dc6b2c308ce89e1a13a8591cf7a7d359a Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 16 Mar 2020 18:19:10 +0100 Subject: [PATCH 025/296] REMOVE eoEvalFuncCounterBounder duplicate of eoEvalCounterThrowException --- eo/src/eoEvalCounterThrowException.h | 6 ++- eo/src/eoEvalFuncCounterBounder.h | 67 ---------------------------- 2 files changed, 5 insertions(+), 68 deletions(-) delete mode 100644 eo/src/eoEvalFuncCounterBounder.h diff --git a/eo/src/eoEvalCounterThrowException.h b/eo/src/eoEvalCounterThrowException.h index 8b38908e4..b83699916 100644 --- a/eo/src/eoEvalCounterThrowException.h +++ b/eo/src/eoEvalCounterThrowException.h @@ -37,6 +37,10 @@ algorithm have reached a maximum number of evaluations. This may be useful if you want to check this kind of stopping criterion at each _evaluation_, instead of using continuators at each _iteration_. +This eval counter permits to stop a search during a generation, without waiting for a continue to be +checked at the end of the loop. Useful if you have 10 individuals and 10 generations, +but want to stop after 95 evaluations. + The class first call the evaluation function, then check the number of times it has been called. If the maximum number of evaluation has been reached, it throw an eoMaxEvalException. You can catch this exception @@ -72,7 +76,7 @@ public : } // evaluate - func(eo); + this->eoEvalFuncCounter::operator()(eo); } // if invalid } diff --git a/eo/src/eoEvalFuncCounterBounder.h b/eo/src/eoEvalFuncCounterBounder.h deleted file mode 100644 index 30ac03473..000000000 --- a/eo/src/eoEvalFuncCounterBounder.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef eoEvalFuncCounterBounder_H -#define eoEvalFuncCounterBounder_H - -#include "eoEvalFunc.h" -#include "utils/eoParam.h" - -/** @addtogroup Evaluation - * @{ - */ - -/** The exception raised by eoEvalFuncCounterBounder - * when the maximum number of allowed evaluations is reached. - */ -class eoEvalFuncCounterBounderException : public std::exception -{ -public: - eoEvalFuncCounterBounderException(unsigned long threshold) : _threshold(threshold){} - - const char* what() const throw() - { - std::ostringstream ss; - ss << "STOP in eoEvalFuncCounterBounderException: the maximum number of evaluation has been reached (" << _threshold << ")."; - return ss.str().c_str(); - } - -private: - unsigned long _threshold; -}; - -/** Counts the number of evaluations actually performed and throw an eoEvalFuncCounterBounderException - * when the maximum number of allowed evaluations is reached. - * - * This eval counter permits to stop a search during a generation, without waiting for a continue to be - * checked at the end of the loop. Useful if you have 10 individuals and 10 generations, - * but want to stop after 95 evaluations. -*/ -template < typename EOT > -class eoEvalFuncCounterBounder : public eoEvalFuncCounter< EOT > -{ -public : - eoEvalFuncCounterBounder(eoEvalFunc& func, unsigned long threshold, std::string name = "Eval. ") - : eoEvalFuncCounter< EOT >( func, name ), _threshold( threshold ) - {} - - using eoEvalFuncCounter< EOT >::value; - - virtual void operator()(EOT& eo) - { - if (eo.invalid()) - { - value()++; - - if (_threshold > 0 && value() >= _threshold) - { - throw eoEvalFuncCounterBounderException(_threshold); - } - - this->func(eo); - } - } - -private : - unsigned long _threshold; -}; - -/** @} */ -#endif From a5354f8ef3216ab8a6901dfdba210ca77eb38df4 Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 16 Mar 2020 18:20:04 +0100 Subject: [PATCH 026/296] add eoEvalNanThrowException Wrap an evaluation function so that an exception may be thrown when the eval function returns a bad value (Not A Number or infinity). --- eo/src/eoEvalNanThrowException.h | 73 ++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 eo/src/eoEvalNanThrowException.h diff --git a/eo/src/eoEvalNanThrowException.h b/eo/src/eoEvalNanThrowException.h new file mode 100644 index 000000000..41251d10f --- /dev/null +++ b/eo/src/eoEvalNanThrowException.h @@ -0,0 +1,73 @@ +/* +(c) Thales group, 2020 + + 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; + version 2 of the License. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact: http://eodev.sourceforge.net + +Authors: +Johann Dréo + +*/ + +#ifndef __eoEvalNanThrowException_h__ +#define __eoEvalNanThrowException_h__ + +#include + +#include "eoEvalFunc.h" +#include "eoExceptions.h" + +/*! +Wrap an evaluation function so that an exception may be thrown when the +eval function returns a bad value (Not A Number or infinity). + +@warning: Only work for eoScalarFitness. + +The class throw an eoNanException. You can catch this exception +from your main function, so as to stop everything properly. + +@ingroup Evaluation +*/ +template < typename EOT > +class eoEvalNanThrowException : public eoEvalFunc< EOT > +{ +public : + eoEvalNanThrowException( eoEvalFunc& func) + : _func(func) + {} + + //! Evaluate the individual, then throw an exception if it exceed the max number of evals. + virtual void operator()(EOT& sol) + { + if(sol.invalid()) { + _func(sol); + + if(not std::isfinite(sol.fitness()) ) { +#ifndef NDEBUG + eo::log << eo::xdebug << sol << std::endl; +#endif + throw eoNanException(); + } + } // if invalid + } + + virtual std::string className() const {return "eoEvalNanThrowException";} + +protected: + eoEvalFunc& _func; +}; + +#endif // __eoEvalNanThrowException_h__ From 80a11c70590625a3d796512c6757004155b37a1e Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 16 Mar 2020 18:21:25 +0100 Subject: [PATCH 027/296] add a reset method to edoNormalAdaptive Useful when performing restart after exception catch. --- edo/src/edoNormalAdaptive.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/edo/src/edoNormalAdaptive.h b/edo/src/edoNormalAdaptive.h index edde019b1..1d8a82bd7 100644 --- a/edo/src/edoNormalAdaptive.h +++ b/edo/src/edoNormalAdaptive.h @@ -153,6 +153,17 @@ public: void path_covar( Vector p ) { _p_c = p; assert( p.size() == _dim ); } void path_sigma( Vector p ) { _p_s = p; assert( p.size() == _dim ); } + void reset() + { + _mean = Vector::Zero(_dim); + _C = Matrix::Identity(_dim,_dim); + _B = Matrix::Identity(_dim,_dim); + _D = Vector::Constant( _dim, 1); + _sigma = 1.0; + _p_c = Vector::Zero(_dim); + _p_s = Vector::Zero(_dim); + } + private: unsigned int _dim; Vector _mean; // mean vector From 11254b4fbdcccfc36fe7acc7a8dbb86d11f004bb Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 16 Mar 2020 18:22:14 +0100 Subject: [PATCH 028/296] remove eoEvalFuncCounterBounder.h from general eo header --- eo/src/eo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/src/eo b/eo/src/eo index c415c214b..57f9e5cc0 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -77,8 +77,8 @@ #include "eoEvalNamedPipe.h" #include "eoEvalCmd.h" #include "eoEvalCounterThrowException.h" +#include "eoEvalNanThrowException.h" #include "eoEvalDump.h" -#include "eoEvalFuncCounterBounder.h" #include "eoEvalFuncCounter.h" #include "eoEvalFunc.h" #include "eoEvalFuncPtr.h" From f68d3c1396fdd004a991d0613593a7c0f02dadde Mon Sep 17 00:00:00 2001 From: nojhan Date: Mon, 16 Mar 2020 18:30:48 +0100 Subject: [PATCH 029/296] add an interface toward IOHexperimenter Handle IOH mono-objective function and CSV logger. --- problems/eval/eoEvalIOH.h | 61 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 problems/eval/eoEvalIOH.h diff --git a/problems/eval/eoEvalIOH.h b/problems/eval/eoEvalIOH.h new file mode 100644 index 000000000..7bbc3d449 --- /dev/null +++ b/problems/eval/eoEvalIOH.h @@ -0,0 +1,61 @@ + +#ifndef _eoEvalIOH_h +#define _eoEvalIOH_h + +#include +#include + +/** Wrap an IOHexperimenter's problem class within an eoEvalFunc. + * + * See https://github.com/IOHprofiler/IOHexperimenter + * + * Handle only fitnesses that inherits from eoScalarFitness. + * + * @note: You're responsible of matching the fitness' scalar type (IOH handle double and int, as of 2020-03-09). + * + * You will need to pass the IOH include directory to your compiler (e.g. IOHexperimenter/build/Cpp/src/). + */ +template +class eoEvalIOH : public eoEvalFunc +{ + public: + using Fitness = typename EOT::Fitness; + using ScalarType = typename Fitness::ScalarType; + + eoEvalIOH( IOHprofiler_problem & pb) : + _ioh_pb(pb), + _has_log(false) + { } + + eoEvalIOH( IOHprofiler_problem & pb, IOHprofiler_csv_logger & log ) : + _ioh_pb(pb), + _has_log(true), + _ioh_log(log) + { } + + virtual void operator()(EOT& sol) + { + if(not sol.invalid()) { + return; + } + + sol.fitness( call( sol ) ); + } + + protected: + IOHprofiler_problem & _ioh_pb; + bool _has_log; + IOHprofiler_csv_logger & _ioh_log; + + virtual Fitness call(EOT& sol) + { + Fitness f = _ioh_pb.evaluate(sol); + if(_has_log) { + _ioh_log.write_line(_ioh_pb.loggerInfo()); + } + return f; + } + +}; + +#endif // _eoEvalIOH_h From 64e14e09dfb11a2c3e6ce8fd36fd6fd62fe505ad Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 17 Mar 2020 12:04:02 +0100 Subject: [PATCH 030/296] move the distrib continue in EDO adaptive algos - Call the continuator right after the distribution update, because we may have generated an ill-conditioned distribution, which would lead to bad solution sampling. - Reserve mem of sampled vector. --- edo/src/edoAlgoAdaptive.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/edo/src/edoAlgoAdaptive.h b/edo/src/edoAlgoAdaptive.h index 5ee0f359a..7de567eee 100644 --- a/edo/src/edoAlgoAdaptive.h +++ b/edo/src/edoAlgoAdaptive.h @@ -160,13 +160,26 @@ public: // (2) Estimation of the distribution parameters _distrib = _estimator(selected_pop); + // TODO modularization: the estimator and the continuator perform + // the same decomposition twice, see how to decompose those operators + + // Call the continuator right after the distribution update, + // because we may have generated an ill-conditioned distribution, + // which would lead to bad solution sampling. + if(not _distribution_continuator(_distrib)) { + break; + } + // (3) sampling // The sampler produces feasible solutions (@see edoSampler that // encapsulate an edoBounder) - current_pop.clear(); + current_pop.clear(); current_pop.reserve(pop.size()); for( unsigned int i = 0; i < pop.size(); ++i ) { current_pop.push_back( _sampler(_distrib) ); } + // TODO modluraziation: the sampler may generate solution that are + // not finite. See how to stop right from there instead of + // performing useless evaluations. // (4) Evaluate new solutions _evaluator( pop, current_pop ); @@ -174,7 +187,7 @@ public: // (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 ) ); + } while( _pop_continuator( pop ) ); } // operator() From 38e3f40bad3f4da6916831dd532d1db8f18e6763 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 17 Mar 2020 12:05:56 +0100 Subject: [PATCH 031/296] cleaner numerical errors management for EDO adaptive algos - Change the ill-condition continuator to use eigen decomposition of the covariance matrix, just like in the adaptive estimator. - Add a warning message in adaptive sampler. --- edo/src/edo | 2 +- edo/src/edoContAdaptiveFinite.h | 51 ++++++++---- edo/src/edoContAdaptiveIllCond.h | 83 -------------------- edo/src/edoContAdaptiveIllCovar.h | 112 +++++++++++++++++++++++++++ edo/src/edoEstimatorNormalAdaptive.h | 7 +- edo/src/edoSamplerNormalAdaptive.h | 23 +++++- 6 files changed, 174 insertions(+), 104 deletions(-) delete mode 100644 edo/src/edoContAdaptiveIllCond.h create mode 100644 edo/src/edoContAdaptiveIllCovar.h diff --git a/edo/src/edo b/edo/src/edo index a6a0861b5..e6a03a1ed 100644 --- a/edo/src/edo +++ b/edo/src/edo @@ -79,7 +79,7 @@ Authors: #include "edoContinue.h" #include "edoCombinedContinue.h" -#include "edoContAdaptiveIllCond.h" +#include "edoContAdaptiveIllCovar.h" #include "edoContAdaptiveFinite.h" #include "utils/edoCheckPoint.h" diff --git a/edo/src/edoContAdaptiveFinite.h b/edo/src/edoContAdaptiveFinite.h index a01775759..c92e6d4ff 100644 --- a/edo/src/edoContAdaptiveFinite.h +++ b/edo/src/edoContAdaptiveFinite.h @@ -47,24 +47,43 @@ public: bool operator()(const D& d) { - // Try to finite_check in most probably ill-conditioned order. - return finite_check(d.covar()) - and finite_check(d.path_covar()) - and finite_check(d.coord_sys()) - and finite_check(d.scaling()) - and finite_check(d.path_sigma()) - and finite_check(d.sigma()) - ; + bool fin_sigma = is_finite(d.sigma() ); + bool fin_path_sigma = is_finite(d.path_sigma()); + bool fin_scaling = is_finite(d.scaling() ); + bool fin_coord_sys = is_finite(d.coord_sys() ); + bool fin_path_covar = is_finite(d.path_covar()); + bool fin_covar = is_finite(d.covar() ); + + bool all_finite = fin_covar + and fin_path_covar + and fin_coord_sys + and fin_scaling + and fin_path_sigma + and fin_sigma; + + if( not all_finite ) { + eo::log << eo::progress << "STOP because parameters are not finite: "; + if( not fin_covar ) { eo::log << eo::errors << "covar, "; } + if( not fin_path_covar ) { eo::log << eo::errors << "path_covar, "; } + if( not fin_coord_sys ) { eo::log << eo::errors << "coord_sys, "; } + if( not fin_scaling ) { eo::log << eo::errors << "scaling, "; } + if( not fin_path_sigma ) { eo::log << eo::errors << "path_sigma, "; } + if( not fin_sigma ) { eo::log << eo::errors << "sigma"; } + eo::log << eo::errors << std::endl; + } + return all_finite; } virtual std::string className() const { return "edoContAdaptiveFinite"; } protected: - bool finite_check(const Matrix& mat) const + bool is_finite(const Matrix& mat) const { for(long i=0; i -*/ - -#ifndef _edoContAdaptiveIllCond_h -#define _edoContAdaptiveIllCond_h - -#ifdef WITH_EIGEN - -#include - -#include "edoContinue.h" - -/** A continuator that check if any matrix among the parameters - * of an edoNormalAdaptive distribution are ill-conditioned. - * - * If the condition number of the covariance matrix - * or the coordinate system matrix are strictly greater - * than the threshold given at construction, it will ask for a stop. - * - * @ingroup Continuators - */ -template -class edoContAdaptiveIllCond : public edoContinue -{ -public: - using EOType = typename D::EOType; - using Matrix = typename D::Matrix; - using Vector = typename D::Vector; - - edoContAdaptiveIllCond( double threshold = 1e6) : - _threshold(threshold) - { } - - bool operator()(const D& d) - { - if( condition(d.covar()) > _threshold - or condition(d.coord_sys()) > _threshold ) { - return false; - } else { - return true; - } - } - - virtual std::string className() const { return "edoContAdaptiveIllCond"; } - -public: - // Public function in case someone would want to dimensionate the condition threshold. - //! Returns the condition number - bool condition(const Matrix& mat) const - { - Eigen::JacobiSVD svd(mat); - return svd.singularValues()(0) / svd.singularValues()(svd.singularValues().size()-1); - } - - const double _threshold; -}; - -#endif // WITH_EIGEN - -#endif diff --git a/edo/src/edoContAdaptiveIllCovar.h b/edo/src/edoContAdaptiveIllCovar.h new file mode 100644 index 000000000..409d6db33 --- /dev/null +++ b/edo/src/edoContAdaptiveIllCovar.h @@ -0,0 +1,112 @@ +/* +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) 2020 Thales group +*/ +/* +Authors: + Johann Dréo +*/ + +#ifndef _edoContAdaptiveIllCovar_h +#define _edoContAdaptiveIllCovar_h + +#ifdef WITH_EIGEN + +#include + +#include "edoContinue.h" + +/** A continuator that check if the covariance matrix + * of an edoNormalAdaptive distribution is ill-conditioned. + * + * If the condition number of the covariance matrix + * is strictly greater than the threshold given at construction, + * it will ask for a stop. + * + * @ingroup Continuators + */ +template +class edoContAdaptiveIllCovar : public edoContinue +{ +public: + using EOType = typename D::EOType; + using Matrix = typename D::Matrix; + using Vector = typename D::Vector; + + edoContAdaptiveIllCovar( double threshold = 1e6) : + _threshold(threshold) + { } + + bool operator()(const D& d) + { + Eigen::SelfAdjointEigenSolver eigensolver( d.covar() ); + + auto info = eigensolver.info(); + if(info == Eigen::ComputationInfo::NumericalIssue) { + eo::log << eo::warnings << "WARNING: the eigen decomposition of the covariance matrix" + << " did not satisfy the prerequisites." << std::endl; + } else if(info == Eigen::ComputationInfo::NoConvergence) { + eo::log << eo::warnings << "WARNING: the eigen decomposition of the covariance matrix" + << " did not converged." << std::endl; + } else if(info == Eigen::ComputationInfo::InvalidInput) { + eo::log << eo::warnings << "WARNING: the eigen decomposition of the covariance matrix" + << " had invalid inputs." << std::endl; + } + if(info != Eigen::ComputationInfo::Success) { + eo::log << eo::progress << "STOP because the covariance matrix" + << " cannot be decomposed" << std::endl; +#ifndef NDEBUG + eo::log << eo::xdebug + << "mean:\n" << d.mean() << std::endl + << "sigma:" << d.sigma() << std::endl + << "coord_sys:\n" << d.coord_sys() << std::endl + << "scaling:\n" << d.scaling() << std::endl; +#endif + return false; + + }else { + Matrix EV = eigensolver.eigenvalues(); + double condition = EV.maxCoeff() / EV.minCoeff(); + + if( not std::isfinite(condition) ) { + eo::log << eo::progress << "STOP because the covariance matrix" + << " condition is not finite." << std::endl; + return false; + + } else if( condition >= _threshold ) { + eo::log << eo::progress << "STOP because the covariance matrix" + << " is ill-conditionned (condition number: " << condition << ")" << std::endl; + return false; + + } else { + return true; + } + } + } + + virtual std::string className() const { return "edoContAdaptiveIllCovar"; } + +protected: + const double _threshold; +}; + +#endif // WITH_EIGEN + +#endif diff --git a/edo/src/edoEstimatorNormalAdaptive.h b/edo/src/edoEstimatorNormalAdaptive.h index f1adf723f..be8c88d15 100644 --- a/edo/src/edoEstimatorNormalAdaptive.h +++ b/edo/src/edoEstimatorNormalAdaptive.h @@ -227,14 +227,15 @@ public: // Matrix CS = C.triangularView() + C.triangularView().transpose(); d.covar( C ); - Eigen::SelfAdjointEigenSolver eigensolver( d.covar() ); // FIXME use JacobiSVD? - d.coord_sys( eigensolver.eigenvectors() ); + Eigen::SelfAdjointEigenSolver eigensolver( d.covar() ); + Matrix mD = eigensolver.eigenvalues().asDiagonal(); - assert( mD.innerSize() == N && mD.outerSize() == N ); // from variance to standard deviations mD.cwiseSqrt(); d.scaling( mD.diagonal() ); + + d.coord_sys( eigensolver.eigenvectors() ); } return d; diff --git a/edo/src/edoSamplerNormalAdaptive.h b/edo/src/edoSamplerNormalAdaptive.h index 051e14835..f1b33d10f 100644 --- a/edo/src/edoSamplerNormalAdaptive.h +++ b/edo/src/edoSamplerNormalAdaptive.h @@ -72,11 +72,32 @@ public: // mean(N,1) + sigma * B(N,N) * ( D(N,1) .* T(N,1) ) Vector sol = distrib.mean() + distrib.sigma() - * distrib.coord_sys() * (distrib.scaling().cwiseProduct(T) ); // C * T = B * (D .* T) + * distrib.coord_sys() + * (distrib.scaling().cwiseProduct(T) ); // C * T = B * (D .* T) assert( sol.size() == N ); /*Vector sol = distrib.mean() + distrib.sigma() * distrib.coord_sys().dot( distrib.scaling().dot( T ) );*/ +#ifndef NDEBUG + bool is_finite = true; + for(long i=0; i Date: Sun, 22 Mar 2020 18:57:50 +0100 Subject: [PATCH 032/296] add eoStoreFunctor::pack to allocate & store in one line Instead of calling `new`, then `state.storeFunctor`, the user can just call `Class& inst = state.pack< Class >( params )` in one line. Use C++11's variadic templates. --- eo/src/eoFunctorStore.h | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/eo/src/eoFunctorStore.h b/eo/src/eoFunctorStore.h index ffcbe90d7..889b832de 100644 --- a/eo/src/eoFunctorStore.h +++ b/eo/src/eoFunctorStore.h @@ -54,20 +54,36 @@ public: /// Add an eoFunctorBase to the store template Functor& storeFunctor(Functor* r) - { + { #ifndef NDEBUG - unsigned int existing = std::count( vec.begin(), vec.end(), r ); - if( existing > 0 ) { - eo::log << eo::warnings << "WARNING: you asked eoFunctorStore to store the functor " << r << " " - << existing + 1 << " times, a segmentation fault may occur in the destructor." << std::endl; - } + unsigned int existing = std::count( vec.begin(), vec.end(), r ); + if( existing > 0 ) { + eo::log << eo::warnings << "WARNING: you asked eoFunctorStore to store the functor " << r << " " + << existing + 1 << " times, a segmentation fault may occur in the destructor." << std::endl; + } #endif - // If the compiler complains about the following line, - // check if you really are giving it a pointer to an - // eoFunctorBase derived object - vec.push_back(r); - return *r; - } + // If the compiler complains about the following line, + // check if you really are giving it a pointer to an + // eoFunctorBase derived object + vec.push_back(r); + return *r; + } + + /** Allocate the given functor, store it and return its reference. + * + * Indicate the class to instanciate as template paramater, + * and pass its constructor arguments. + * + * @code + * eoSelect& selector = state.pack< eoRankMuSelect >( mu ); + * @endcode + */ + template + Functor& pack( Args&&... args ) + { + Functor* f = new Functor(args...); + return this->storeFunctor(f); + } private : From ab740b2a72552b3babadd57d684fae6f6ba64b96 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 24 Mar 2020 16:27:58 +0100 Subject: [PATCH 033/296] add a monitor to print on eo::log at given level - add eoTimedMonitor missing header --- eo/src/utils/checkpointing | 2 + eo/src/utils/eoLogMonitor.h | 73 +++++++++++++++++++++++++++++++++++++ eo/src/utils/eoLogger.h | 3 +- 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 eo/src/utils/eoLogMonitor.h diff --git a/eo/src/utils/checkpointing b/eo/src/utils/checkpointing index f630c3744..79fdab123 100644 --- a/eo/src/utils/checkpointing +++ b/eo/src/utils/checkpointing @@ -29,8 +29,10 @@ #include "eoUpdater.h" #include "eoMonitor.h" #include "eoFileMonitor.h" +#include "eoTimedMonitor.h" #include "eoStdoutMonitor.h" #include "eoOStreamMonitor.h" +#include "eoLogMonitor.h" #ifndef _MSC_VER #include "eoGnuplot1DMonitor.h" #include "eoGnuplot1DSnapshot.h" diff --git a/eo/src/utils/eoLogMonitor.h b/eo/src/utils/eoLogMonitor.h new file mode 100644 index 000000000..94884250b --- /dev/null +++ b/eo/src/utils/eoLogMonitor.h @@ -0,0 +1,73 @@ +/* + +(c) Marc Schoenauer, Maarten Keijzer and GeNeura Team, 2000 +(c) Thales group, 2010 + + 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; version 2 of the license. + + This library is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along + with this library; if not, write to the Free Software Foundation, Inc., 59 + Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact: http://eodev.sourceforge.net + +Authors: + Johann Dréo +*/ + +#ifndef _eoLogMonitor_h_ +#define _eoLogMonitor_h_ + +#include +#include +#include + +#include "eoOStreamMonitor.h" +#include "eoLogger.h" + +/** + Prints statistics to a given ostream. + + You can pass any instance of an ostream to the constructor, like, for example, std::clog. + + @ingroup Monitors +*/ +class eoLogMonitor : public eoOStreamMonitor +{ +public : + eoLogMonitor( + eoLogger& logger = eo::log, + eo::Levels level = eo::progress, + std::string delim = "\t", unsigned int width=20, char fill=' ', + bool print_names = false, std::string name_sep = ":" + ) : + eoOStreamMonitor(_oss, delim, width, fill, print_names, name_sep), + _log(logger), + _level(level) + {} + + eoMonitor& operator()(void) + { + eoOStreamMonitor::operator()(); // write to _oss + // Output at the log level. + _log << _level << _oss.str(); + // Empty the output stream to avoid duplicated lines. + _oss.str(""); _oss.clear(); + return *this; + } + + virtual std::string className(void) const { return "eoLogMonitor"; } + +private : + std::ostringstream _oss; + eoLogger & _log; + eo::Levels _level; +}; + +#endif // _eoLogMonitor_h_ diff --git a/eo/src/utils/eoLogger.h b/eo/src/utils/eoLogger.h index a3c377fed..785d37acd 100644 --- a/eo/src/utils/eoLogger.h +++ b/eo/src/utils/eoLogger.h @@ -138,8 +138,7 @@ namespace eo * Class providing a verbose management through EO * Use of a global variable eo::log to easily use the logger like std::cout */ -class eoLogger : public eoObject, - public std::ostream +class eoLogger : public eoObject, public std::ostream { public: //! default ctor From e0e1cb8bc9db7636312cacacf99af2c95c781567 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 24 Mar 2020 16:31:49 +0100 Subject: [PATCH 034/296] feat: separate estimators for init and in loop in edoAlgoAdaptive Allows for easier reseting or editing of distribution during restarts. --- edo/src/edoAlgoAdaptive.h | 54 ++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/edo/src/edoAlgoAdaptive.h b/edo/src/edoAlgoAdaptive.h index 7de567eee..efc23db9a 100644 --- a/edo/src/edoAlgoAdaptive.h +++ b/edo/src/edoAlgoAdaptive.h @@ -34,7 +34,7 @@ Authors: #include "edoAlgo.h" #include "edoEstimator.h" -#include "edoModifierMass.h" +// #include "edoModifierMass.h" #include "edoSampler.h" #include "edoContinue.h" @@ -67,7 +67,44 @@ public: public: /*! - Takes algo operators, all are mandatory + Takes all operators. + + \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 estimator_init Estimation of the distribution parameters, called before the main loop. + \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, + edoEstimator< D > & estimator_init, + edoSampler< D > & sampler, + eoReplacement< EOType > & replacor, + eoContinue< EOType > & pop_continuator, + edoContinue< D > & distribution_continuator + ) : + _distrib(distrib), + _evaluator(evaluator), + _selector(selector), + _estimator(estimator), + _estimator_init(estimator_init), + _sampler(sampler), + _replacor(replacor), + _pop_continuator(pop_continuator), + _dummy_continue(), + _distribution_continuator(distribution_continuator) + {} + + + /*! + Without the initialization estimator (set the same estimator everywhere). \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 @@ -92,6 +129,7 @@ public: _evaluator(evaluator), _selector(selector), _estimator(estimator), + _estimator_init(estimator), _sampler(sampler), _replacor(replacor), _pop_continuator(pop_continuator), @@ -125,6 +163,7 @@ public: _evaluator(evaluator), _selector(selector), _estimator(estimator), + _estimator_init(estimator), _sampler(sampler), _replacor(replacor), _pop_continuator(pop_continuator), @@ -141,18 +180,18 @@ public: { 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); + _distrib = _estimator_init(pop); // Evaluating a first time the candidate solutions // The first pop is not supposed to be evaluated (@see eoPopLoopEval). // _evaluator( current_pop, pop ); do { + eoPop< EOType > current_pop; + eoPop< EOType > selected_pop; + // (1) Selection of the best points in the population _selector(pop, selected_pop); assert( selected_pop.size() > 0 ); @@ -205,6 +244,9 @@ protected: //! A EOType estimator. It is going to estimate distribution parameters. edoEstimator & _estimator; + //! A EOType estimator. Called before the main loop. + edoEstimator & _estimator_init; + //! A D sampler edoSampler & _sampler; From 77921fea0c12ecff76a7fd42e7327099bd5bc772 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 24 Mar 2020 16:34:01 +0100 Subject: [PATCH 035/296] feat: add initializer list interface to eoFunctorStore Easier to use while state initialize combined operators. --- eo/src/eoFunctorStore.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/eo/src/eoFunctorStore.h b/eo/src/eoFunctorStore.h index 889b832de..7ed2947ac 100644 --- a/eo/src/eoFunctorStore.h +++ b/eo/src/eoFunctorStore.h @@ -85,6 +85,14 @@ public: return this->storeFunctor(f); } + // Allow to pass initializer lists of pointers, for example for edoCombinedContinue. + template + Functor& pack( std::initializer_list args ) + { + Functor* f = new Functor(args); + return this->storeFunctor(f); + } + private : /** no copying allowed */ From e389294cbb906e18778568abcc3b3f5baa989950 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 24 Mar 2020 16:35:49 +0100 Subject: [PATCH 036/296] feat: EDO add combinable estimators Useful to edit the distribution during init, restart or even search. --- edo/src/edo | 3 + edo/src/edoEstimatorAdaptiveEdit.h | 79 +++++++++++++++++++++ edo/src/edoEstimatorAdaptiveReset.h | 54 +++++++++++++++ edo/src/edoEstimatorCombined.h | 103 ++++++++++++++++++++++++++++ 4 files changed, 239 insertions(+) create mode 100644 edo/src/edoEstimatorAdaptiveEdit.h create mode 100644 edo/src/edoEstimatorAdaptiveReset.h create mode 100644 edo/src/edoEstimatorCombined.h diff --git a/edo/src/edo b/edo/src/edo index e6a03a1ed..030da23b0 100644 --- a/edo/src/edo +++ b/edo/src/edo @@ -46,9 +46,12 @@ Authors: #include "edoEstimatorNormalMono.h" #include "edoEstimatorNormalMulti.h" #include "edoEstimatorAdaptive.h" +#include "edoEstimatorAdaptiveReset.h" +#include "edoEstimatorAdaptiveEdit.h" #include "edoEstimatorNormalAdaptive.h" #include "edoEstimatorBinomial.h" #include "edoEstimatorBinomialMulti.h" +#include "edoEstimatorCombined.h" #include "edoModifier.h" #include "edoModifierDispersion.h" diff --git a/edo/src/edoEstimatorAdaptiveEdit.h b/edo/src/edoEstimatorAdaptiveEdit.h new file mode 100644 index 000000000..dbf0d920b --- /dev/null +++ b/edo/src/edoEstimatorAdaptiveEdit.h @@ -0,0 +1,79 @@ +/* +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) 2020 Thales group +*/ +/* +Authors: + Johann Dréo +*/ + +#ifndef _edoEstimatorAdaptiveEdit_h +#define _edoEstimatorAdaptiveEdit_h + +#include + +#include "edoEstimatorAdaptive.h" + +/** An estimator that calls `reset` on the managed distribution. + * + * @ingroup Estimators + */ +template +class edoEstimatorAdaptiveEdit : public edoEstimatorAdaptive +{ +public: + typedef typename D::EOType EOType; + + /** Edit the given distribution's members with the given accessors. + * + * For example, to shift the distribution's mean toward pop's best element + * (note the lack of parenthesis): + * @code + * edoEstimatorAdaptiveEdit e(distrib, + * std::bind(&eoPop::best_element, &pop), + * // std::bind(&D::mean, &distrib, std::placeholders::_1) // Fail to deduce templates + * // but you can use lambdas (even more readable): + * [&distrib](S center){distrib.mean(center);} + * distrib.mean, pop.best_element); + * @endcode + */ + edoEstimatorAdaptiveEdit( + D& distrib, + std::function getter, + std::function setter + ) : + edoEstimatorAdaptive(distrib), + _getter(getter), + _setter(setter) + {} + + virtual D operator()( eoPop& pop ) + { + _setter( _getter() ); + return this->_distrib; + } + +protected: + std::function< P ( )> _getter; + std::function _setter; + +}; + +#endif // !_edoEstimatorAdaptiveEdit_h diff --git a/edo/src/edoEstimatorAdaptiveReset.h b/edo/src/edoEstimatorAdaptiveReset.h new file mode 100644 index 000000000..012784a3d --- /dev/null +++ b/edo/src/edoEstimatorAdaptiveReset.h @@ -0,0 +1,54 @@ +/* +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) 2020 Thales group +*/ +/* +Authors: + Johann Dréo +*/ + +#ifndef _edoEstimatorAdaptiveReset_h +#define _edoEstimatorAdaptiveReset_h + +#include + +#include "edoEstimatorAdaptive.h" + +/** An estimator that calls `reset` on the managed distribution. + * + * @ingroup Estimators + */ +template +class edoEstimatorAdaptiveReset : public edoEstimatorAdaptive +{ +public: + typedef typename D::EOType EOType; + + edoEstimatorAdaptiveReset( D& distrib ) : edoEstimatorAdaptive(distrib) {} + + virtual D operator() ( eoPop& ) + { + this->_distrib.reset(); + return this->_distrib; + } + +}; + +#endif // !_edoEstimatorAdaptiveReset_h diff --git a/edo/src/edoEstimatorCombined.h b/edo/src/edoEstimatorCombined.h new file mode 100644 index 000000000..f884f38f1 --- /dev/null +++ b/edo/src/edoEstimatorCombined.h @@ -0,0 +1,103 @@ +/* +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) 2020 Thales group +*/ +/* +Authors: + Johann Dréo +*/ + +#ifndef _edoEstimatorAdaptiveCombined_h +#define _edoEstimatorAdaptiveCombined_h + +#include + +#include + +#include "edoEstimatorAdaptive.h" + +/** An estimator that calls several ordered estimators, stateful version. + * + * @ingroup Estimators + */ +template +class edoEstimatorCombinedAdaptive : public edoEstimatorAdaptive, public std::vector*> +{ +public: + typedef typename D::EOType EOType; + + edoEstimatorCombinedAdaptive( D& distrib, edoEstimator& estim) : + edoEstimatorAdaptive(distrib), + std::vector*>(1,&estim) + {} + + edoEstimatorCombinedAdaptive( D& distrib, std::vector*> estims) : + edoEstimatorAdaptive(distrib), + std::vector*>(estims) + {} + + void add( edoEstimator& estim ) + { + this->push_back(&estim); + } + + virtual D operator()( eoPop& pop ) + { + for(edoEstimator* pestim : *this) { + this->_distrib = (*pestim)( pop ); + } + return this->_distrib; + } + +}; + +/** An estimator that calls several ordered estimators, stateless version. + * + * @ingroup Estimators + */ +template +class edoEstimatorCombinedStateless : public edoEstimatorCombinedAdaptive +{ +public: + typedef typename D::EOType EOType; + + edoEstimatorCombinedStateless( edoEstimator& estim ) : + edoEstimatorCombinedAdaptive(*(new D), estim) + {} + + edoEstimatorCombinedStateless( std::vector*> estims) : + edoEstimatorCombinedAdaptive(*(new D), estims) + {} + + virtual D operator()( eoPop& pop ) + { + delete &(this->_distrib); + this->_distrib = *(new D); + return edoEstimatorCombinedAdaptive::operator()(pop); + } + + ~edoEstimatorCombinedStateless() + { + delete &(this->_distrib); + } + +}; + +#endif // !_edoEstimatorAdaptiveCombined_h From 40fb64a5aaecb0844fd427c65e3da6dab2efba44 Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 24 Mar 2020 16:37:30 +0100 Subject: [PATCH 037/296] feat: add a dummy continue, always returning true. Useful in do_make* when no continue may be instanciated. --- eo/src/eoContinue.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/eo/src/eoContinue.h b/eo/src/eoContinue.h index 429ea58b7..cdf9ea432 100644 --- a/eo/src/eoContinue.h +++ b/eo/src/eoContinue.h @@ -67,6 +67,17 @@ public: } }; +/** A continue that always return true. + * + * @ingroup Continuators + */ +template< class EOT > +class eoDummyContinue : public eoContinue< EOT > +{ + public: + bool operator()(const eoPop&) {return true;} +}; + /** * Termination condition with a count condition (totalGenerations). This continuator contains * a count of cycles, which can be retrieved or set. From 98501e0dd4aff8a57329fc6788e2817193c8f0bc Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 24 Mar 2020 18:25:25 +0100 Subject: [PATCH 038/296] feat: add an algo that manage restarts Reset the pop for you, then call the algo, until continue. --- eo/src/eo | 3 + eo/src/eoAlgoRestart.h | 120 ++++++++++++++++++++++++++++++++++++ eo/src/utils/eoLogMonitor.h | 4 +- 3 files changed, 125 insertions(+), 2 deletions(-) create mode 100644 eo/src/eoAlgoRestart.h diff --git a/eo/src/eo b/eo/src/eo index 57f9e5cc0..c0fe2b8d7 100644 --- a/eo/src/eo +++ b/eo/src/eo @@ -92,8 +92,10 @@ #include "eoSteadyFitContinue.h" #include "eoEvalContinue.h" #include "eoFitContinue.h" +#include "eoSIGContinue.h" #include "eoPeriodicContinue.h" #include "eoTimeContinue.h" // added th T.Legrand +#include "eoSecondsElapsedContinue.h" #ifndef _MSC_VER #include "eoCtrlCContinue.h" // CtrlC handling (using 2 global variables!) #endif @@ -145,6 +147,7 @@ #include "eoEasyEA.h" #include "eoSGA.h" // #include "eoEvolutionStrategy.h" removed for a while - until eoGenOp is done +#include "eoAlgoRestart.h" // Utils #include "utils/checkpointing" diff --git a/eo/src/eoAlgoRestart.h b/eo/src/eoAlgoRestart.h new file mode 100644 index 000000000..6e98d774a --- /dev/null +++ b/eo/src/eoAlgoRestart.h @@ -0,0 +1,120 @@ +/* +The Evolving Objects framework is a template-based, +ANSI-C++ evolutionary computation library which helps you to write your +own evolutionary 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 +*/ + +#ifndef _EOALGORESTART_H_ +#define _EOALGORESTART_H_ + +#include "eoPop.h" +#include "eoAlgo.h" + +/** An algo that restart the given algorithm on a freshly init pop. + * + * @note: The fresh population size is set to the size of the last population at previous run. + * + * @ingroup Algorithms + */ +template +class eoAlgoRestart : public eoAlgo +{ +public: + /** Constructor with an eoPopEvalFunc + * + * @param init the initialization operator + * @param popeval an evaluator for populations + * @param algo the algorithm to restart + * @param continuator a stopping criterion to manage the number of restarts + */ + eoAlgoRestart( + eoInit& init, + eoPopEvalFunc& pop_eval, + eoAlgo& algo, + eoContinue& continuator + ) : + eoAlgo(), + _init(init), + _eval(_dummy_eval), + _loop_eval(_dummy_eval), + _pop_eval(pop_eval), + _algo(algo), + _continue(continuator) + {} + + /** Constructor with an eoEvalFunc + * + * @param init the initialization operator + * @param popeval an evaluator for populations + * @param algo the algorithm to restart + * @param continuator a stopping criterion to manage the number of restarts + */ + eoAlgoRestart( + eoInit& init, + eoEvalFunc& eval, + eoAlgo& algo, + eoContinue& continuator + ) : + eoAlgo(), + _init(init), + _eval(eval), + _loop_eval(_eval), + _pop_eval(_loop_eval), + _algo(algo), + _continue(continuator) + {} + + virtual void operator()(eoPop & pop) + { + do { + size_t pop_size = pop.size(); + pop.clear(); + pop.append(pop_size, _init); + _pop_eval(pop,pop); + + _algo(pop); + + } while( _continue(pop) ); + } + +protected: + eoInit& _init; + + eoEvalFunc& _eval; + eoPopLoopEval _loop_eval; + eoPopEvalFunc& _pop_eval; + + eoAlgo& _algo; + eoContinue& _continue; + + class eoDummyEval : public eoEvalFunc + { + public: + void operator()(EOT &) + {} + }; + eoDummyEval _dummy_eval; +}; + + +#endif // _EOALGORESTART_H_ diff --git a/eo/src/utils/eoLogMonitor.h b/eo/src/utils/eoLogMonitor.h index 94884250b..46420ef3f 100644 --- a/eo/src/utils/eoLogMonitor.h +++ b/eo/src/utils/eoLogMonitor.h @@ -32,9 +32,9 @@ Authors: #include "eoLogger.h" /** - Prints statistics to a given ostream. + Prints statistics to the given eoLogger. - You can pass any instance of an ostream to the constructor, like, for example, std::clog. + You can configure the log level. @ingroup Monitors */ From 193ea83eb3153b07d2ddd13296f332ef70ac8e0d Mon Sep 17 00:00:00 2001 From: nojhan Date: Tue, 24 Mar 2020 23:01:06 +0100 Subject: [PATCH 039/296] feat: add a way to print a message at each stop criterion call --- eo/src/utils/checkpointing | 1 + eo/src/utils/eoLogMessage.h | 59 +++++++++++++++++++++++++++++++++++++ eo/src/utils/eoUpdater.h | 1 - 3 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 eo/src/utils/eoLogMessage.h diff --git a/eo/src/utils/checkpointing b/eo/src/utils/checkpointing index 79fdab123..ad190602a 100644 --- a/eo/src/utils/checkpointing +++ b/eo/src/utils/checkpointing @@ -27,6 +27,7 @@ #include "eoParser.h" #include "eoState.h" #include "eoUpdater.h" +#include "eoLogMessage.h" #include "eoMonitor.h" #include "eoFileMonitor.h" #include "eoTimedMonitor.h" diff --git a/eo/src/utils/eoLogMessage.h b/eo/src/utils/eoLogMessage.h new file mode 100644 index 000000000..4a9a02381 --- /dev/null +++ b/eo/src/utils/eoLogMessage.h @@ -0,0 +1,59 @@ +/* +(c) Thales group, 2020 + + 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; version 2 of the license. + + This library is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along + with this library; if not, write to the Free Software Foundation, Inc., 59 + Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Contact: http://eodev.sourceforge.net + +Authors: + Johann Dréo +*/ + +#ifndef _eoLogMessage_h +#define _eoLogMessage_h + +#include +#include "eoUpdater.h" +#include "eoLogger.h" + +/** + An updater that print its message when called (usually within an eoCheckPoint) + + @ingroup Utilities +*/ +class eoLogMessage : public eoUpdater +{ +public : + eoLogMessage( + std::string msg, + eoLogger& log = eo::log, + eo::Levels level = eo::progress + ) : + _msg(msg), + _log(log), + _level(level) + { } + + virtual void operator()() + { + _log << _level << _msg << std::endl; + } + +protected: + std::string _msg; + eoLogger& _log; + eo::Levels _level; + +}; + +#endif diff --git a/eo/src/utils/eoUpdater.h b/eo/src/utils/eoUpdater.h index 0ae3b9c25..6626fabec 100644 --- a/eo/src/utils/eoUpdater.h +++ b/eo/src/utils/eoUpdater.h @@ -168,5 +168,4 @@ private : const std::string extension; }; - #endif From 1cdbb036d36b94c4736aac75c233050c47504f4e Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 25 Mar 2020 14:43:36 +0100 Subject: [PATCH 040/296] add a dimension accessor to eoInitFixedLength Useful to avoid divergence on indiv size in auto makers. --- eo/src/eoInit.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/eo/src/eoInit.h b/eo/src/eoInit.h index 9230f4b64..9965af919 100644 --- a/eo/src/eoInit.h +++ b/eo/src/eoInit.h @@ -90,20 +90,22 @@ class eoInitFixedLength: public eoInit { public: - typedef typename EOT::AtomType AtomType; + typedef typename EOT::AtomType AtomType; - eoInitFixedLength(unsigned _combien, eoRndGenerator& _generator) - : combien(_combien), generator(_generator) {} + eoInitFixedLength(unsigned _dimension, eoRndGenerator& _generator) + : dim(_dimension), generator(_generator) {} virtual void operator()(EOT& chrom) { - chrom.resize(combien); + chrom.resize(dim); std::generate(chrom.begin(), chrom.end(), generator); chrom.invalidate(); } + unsigned dimension() const {return dim;} + private : - unsigned combien; + unsigned dim; /// generic wrapper for eoFunctor (s), to make them have the function-pointer style copy semantics eoSTLF generator; }; From 0332920d633fe2ddba834df019a1757083a152c8 Mon Sep 17 00:00:00 2001 From: nojhan Date: Wed, 25 Mar 2020 14:45:11 +0100 Subject: [PATCH 041/296] several fix of minor warnings --- edo/src/edoEstimatorAdaptiveEdit.h | 2 +- edo/src/edoSamplerBinomialMulti.h | 4 ++-- eo/src/eoEasyPSO.h | 4 ++-- eo/src/eoEvalCmd.h | 4 ++-- eo/src/eoEvalDump.h | 2 +- eo/src/eoEvalKeepBest.h | 2 +- eo/src/eoSIGContinue.h | 2 +- eo/src/eoSecondsElapsedContinue.h | 2 +- eo/src/eoStarTopology.h | 6 +++--- eo/src/eoSyncEasyPSO.h | 4 ++-- eo/src/eoTruncatedSelectOne.h | 4 ++-- eo/src/ga/make_ga.h | 2 +- eo/src/utils/eoFDCStat.h | 2 +- eo/src/utils/eoTimedMonitor.h | 2 ++ 14 files changed, 22 insertions(+), 20 deletions(-) diff --git a/edo/src/edoEstimatorAdaptiveEdit.h b/edo/src/edoEstimatorAdaptiveEdit.h index dbf0d920b..cefd4187c 100644 --- a/edo/src/edoEstimatorAdaptiveEdit.h +++ b/edo/src/edoEstimatorAdaptiveEdit.h @@ -64,7 +64,7 @@ public: _setter(setter) {} - virtual D operator()( eoPop& pop ) + virtual D operator()( eoPop& ) { _setter( _getter() ); return this->_distrib; diff --git a/edo/src/edoSamplerBinomialMulti.h b/edo/src/edoSamplerBinomialMulti.h index 732cdbed5..dda1a4eb1 100644 --- a/edo/src/edoSamplerBinomialMulti.h +++ b/edo/src/edoSamplerBinomialMulti.h @@ -51,13 +51,13 @@ public: * The default implementation is to push back a true boolean. * If you have a more complex data structure, you can just overload this. */ - virtual void make_true( AtomType & atom, unsigned int i, unsigned int j ) + virtual void make_true( AtomType & atom, unsigned int, unsigned int ) { atom.push_back( 1 ); } /** @see make_true */ - virtual void make_false( AtomType & atom, unsigned int i, unsigned int j ) + virtual void make_false( AtomType & atom, unsigned int, unsigned int ) { atom.push_back( 0 ); } diff --git a/eo/src/eoEasyPSO.h b/eo/src/eoEasyPSO.h index 3e9997e3a..f1e00bf2a 100644 --- a/eo/src/eoEasyPSO.h +++ b/eo/src/eoEasyPSO.h @@ -176,7 +176,7 @@ protected: { public: eoDummyFlight () {} - void operator () (POT & _po) {} + void operator () (POT &) {} }dummyFlight; // if the initializer does not need to be used, use the dummy one instead @@ -184,7 +184,7 @@ protected: { public: eoDummyInitializer () {} - void operator () (POT & _po) {} + void operator () (POT &) {} }dummyInit; }; diff --git a/eo/src/eoEvalCmd.h b/eo/src/eoEvalCmd.h index e34dd3eee..0f2633a98 100644 --- a/eo/src/eoEvalCmd.h +++ b/eo/src/eoEvalCmd.h @@ -74,9 +74,9 @@ public: const std::string suffix = "" ) : _cmd(cmd), - _suffix(suffix), - _infix(infix), _prefix(prefix), + _infix(infix), + _suffix(suffix), _last_call("") {} diff --git a/eo/src/eoEvalDump.h b/eo/src/eoEvalDump.h index a5ad8e3fb..2f26ee327 100644 --- a/eo/src/eoEvalDump.h +++ b/eo/src/eoEvalDump.h @@ -120,7 +120,7 @@ protected: protected: class DummyEval : public eoEvalFunc { - void operator()(EOT& sol) {/*empty*/} + void operator()(EOT&) {/*empty*/} }; DummyEval _dummy_eval; eoEvalFunc& _func; diff --git a/eo/src/eoEvalKeepBest.h b/eo/src/eoEvalKeepBest.h index 133e01b87..86dd50456 100644 --- a/eo/src/eoEvalKeepBest.h +++ b/eo/src/eoEvalKeepBest.h @@ -142,7 +142,7 @@ template class eoEvalKeepBest : public eoEvalFunc, public eoValu class DummyEval : public eoEvalFunc { - void operator()(EOT& sol) {/*empty*/} + void operator()(EOT&) {/*empty*/} }; protected : diff --git a/eo/src/eoSIGContinue.h b/eo/src/eoSIGContinue.h index 32e7c1857..a0afae040 100644 --- a/eo/src/eoSIGContinue.h +++ b/eo/src/eoSIGContinue.h @@ -71,7 +71,7 @@ public: } /** Returns false when the signal has been typed in reached */ - virtual bool operator() ( const eoPop& _vEO ) + virtual bool operator() ( const eoPop& ) { if (call_func) { diff --git a/eo/src/eoSecondsElapsedContinue.h b/eo/src/eoSecondsElapsedContinue.h index a580b7f42..a258819fa 100644 --- a/eo/src/eoSecondsElapsedContinue.h +++ b/eo/src/eoSecondsElapsedContinue.h @@ -41,7 +41,7 @@ public: eoSecondsElapsedContinue(int nSeconds) : start(time(0)), seconds(nSeconds) {} - virtual bool operator() ( const eoPop& _vEO ) { + virtual bool operator() ( const eoPop& ) { time_t now = time(0); time_t diff = now - start; diff --git a/eo/src/eoStarTopology.h b/eo/src/eoStarTopology.h index a345c8bc3..6083dbba8 100644 --- a/eo/src/eoStarTopology.h +++ b/eo/src/eoStarTopology.h @@ -86,7 +86,7 @@ public: * @param _po - The particle to update * @param _indice - The indice of the given particle in the population */ - void updateNeighborhood(POT & _po,unsigned _indice) + void updateNeighborhood(POT & _po, unsigned) { // update the best fitness of the particle if (_po.fitness() > _po.best()) @@ -108,13 +108,13 @@ public: * @param _indice - The indice of a particle in the population * @return POT & - The best particle in the neighborhood of the particle whose indice is _indice */ - POT & best (unsigned _indice) {return (neighborhood.best());} + POT & best (unsigned) {return (neighborhood.best());} /* * Return the global best of the topology */ - virtual POT & globalBest(const eoPop& _pop) + virtual POT & globalBest(const eoPop&) { return neighborhood.best(); } diff --git a/eo/src/eoSyncEasyPSO.h b/eo/src/eoSyncEasyPSO.h index 0fc7a2492..64cf64724 100644 --- a/eo/src/eoSyncEasyPSO.h +++ b/eo/src/eoSyncEasyPSO.h @@ -241,7 +241,7 @@ protected: { public: eoDummyFlight () {} - void operator () (POT & /*_po*/) {} + void operator () (POT &) {} }dummyFlight; // if the initializer does not need to be used, use the dummy one instead @@ -249,7 +249,7 @@ protected: { public: eoDummyInitializer () {} - void operator () (POT & _po) {} + void operator () (POT &) {} }dummyInit; }; diff --git a/eo/src/eoTruncatedSelectOne.h b/eo/src/eoTruncatedSelectOne.h index 431f7465a..5bda5600f 100644 --- a/eo/src/eoTruncatedSelectOne.h +++ b/eo/src/eoTruncatedSelectOne.h @@ -93,10 +93,10 @@ public: /** The implementation selects an individual from the fertile pop - @param _pop the source population + @param unused @return the selected guy */ - const EOT& operator()(const eoPop& _pop) + const EOT& operator()(const eoPop& ) { return select(actualPop); } diff --git a/eo/src/ga/make_ga.h b/eo/src/ga/make_ga.h index 660462477..9cec19ae4 100644 --- a/eo/src/ga/make_ga.h +++ b/eo/src/ga/make_ga.h @@ -93,7 +93,7 @@ void run_ea(eoAlgo >& _ga, eoPop Date: Thu, 26 Mar 2020 07:53:23 +0100 Subject: [PATCH 042/296] refactor exceptions and exceptions hierarchy --- eo/src/eoExceptions.h | 161 ++++++++++++++++++++++++++--------------- eo/src/utils/eoState.h | 4 +- 2 files changed, 106 insertions(+), 59 deletions(-) diff --git a/eo/src/eoExceptions.h b/eo/src/eoExceptions.h index ef1a5c67e..618173f91 100644 --- a/eo/src/eoExceptions.h +++ b/eo/src/eoExceptions.h @@ -28,8 +28,63 @@ Johann Dréo #include #include -class eoMaxException : public std::exception {}; +//! You can catch this base exception if you want to catch anything thrown by ParadisEO. @ingroup Core +class eoException : public std::runtime_error +{ +public: + eoException(std::string msg = "") : + std::runtime_error(msg) + { + _msg << msg; + } + const char* what() const throw() + { + return _msg.str().c_str(); + } + + ~eoException() throw() {} + +protected: + std::ostringstream _msg; +}; + +/** Base class for exceptions which need to stop the algorithm to be handled + * + * (like stopping criterion or numerical errors). + */ +class eoStopException : public eoException +{ +public: + eoStopException(std::string msg = "") : eoException(msg) {} + ~eoStopException() throw() {} +}; + + +//! Base class for limit-based exceptions (see eoMaxTimeException and eoMaxEvalException. +class eoMaxException : public eoStopException +{ +public: + eoMaxException(std::string msg = "") : eoStopException(msg) {} + ~eoMaxException() throw() {} +}; + + +/*! +An error that signals that some bad data have been returned. + +Thrown by @see eoEvalNanThrowException + +@ingroup Evaluation +*/ +class eoNanException : public eoStopException +{ +public: + eoNanException() : + eoStopException("The objective function returned a bad value (nan or inf)") + { } + ~eoNanException() throw() {} +}; /*! @@ -42,107 +97,103 @@ Thrown by @see eoEvalTimeThrowException class eoMaxTimeException : public eoMaxException { public: - eoMaxTimeException( time_t elapsed) : _elapsed(elapsed) {} - - virtual const char* what() const throw() + eoMaxTimeException( time_t elapsed) : + eoMaxException("STOP") { - std::ostringstream ss; - ss << "STOP in eoMaxTimeException: the maximum number of allowed seconds has been reached (" << _elapsed << ")."; - return ss.str().c_str(); + _msg << " the maximum number of allowed seconds has been reached (" + << elapsed << ")"; } - -private: - const time_t _elapsed; + ~eoMaxTimeException() throw() {} }; /*! An error that signals that a maximum number of evaluations has been reached. -Thrown by @see eoEvalEvalThrowException +Thrown by @see eoEvalThrowException @ingroup Evaluation */ class eoMaxEvalException : public eoMaxException { public: - eoMaxEvalException(unsigned long threshold) : _threshold(threshold){} - - virtual const char* what() const throw() + eoMaxEvalException(unsigned long threshold) : + eoMaxException("STOP") { - std::ostringstream ss; - ss << "STOP in eoMaxEvalException: the maximum number of evaluation has been reached (" << _threshold << ")."; - return ss.str().c_str(); + _msg << " the maximum number of evaluation has been reached (" + << threshold << ")."; } - -private: - const unsigned long _threshold; + ~eoMaxEvalException() throw() {} }; +//! Base class for exceptions related to eoParam management. @ingroup Parameters +class eoParamException : public eoException +{ +public: + eoParamException(std::string msg = "") : eoException(msg) {} +}; /*! * An error that signals a missing parameter * * Thrown by eoParser::getParam * - * @ingroup Parameters + * @ingroup Parameters */ -class eoMissingParamException : public std::exception +class eoMissingParamException : public eoParamException { public: - eoMissingParamException(std::string name) : _name(name){} - - virtual const char* what() const throw() + eoMissingParamException(std::string name) : + eoParamException() { - std::ostringstream ss; - ss << "The command parameter " << _name << " has not been declared"; - return ss.str().c_str(); + _msg << "The command parameter " << name << " has not been declared"; } - ~eoMissingParamException() throw() {} - -private: - const std::string _name; }; + /*! * An error that signals a bad parameter type * * Thrown by eoParser::valueOf * - * @ingroup Parameters + * @ingroup Parameters */ -class eoWrongParamTypeException : public std::exception +class eoWrongParamTypeException : public eoParamException { public: - eoWrongParamTypeException(std::string name) : _name(name){} - - virtual const char* what() const throw() + eoWrongParamTypeException(std::string name) : + eoParamException() { - std::ostringstream ss; - ss << "You asked for the parameter " << _name << " but it has not been declared under this type"; - return ss.str().c_str(); + _msg << "You asked for the parameter " << name + << " but it has not been declared under this type"; } - ~eoWrongParamTypeException() throw() {} - -private: - const std::string _name; }; -class eoSystemError : public std::exception +//! Exception related to a system call. +class eoSystemError : public eoException { public: - eoSystemError(std::string cmd) - : _cmd(cmd), _has_pipe(false), _err_code(-1), _output("") - {} + eoSystemError(std::string cmd) : + eoException(), + _cmd(cmd), _has_pipe(false), _err_code(-1), _output("") + { + _msg << msg(); + } - eoSystemError(std::string cmd, int err_code, std::string output) - : _cmd(cmd), _has_pipe(true), _err_code(err_code), _output(output) - {} + eoSystemError(std::string cmd, int err_code, std::string output) : + eoException(), + _cmd(cmd), _has_pipe(true), _err_code(err_code), _output(output) + { + _msg << msg(); + } - virtual const char* what() const throw() + ~eoSystemError() throw() {} + +protected: + const std::string msg() const throw() { std::ostringstream ss; ss << "System call: `" << _cmd << "` error"; @@ -150,17 +201,13 @@ public: ss << " code #" << _err_code << " with the following output:" << std::endl << _output; } - return ss.str().c_str(); + return ss.str(); } - ~eoSystemError() throw() {} - -private: const std::string _cmd; const bool _has_pipe; const int _err_code; const std::string _output; - }; #endif // __eoExceptions_h__ diff --git a/eo/src/utils/eoState.h b/eo/src/utils/eoState.h index e96917e9d..802709b30 100644 --- a/eo/src/utils/eoState.h +++ b/eo/src/utils/eoState.h @@ -122,9 +122,9 @@ public : /** * Loading error thrown when nothing seems to work. */ - struct loading_error : public std::runtime_error + struct loading_error : public eoException { - loading_error(std::string huh = "Error while loading") : std::runtime_error(huh) {} + loading_error(std::string huh = "Error while loading") : eoException(huh) {} }; std::string getCommentString(void) const { return "#"; } From 6aeb74f6e04d2ead9fceeda47ccde628e51413a7 Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 26 Mar 2020 22:46:52 +0100 Subject: [PATCH 043/296] refactor exceptions --- eo/src/eoExceptions.h | 89 +++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 24 deletions(-) diff --git a/eo/src/eoExceptions.h b/eo/src/eoExceptions.h index 618173f91..476a064d6 100644 --- a/eo/src/eoExceptions.h +++ b/eo/src/eoExceptions.h @@ -27,26 +27,31 @@ Johann Dréo #include #include #include +#include //! You can catch this base exception if you want to catch anything thrown by ParadisEO. @ingroup Core class eoException : public std::runtime_error { public: eoException(std::string msg = "") : - std::runtime_error(msg) + std::runtime_error(""), + _msg(msg) + { } + + virtual std::string message() const throw() { - _msg << msg; + return _msg; } const char* what() const throw() { - return _msg.str().c_str(); + return message().c_str(); } ~eoException() throw() {} protected: - std::ostringstream _msg; + const std::string _msg; }; /** Base class for exceptions which need to stop the algorithm to be handled @@ -98,12 +103,22 @@ class eoMaxTimeException : public eoMaxException { public: eoMaxTimeException( time_t elapsed) : - eoMaxException("STOP") + eoMaxException(), + _elapsed(elapsed) + { } + + virtual std::string message() const throw() { - _msg << " the maximum number of allowed seconds has been reached (" - << elapsed << ")"; + std::ostringstream msg; + msg << "STOP because the maximum number of allowed seconds has been reached (" + << _elapsed << ")"; + return msg.str(); } + ~eoMaxTimeException() throw() {} + +protected: + const time_t _elapsed; }; @@ -118,12 +133,22 @@ class eoMaxEvalException : public eoMaxException { public: eoMaxEvalException(unsigned long threshold) : - eoMaxException("STOP") + eoMaxException(), + _threshold(threshold) + { } + + virtual std::string message() const throw() { - _msg << " the maximum number of evaluation has been reached (" - << threshold << ")."; + std::ostringstream msg; + msg << " the maximum number of evaluation has been reached (" + << _threshold << ")."; + return msg.str(); } + ~eoMaxEvalException() throw() {} + +protected: + const unsigned long _threshold; }; //! Base class for exceptions related to eoParam management. @ingroup Parameters @@ -144,11 +169,21 @@ class eoMissingParamException : public eoParamException { public: eoMissingParamException(std::string name) : - eoParamException() + eoParamException(), + _name(name) + { } + + virtual std::string message() const throw() { - _msg << "The command parameter " << name << " has not been declared"; + std::ostringstream msg; + msg << "The command parameter " << _name << " has not been declared"; + return msg.str(); } + ~eoMissingParamException() throw() {} + +protected: + const std::string _name; }; @@ -163,12 +198,22 @@ class eoWrongParamTypeException : public eoParamException { public: eoWrongParamTypeException(std::string name) : - eoParamException() + eoParamException(), + _name(name) + { } + + virtual std::string message() const throw() { - _msg << "You asked for the parameter " << name + std::ostringstream msg; + msg << "You asked for the parameter " << _name << " but it has not been declared under this type"; + return msg.str(); } + ~eoWrongParamTypeException() throw() {} + +protected: + const std::string _name; }; @@ -179,21 +224,14 @@ public: eoSystemError(std::string cmd) : eoException(), _cmd(cmd), _has_pipe(false), _err_code(-1), _output("") - { - _msg << msg(); - } + { } eoSystemError(std::string cmd, int err_code, std::string output) : eoException(), _cmd(cmd), _has_pipe(true), _err_code(err_code), _output(output) - { - _msg << msg(); - } + { } - ~eoSystemError() throw() {} - -protected: - const std::string msg() const throw() + virtual std::string message() const throw() { std::ostringstream ss; ss << "System call: `" << _cmd << "` error"; @@ -204,6 +242,9 @@ protected: return ss.str(); } + ~eoSystemError() throw() {} + +protected: const std::string _cmd; const bool _has_pipe; const int _err_code; From 75ac37b02afe5698e0dc04cc54020717c7deb987 Mon Sep 17 00:00:00 2001 From: nojhan Date: Thu, 26 Mar 2020 22:47:26 +0100 Subject: [PATCH 044/296] fix some errors in tests - use eoEvalCounterThrowException - use make_help --- edo/application/cmaes/main.cpp | 6 +++--- edo/application/eda/main.cpp | 6 +++--- eo/src/eoSIGContinue.cpp | 6 ++++++ eo/src/eoSIGContinue.h | 5 +---- eo/src/es/make_es.h | 2 +- eo/src/es/make_real.h | 2 +- eo/test/t-eoEvalCmd.cpp | 2 +- eo/test/t-eoFitnessAssembledEA.cpp | 2 +- eo/test/t-eoGA.cpp | 1 + eo/test/t-eoReal.cpp | 1 + eo/tutorial/Lesson4/RealEA.cpp | 1 + eo/tutorial/Lesson5/OneMaxEA.cpp | 2 +- eo/tutorial/Lesson5/OneMaxLibEA.cpp | 2 +- moeo/tutorial/Lesson2/FlowShopEA.cpp | 2 +- moeo/tutorial/Lesson3/FlowShopEA2.cpp | 2 +- moeo/tutorial/Lesson4/FlowShopDMLS.cpp | 2 +- 16 files changed, 25 insertions(+), 19 deletions(-) diff --git a/edo/application/cmaes/main.cpp b/edo/application/cmaes/main.cpp index ed7f10a44..47a09f998 100644 --- a/edo/application/cmaes/main.cpp +++ b/edo/application/cmaes/main.cpp @@ -28,7 +28,7 @@ Authors: #include //#include -#include +#include #include #include @@ -67,7 +67,7 @@ int main(int ac, char** av) eoEvalFunc< RealVec >* plainEval = new Rosenbrock< RealVec >(); state.storeFunctor(plainEval); - eoEvalFuncCounterBounder< RealVec > eval(*plainEval, max_eval); + eoEvalCounterThrowException< RealVec > eval(*plainEval, max_eval); eoRndGenerator< double >* gen = new eoUniformGenerator< double >(-5, 5); state.storeFunctor(gen); @@ -145,7 +145,7 @@ int main(int ac, char** av) eo::log << eo::progress << "Best solution after random init: " << pop.best_element().fitness() << std::endl; do_run(*algo, pop); - } catch (eoEvalFuncCounterBounderException& e) { + } catch (eoMaxEvalException& e) { eo::log << eo::warnings << "warning: " << e.what() << std::endl; } diff --git a/edo/application/eda/main.cpp b/edo/application/eda/main.cpp index 6e024545b..6b0311fe0 100644 --- a/edo/application/eda/main.cpp +++ b/edo/application/eda/main.cpp @@ -28,7 +28,7 @@ Authors: #include // #include -#include +#include #include #include @@ -69,7 +69,7 @@ int main(int ac, char** av) state.storeFunctor(plainEval); unsigned long max_eval = parser.getORcreateParam((unsigned long)0, "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion").value(); // E - eoEvalFuncCounterBounder< EOT > eval(*plainEval, max_eval); + eoEvalCounterThrowException< EOT > eval(*plainEval, max_eval); eoRndGenerator< double >* gen = new eoUniformGenerator< double >(-5, 5); state.storeFunctor(gen); @@ -169,7 +169,7 @@ int main(int ac, char** av) try { do_run(*algo, pop); - } catch (eoEvalFuncCounterBounderException& e) { + } catch (eoMaxEvalException& e) { eo::log << eo::warnings << "warning: " << e.what() << std::endl; } catch (std::exception& e) { diff --git a/eo/src/eoSIGContinue.cpp b/eo/src/eoSIGContinue.cpp index 2f126ea91..0e4299c71 100644 --- a/eo/src/eoSIGContinue.cpp +++ b/eo/src/eoSIGContinue.cpp @@ -36,3 +36,9 @@ // --- Global variables - but don't know what else to do - MS --- bool existSIGContinue = false; bool call_func = false; + +void set_bool(int) +{ + call_func = true; +} + diff --git a/eo/src/eoSIGContinue.h b/eo/src/eoSIGContinue.h index a0afae040..416cad692 100644 --- a/eo/src/eoSIGContinue.h +++ b/eo/src/eoSIGContinue.h @@ -42,10 +42,7 @@ extern bool existSIGContinue; extern bool call_func; -void set_bool(int) -{ - call_func = true; -} +void set_bool(int); /** A continuator that stops if a given signal is received during the execution diff --git a/eo/src/es/make_es.h b/eo/src/es/make_es.h index 540609741..84c4fa823 100644 --- a/eo/src/es/make_es.h +++ b/eo/src/es/make_es.h @@ -145,7 +145,7 @@ void run_ea(eoAlgo >& _ga, eoPop >& _ga, eoPop EOT; diff --git a/eo/test/t-eoFitnessAssembledEA.cpp b/eo/test/t-eoFitnessAssembledEA.cpp index e04535673..3dfb063ba 100644 --- a/eo/test/t-eoFitnessAssembledEA.cpp +++ b/eo/test/t-eoFitnessAssembledEA.cpp @@ -95,7 +95,7 @@ public: }; // checks for help demand, and writes the status file and make_help; in libutils -void make_help(eoParser & _parser); +// void make_help(eoParser & _parser); // now use all of the above, + representation dependent things int main(int argc, char* argv[]){ diff --git a/eo/test/t-eoGA.cpp b/eo/test/t-eoGA.cpp index fafed297d..bc2d3df30 100644 --- a/eo/test/t-eoGA.cpp +++ b/eo/test/t-eoGA.cpp @@ -1,5 +1,6 @@ #include +#include #include #include #include "binary_value.h" diff --git a/eo/test/t-eoReal.cpp b/eo/test/t-eoReal.cpp index 163b0ea86..7d5bd4cf8 100644 --- a/eo/test/t-eoReal.cpp +++ b/eo/test/t-eoReal.cpp @@ -1,5 +1,6 @@ #include +#include #include #include "real_value.h" #include diff --git a/eo/tutorial/Lesson4/RealEA.cpp b/eo/tutorial/Lesson4/RealEA.cpp index 1775b12b7..ef7ad6521 100644 --- a/eo/tutorial/Lesson4/RealEA.cpp +++ b/eo/tutorial/Lesson4/RealEA.cpp @@ -1,5 +1,6 @@ #include +#include #include #include "real_value.h" #include diff --git a/eo/tutorial/Lesson5/OneMaxEA.cpp b/eo/tutorial/Lesson5/OneMaxEA.cpp index 14a0f4c5e..b75e57e51 100644 --- a/eo/tutorial/Lesson5/OneMaxEA.cpp +++ b/eo/tutorial/Lesson5/OneMaxEA.cpp @@ -116,7 +116,7 @@ void run_ea(eoAlgo& _ga, eoPop& _pop) // checks for help demand, and writes the status file // and make_help; in libutils -void make_help(eoParser & _parser); +// void make_help(eoParser & _parser); // now use all of the above, + representation dependent things int main(int argc, char* argv[]) diff --git a/eo/tutorial/Lesson5/OneMaxLibEA.cpp b/eo/tutorial/Lesson5/OneMaxLibEA.cpp index febcca445..3943379f0 100644 --- a/eo/tutorial/Lesson5/OneMaxLibEA.cpp +++ b/eo/tutorial/Lesson5/OneMaxLibEA.cpp @@ -89,7 +89,7 @@ void run_ea(eoAlgo& _ga, eoPop& _pop); // checks for help demand, and writes the status file // and make_help; in libutils - just a declaration, code in libeoutils.a -void make_help(eoParser & _parser); +// void make_help(eoParser & _parser); // now use all of the above, + representation dependent things // from here on, no difference with eoOneMax.cpp diff --git a/moeo/tutorial/Lesson2/FlowShopEA.cpp b/moeo/tutorial/Lesson2/FlowShopEA.cpp index 4f7a28913..445f4b227 100644 --- a/moeo/tutorial/Lesson2/FlowShopEA.cpp +++ b/moeo/tutorial/Lesson2/FlowShopEA.cpp @@ -47,7 +47,7 @@ // how to initialize the population #include // checks for help demand, and writes the status file and make_help; in libutils -void make_help(eoParser & _parser); +// void make_help(eoParser & _parser); // definition of the representation #include diff --git a/moeo/tutorial/Lesson3/FlowShopEA2.cpp b/moeo/tutorial/Lesson3/FlowShopEA2.cpp index 1752bab4f..1985eb75e 100644 --- a/moeo/tutorial/Lesson3/FlowShopEA2.cpp +++ b/moeo/tutorial/Lesson3/FlowShopEA2.cpp @@ -55,7 +55,7 @@ // simple call to the algo #include // checks for help demand, and writes the status file and make_help; in libutils -void make_help(eoParser & _parser); +// void make_help(eoParser & _parser); // definition of the representation #include diff --git a/moeo/tutorial/Lesson4/FlowShopDMLS.cpp b/moeo/tutorial/Lesson4/FlowShopDMLS.cpp index a2e864a77..a84a33dcf 100644 --- a/moeo/tutorial/Lesson4/FlowShopDMLS.cpp +++ b/moeo/tutorial/Lesson4/FlowShopDMLS.cpp @@ -48,7 +48,7 @@ // how to initialize the population #include // checks for help demand, and writes the status file and make_help; in libutils -void make_help(eoParser & _parser); +// void make_help(eoParser & _parser); // definition of the representation #include From eba2e149503d5fa07e16c79b7a2dcaceb80868e3 Mon Sep 17 00:00:00 2001 From: nojhan Date: Fri, 27 Mar 2020 00:21:52 +0100 Subject: [PATCH 045/296] use eoExceptions everywhere --- edo/src/utils/edoFileSnapshot.cpp | 6 +- eo/src/EO.h | 8 +- eo/src/PO.h | 4 +- eo/src/do/make_algo_easea.h | 6 +- eo/src/do/make_algo_scalar.h | 6 +- eo/src/do/make_continue.h | 2 +- eo/src/do/make_general_replacement.h | 4 +- eo/src/eoCtrlCContinue.h | 2 +- eo/src/eoEasyEA.h | 22 ++--- eo/src/eoEasyPSO.h | 18 ++-- eo/src/eoEvalDump.h | 4 +- eo/src/eoExceptions.h | 97 +++++++++++++++++-- eo/src/eoFlOrBinOp.h | 8 +- eo/src/eoFlOrQuadOp.h | 6 +- eo/src/eoG3Replacement.h | 2 +- eo/src/eoInit.h | 3 +- eo/src/eoLinearTopology.h | 2 +- eo/src/eoMGGReplacement.h | 2 +- eo/src/eoMerge.h | 6 +- eo/src/eoNDSorting.h | 4 +- eo/src/eoOneToOneBreeder.h | 2 +- eo/src/eoPop.h | 5 +- eo/src/eoProportionalSelect.h | 2 +- eo/src/eoRandomRealWeightUp.h | 2 +- eo/src/eoRanking.h | 4 +- eo/src/eoReduce.h | 12 +-- eo/src/eoReduceMerge.h | 2 +- eo/src/eoReduceMergeReduce.h | 2 +- eo/src/eoReduceSplit.h | 14 +-- eo/src/eoSIGContinue.h | 2 +- eo/src/eoSelectFactory.h | 2 +- eo/src/eoSelectFromWorth.h | 2 +- eo/src/eoSequentialSelect.h | 2 +- eo/src/eoSharing.h | 3 +- eo/src/eoSimpleEDA.h | 18 ++-- eo/src/eoSocialNeighborhood.h | 2 +- eo/src/eoStochasticUniversalSelect.h | 2 +- eo/src/eoSurviveAndDie.h | 4 +- eo/src/eoSwapMutation.h | 2 +- eo/src/eoSyncEasyPSO.h | 18 ++-- eo/src/es/eoNormalMutation.h | 2 +- eo/src/es/eoRealInitBounded.h | 2 +- eo/src/es/eoRealOp.h | 8 +- eo/src/es/make_algo_scalar_es.cpp | 12 +-- eo/src/es/make_genotype_real.h | 2 +- eo/src/es/make_op.h | 24 ++--- eo/src/es/make_op_es.h | 12 +-- eo/src/es/make_op_real.h | 24 ++--- eo/src/ga/make_PBILupdate.h | 2 +- eo/src/ga/make_op.h | 22 ++--- eo/src/gp/eoParseTreeDepthInit.h | 2 +- eo/src/gp/eoStParseTreeDepthInit.h | 2 +- eo/src/mpi/eoParallelApply.h | 2 +- eo/src/pyeo/PyEO.cpp | 8 +- eo/src/pyeo/PyEO.h | 4 +- eo/src/pyeo/monitors.cpp | 2 +- eo/src/pyeo/statistics.cpp | 2 +- eo/src/pyeo/valueParam.cpp | 6 +- eo/src/utils/eoAssembledFitnessStat.h | 4 +- eo/src/utils/eoFDCStat.h | 2 +- eo/src/utils/eoFileMonitor.cpp | 9 +- eo/src/utils/eoFileMonitor.h | 5 +- eo/src/utils/eoFileSnapshot.h | 10 +- eo/src/utils/eoGnuplot.cpp | 3 +- eo/src/utils/eoGnuplot1DMonitor.cpp | 2 +- eo/src/utils/eoHowMany.h | 6 +- eo/src/utils/eoIntBounds.cpp | 10 +- eo/src/utils/eoIntBounds.h | 37 +++---- eo/src/utils/eoOStreamMonitor.cpp | 4 +- eo/src/utils/eoParam.h | 5 +- eo/src/utils/eoParser.cpp | 4 +- eo/src/utils/eoRealBounds.cpp | 16 +-- eo/src/utils/eoRealBounds.h | 28 +++--- eo/src/utils/eoRealVectorBounds.h | 16 +-- eo/src/utils/eoRndGenerators.h | 3 +- eo/src/utils/eoStat.h | 2 +- eo/src/utils/eoState.cpp | 16 +-- eo/src/utils/eoUniformInit.h | 2 +- eo/src/utils/make_help.cpp | 6 +- eo/src/utils/rnd_generators.h | 5 +- eo/src/utils/selectors.h | 2 +- eo/test/fitness_traits.cpp | 10 +- eo/test/mpi/t-mpi-distrib-exp.cpp | 6 +- eo/test/mpi/t-mpi-multipleRoles.cpp | 2 +- eo/test/mpi/t-mpi-parallelApply.cpp | 2 +- eo/test/t-eoESFull.cpp | 2 +- eo/test/t-eoGenOp.cpp | 2 +- eo/test/t-eoInitPermutation.cpp | 2 +- eo/test/t-eoOrderXover.cpp | 2 +- eo/test/t-eoSelect.cpp | 4 +- eo/test/t-eoSharing.cpp | 2 +- eo/test/t-eoShiftMutation.cpp | 2 +- eo/test/t-eoSwapMutation.cpp | 2 +- eo/test/t-eoTwoOptMutation.cpp | 2 +- eo/tutorial/Lesson5/make_op_OneMax.h | 4 +- eo/tutorial/Templates/EO.tpl | 6 +- eo/tutorial/Templates/MyStructSEA.cpp | 6 +- eo/tutorial/Templates/make_op_MyStruct.h | 4 +- mo/src/continuator/moVectorMonitor.h | 4 +- mo/src/problems/bitString/moBitNeighbor.h | 2 +- mo/src/sampling/moSampling.h | 6 +- moeo/src/CMakeLists.txt | 2 +- moeo/src/algo/moeoEasyEA.h | 22 ++--- .../comparator/moeoOneObjectiveComparator.h | 2 +- moeo/src/core/MOEO.h | 6 +- moeo/src/core/moeoObjectiveVectorTraits.h | 8 +- moeo/src/core/moeoVector.h | 2 +- moeo/src/do/make_continue_moeo.h | 2 +- moeo/src/do/make_ea_moeo.h | 12 +-- .../moeoDominanceDepthFitnessAssignment.h | 2 +- .../explorer/moeoHCMoveLoopExpl.h | 2 +- .../explorer/moeoTSMoveLoopExpl.h | 2 +- moeo/src/utils/moeoBestObjVecStat.h | 2 +- .../flowshop/FlowShopBenchmarkParser.cpp | 3 +- .../examples/flowshop/make_op_FlowShop.h | 4 +- problems/eval/maxSATeval.h | 10 +- problems/eval/nkLandscapesEval.h | 16 +-- problems/eval/nkpLandscapesEval.h | 16 +-- problems/eval/nkqLandscapesEval.h | 18 ++-- problems/eval/qapEval.h | 4 +- problems/eval/ubqpEval.h | 6 +- smp/src/MWAlgo/eoEasyEA.cpp | 24 ++--- smp/src/MWAlgo/eoEasyPSO.cpp | 18 ++-- smp/src/MWAlgo/eoSyncEasyPSO.cpp | 18 ++-- smp/src/MWModel.cpp | 2 +- smp/src/topology/customBooleanTopology.cpp | 8 +- smp/src/topology/customStochasticTopology.cpp | 8 +- 127 files changed, 523 insertions(+), 417 deletions(-) diff --git a/edo/src/utils/edoFileSnapshot.cpp b/edo/src/utils/edoFileSnapshot.cpp index 1860ac0f1..32107b409 100644 --- a/edo/src/utils/edoFileSnapshot.cpp +++ b/edo/src/utils/edoFileSnapshot.cpp @@ -59,7 +59,7 @@ edoFileSnapshot::edoFileSnapshot(std::string dirname, if ( (res == -1) || (res == 127) ) { - throw std::runtime_error("Problem executing test of dir in eoFileSnapshot"); + throw eoSystemError(s, res); } // now make sure there is a dir without any genXXX file in it @@ -112,8 +112,8 @@ eoMonitor& edoFileSnapshot::operator()(void) if (!os) { - std::string str = "edoFileSnapshot: Could not open " + _currentFileName; - throw std::runtime_error(str); + // std::string str = "edoFileSnapshot: Could not open " + _currentFileName; + throw eoFileError(_currentFileName); } if ( _saveFilenames ) diff --git a/eo/src/EO.h b/eo/src/EO.h index 19708314f..490dd7d83 100644 --- a/eo/src/EO.h +++ b/eo/src/EO.h @@ -30,6 +30,7 @@ #include // std::runtime_error #include "eoObject.h" // eoObject #include "eoPersistent.h" // eoPersistent +#include "eoExceptions.h" /** @defgroup Core Core components @@ -73,13 +74,14 @@ public: /// Return fitness value. const Fitness& fitness() const { if (invalid()) - throw std::runtime_error("invalid fitness"); + throw eoInvalidFitnessError("Cannot retrieve unevaluated fitness"); return repFitness; } /// Get fitness as reference, useful when fitness is set in a multi-stage way, e.g., MOFitness gets performance information, is subsequently ranked Fitness& fitnessReference() { - if (invalid()) throw std::runtime_error("invalid fitness"); + if (invalid()) + throw eoInvalidFitnessError("Cannot retrieve unevaluated fitness reference"); return repFitness; } @@ -120,7 +122,7 @@ public: * The read and print methods should be compatible and have the same format. * In principle, format is "plain": they just print a number * @param _is a std::istream. - * @throw runtime_std::exception If a valid object can't be read. + * @throw eoInvalidFitnessError If a valid object can't be read. */ virtual void readFrom(std::istream& _is) { diff --git a/eo/src/PO.h b/eo/src/PO.h index c4225cf61..477f165c9 100644 --- a/eo/src/PO.h +++ b/eo/src/PO.h @@ -60,7 +60,7 @@ public: Fitness fitness () const { if (invalid ()) - throw std::runtime_error ("invalid fitness in PO.h"); + throw eoInvalidFitnessError("invalid fitness in PO.h"); return repFitness; } @@ -80,7 +80,7 @@ public: Fitness best () const { if (invalid ()) - throw std::runtime_error ("invalid best fitness in PO.h"); + throw eoInvalidFitnessError("invalid best fitness in PO.h"); return bestFitness; } diff --git a/eo/src/do/make_algo_easea.h b/eo/src/do/make_algo_easea.h index 3fadf05ec..bf5b8b188 100644 --- a/eo/src/do/make_algo_easea.h +++ b/eo/src/do/make_algo_easea.h @@ -183,7 +183,7 @@ eoAlgo & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF else { std::string stmp = std::string("Invalid selection: ") + ppSelect.first; - throw std::runtime_error(stmp.c_str()); + throw eoException(stmp.c_str()); } _state.storeFunctor(select); @@ -260,7 +260,7 @@ eoAlgo & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF } else { - throw std::runtime_error("Sorry, only deterministic tournament available at the moment"); + throw eoException("Sorry, only deterministic tournament available at the moment"); } } ptReplace = new eoMGGReplacement(-surviveParents, tSize); @@ -341,7 +341,7 @@ eoAlgo & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoPopEvalF } else // no replacement recognized { - throw std::runtime_error("Invalid replacement type " + replacementParam.first); + throw eoException("Invalid replacement type " + replacementParam.first); } ptReplace = & make_general_replacement( diff --git a/eo/src/do/make_algo_scalar.h b/eo/src/do/make_algo_scalar.h index 92e16d2f2..7819a4270 100644 --- a/eo/src/do/make_algo_scalar.h +++ b/eo/src/do/make_algo_scalar.h @@ -120,7 +120,7 @@ eoAlgo & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc else // parameter passed by user as DetTour(T) nicheSize = atof(ppSelect.second[0].c_str()); if (_dist == NULL) // no distance - throw std::runtime_error("You didn't specify a distance when calling make_algo_scalar and using sharing"); + throw eoException("You didn't specify a distance when calling make_algo_scalar and using sharing"); select = new eoSharingSelect(nicheSize, *_dist); } else if (ppSelect.first == std::string("StochTour")) @@ -206,7 +206,7 @@ eoAlgo & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc else { std::string stmp = std::string("Invalid selection: ") + ppSelect.first; - throw std::runtime_error(stmp.c_str()); + throw eoException(stmp.c_str()); } _state.storeFunctor(select); @@ -282,7 +282,7 @@ eoAlgo & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc else { std::string stmp = std::string("Invalid replacement: ") + ppReplace.first; - throw std::runtime_error(stmp.c_str()); + throw eoException(stmp.c_str()); } _state.storeFunctor(replace); diff --git a/eo/src/do/make_continue.h b/eo/src/do/make_continue.h index f09bf8642..9d773fec1 100644 --- a/eo/src/do/make_continue.h +++ b/eo/src/do/make_continue.h @@ -156,7 +156,7 @@ eoContinue & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu // now check that there is at least one! if (!continuator) - throw std::runtime_error("You MUST provide a stopping criterion"); + throw eoException("You MUST provide a stopping criterion"); // OK, it's there: store in the eoState _state.storeFunctor(continuator); diff --git a/eo/src/do/make_general_replacement.h b/eo/src/do/make_general_replacement.h index 52c54ff6f..717cc668d 100644 --- a/eo/src/do/make_general_replacement.h +++ b/eo/src/do/make_general_replacement.h @@ -97,7 +97,7 @@ eoReduce & decode_reduce(eoParamParamType & _ppReduce, eoState & _state) { p = atof(_ppReduce.second[0].c_str()); if ( (p<=0.5) || (p>1) ) - throw std::runtime_error("Stochastic tournament size should be in [0.5,1]"); + throw eoException("Stochastic tournament size should be in [0.5,1]"); } ptReduce = new eoStochTournamentTruncate(p); @@ -110,7 +110,7 @@ eoReduce & decode_reduce(eoParamParamType & _ppReduce, eoState & _state) } else // no known reduction entered { - throw std::runtime_error("Unknown reducer: " + _ppReduce.first); + throw eoException("Unknown reducer: " + _ppReduce.first); } // all done, stores and return a reference _state.storeFunctor(ptReduce); diff --git a/eo/src/eoCtrlCContinue.h b/eo/src/eoCtrlCContinue.h index 37b665a10..b184ffcfe 100644 --- a/eo/src/eoCtrlCContinue.h +++ b/eo/src/eoCtrlCContinue.h @@ -56,7 +56,7 @@ public: { // First checks that no other eoCtrlCContinue does exist if (existCtrlCContinue) - throw std::runtime_error("A signal handler for Ctrl C is already defined!\n"); + throw eoParamException("A signal handler for Ctrl C is already defined!\n"); #ifndef _WINDOWS #ifdef SIGQUIT diff --git a/eo/src/eoEasyEA.h b/eo/src/eoEasyEA.h index d3fd2825a..effe81a14 100644 --- a/eo/src/eoEasyEA.h +++ b/eo/src/eoEasyEA.h @@ -261,8 +261,8 @@ template class eoEasyEA: public eoAlgo do { - try - { + // try + // { unsigned pSize = _pop.size(); offspring.clear(); // new offspring @@ -273,17 +273,17 @@ template class eoEasyEA: public eoAlgo replace(_pop, offspring); // after replace, the new pop. is in _pop if (pSize > _pop.size()) - throw std::runtime_error("Population shrinking!"); + throw eoException("Population shrinking!"); else if (pSize < _pop.size()) - throw std::runtime_error("Population growing!"); + throw eoException("Population growing!"); - } - catch (std::exception& e) - { - std::string s = e.what(); - s.append( " in eoEasyEA"); - throw std::runtime_error( s ); - } + // } + // catch (std::exception& e) + // { + // std::string s = e.what(); + // s.append( " in eoEasyEA"); + // throw std::runtime_error( s ); + // } } while ( continuator( _pop ) ); } diff --git a/eo/src/eoEasyPSO.h b/eo/src/eoEasyPSO.h index f1e00bf2a..87c27cad3 100644 --- a/eo/src/eoEasyPSO.h +++ b/eo/src/eoEasyPSO.h @@ -129,8 +129,8 @@ public: /// Apply a few iteration of flight to the population (=swarm). virtual void operator () (eoPop < POT > &_pop) { - try - { + // try + // { // initializes the topology, velocity, best particle(s) init(); do @@ -154,13 +154,13 @@ public: } while (continuator (_pop)); - } - catch (std::exception & e) - { - std::string s = e.what (); - s.append (" in eoEasyPSO"); - throw std::runtime_error (s); - } + // } + // catch (std::exception & e) + // { + // std::string s = e.what (); + // s.append (" in eoEasyPSO"); + // throw std::runtime_error (s); + // } } diff --git a/eo/src/eoEvalDump.h b/eo/src/eoEvalDump.h index 2f26ee327..7a7349360 100644 --- a/eo/src/eoEvalDump.h +++ b/eo/src/eoEvalDump.h @@ -105,8 +105,8 @@ protected: } #ifndef NDEBUG if ( !_of.is_open() ) { - std::string str = "Error, eoEvalDump could not open: " + _filename; - throw std::runtime_error( str ); + // std::string str = "Error, eoEvalDump could not open: " + _filename; + throw eoFileError( _filename ); } #endif // here, in release mode, we assume that the file could be opened diff --git a/eo/src/eoExceptions.h b/eo/src/eoExceptions.h index 476a064d6..b91bd6207 100644 --- a/eo/src/eoExceptions.h +++ b/eo/src/eoExceptions.h @@ -54,6 +54,69 @@ protected: const std::string _msg; }; + +class eoInvalidFitnessError : public eoException +{ +public: + eoInvalidFitnessError(std::string msg = "Invalid fitness") : eoException(msg) {} + ~eoInvalidFitnessError() throw() {} +}; + + +class eoPopSizeException : public eoException +{ +public: + eoPopSizeException(size_t size, std::string msg = "") : + eoException(), + _size(size), + _msg(msg) + {} + + virtual std::string message() const throw() + { + std::ostringstream oss; + oss << "Bad population size: " << _size; + if(_msg != "") { + oss << ", " << _msg; + } + return oss.str(); + } + + ~eoPopSizeException() throw() {} +protected: + const size_t _size; + const std::string _msg; +}; + + +class eoPopSizeChangeException : public eoPopSizeException +{ +public: + eoPopSizeChangeException(size_t size_from, size_t size_to, std::string msg="") : + eoPopSizeException(0), + _size_from(size_from), + _size_to(size_to), + _msg(msg) + {} + + virtual std::string message() const throw() + { + std::ostringstream oss; + oss << "Population size changed from " << _size_from << " to " << _size_to; + if(_msg != "") { + oss << ", " << _msg; + } + return oss.str(); + } + + ~eoPopSizeChangeException() throw() {} +protected: + const size_t _size_from; + const size_t _size_to; + const std::string _msg; +}; + + /** Base class for exceptions which need to stop the algorithm to be handled * * (like stopping criterion or numerical errors). @@ -110,7 +173,7 @@ public: virtual std::string message() const throw() { std::ostringstream msg; - msg << "STOP because the maximum number of allowed seconds has been reached (" + msg << "The maximum number of allowed seconds has been reached (" << _elapsed << ")"; return msg.str(); } @@ -140,7 +203,7 @@ public: virtual std::string message() const throw() { std::ostringstream msg; - msg << " the maximum number of evaluation has been reached (" + msg << "The maximum number of evaluation has been reached (" << _threshold << ")."; return msg.str(); } @@ -226,7 +289,7 @@ public: _cmd(cmd), _has_pipe(false), _err_code(-1), _output("") { } - eoSystemError(std::string cmd, int err_code, std::string output) : + eoSystemError(std::string cmd, int err_code, std::string output = "") : eoException(), _cmd(cmd), _has_pipe(true), _err_code(err_code), _output(output) { } @@ -234,10 +297,12 @@ public: virtual std::string message() const throw() { std::ostringstream ss; - ss << "System call: `" << _cmd << "` error"; + ss << "System call: `" << _cmd << "` ended with error"; if(_has_pipe) { - ss << " code #" << _err_code - << " with the following output:" << std::endl << _output; + ss << " code #" << _err_code; + if(_output != "") { + ss << " with the following output:" << std::endl << _output; + } } return ss.str(); } @@ -251,4 +316,24 @@ protected: const std::string _output; }; + +class eoFileError : public eoSystemError +{ +public: + eoFileError(std::string filename) : + eoSystemError(""), + _filename(filename) + { } + + virtual std::string message() const throw() + { + std::ostringstream oss; + oss << "Could not open file: " << _filename; + return oss.str(); + } + +protected: + std::string _filename; +}; + #endif // __eoExceptions_h__ diff --git a/eo/src/eoFlOrBinOp.h b/eo/src/eoFlOrBinOp.h index 343b2c738..a4f18128c 100644 --- a/eo/src/eoFlOrBinOp.h +++ b/eo/src/eoFlOrBinOp.h @@ -66,7 +66,7 @@ public : if (_eo1.size() != _eo2.size()) { string s = "Operand size don't match in " + className(); - throw runtime_error(s); + throw eoException(s); } bool changed = false; for ( unsigned i = 0; i < _eo1.size(); i++ ) { @@ -109,7 +109,7 @@ public : if (_eo1.size() != _eo2.size()) { string s = "Operand size don't match in " + className(); - throw runtime_error(s); + throw eoException(s); } bool changed = false; @@ -155,7 +155,7 @@ public : if (_eo1.size() != _eo2.size()) { string s = "Operand size don't match in " + className(); - throw runtime_error(s); + throw eoException(s); } bool hasChanged = false; for (unsigned i=0; i<_eo1.size(); i++) @@ -199,7 +199,7 @@ public : if (_eo1.size() != _eo2.size()) { string s = "Operand size don't match in " + className(); - throw runtime_error(s); + throw eoException(s); } bool hasChanged = false; unsigned where = eo::rng.random(_eo1.size()-1); diff --git a/eo/src/eoFlOrQuadOp.h b/eo/src/eoFlOrQuadOp.h index 1c0c805fd..f887d952a 100644 --- a/eo/src/eoFlOrQuadOp.h +++ b/eo/src/eoFlOrQuadOp.h @@ -101,7 +101,7 @@ public : if (_eo1.size() != _eo2.size()) { string s = "Operand size don't match in " + className(); - throw runtime_error(s); + throw eoException(s); } bool changed = false; @@ -146,7 +146,7 @@ public : if (_eo1.size() != _eo2.size()) { string s = "Operand size don't match in " + className(); - throw runtime_error(s); + throw eoException(s); } bool hasChanged = false; for (unsigned i=0; i<_eo1.size(); i++) @@ -191,7 +191,7 @@ public : if (_eo1.size() != _eo2.size()) { string s = "Operand size don't match in " + className(); - throw runtime_error(s); + throw eoException(s); } bool hasChanged = false; unsigned where = eo::rng.random(_eo1.size()-1); diff --git a/eo/src/eoG3Replacement.h b/eo/src/eoG3Replacement.h index c7cf20178..e9de717cc 100644 --- a/eo/src/eoG3Replacement.h +++ b/eo/src/eoG3Replacement.h @@ -71,7 +71,7 @@ public: if (_offspring.size() != toKeep) { std::cerr << "Les tailles " << _offspring.size() << " " << toKeep << std::endl; - throw std::runtime_error("eoG3Replacement: wrong number of remaining offspring"); + throw eoException("eoG3Replacement: wrong number of remaining offspring"); } // and put back into _parents plus(_offspring, _parents); diff --git a/eo/src/eoInit.h b/eo/src/eoInit.h index 9965af919..d9b4a0e30 100644 --- a/eo/src/eoInit.h +++ b/eo/src/eoInit.h @@ -33,6 +33,7 @@ #include "eoSTLFunctor.h" #include "utils/eoRndGenerators.h" #include "utils/rnd_generators.h" // for shuffle method +#include "eoExceptions.h" /** @@ -134,7 +135,7 @@ typedef typename EOT::AtomType AtomType; : offset(_minSize), extent(_maxSize - _minSize), init(_init) { if (_minSize >= _maxSize) - throw std::logic_error("eoInitVariableLength: minSize larger or equal to maxSize"); + throw eoException("eoInitVariableLength: minSize larger or equal to maxSize"); } diff --git a/eo/src/eoLinearTopology.h b/eo/src/eoLinearTopology.h index 027be1871..a9dff1e3c 100644 --- a/eo/src/eoLinearTopology.h +++ b/eo/src/eoLinearTopology.h @@ -67,7 +67,7 @@ public: if (neighborhoodSize >= _pop.size()){ std::string s; s.append (" Invalid neighborhood size in eoLinearTopology "); - throw std::runtime_error (s); + throw eoException(s); } unsigned howManyNeighborhood=_pop.size()/ neighborhoodSize; diff --git a/eo/src/eoMGGReplacement.h b/eo/src/eoMGGReplacement.h index 1e4c40f2d..d33ff6a06 100644 --- a/eo/src/eoMGGReplacement.h +++ b/eo/src/eoMGGReplacement.h @@ -71,7 +71,7 @@ public: unsigned toKeep = temp.size(); // how many to keep from merged populations // minimal check if (toKeep < 2) - throw std::runtime_error("Not enough parents killed in eoMGGReplacement"); + throw eoException("Not enough parents killed in eoMGGReplacement"); // select best offspring typename eoPop::iterator it = _offspring.it_best_element(); diff --git a/eo/src/eoMerge.h b/eo/src/eoMerge.h index 5870849cf..1564f3977 100644 --- a/eo/src/eoMerge.h +++ b/eo/src/eoMerge.h @@ -67,13 +67,13 @@ public : if (_interpret_as_rate) { if ( (_rate<0) || (_rate>1) ) - throw std::logic_error("eoElitism: rate shoud be in [0,1]"); + throw eoParamException("eoElitism: rate shoud be in [0,1]"); rate = _rate; } else { if (_rate<0) - throw std::logic_error("Negative number of offspring in eoElitism!"); + throw eoParamException("Negative number of offspring in eoElitism!"); combien = (unsigned int)_rate; if (combien != _rate) eo::log << eo::warnings << "Warning: Number of guys to merge in eoElitism was rounded" << std::endl; @@ -91,7 +91,7 @@ public : combienLocal = combien; if (combienLocal > _pop.size()) - throw std::logic_error("Elite larger than population"); + throw eoException("Elite larger than population"); std::vector result; _pop.nth_element(combienLocal, result); diff --git a/eo/src/eoNDSorting.h b/eo/src/eoNDSorting.h index b8315b458..fee6d1cb8 100644 --- a/eo/src/eoNDSorting.h +++ b/eo/src/eoNDSorting.h @@ -222,7 +222,7 @@ private : // Check whether the derived class was nice if (niche_count.size() != fronts[i].size()) { - throw std::logic_error("eoNDSorting: niche and front should have the same size"); + throw eoException("eoNDSorting: niche and front should have the same size"); } double max_niche = *std::max_element(niche_count.begin(), niche_count.end()); @@ -322,7 +322,7 @@ private : // Check whether the derived class was nice if (niche_count.size() != current_front.size()) { - throw std::logic_error("eoNDSorting: niche and front should have the same size"); + throw eoException("eoNDSorting: niche and front should have the same size"); } double max_niche = *std::max_element(niche_count.begin(), niche_count.end()); diff --git a/eo/src/eoOneToOneBreeder.h b/eo/src/eoOneToOneBreeder.h index 587dbce19..87470e0f1 100644 --- a/eo/src/eoOneToOneBreeder.h +++ b/eo/src/eoOneToOneBreeder.h @@ -95,7 +95,7 @@ class eoOneToOneBreeder: public eoBreed // check: only one offspring? unsigned posEnd = popit.tellp(); if (posEnd != pos) - throw std::runtime_error("Operator can only generate a SINGLE offspring in eoOneToOneBreeder"); + throw eoException("Operator can only generate a SINGLE offspring in eoOneToOneBreeder"); // do the tournament between parent and offspring eval(leOffspring); // first need to evaluate the offspring diff --git a/eo/src/eoPop.h b/eo/src/eoPop.h index 9213bca5c..ed2c09ef8 100644 --- a/eo/src/eoPop.h +++ b/eo/src/eoPop.h @@ -45,6 +45,7 @@ Authors: #include "eoPersistent.h" #include "eoInit.h" #include "utils/rnd_generators.h" // for shuffle method +#include "eoExceptions.h" /** A std::vector of EO object, to be used in all algorithms * (selectors, operators, replacements, ...). @@ -108,7 +109,7 @@ class eoPop: public std::vector, public eoObject, public eoPersistent unsigned oldSize = size(); if (_newPopSize < oldSize) { - throw std::runtime_error("New size smaller than old size in pop.append"); + throw eoPopSizeChangeException(oldSize, _newPopSize); return; } if (_newPopSize == oldSize) @@ -222,7 +223,7 @@ class eoPop: public std::vector, public eoObject, public eoPersistent typename eoPop::const_iterator it = std::max_element(begin(), end()); #endif if( it == end() ) - throw std::runtime_error("eoPop: Empty population, when calling best_element()."); + throw eoPopSizeException(this->size()); return (*it); } diff --git a/eo/src/eoProportionalSelect.h b/eo/src/eoProportionalSelect.h index 35dd3065c..8da608f6f 100644 --- a/eo/src/eoProportionalSelect.h +++ b/eo/src/eoProportionalSelect.h @@ -49,7 +49,7 @@ public: eoProportionalSelect(const eoPop& /*pop*/ = eoPop()) { if (minimizing_fitness()) - throw std::logic_error("eoProportionalSelect: minimizing fitness"); + throw eoException("eoProportionalSelect: minimizing fitness"); } void setup(const eoPop& _pop) diff --git a/eo/src/eoRandomRealWeightUp.h b/eo/src/eoRandomRealWeightUp.h index d135af93f..1adbca105 100644 --- a/eo/src/eoRandomRealWeightUp.h +++ b/eo/src/eoRandomRealWeightUp.h @@ -56,7 +56,7 @@ public: { std::string s; s.append (" min > max in eoRandomRealWeightUp"); - throw std::runtime_error (s); + throw eoException(s); } } diff --git a/eo/src/eoRanking.h b/eo/src/eoRanking.h index 65fbe87a4..63a031071 100644 --- a/eo/src/eoRanking.h +++ b/eo/src/eoRanking.h @@ -59,7 +59,7 @@ public: if (_eo == &(*it)) return it-_pop.begin(); } - throw std::runtime_error("Not found in eoLinearRanking"); + throw eoException("Not found in eoLinearRanking"); } /* COmputes the ranked fitness: fitnesses range in [m,M] @@ -74,7 +74,7 @@ public: unsigned int pSizeMinusOne = pSize-1; if (pSize <= 1) - throw std::runtime_error("Cannot do ranking with population of size <= 1"); + throw eoPopSizeException(pSize,"cannot do ranking with population of size <= 1"); // value() refers to the std::vector of worthes (we're in an eoParamvalue) value().resize(pSize); diff --git a/eo/src/eoReduce.h b/eo/src/eoReduce.h index c1039e47b..81c9b49a1 100644 --- a/eo/src/eoReduce.h +++ b/eo/src/eoReduce.h @@ -57,7 +57,7 @@ template class eoTruncate : public eoReduce if (_newgen.size() == _newsize) return; if (_newgen.size() < _newsize) - throw std::logic_error("eoTruncate: Cannot truncate to a larger size!\n"); + throw eoException("eoTruncate: Cannot truncate to a larger size!\n"); _newgen.sort(); _newgen.resize(_newsize); @@ -74,7 +74,7 @@ template class eoRandomReduce : public eoReduce if (_newgen.size() == _newsize) return; if (_newgen.size() < _newsize) - throw std::logic_error("eoRandomReduce: Cannot truncate to a larger size!\n"); + throw eoException("eoRandomReduce: Cannot truncate to a larger size!\n"); // shuffle the population, then trucate _newgen.shuffle(); @@ -123,7 +123,7 @@ public: if (presentSize == _newsize) return; if (presentSize < _newsize) - throw std::logic_error("eoTruncate: Cannot truncate to a larger size!\n"); + throw eoException("eoTruncate: Cannot truncate to a larger size!\n"); std::vector scores(presentSize); for (unsigned i=0; i if (oldSize == _newsize) return; if (oldSize < _newsize) - throw std::logic_error("eoLinearTruncate: Cannot truncate to a larger size!\n"); + throw eoException("eoLinearTruncate: Cannot truncate to a larger size!\n"); for (unsigned i=0; i::iterator it = _newgen.it_worse_element(); @@ -224,7 +224,7 @@ public: if (oldSize == _newsize) return; if (oldSize < _newsize) - throw std::logic_error("eoDetTournamentTruncate: Cannot truncate to a larger size!\n"); + throw eoException("eoDetTournamentTruncate: Cannot truncate to a larger size!\n"); // Now OK to erase some losers @@ -280,7 +280,7 @@ public: if (oldSize == _newsize) return; if (oldSize < _newsize) - throw std::logic_error("eoStochTournamentTruncate: Cannot truncate to a larger size!\n"); + throw eoException("eoStochTournamentTruncate: Cannot truncate to a larger size!\n"); // Now OK to erase some losers for (unsigned i=0; i void operator()(eoPop& _parents, eoPop& _offspring) { if (_parents.size() < _offspring.size()) - throw std::logic_error("eoReduceMerge: More offspring than parents!\n"); + throw eoPopSizeChangeException(_parents.size(), _offspring.size(),"more offspring than parents!"); reduce(_parents, _parents.size() - _offspring.size()); merge(_offspring, _parents); } diff --git a/eo/src/eoReduceMergeReduce.h b/eo/src/eoReduceMergeReduce.h index 0f7f0ad4c..d12a2b692 100644 --- a/eo/src/eoReduceMergeReduce.h +++ b/eo/src/eoReduceMergeReduce.h @@ -90,7 +90,7 @@ public: // then the offspring unsigned reducedOffspringSize = howManyReducedOffspring(offSize); if (!reducedOffspringSize) - throw std::runtime_error("No offspring left after reduction!"); + throw eoPopSizeException(reducedOffspringSize,"no offspring left after reduction!"); if (reducedOffspringSize != offSize) // need reduction reduceOffspring(_offspring, reducedOffspringSize); diff --git a/eo/src/eoReduceSplit.h b/eo/src/eoReduceSplit.h index a8640c039..b31008768 100644 --- a/eo/src/eoReduceSplit.h +++ b/eo/src/eoReduceSplit.h @@ -66,7 +66,7 @@ public: return ; unsigned newsize = popSize - eliminated; if (newsize < 0) - throw std::logic_error("eoTruncateSplit: Cannot truncate to a larger size!\n"); + throw eoException("eoTruncateSplit: Cannot truncate to a larger size!\n"); _newgen.nth_element(newsize); @@ -106,7 +106,7 @@ public: return ; long newsize = static_cast(popSize) - static_cast(eliminated); if (newsize < 0) - throw std::logic_error("eoLinearTruncateSplit: Cannot truncate to a larger size!\n"); + throw eoException("eoLinearTruncateSplit: Cannot truncate to a larger size!\n"); _eliminated.reserve(_eliminated.size()+eliminated); //in case not empty? for (unsigned i=0; i( rate ); } else { - throw std::runtime_error( "Incorrect selector type" ); + throw eoException( "Incorrect selector type" ); } } return selectPtr; diff --git a/eo/src/eoSelectFromWorth.h b/eo/src/eoSelectFromWorth.h index c6ba5c1e5..bbd0380a3 100644 --- a/eo/src/eoSelectFromWorth.h +++ b/eo/src/eoSelectFromWorth.h @@ -79,7 +79,7 @@ protected: std::vector fitness; void check_sync(unsigned index, const EOT& _eo) { if (fitness[index] != _eo.fitness()) { - throw std::runtime_error("eoSelectFromWorth: fitnesses are not in sync"); + throw eoException("eoSelectFromWorth: fitnesses are not in sync"); } } #endif diff --git a/eo/src/eoSequentialSelect.h b/eo/src/eoSequentialSelect.h index adf3cf452..53ffdd3b2 100644 --- a/eo/src/eoSequentialSelect.h +++ b/eo/src/eoSequentialSelect.h @@ -134,7 +134,7 @@ template class eoEliteSequentialSelect: public eoSelectOne unsigned int ibest = 0; const EOT * best = eoPters[0]; if (_pop.size() == 1) - throw std::runtime_error("Trying eoEliteSequentialSelect with only one individual!"); + throw eoException("Trying eoEliteSequentialSelect with only one individual!"); for (unsigned i=1; i<_pop.size(); i++) if (*eoPters[i]>*best) { diff --git a/eo/src/eoSharing.h b/eo/src/eoSharing.h index fa7583030..824bb20a4 100644 --- a/eo/src/eoSharing.h +++ b/eo/src/eoSharing.h @@ -26,6 +26,7 @@ #ifndef eoSharing_h #define eoSharing_h +#include "eoExceptions.h" #include "eoPerf2Worth.h" #include "utils/eoDistance.h" @@ -100,7 +101,7 @@ public: unsigned i, j, pSize=_pop.size(); if (pSize <= 1) - throw std::runtime_error("Apptempt to do sharing with population of size 1"); + throw eoPopSizeException(pSize, "attempt to do sharing with population of size 1"); value().resize(pSize); std::vector sim(pSize); // to hold the similarities dMatrix distMatrix(pSize); // to hold the distances diff --git a/eo/src/eoSimpleEDA.h b/eo/src/eoSimpleEDA.h index 0704b5722..ac815e1b7 100644 --- a/eo/src/eoSimpleEDA.h +++ b/eo/src/eoSimpleEDA.h @@ -73,21 +73,21 @@ template class eoSimpleEDA: public eoEDA eoPop pop(popSize, _distrib); do { - try - { + // try + // { apply(_distrib, pop); // re-init. of _pop from distrib apply(eval, pop); // eval of current population update(_distrib, pop); // updates distrib from _pop - } - catch (std::exception& e) - { - std::string s = e.what(); - s.append( " in eoSimpleEDA"); - throw std::runtime_error( s ); - } + // } + // catch (std::exception& e) + // { + // std::string s = e.what(); + // s.append( " in eoSimpleEDA"); + // throw std::runtime_error( s ); + // } } while ( continuator( pop ) ); } diff --git a/eo/src/eoSocialNeighborhood.h b/eo/src/eoSocialNeighborhood.h index 3f46b4a4e..315d105e8 100644 --- a/eo/src/eoSocialNeighborhood.h +++ b/eo/src/eoSocialNeighborhood.h @@ -94,7 +94,7 @@ public: else{ std::string s; s.append (" Invalid indice in eoSocialNeighborhood "); - throw std::runtime_error (s); + throw eoException(s); } } diff --git a/eo/src/eoStochasticUniversalSelect.h b/eo/src/eoStochasticUniversalSelect.h index 956bf62c7..e95f9eb0b 100644 --- a/eo/src/eoStochasticUniversalSelect.h +++ b/eo/src/eoStochasticUniversalSelect.h @@ -47,7 +47,7 @@ public: eoStochasticUniversalSelect(const eoPop& pop = eoPop()) { if (minimizing_fitness()) - throw std::logic_error("eoStochasticUniversalSelect: minimizing fitness"); + throw eoException("eoStochasticUniversalSelect: minimizing fitness"); } void setup(const eoPop& _pop) diff --git a/eo/src/eoSurviveAndDie.h b/eo/src/eoSurviveAndDie.h index 2ca4a3833..3e36ce54e 100644 --- a/eo/src/eoSurviveAndDie.h +++ b/eo/src/eoSurviveAndDie.h @@ -107,7 +107,7 @@ public: // carefull, we can have a rate of 1 if we want to kill all remaining unsigned nbDie = std::min(howmanyDie(pSize), pSize-nbSurvive); if (nbDie > nbRemaining) - throw std::logic_error("eoDeterministicSurviveAndDie: Too many to kill!\n"); + throw eoException("eoDeterministicSurviveAndDie: Too many to kill!\n"); if (!nbDie) { @@ -169,7 +169,7 @@ public: unsigned survivorSize = luckyOffspring.size() + luckyParents.size(); if (survivorSize > pSize) - throw std::logic_error("eoGeneralReplacement: More survivors than parents!\n"); + throw eoPopSizeChangeException(survivorSize, pSize, "more survivors than parents!"); plus(_parents, _offspring); // all that remain in _offspring diff --git a/eo/src/eoSwapMutation.h b/eo/src/eoSwapMutation.h index 58d3cf604..33d04ac8d 100644 --- a/eo/src/eoSwapMutation.h +++ b/eo/src/eoSwapMutation.h @@ -46,7 +46,7 @@ template class eoSwapMutation: public eoMonOp { // consistency check if(howManySwaps < 1) - throw std::runtime_error("Invalid number of swaps in eoSwapMutation"); + throw eoException("Invalid number of swaps in eoSwapMutation"); } /// The class name. diff --git a/eo/src/eoSyncEasyPSO.h b/eo/src/eoSyncEasyPSO.h index 64cf64724..11640af53 100644 --- a/eo/src/eoSyncEasyPSO.h +++ b/eo/src/eoSyncEasyPSO.h @@ -181,8 +181,8 @@ public: virtual void operator () (eoPop < POT > &_pop) { - try - { + // try + // { // initializes the topology, velocity, best particle(s) init(); @@ -206,13 +206,13 @@ public: } while (continuator (_pop)); - } - catch (std::exception & e) - { - std::string s = e.what (); - s.append (" in eoSyncEasyPSO"); - throw std::runtime_error (s); - } + // } + // catch (std::exception & e) + // { + // std::string s = e.what (); + // s.append (" in eoSyncEasyPSO"); + // throw std::runtime_error (s); + // } } diff --git a/eo/src/es/eoNormalMutation.h b/eo/src/es/eoNormalMutation.h index 48d09c6d5..266b10103 100644 --- a/eo/src/es/eoNormalMutation.h +++ b/eo/src/es/eoNormalMutation.h @@ -207,7 +207,7 @@ public: { // minimal check if (updateFactor>=1) - throw std::runtime_error("Update factor must be < 1 in eoOneFifthMutation"); + throw eoParamException("Update factor must be < 1 in eoOneFifthMutation"); } /** The class name */ diff --git a/eo/src/es/eoRealInitBounded.h b/eo/src/es/eoRealInitBounded.h index fa0259ec4..a011484a7 100644 --- a/eo/src/es/eoRealInitBounded.h +++ b/eo/src/es/eoRealInitBounded.h @@ -47,7 +47,7 @@ class eoRealInitBounded : public eoInit eoRealInitBounded(eoRealVectorBounds & _bounds):bounds(_bounds) { if (!bounds.isBounded()) - throw std::runtime_error("Needs bounded bounds to initialize a std::vector"); + throw eoException("Needs bounded bounds to initialize a std::vector"); } /** simply passes the argument to the uniform method of the bounds */ diff --git a/eo/src/es/eoRealOp.h b/eo/src/es/eoRealOp.h index 64b64101d..8c957413d 100644 --- a/eo/src/es/eoRealOp.h +++ b/eo/src/es/eoRealOp.h @@ -111,7 +111,7 @@ template class eoUniformMutation: public eoMonOp { // sanity check ? if (_eo.size() != bounds.size()) - throw std::runtime_error("Invalid size of indi in eoUniformMutation"); + throw eoException("Invalid size of indi in eoUniformMutation"); for (unsigned lieu=0; lieu<_eo.size(); lieu++) if (rng.flip(p_change[lieu])) @@ -213,7 +213,7 @@ template class eoDetUniformMutation: public eoMonOp { // sanity check ? if (_eo.size() != bounds.size()) - throw std::runtime_error("Invalid size of indi in eoDetUniformMutation"); + throw eoException("Invalid size of indi in eoDetUniformMutation"); for (unsigned i=0; i class eoHypercubeCrossover: public eoQuadOp bounds(eoDummyVectorNoBounds), alpha(_alpha), range(1+2*_alpha) { if (_alpha < 0) - throw std::runtime_error("BLX coefficient should be positive"); + throw eoParamException("BLX coefficient should be positive"); } /** @@ -373,7 +373,7 @@ template class eoHypercubeCrossover: public eoQuadOp bounds(_bounds), alpha(_alpha), range(1+2*_alpha) { if (_alpha < 0) - throw std::runtime_error("BLX coefficient should be positive"); + throw eoParamException("BLX coefficient should be positive"); } /// The class name. diff --git a/eo/src/es/make_algo_scalar_es.cpp b/eo/src/es/make_algo_scalar_es.cpp index e1bd1fb9d..3216a2f01 100644 --- a/eo/src/es/make_algo_scalar_es.cpp +++ b/eo/src/es/make_algo_scalar_es.cpp @@ -51,34 +51,34 @@ // Algo /////// -eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* _dist) +eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* /*_dist*/) { return do_make_algo_scalar(_parser, _state, _eval, _continue, _op); } -eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* _dist) +eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* /*_dist*/) { return do_make_algo_scalar(_parser, _state, _eval, _continue, _op); } ////////////// -eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* _dist) +eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* /*_dist*/) { return do_make_algo_scalar(_parser, _state, _eval, _continue, _op); } -eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* _dist) +eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* /*_dist*/) { return do_make_algo_scalar(_parser, _state, _eval, _continue, _op); } /////////////// -eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* _dist) +eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* /*_dist*/) { return do_make_algo_scalar(_parser, _state, _eval, _continue, _op); } -eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* _dist) +eoAlgo >& make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc >& _eval, eoContinue >& _continue, eoGenOp >& _op, eoDistance >* /*_dist*/) { return do_make_algo_scalar(_parser, _state, _eval, _continue, _op); } diff --git a/eo/src/es/make_genotype_real.h b/eo/src/es/make_genotype_real.h index 82b07db8f..7f86e6720 100644 --- a/eo/src/es/make_genotype_real.h +++ b/eo/src/es/make_genotype_real.h @@ -98,7 +98,7 @@ eoEsChromInit & do_make_genotype(eoParser& _parser, eoState& _state, EOT) is >> sigma; // minimum check if(sigma < 0) - throw std::runtime_error("Negative sigma in make_genotype"); + throw eoException("Negative sigma in make_genotype"); if(to_scale) init = new eoEsChromInit(boundsParam.value(), sigma, to_scale); else { diff --git a/eo/src/es/make_op.h b/eo/src/es/make_op.h index 35767b5df..b53022bfe 100644 --- a/eo/src/es/make_op.h +++ b/eo/src/es/make_op.h @@ -107,7 +107,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit proportional choice @@ -138,14 +138,14 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit 1) ) - throw std::runtime_error("Invalid pCross"); + throw eoParamException("Invalid pCross"); eoValueParam& pMutParam = _parser.getORcreateParam(0.1, "pMut", "Probability of Mutation", 'M', "Genetic Operators" ); // minimum check if ( (pMutParam.value() < 0) || (pMutParam.value() > 1) ) - throw std::runtime_error("Invalid pMut"); + throw eoParamException("Invalid pMut"); // the crossovers ///////////////// @@ -156,7 +156,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit& arithmeticRateParam = _parser.getORcreateParam(double(2.0), "arithmeticRate", @@ -164,7 +164,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit & uniformMutRateParam = _parser.getORcreateParam(1.0, "uniformMutRate", "Relative rate for uniform mutation", 'u', "Genetic Operators" ); // minimum check if ( (uniformMutRateParam.value() < 0) ) - throw std::runtime_error("Invalid uniformMutRate"); + throw eoParamException("Invalid uniformMutRate"); eoValueParam & detMutRateParam = _parser.getORcreateParam(1.0, "detMutRate", @@ -217,7 +217,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit & normalMutRateParam = _parser.getORcreateParam(1.0, "normalMutRate", @@ -225,7 +225,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit & sigmaParam = _parser.getORcreateParam(1.0, "sigma", @@ -233,7 +233,7 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit *ptCombinedMonOp = NULL; diff --git a/eo/src/es/make_op_es.h b/eo/src/es/make_op_es.h index 0b78a724f..d52669489 100644 --- a/eo/src/es/make_op_es.h +++ b/eo/src/es/make_op_es.h @@ -88,7 +88,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'o', "Variation Operators"); if (operatorParam.value() != std::string("SGA")) - throw std::runtime_error("Sorry, only SGA-like operator available right now\n"); + throw eoException("Sorry, only SGA-like operator available right now\n"); // now we read Pcross and Pmut, // and create the eoGenOp that is exactly @@ -99,14 +99,14 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'C', "Variation Operators" ); // minimum check if ( (pCrossParam.value() < 0) || (pCrossParam.value() > 1) ) - throw std::runtime_error("Invalid pCross"); + throw eoParamException("Invalid pCross"); eoValueParam& pMutParam = _parser.getORcreateParam(1.0, "pMut", "Probability of Mutation", 'M', "Variation Operators" ); // minimum check if ( (pMutParam.value() < 0) || (pMutParam.value() > 1) ) - throw std::runtime_error("Invalid pMut"); + throw eoParamException("Invalid pMut"); // crossover @@ -140,7 +140,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< ptObjAtomCross = new eoDoubleIntermediate; else if (crossObjParam.value() == std::string("none")) ptObjAtomCross = new eoBinCloneOp; - else throw std::runtime_error("Invalid Object variable crossover type"); + else throw eoException("Invalid Object variable crossover type"); if (crossStdevParam.value() == std::string("discrete")) ptStdevAtomCross = new eoDoubleExchange; @@ -148,7 +148,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< ptStdevAtomCross = new eoDoubleIntermediate; else if (crossStdevParam.value() == std::string("none")) ptStdevAtomCross = new eoBinCloneOp; - else throw std::runtime_error("Invalid mutation strategy parameter crossover type"); + else throw eoException("Invalid mutation strategy parameter crossover type"); // and build the indi Xover if (crossTypeParam.value() == std::string("global")) @@ -160,7 +160,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< ); ptCross = new eoBinGenOp(crossTmp); } - else throw std::runtime_error("Invalide Object variable crossover type"); + else throw eoException("Invalide Object variable crossover type"); // now that everything is OK, DON'T FORGET TO STORE MEMORY _state.storeFunctor(ptObjAtomCross); diff --git a/eo/src/es/make_op_real.h b/eo/src/es/make_op_real.h index 198483a5a..0c202d767 100644 --- a/eo/src/es/make_op_real.h +++ b/eo/src/es/make_op_real.h @@ -89,7 +89,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'o', "Variation Operators"); if (operatorParam.value() != std::string("SGA")) - throw std::runtime_error("Sorry, only SGA-like operator available right now\n"); + throw eoException("Sorry, only SGA-like operator available right now\n"); // now we read Pcross and Pmut, // the relative weights for all crossovers -> proportional choice @@ -103,7 +103,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'C', "Variation Operators" ); // minimum check if ( (pCrossParam.value() < 0) || (pCrossParam.value() > 1) ) - throw std::runtime_error("Invalid pCross"); + throw eoParamException("Invalid pCross"); eoValueParam& pMutParam = _parser.getORcreateParam(0.1, "pMut", @@ -111,7 +111,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'M', "Variation Operators" ); // minimum check if ( (pMutParam.value() < 0) || (pMutParam.value() > 1) ) - throw std::runtime_error("Invalid pMut"); + throw eoParamException("Invalid pMut"); // the crossovers ///////////////// @@ -122,7 +122,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'a', "Variation Operators" ); // minimum check if ( (alphaParam.value() < 0) ) - throw std::runtime_error("Invalid BLX coefficient alpha"); + throw eoParamException("Invalid BLX coefficient alpha"); eoValueParam& segmentRateParam @@ -131,7 +131,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 's', "Variation Operators" ); // minimum check if ( (segmentRateParam.value() < 0) ) - throw std::runtime_error("Invalid segmentRate"); + throw eoParamException("Invalid segmentRate"); eoValueParam& hypercubeRateParam = _parser.getORcreateParam(double(1.0), "hypercubeRate", @@ -139,7 +139,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'A', "Variation Operators" ); // minimum check if ( (hypercubeRateParam.value() < 0) ) - throw std::runtime_error("Invalid hypercubeRate"); + throw eoParamException("Invalid hypercubeRate"); eoValueParam& uxoverRateParam = _parser.getORcreateParam(double(1.0), "uxoverRate", @@ -147,7 +147,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'A', "Variation Operators" ); // minimum check if ( (uxoverRateParam.value() < 0) ) - throw std::runtime_error("Invalid uxoverRate"); + throw eoParamException("Invalid uxoverRate"); // minimum check bool bCross = true; @@ -191,7 +191,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'e', "Variation Operators" ); // minimum check if ( (epsilonParam.value() < 0) ) - throw std::runtime_error("Invalid epsilon"); + throw eoParamException("Invalid epsilon"); eoValueParam & uniformMutRateParam = _parser.getORcreateParam(1.0, "uniformMutRate", @@ -199,7 +199,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'u', "Variation Operators" ); // minimum check if ( (uniformMutRateParam.value() < 0) ) - throw std::runtime_error("Invalid uniformMutRate"); + throw eoParamException("Invalid uniformMutRate"); eoValueParam & detMutRateParam = _parser.getORcreateParam(1.0, "detMutRate", @@ -207,14 +207,14 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< 'd', "Variation Operators" ); // minimum check if ( (detMutRateParam.value() < 0) ) - throw std::runtime_error("Invalid detMutRate"); + throw eoParamException("Invalid detMutRate"); eoValueParam & normalMutRateParam = _parser.getORcreateParam(1.0, "normalMutRate", "Relative rate for Gaussian mutation", 'd', "Variation Operators" ); // minimum check if ( (normalMutRateParam.value() < 0) ) - throw std::runtime_error("Invalid normalMutRate"); + throw eoParamException("Invalid normalMutRate"); eoValueParam & sigmaParam = _parser.getORcreateParam(0.3, "sigma", @@ -234,7 +234,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoRealInitBounded< bMut = false; } if (!bCross && !bMut) - throw std::runtime_error("No operator called in SGA operator definition!!!"); + throw eoException("No operator called in SGA operator definition!!!"); // Create the CombinedMonOp eoPropCombinedMonOp *ptCombinedMonOp = NULL; diff --git a/eo/src/ga/make_PBILupdate.h b/eo/src/ga/make_PBILupdate.h index 34a062a96..43a04dd88 100644 --- a/eo/src/ga/make_PBILupdate.h +++ b/eo/src/ga/make_PBILupdate.h @@ -69,7 +69,7 @@ eoDistribUpdater & do_make_PBILupdate(eoParser & _parser, eoState& _state, ptUpdate = new eoPBILAdditive(LRBest, nbBest, tolerance, LRWorst, nbWorst); } else - throw std::runtime_error("Only PBIL additive update rule available at the moment"); + throw eoException("Only PBIL additive update rule available at the moment"); // done: don't forget to store the allocated pointers _state.storeFunctor(ptUpdate); diff --git a/eo/src/ga/make_op.h b/eo/src/ga/make_op.h index b8993f312..afe5a5bc9 100644 --- a/eo/src/ga/make_op.h +++ b/eo/src/ga/make_op.h @@ -78,7 +78,7 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoInit& _init eoValueParam& operatorParam = _parser.createParam(std::string("SGA"), "operator", "Description of the operator (SGA only now)", 'o', "Variation Operators"); if (operatorParam.value() != std::string("SGA")) - throw std::runtime_error("Only SGA-like operator available right now\n"); + throw eoException("Only SGA-like operator available right now\n"); // now we read Pcross and Pmut, // the relative weights for all crossovers -> proportional choice @@ -89,12 +89,12 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoInit& _init eoValueParam& pCrossParam = _parser.createParam(0.6, "pCross", "Probability of Crossover", 'C', "Variation Operators" ); // minimum check if ( (pCrossParam.value() < 0) || (pCrossParam.value() > 1) ) - throw std::runtime_error("Invalid pCross"); + throw eoParamException("Invalid pCross"); eoValueParam& pMutParam = _parser.createParam(0.1, "pMut", "Probability of Mutation", 'M', "Variation Operators" ); // minimum check if ( (pMutParam.value() < 0) || (pMutParam.value() > 1) ) - throw std::runtime_error("Invalid pMut"); + throw eoParamException("Invalid pMut"); // the crossovers ///////////////// @@ -102,17 +102,17 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoInit& _init eoValueParam& onePointRateParam = _parser.createParam(double(1.0), "onePointRate", "Relative rate for one point crossover", '1', "Variation Operators" ); // minimum check if ( (onePointRateParam.value() < 0) ) - throw std::runtime_error("Invalid onePointRate"); + throw eoParamException("Invalid onePointRate"); eoValueParam& twoPointsRateParam = _parser.createParam(double(1.0), "twoPointRate", "Relative rate for two point crossover", '2', "Variation Operators" ); // minimum check if ( (twoPointsRateParam.value() < 0) ) - throw std::runtime_error("Invalid twoPointsRate"); + throw eoParamException("Invalid twoPointsRate"); eoValueParam& uRateParam = _parser.createParam(double(2.0), "uRate", "Relative rate for uniform crossover", 'U', "Variation Operators" ); // minimum check if ( (uRateParam.value() < 0) ) - throw std::runtime_error("Invalid uRate"); + throw eoParamException("Invalid uRate"); // minimum check // bool bCross = true; // not used ? @@ -149,29 +149,29 @@ eoGenOp & do_make_op(eoParser& _parser, eoState& _state, eoInit& _init eoValueParam & pMutPerBitParam = _parser.createParam(0.01, "pMutPerBit", "Probability of flipping 1 bit in bit-flip mutation", 'b', "Variation Operators" ); // minimum check if ( (pMutPerBitParam.value() < 0) || (pMutPerBitParam.value() > 0.5) ) - throw std::runtime_error("Invalid pMutPerBit"); + throw eoParamException("Invalid pMutPerBit"); eoValueParam & bitFlipRateParam = _parser.createParam(0.01, "bitFlipRate", "Relative rate for bit-flip mutation", 's', "Variation Operators" ); // minimum check if ( (bitFlipRateParam.value() < 0) ) - throw std::runtime_error("Invalid bitFlipRate"); + throw eoParamException("Invalid bitFlipRate"); // oneBitFlip eoValueParam & oneBitRateParam = _parser.createParam(0.01, "oneBitRate", "Relative rate for deterministic bit-flip mutation", 'd', "Variation Operators" ); // minimum check if ( (oneBitRateParam.value() < 0) ) - throw std::runtime_error("Invalid oneBitRate"); + throw eoParamException("Invalid oneBitRate"); // kBitFlip eoValueParam & kBitParam = _parser.createParam((unsigned)1, "kBit", "Number of bit for deterministic k bit-flip mutation", 0, "Variation Operators" ); // minimum check if ( ! kBitParam.value() ) - throw std::runtime_error("Invalid kBit"); + throw eoParamException("Invalid kBit"); eoValueParam & kBitRateParam = _parser.createParam(0.0, "kBitRate", "Relative rate for deterministic k bit-flip mutation", 0, "Variation Operators" ); // minimum check if ( (kBitRateParam.value() < 0) ) - throw std::runtime_error("Invalid kBitRate"); + throw eoParamException("Invalid kBitRate"); // minimum check // bool bMut = true; // not used ? diff --git a/eo/src/gp/eoParseTreeDepthInit.h b/eo/src/gp/eoParseTreeDepthInit.h index 6abe2e4ff..ba1cf1f5a 100644 --- a/eo/src/gp/eoParseTreeDepthInit.h +++ b/eo/src/gp/eoParseTreeDepthInit.h @@ -81,7 +81,7 @@ class eoParseTreeDepthInit : public eoInit< eoParseTree > { if(initializor.empty()) { - throw std::logic_error("eoParseTreeDepthInit: uhm, wouldn't you rather give a non-empty set of Nodes?"); + throw eoException("eoParseTreeDepthInit: uhm, wouldn't you rather give a non-empty set of Nodes?"); } // lets sort the initializor std::vector according to arity (so we can be sure the terminals are in front) // we use stable_sort so that if element i was in front of element j and they have the same arity i remains in front of j diff --git a/eo/src/gp/eoStParseTreeDepthInit.h b/eo/src/gp/eoStParseTreeDepthInit.h index aa7247dd8..54764b1b6 100644 --- a/eo/src/gp/eoStParseTreeDepthInit.h +++ b/eo/src/gp/eoStParseTreeDepthInit.h @@ -87,7 +87,7 @@ class eoStParseTreeDepthInit : public eoInit< eoParseTree > { if(_node.empty()) { - throw std::logic_error("eoStParseTreeDepthInit: uhm, wouldn't you rather give a non-empty set of Nodes?"); + throw eoException("eoStParseTreeDepthInit: uhm, wouldn't you rather give a non-empty set of Nodes?"); } diff --git a/eo/src/mpi/eoParallelApply.h b/eo/src/mpi/eoParallelApply.h index dfb66e027..c85e5f7a8 100644 --- a/eo/src/mpi/eoParallelApply.h +++ b/eo/src/mpi/eoParallelApply.h @@ -102,7 +102,7 @@ namespace eo { if ( _packetSize <= 0 ) { - throw std::runtime_error("Packet size should not be negative."); + throw eoException("Packet size should not be negative."); } if( table ) diff --git a/eo/src/pyeo/PyEO.cpp b/eo/src/pyeo/PyEO.cpp index 8517c9aad..f29f13230 100644 --- a/eo/src/pyeo/PyEO.cpp +++ b/eo/src/pyeo/PyEO.cpp @@ -115,13 +115,13 @@ PyEO& pop_getitem(eoPop& pop, boost::python::object key) { boost::python::extract x(key); if (!x.check()) - throw index_error("Slicing not allowed"); + throw eoException("Slicing not allowed"); int i = x(); if (static_cast(i) >= pop.size()) { - throw index_error("Index out of bounds"); + throw eoException("Index out of bounds"); } return pop[i]; } @@ -130,13 +130,13 @@ void pop_setitem(eoPop& pop, boost::python::object key, PyEO& value) { boost::python::extract x(key); if (!x.check()) - throw index_error("Slicing not allowed"); + throw eoException("Slicing not allowed"); int i = x(); if (static_cast(i) >= pop.size()) { - throw index_error("Index out of bounds"); + throw eoException("Index out of bounds"); } pop[i] = value; diff --git a/eo/src/pyeo/PyEO.h b/eo/src/pyeo/PyEO.h index e9452800e..ba5cabd38 100644 --- a/eo/src/pyeo/PyEO.h +++ b/eo/src/pyeo/PyEO.h @@ -55,7 +55,7 @@ public : { if (which >= objective_info.size()) { - throw index_error("Too few elements allocated, resize objectives first"); + throw eoException("Too few elements allocated, resize objectives first"); } objective_info[which] = value; @@ -70,7 +70,7 @@ public : boost::python::extract x(object::operator[](i)); if (!x.check()) - throw std::runtime_error("PyFitness: does not contain doubles"); + throw eoException("PyFitness: does not contain doubles"); return x(); } diff --git a/eo/src/pyeo/monitors.cpp b/eo/src/pyeo/monitors.cpp index f64881659..814a4c859 100644 --- a/eo/src/pyeo/monitors.cpp +++ b/eo/src/pyeo/monitors.cpp @@ -42,7 +42,7 @@ public: { if (static_cast(i) >= vec.size()) { - throw index_error("Index out of bounds"); + throw eoException("Index out of bounds"); } return vec[i]->getValue(); diff --git a/eo/src/pyeo/statistics.cpp b/eo/src/pyeo/statistics.cpp index e48b6f2fa..df7504b51 100644 --- a/eo/src/pyeo/statistics.cpp +++ b/eo/src/pyeo/statistics.cpp @@ -35,7 +35,7 @@ const PyEO& popview_getitem(const std::vector& pop, int it) { unsigned item = unsigned(it); if (item > pop.size()) - throw index_error("too much"); + throw eoException("too much"); return *pop[item]; } diff --git a/eo/src/pyeo/valueParam.cpp b/eo/src/pyeo/valueParam.cpp index 6e4b06218..3d1a867e2 100644 --- a/eo/src/pyeo/valueParam.cpp +++ b/eo/src/pyeo/valueParam.cpp @@ -109,7 +109,7 @@ void setv< std::vector, numeric::array > { extract x(val[i]); if (!x.check()) - throw std::runtime_error("double expected"); + throw eoException("double expected"); v[i] = x(); } @@ -130,9 +130,9 @@ void setv< std::pair, tuple > extract second(val[1]); if (!first.check()) - throw std::runtime_error("doubles expected"); + throw eoException("doubles expected"); if (!second.check()) - throw std::runtime_error("doubles expected"); + throw eoException("doubles expected"); p.value().first = first(); p.value().second = second(); diff --git a/eo/src/utils/eoAssembledFitnessStat.h b/eo/src/utils/eoAssembledFitnessStat.h index 43e922f3f..c9cd7d464 100644 --- a/eo/src/utils/eoAssembledFitnessStat.h +++ b/eo/src/utils/eoAssembledFitnessStat.h @@ -63,7 +63,7 @@ public : virtual void operator()(const eoPop& _pop) { if( whichFitnessTerm >= _pop[0].fitness().size() ) - throw std::logic_error("Fitness term requested out of range"); + throw eoException("Fitness term requested out of range"); double result =0.0; unsigned count = 0; @@ -102,7 +102,7 @@ public: virtual void operator()(const eoPop& _pop) { if( whichFitnessTerm >= _pop[0].fitness().size() ) - throw std::logic_error("Fitness term requested out of range"); + throw eoException("Fitness term requested out of range"); value() = _pop.best_element().fitness()[whichFitnessTerm]; } diff --git a/eo/src/utils/eoFDCStat.h b/eo/src/utils/eoFDCStat.h index 69ce60072..75a49674a 100644 --- a/eo/src/utils/eoFDCStat.h +++ b/eo/src/utils/eoFDCStat.h @@ -135,7 +135,7 @@ public: /** just to be sure the add method is not called further */ virtual void add(const eoParam& ) - { throw std::runtime_error("eoFDCFileSnapshot::add(). Trying to add stats to an eoFDCFileSnapshot"); } + { throw eoException("eoFDCFileSnapshot::add(). Trying to add stats to an eoFDCFileSnapshot"); } private: eoFDCStat & FDCstat; diff --git a/eo/src/utils/eoFileMonitor.cpp b/eo/src/utils/eoFileMonitor.cpp index e1e58ba21..d504305a8 100644 --- a/eo/src/utils/eoFileMonitor.cpp +++ b/eo/src/utils/eoFileMonitor.cpp @@ -10,6 +10,7 @@ #include "eoFileMonitor.h" #include "compatibility.h" #include "eoParam.h" +#include "../eoExceptions.h" using namespace std; @@ -36,8 +37,8 @@ void eoFileMonitor::printHeader() if (!os) { - string str = "eoFileMonitor could not open: " + filename; - throw runtime_error(str); + // string str = "eoFileMonitor could not open: " + filename; + throw eoFileError(filename); } printHeader(os); @@ -54,8 +55,8 @@ eoMonitor& eoFileMonitor::operator()(void) if (!os) { - string str = "eoFileMonitor could not write to: " + filename; - throw runtime_error(str); + // string str = "eoFileMonitor could not write to: " + filename; + throw eoFileError(filename); } if ( diff --git a/eo/src/utils/eoFileMonitor.h b/eo/src/utils/eoFileMonitor.h index 0d23dcbf5..9711d7dcf 100644 --- a/eo/src/utils/eoFileMonitor.h +++ b/eo/src/utils/eoFileMonitor.h @@ -33,6 +33,7 @@ #include "eoMonitor.h" #include "../eoObject.h" +#include "../eoExceptions.h" /** Prints statistics to file @@ -75,8 +76,8 @@ public : std::ofstream os (filename.c_str ()); if (!os) { - std::string str = "Error, eoFileMonitor could not open: " + filename; - throw std::runtime_error (str); + // std::string str = "Error, eoFileMonitor could not open: " + filename; + throw eoFileError(filename); } } // if ! keep } diff --git a/eo/src/utils/eoFileSnapshot.h b/eo/src/utils/eoFileSnapshot.h index c474a9293..3c7095894 100644 --- a/eo/src/utils/eoFileSnapshot.h +++ b/eo/src/utils/eoFileSnapshot.h @@ -67,7 +67,7 @@ public : int res = system(s.c_str()); // test for (unlikely) errors if ( (res==-1) || (res==127) ) - throw std::runtime_error("Problem executing test of dir in eoFileSnapshot"); + throw eoSystemError(s, res); // now make sure there is a dir without any genXXX file in it if (res) // no dir present { @@ -122,8 +122,8 @@ public : if (!os) { - std::string str = "eoFileSnapshot: Could not open " + currentFileName; - throw std::runtime_error(str); + // std::string str = "eoFileSnapshot: Could not open " + currentFileName; + throw eoFileError(currentFileName);; } return operator()(os); @@ -151,7 +151,7 @@ public : ptParam = static_cast >* >(vec[1]); vv[i] = ptParam->value(); if (vv[i].size() != v.size()) - throw std::runtime_error("Dimension error in eoSnapshotMonitor"); + throw eoException("Dimension error in eoSnapshotMonitor"); } for (unsigned k=0; k >*>(&_param)) { - throw std::logic_error(std::string("eoFileSnapshot: I can only monitor std::vectors of doubles, sorry. The offending parameter name = ") + _param.longName()); + throw eoException(std::string("eoFileSnapshot: I can only monitor std::vectors of doubles, sorry. The offending parameter name = ") + _param.longName()); } eoMonitor::add(_param); } diff --git a/eo/src/utils/eoGnuplot.cpp b/eo/src/utils/eoGnuplot.cpp index 2905e6161..2a7fe5229 100644 --- a/eo/src/utils/eoGnuplot.cpp +++ b/eo/src/utils/eoGnuplot.cpp @@ -29,6 +29,7 @@ #include #include "eoGnuplot.h" +#include "../eoExceptions.h" unsigned eoGnuplot::numWindow=0; @@ -82,7 +83,7 @@ void eoGnuplot::initGnuPlot(std::string _title, std::string _extra) args[5] = 0; gpCom = PipeComOpenArgv( GNUPLOT_PROGRAM, args ); if(! gpCom ) - throw std::runtime_error("Cannot spawn gnuplot\n"); + throw eoSystemError(GNUPLOT_PROGRAM); else { PipeComSend( gpCom, "set grid\n" ); PipeComSend( gpCom, _extra.c_str() ); diff --git a/eo/src/utils/eoGnuplot1DMonitor.cpp b/eo/src/utils/eoGnuplot1DMonitor.cpp index ab54b1132..d63d19994 100644 --- a/eo/src/utils/eoGnuplot1DMonitor.cpp +++ b/eo/src/utils/eoGnuplot1DMonitor.cpp @@ -61,7 +61,7 @@ void eoGnuplot1DMonitor::FirstPlot() { if (this->vec.size() < 2) { - throw std::runtime_error("Must have some stats to plot!\n"); + throw eoException("Must have some stats to plot!\n"); } #ifdef HAVE_GNUPLOT std::ostringstream os; diff --git a/eo/src/utils/eoHowMany.h b/eo/src/utils/eoHowMany.h index 56c730f17..780439851 100644 --- a/eo/src/utils/eoHowMany.h +++ b/eo/src/utils/eoHowMany.h @@ -119,7 +119,7 @@ public: { unsigned int combloc = -count; if (_size= _value.size()) // nothing left to read - throw std::runtime_error("Syntax error in eoGeneralIntBounds Ctor"); + throw eoException("Syntax error in eoGeneralIntBounds Ctor"); // ending char: next {}() after posDeb size_t posFin = _value.find_first_of(beginOrClose,posDeb+1); if (posFin >= _value.size()) // not found - throw std::runtime_error("Syntax error in eoGeneralIntBounds Ctor"); + throw eoException("Syntax error in eoGeneralIntBounds Ctor"); // the bounds std::string sBounds = _value.substr(posDeb+1, posFin-posDeb-1); @@ -51,7 +51,7 @@ eoIntBounds* eoGeneralIntBounds::getBoundsFromString(std::string _value) remove_leading(sBounds, delim); size_t posDelim = sBounds.find_first_of(delim); if (posDelim >= sBounds.size()) - throw std::runtime_error("Syntax error in eoGeneralIntBounds Ctor"); + throw eoException("Syntax error in eoGeneralIntBounds Ctor"); bool minBounded=false, maxBounded=false; long int minBound=0, maxBound=0; @@ -85,7 +85,7 @@ eoIntBounds* eoGeneralIntBounds::getBoundsFromString(std::string _value) if (minBounded && maxBounded) { if (maxBound <= minBound) - throw std::runtime_error("Syntax error in eoGeneralIntBounds Ctor"); + throw eoException("Syntax error in eoGeneralIntBounds Ctor"); locBound = new eoIntInterval(minBound, maxBound); } else if (!minBounded && !maxBounded) // no bound at all diff --git a/eo/src/utils/eoIntBounds.h b/eo/src/utils/eoIntBounds.h index 924d0e022..73b18548e 100644 --- a/eo/src/utils/eoIntBounds.h +++ b/eo/src/utils/eoIntBounds.h @@ -29,6 +29,7 @@ #include // std::exceptions! #include "eoRNG.h" +#include "../eoExceptions.h" /** \class eoIntBounds eoIntBounds.h es/eoIntBounds.h @@ -163,29 +164,29 @@ public: virtual long int minimum() const { - throw std::logic_error("Trying to get minimum of unbounded eoIntBounds"); + throw eoException("Trying to get minimum of unbounded eoIntBounds"); } virtual long int maximum() const { - throw std::logic_error("Trying to get maximum of unbounded eoIntBounds"); + throw eoException("Trying to get maximum of unbounded eoIntBounds"); } virtual long int range() const { - throw std::logic_error("Trying to get range of unbounded eoIntBounds"); + throw eoException("Trying to get range of unbounded eoIntBounds"); } virtual double uniform(eoRng & _rng = eo::rng) const { (void)_rng; - throw std::logic_error("Trying to generate uniform values in unbounded eoIntBounds"); + throw eoException("Trying to generate uniform values in unbounded eoIntBounds"); } virtual long int random(eoRng & _rng = eo::rng) const { (void)_rng; - throw std::logic_error("Trying to generate uniform values in unbounded eoIntBounds"); + throw eoException("Trying to generate uniform values in unbounded eoIntBounds"); } // methods from eoPersistent @@ -199,7 +200,7 @@ public: { (void)_is; - throw std::runtime_error("Should not use eoIntBounds::readFrom"); + throw eoException("Should not use eoIntBounds::readFrom"); } /** @@ -244,7 +245,7 @@ public : repMinimum(_min), repMaximum(_max), repRange(_max-_min) { if (repRange<=0) - throw std::logic_error("Void range in eoIntBounds"); + throw eoException("Void range in eoIntBounds"); } // accessors @@ -328,7 +329,7 @@ public : { (void)_is; - throw std::runtime_error("Should not use eoIntInterval::readFrom"); + throw eoException("Should not use eoIntInterval::readFrom"); } /** @@ -374,25 +375,25 @@ public : virtual long int maximum() const { - throw std::logic_error("Trying to get maximum of eoIntBelowBound"); + throw eoException("Trying to get maximum of eoIntBelowBound"); } virtual long int range() const { - throw std::logic_error("Trying to get range of eoIntBelowBound"); + throw eoException("Trying to get range of eoIntBelowBound"); } virtual double uniform(eoRng & _rng = eo::rng) const { (void)_rng; - throw std::logic_error("Trying to generate uniform values in eoIntBelowBound"); + throw eoException("Trying to generate uniform values in eoIntBelowBound"); } virtual long int random(eoRng & _rng = eo::rng) const { (void)_rng; - throw std::logic_error("Trying to generate uniform values in eoIntBelowBound"); + throw eoException("Trying to generate uniform values in eoIntBelowBound"); } // description @@ -437,7 +438,7 @@ public : { (void)_is; - throw std::runtime_error("Should not use eoIntBelowBound::readFrom"); + throw eoException("Should not use eoIntBelowBound::readFrom"); } /** @@ -482,25 +483,25 @@ public : virtual long int minimum() const { - throw std::logic_error("Trying to get minimum of eoIntAboveBound"); + throw eoException("Trying to get minimum of eoIntAboveBound"); } virtual long int range() const { - throw std::logic_error("Trying to get range of eoIntAboveBound"); + throw eoException("Trying to get range of eoIntAboveBound"); } virtual double uniform(eoRng & _rng = eo::rng) const { (void)_rng; - throw std::logic_error("Trying to generate uniform values in eoIntAboveBound"); + throw eoException("Trying to generate uniform values in eoIntAboveBound"); } virtual long int random(eoRng & _rng = eo::rng) const { (void)_rng; - throw std::logic_error("Trying to generate uniform values in eoIntAboveBound"); + throw eoException("Trying to generate uniform values in eoIntAboveBound"); } // description @@ -545,7 +546,7 @@ public : { (void)_is; - throw std::runtime_error("Should not use eoIntAboveBound::readFrom"); + throw eoException("Should not use eoIntAboveBound::readFrom"); } /** diff --git a/eo/src/utils/eoOStreamMonitor.cpp b/eo/src/utils/eoOStreamMonitor.cpp index af2bfcf63..b55cebf17 100644 --- a/eo/src/utils/eoOStreamMonitor.cpp +++ b/eo/src/utils/eoOStreamMonitor.cpp @@ -19,8 +19,8 @@ eoMonitor& eoOStreamMonitor::operator()(void) { if (!out) { - std::string str = "eoOStreamMonitor: Could not write to the output stream"; - throw std::runtime_error(str); + // std::string str = "eoOStreamMonitor: Could not write to the output stream"; + throw eoFileError("output stream"); } if (firsttime) { diff --git a/eo/src/utils/eoParam.h b/eo/src/utils/eoParam.h index d2c39efbd..969ea00a8 100644 --- a/eo/src/utils/eoParam.h +++ b/eo/src/utils/eoParam.h @@ -34,6 +34,7 @@ #include #include #include "../eoScalarFitness.h" +#include "../eoExceptions.h" /** @defgroup Parameters Parameters management * @@ -385,14 +386,14 @@ inline void eoValueParam >::setValue(const std: template <> inline std::string eoValueParam >::getValue(void) const { - throw std::runtime_error("I cannot getValue for a std::vector"); + throw eoException("I cannot getValue for a std::vector"); return std::string(""); } template <> inline void eoValueParam >::setValue(const std::string&) { - throw std::runtime_error("I cannot setValue for a std::vector"); + throw eoException("I cannot setValue for a std::vector"); return; } diff --git a/eo/src/utils/eoParser.cpp b/eo/src/utils/eoParser.cpp index 15a66105a..dc615bfa1 100644 --- a/eo/src/utils/eoParser.cpp +++ b/eo/src/utils/eoParser.cpp @@ -96,8 +96,8 @@ eoParser::eoParser ( unsigned _argc, char **_argv , string _programDescription, ifs.peek(); // check if it exists if (!ifs) { - string msg = string("Could not open response file: ") + pts; - throw runtime_error(msg); + // string msg = string("Could not open response file: ") + pts; + throw eoFileError(pts); } // read - will be overwritten by command-line readFrom(ifs); diff --git a/eo/src/utils/eoRealBounds.cpp b/eo/src/utils/eoRealBounds.cpp index 89dcb3584..bb3ac11a5 100644 --- a/eo/src/utils/eoRealBounds.cpp +++ b/eo/src/utils/eoRealBounds.cpp @@ -101,7 +101,7 @@ void eoRealVectorBounds::readFrom(std::string _value) size_t posFin = _value.find_first_of(std::string(closeChar)); if (posFin >= _value.size()) - throw std::runtime_error("Syntax error when reading bounds"); + throw eoException("Syntax error when reading bounds"); // y a-t-il un nbre devant unsigned count = 1; @@ -110,7 +110,7 @@ void eoRealVectorBounds::readFrom(std::string _value) std::string sCount = _value.substr(0, posDeb); count = read_int(sCount); if (count <= 0) - throw std::runtime_error("Syntax error when reading bounds"); + throw eoException("Syntax error when reading bounds"); } // the bounds @@ -121,7 +121,7 @@ void eoRealVectorBounds::readFrom(std::string _value) remove_leading(sBounds, delim); size_t posDelim = sBounds.find_first_of(delim); if (posDelim >= sBounds.size()) - throw std::runtime_error("Syntax error when reading bounds"); + throw eoException("Syntax error when reading bounds"); bool minBounded=false, maxBounded=false; double minBound=0, maxBound=0; @@ -192,17 +192,17 @@ eoRealBounds* eoGeneralRealBounds::getBoundsFromString(std::string _value) std::string delim(",; "); std::string beginOrClose("[(])"); if (!remove_leading(_value, delim)) // only delimiters were left - throw std::runtime_error("Syntax error in eoGeneralRealBounds Ctor"); + throw eoException("Syntax error in eoGeneralRealBounds Ctor"); // look for opening char size_t posDeb = _value.find_first_of(beginOrClose); // allow ]a,b] if (posDeb >= _value.size()) // nothing left to read - throw std::runtime_error("Syntax error in eoGeneralRealBounds Ctor"); + throw eoException("Syntax error in eoGeneralRealBounds Ctor"); // ending char: next {}() after posDeb size_t posFin = _value.find_first_of(beginOrClose,posDeb+1); if (posFin >= _value.size()) // not found - throw std::runtime_error("Syntax error in eoGeneralRealBounds Ctor"); + throw eoException("Syntax error in eoGeneralRealBounds Ctor"); // the bounds std::string sBounds = _value.substr(posDeb+1, posFin-posDeb-1); @@ -212,7 +212,7 @@ eoRealBounds* eoGeneralRealBounds::getBoundsFromString(std::string _value) remove_leading(sBounds, delim); size_t posDelim = sBounds.find_first_of(delim); if (posDelim >= sBounds.size()) - throw std::runtime_error("Syntax error in eoGeneralRealBounds Ctor"); + throw eoException("Syntax error in eoGeneralRealBounds Ctor"); bool minBounded=false, maxBounded=false; double minBound=0, maxBound=0; @@ -246,7 +246,7 @@ eoRealBounds* eoGeneralRealBounds::getBoundsFromString(std::string _value) if (minBounded && maxBounded) { if (maxBound <= minBound) - throw std::runtime_error("Syntax error in eoGeneralRealBounds Ctor"); + throw eoException("Syntax error in eoGeneralRealBounds Ctor"); locBound = new eoRealInterval(minBound, maxBound); } else if (!minBounded && !maxBounded) // no bound at all diff --git a/eo/src/utils/eoRealBounds.h b/eo/src/utils/eoRealBounds.h index 5d28c1741..c76031846 100644 --- a/eo/src/utils/eoRealBounds.h +++ b/eo/src/utils/eoRealBounds.h @@ -161,22 +161,22 @@ public: virtual double minimum() const { - throw std::logic_error("Trying to get minimum of unbounded eoRealBounds"); + throw eoException("Trying to get minimum of unbounded eoRealBounds"); } virtual double maximum() const { - throw std::logic_error("Trying to get maximum of unbounded eoRealBounds"); + throw eoException("Trying to get maximum of unbounded eoRealBounds"); } virtual double range() const { - throw std::logic_error("Trying to get range of unbounded eoRealBounds"); + throw eoException("Trying to get range of unbounded eoRealBounds"); } virtual double uniform(eoRng & _rng = eo::rng) const { (void)_rng; - throw std::logic_error("Trying to generate uniform values in unbounded eoRealBounds"); + throw eoException("Trying to generate uniform values in unbounded eoRealBounds"); } // methods from eoPersistent @@ -190,7 +190,7 @@ public: { (void)_is; - throw std::runtime_error("Should not use eoRealBounds::readFrom"); + throw eoException("Should not use eoRealBounds::readFrom"); } /** @@ -315,7 +315,7 @@ public : { (void)_is; - throw std::runtime_error("Should not use eoRealInterval::readFrom"); + throw eoException("Should not use eoRealInterval::readFrom"); } /** @@ -360,11 +360,11 @@ public : virtual double maximum() const { - throw std::logic_error("Trying to get maximum of eoRealBelowBound"); + throw eoException("Trying to get maximum of eoRealBelowBound"); } virtual double range() const { - throw std::logic_error("Trying to get range of eoRealBelowBound"); + throw eoException("Trying to get range of eoRealBelowBound"); } // random generators @@ -372,7 +372,7 @@ public : { (void)_rng; - throw std::logic_error("Trying to generate uniform values in eoRealBelowBound"); + throw eoException("Trying to generate uniform values in eoRealBelowBound"); } // description @@ -417,7 +417,7 @@ public : { (void)_is; - throw std::runtime_error("Should not use eoRealBelowBound::readFrom"); + throw eoException("Should not use eoRealBelowBound::readFrom"); } /** @@ -459,11 +459,11 @@ public : virtual double minimum() const { - throw std::logic_error("Trying to get minimum of eoRealAboveBound"); + throw eoException("Trying to get minimum of eoRealAboveBound"); } virtual double range() const { - throw std::logic_error("Trying to get range of eoRealAboveBound"); + throw eoException("Trying to get range of eoRealAboveBound"); } // random generators @@ -471,7 +471,7 @@ public : { (void)_rng; - throw std::logic_error("Trying to generate uniform values in eoRealAboveBound"); + throw eoException("Trying to generate uniform values in eoRealAboveBound"); } // description @@ -516,7 +516,7 @@ public : { (void)_is; - throw std::runtime_error("Should not use eoRealAboveBound::readFrom"); + throw eoException("Should not use eoRealAboveBound::readFrom"); } /** diff --git a/eo/src/utils/eoRealVectorBounds.h b/eo/src/utils/eoRealVectorBounds.h index 7fb880f53..d877853c2 100644 --- a/eo/src/utils/eoRealVectorBounds.h +++ b/eo/src/utils/eoRealVectorBounds.h @@ -250,7 +250,7 @@ public: eoRealBaseVectorBounds(), factor(1, _dim), ownedBounds(0) { if (_max-_min<=0) - throw std::logic_error("Void range in eoRealVectorBounds"); + throw eoException("Void range in eoRealVectorBounds"); eoRealBounds *ptBounds = new eoRealInterval(_min, _max); // handle memory once ownedBounds.push_back(ptBounds); @@ -265,7 +265,7 @@ public: factor(_min.size(), 1), ownedBounds(0) { if (_max.size() != _min.size()) - throw std::logic_error("Dimensions don't match in eoRealVectorBounds"); + throw eoException("Dimensions don't match in eoRealVectorBounds"); // the bounds eoRealBounds *ptBounds; for (unsigned i=0; i<_min.size(); i++) @@ -386,20 +386,20 @@ public: // accessors virtual double minimum(unsigned) { - throw std::logic_error("Trying to get minimum of eoRealVectorNoBounds"); + throw eoException("Trying to get minimum of eoRealVectorNoBounds"); } virtual double maximum(unsigned) { - throw std::logic_error("Trying to get maximum of eoRealVectorNoBounds"); + throw eoException("Trying to get maximum of eoRealVectorNoBounds"); } virtual double range(unsigned) { - throw std::logic_error("Trying to get range of eoRealVectorNoBounds"); + throw eoException("Trying to get range of eoRealVectorNoBounds"); } virtual double averageRange() { - throw std::logic_error("Trying to get average range of eoRealVectorNoBounds"); + throw eoException("Trying to get average range of eoRealVectorNoBounds"); } // random generators @@ -407,7 +407,7 @@ public: { (void)_rng; - throw std::logic_error("No uniform distribution on eoRealVectorNoBounds"); + throw eoException("No uniform distribution on eoRealVectorNoBounds"); } // fills a std::vector with uniformly chosen variables in bounds @@ -415,7 +415,7 @@ public: { (void)_rng; - throw std::logic_error("No uniform distribution on eoRealVectorNoBounds"); + throw eoException("No uniform distribution on eoRealVectorNoBounds"); } }; diff --git a/eo/src/utils/eoRndGenerators.h b/eo/src/utils/eoRndGenerators.h index 454845b17..d70143ff6 100644 --- a/eo/src/utils/eoRndGenerators.h +++ b/eo/src/utils/eoRndGenerators.h @@ -29,6 +29,7 @@ #ifndef eoRndGenerators_h #define eoRndGenerators_h +#include "../eoExceptions.h" #include "eoRNG.h" #include "../eoFunctor.h" #include @@ -80,7 +81,7 @@ template class eoUniformGenerator : public eoRndGenerator minim(_min), range(_max-_min), uniform(_rng) { if (_min>_max) - throw std::logic_error("Min is greater than Max in uniform_generator"); + throw eoException("Min is greater than Max in uniform_generator"); } /** diff --git a/eo/src/utils/eoStat.h b/eo/src/utils/eoStat.h index 5610ecbee..9803f66cd 100644 --- a/eo/src/utils/eoStat.h +++ b/eo/src/utils/eoStat.h @@ -251,7 +251,7 @@ public : virtual void operator()(const std::vector& _pop) { if (whichElement > _pop.size()) - throw std::logic_error("fitness requested of element outside of pop"); + throw eoException("fitness requested of element outside of pop"); doit(_pop, Fitness()); } diff --git a/eo/src/utils/eoState.cpp b/eo/src/utils/eoState.cpp index 884549244..0b70f533a 100644 --- a/eo/src/utils/eoState.cpp +++ b/eo/src/utils/eoState.cpp @@ -69,7 +69,7 @@ void eoState::registerObject(eoPersistent& registrant) } else { - throw logic_error("Interval error: object already present in the state"); + throw eoException("Interval error: object already present in the state"); } } @@ -79,8 +79,8 @@ void eoState::load(const string& _filename) if (!is) { - string str = "Could not open file " + _filename; - throw runtime_error(str); + // string str = "Could not open file " + _filename; + throw eoFileError(_filename); } load(is); @@ -96,8 +96,8 @@ void eoState::load(std::istream& is) if (is.fail()) { - string str = "Error while reading stream"; - throw runtime_error(str); + // string str = "Error while reading stream"; + throw eoFileError("stream"); } while(! is.eof()) @@ -127,7 +127,7 @@ void eoState::load(std::istream& is) while (getline(is, str)) { if (is.eof()) - throw runtime_error("No section in load file"); + throw eoException("No section in load file"); if (is_section(str, name)) break; @@ -154,8 +154,8 @@ void eoState::save(const string& filename) const if (!os) { - string msg = "Could not open file: " + filename + " for writing!"; - throw runtime_error(msg); + // string msg = "Could not open file: " + filename + " for writing!"; + throw eoFileError(filename); } save(os); diff --git a/eo/src/utils/eoUniformInit.h b/eo/src/utils/eoUniformInit.h index 8f4cd9d86..d338b2d78 100644 --- a/eo/src/utils/eoUniformInit.h +++ b/eo/src/utils/eoUniformInit.h @@ -82,7 +82,7 @@ template class eoUniformInit : public eoInit minim(_min), range(_max-_min), uniform(_rng) { if (_min>_max) - throw std::logic_error("Min is greater than Max in uniform_generator"); + throw eoParamException("Min is greater than Max in uniform_generator"); } /** diff --git a/eo/src/utils/make_help.cpp b/eo/src/utils/make_help.cpp index 6fb797eea..26644ea02 100644 --- a/eo/src/utils/make_help.cpp +++ b/eo/src/utils/make_help.cpp @@ -85,8 +85,8 @@ bool testDirRes(std::string _dirName, bool _erase=true) // test for (unlikely) errors if ( (res==-1) || (res==127) ) { - s = "Problem executing test of dir " + _dirName; - throw runtime_error(s); + // s = "Problem executing test of dir " + _dirName; + throw eoSystemError(s,res); } // now make sure there is a dir without any file in it - or quit if (res) // no dir present @@ -108,7 +108,7 @@ bool testDirRes(std::string _dirName, bool _erase=true) // WARNING: bug if dir exists and is empty; this says it is not! // shoudl use scandir instead - no time now :-((( MS Aug. 01 s = "Dir " + _dirName + " is not empty"; - throw runtime_error(s); + throw eoException(s); return true; } diff --git a/eo/src/utils/rnd_generators.h b/eo/src/utils/rnd_generators.h index d71caf803..60ff04b3f 100644 --- a/eo/src/utils/rnd_generators.h +++ b/eo/src/utils/rnd_generators.h @@ -31,6 +31,7 @@ #ifndef eoRND_GENERATORS_H #define eoRND_GENERATORS_H +#include "../eoExceptions.h" #include "eoRNG.h" #include @@ -56,7 +57,7 @@ template class uniform_generator minim(_min), range(_max-_min), uniform(_rng) { if (_min>_max) - throw std::logic_error("Min is greater than Max in uniform_generator"); + throw eoParamException("Min is greater than Max in uniform_generator"); } T operator()(void) { return minim+static_cast(uniform.uniform(range)); } @@ -99,7 +100,7 @@ template class random_generator minim(_min), range(_max-_min), random(_rng) { if (_min>_max) - throw std::logic_error("Min is greater than Max in random_generator"); + throw eoParamException("Min is greater than Max in random_generator"); } T operator()(void) { return (T) (minim + random.random(range)); } diff --git a/eo/src/utils/selectors.h b/eo/src/utils/selectors.h index 43992ac3c..8805fb132 100644 --- a/eo/src/utils/selectors.h +++ b/eo/src/utils/selectors.h @@ -89,7 +89,7 @@ double sum_fitness(It begin, It end) { double v = static_cast(begin->fitness()); if (v < 0.0) - throw std::logic_error("sum_fitness: negative fitness value encountered"); + throw eoInvalidFitnessError("sum_fitness: negative fitness value encountered"); sum += v; } diff --git a/eo/test/fitness_traits.cpp b/eo/test/fitness_traits.cpp index 4af0e34bb..2db7ea88f 100644 --- a/eo/test/fitness_traits.cpp +++ b/eo/test/fitness_traits.cpp @@ -133,7 +133,7 @@ public : performance_type performance(void) const { - if(!valid_performance) throw runtime_error("no performance"); + if(!valid_performance) throw eoException("no performance"); return Traits::get_performance(rep_fitness); } @@ -145,8 +145,8 @@ public : worth_type worth(void) const { - if(!valid_worth) throw runtime_error("no worth"); - if(!Traits::needs_mapping) throw runtime_error("no mapping"); + if(!valid_worth) throw eoException("no worth"); + if(!Traits::needs_mapping) throw eoException("no mapping"); return Traits::get_worth(rep_fitness); } @@ -236,14 +236,14 @@ public : { if (!fitness_traits::needs_mapping) { - throw runtime_error("eoPop: no scaling needed, yet a scaling function is defined"); + throw eoException("eoPop: no scaling needed, yet a scaling function is defined"); } (*p2w)(*this); } else if (fitness_traits::needs_mapping) { - throw runtime_error("eoPop: no scaling function attached to the population, while one was certainly called for"); + throw eoException("eoPop: no scaling function attached to the population, while one was certainly called for"); } } diff --git a/eo/test/mpi/t-mpi-distrib-exp.cpp b/eo/test/mpi/t-mpi-distrib-exp.cpp index 46a4efa57..d3278fcad 100644 --- a/eo/test/mpi/t-mpi-distrib-exp.cpp +++ b/eo/test/mpi/t-mpi-distrib-exp.cpp @@ -374,7 +374,7 @@ class Experiment : public eoserial::Persistent } else if( distribName == "exponential" ) { _distribution = & exponentialDistribution; } else { - throw std::runtime_error("When unpacking experience, no distribution found."); + throw eoException("When unpacking experience, no distribution found."); } eoserial::unpackObject( *obj, "distribution", *_distribution ); @@ -503,7 +503,7 @@ int main( int argc, char** argv ) { if( isChosenDistrib ) { - throw std::runtime_error("Only one distribution can be chosen during a launch!"); + throw eoException("Only one distribution can be chosen during a launch!"); } else { isChosenDistrib = true; @@ -517,7 +517,7 @@ int main( int argc, char** argv ) if( !isChosenDistrib ) { - throw std::runtime_error("No distribution chosen. One distribution should be chosen."); + throw eoException("No distribution chosen. One distribution should be chosen."); } Experiment e( pdistrib, size, packet_size, worker_print_waiting_time, seed, fileName ); diff --git a/eo/test/mpi/t-mpi-multipleRoles.cpp b/eo/test/mpi/t-mpi-multipleRoles.cpp index 3a525126b..e0ca7ed68 100644 --- a/eo/test/mpi/t-mpi-multipleRoles.cpp +++ b/eo/test/mpi/t-mpi-multipleRoles.cpp @@ -130,7 +130,7 @@ int main(int argc, char** argv) // eo::log << eo::setlevel( eo::debug ); Node::init( argc, argv ); if( Node::comm().size() != 7 ) { - throw std::runtime_error("World size should be 7."); + throw eoException("World size should be 7."); } SerializableVector< SerializableBase > v; diff --git a/eo/test/mpi/t-mpi-parallelApply.cpp b/eo/test/mpi/t-mpi-parallelApply.cpp index 559505bd1..efe8b2364 100644 --- a/eo/test/mpi/t-mpi-parallelApply.cpp +++ b/eo/test/mpi/t-mpi-parallelApply.cpp @@ -105,7 +105,7 @@ int main(int argc, char** argv) const int ALL = Node::comm().size(); if( ALL < 3 ) { - throw std::runtime_error("Needs at least 3 processes to be launched!"); + throw eoException("Needs at least 3 processes to be launched!"); } // Tests are auto described thanks to member "description" diff --git a/eo/test/t-eoESFull.cpp b/eo/test/t-eoESFull.cpp index 7c5e84d99..d2f84adfb 100644 --- a/eo/test/t-eoESFull.cpp +++ b/eo/test/t-eoESFull.cpp @@ -120,7 +120,7 @@ void runAlgorithm(EOT, eoParser& _parser, eoState& _state, eoRealVectorBounds& _ if (lambda_rate.value() < 1.0f) { - throw logic_error("lambda_rate must be larger than 1 in a comma strategy"); + throw eoParamException("lambda_rate must be larger than 1 in a comma strategy"); } // Initialization diff --git a/eo/test/t-eoGenOp.cpp b/eo/test/t-eoGenOp.cpp index c959a3bb9..7a6f6b7bc 100644 --- a/eo/test/t-eoGenOp.cpp +++ b/eo/test/t-eoGenOp.cpp @@ -174,7 +174,7 @@ void init(eoPop & _pop, unsigned _pSize) } else { - throw std::runtime_error("init pop with 0 size"); + throw eoPopSizeException(_pSize,"init pop with 0 size"); } for (unsigned i=0; i<_pSize; i++) { diff --git a/eo/test/t-eoInitPermutation.cpp b/eo/test/t-eoInitPermutation.cpp index e4a683b15..4b64f3576 100644 --- a/eo/test/t-eoInitPermutation.cpp +++ b/eo/test/t-eoInitPermutation.cpp @@ -32,7 +32,7 @@ bool check_permutation(const Chrom & _chrom) std::cout << " Error: Wrong permutation !" << std::endl; std::string s; s.append( " Wrong permutation in t-eoInitPermutation"); - throw std::runtime_error( s ); + throw eoException( s ); } return true; } diff --git a/eo/test/t-eoOrderXover.cpp b/eo/test/t-eoOrderXover.cpp index 32e44dad9..71453c59b 100644 --- a/eo/test/t-eoOrderXover.cpp +++ b/eo/test/t-eoOrderXover.cpp @@ -23,7 +23,7 @@ bool check_permutation(const Chrom& _chrom){ std::cout << " Error: Wrong permutation !" << std::endl; std::string s; s.append( " Wrong permutation in t-eoShiftMutation"); - throw std::runtime_error( s ); + throw eoException( s ); return false; } } diff --git a/eo/test/t-eoSelect.cpp b/eo/test/t-eoSelect.cpp index 23d76c48c..400f6725d 100644 --- a/eo/test/t-eoSelect.cpp +++ b/eo/test/t-eoSelect.cpp @@ -64,7 +64,7 @@ void testSelectMany(eoSelect & _select, std::string _name) { unsigned trouve = isInPop(offspring[i], parents); if (trouve == parents.size()) // pas trouve - throw std::runtime_error("Pas trouve ds parents"); + throw eoException("Pas trouve ds parents"); nb[trouve]++; } // dump to file so you can plot using gnuplot - dir name is hardcoded! @@ -149,7 +149,7 @@ eoValueParam tournamentSizeParam = parser.createParam(unsigned(2), "to parentsOrg[pSize-1].fitness(10*pSize); } else - throw std::runtime_error("Invalid fitness Type"+fitnessType); + throw eoInvalidFitnessError("Invalid fitness Type"+fitnessType); std::cout << "Initial parents (odd)\n" << parentsOrg << std::endl; diff --git a/eo/test/t-eoSharing.cpp b/eo/test/t-eoSharing.cpp index 86721b098..fee072b75 100644 --- a/eo/test/t-eoSharing.cpp +++ b/eo/test/t-eoSharing.cpp @@ -86,7 +86,7 @@ void testSelectMany(eoSelect & _select, std::string _name) { unsigned trouve = isInPop(offspring[i], parents); if (trouve == parents.size()) // pas trouve - throw std::runtime_error("Pas trouve ds parents"); + throw eoException("Pas trouve ds parents"); nb[trouve]++; } // dump to file so you can plot using gnuplot - dir name is hardcoded! diff --git a/eo/test/t-eoShiftMutation.cpp b/eo/test/t-eoShiftMutation.cpp index 15c4e6b92..2106233d1 100644 --- a/eo/test/t-eoShiftMutation.cpp +++ b/eo/test/t-eoShiftMutation.cpp @@ -32,7 +32,7 @@ bool check_permutation(const Chrom& _chrom){ std::cout << " Error: Wrong permutation !" << std::endl; std::string s; s.append( " Wrong permutation in t-eoShiftMutation"); - throw std::runtime_error( s ); + throw eoException( s ); return false; } } diff --git a/eo/test/t-eoSwapMutation.cpp b/eo/test/t-eoSwapMutation.cpp index 3099d7075..38601fd2d 100644 --- a/eo/test/t-eoSwapMutation.cpp +++ b/eo/test/t-eoSwapMutation.cpp @@ -33,7 +33,7 @@ bool check_permutation(const Chrom& _chrom){ std::cout << " Error: Wrong permutation !" << std::endl; std::string s; s.append( " Wrong permutation in t-eoShiftMutation"); - throw std::runtime_error( s ); + throw eoException( s ); return false; } } diff --git a/eo/test/t-eoTwoOptMutation.cpp b/eo/test/t-eoTwoOptMutation.cpp index 60ef89a15..7d53b77d4 100644 --- a/eo/test/t-eoTwoOptMutation.cpp +++ b/eo/test/t-eoTwoOptMutation.cpp @@ -33,7 +33,7 @@ bool check_permutation(const Chrom& _chrom){ std::cout << " Error: Wrong permutation !" << std::endl; std::string s; s.append( " Wrong permutation in t-eoShiftMutation"); - throw std::runtime_error( s ); + throw eoException( s ); return false; } } diff --git a/eo/tutorial/Lesson5/make_op_OneMax.h b/eo/tutorial/Lesson5/make_op_OneMax.h index e157720fa..d8c5ed853 100644 --- a/eo/tutorial/Lesson5/make_op_OneMax.h +++ b/eo/tutorial/Lesson5/make_op_OneMax.h @@ -182,12 +182,12 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit& pCrossParam = _parser.createParam(0.6, "pCross", "Probability of Crossover", 'C', "Variation Operators" ); // minimum check if ( (pCrossParam.value() < 0) || (pCrossParam.value() > 1) ) - throw runtime_error("Invalid pCross"); + throw eoParamException("Invalid pCross"); eoValueParam& pMutParam = _parser.createParam(0.1, "pMut", "Probability of Mutation", 'M', "Variation Operators" ); // minimum check if ( (pMutParam.value() < 0) || (pMutParam.value() > 1) ) - throw runtime_error("Invalid pMut"); + throw eoParamException("Invalid pMut"); // the crossover - with probability pCross diff --git a/eo/tutorial/Templates/EO.tpl b/eo/tutorial/Templates/EO.tpl index 959ad56a8..b5cd2a162 100644 --- a/eo/tutorial/Templates/EO.tpl +++ b/eo/tutorial/Templates/EO.tpl @@ -215,12 +215,12 @@ try { double pCross = parser.createParam(0.6, "pCross", "Probability of Crossover", 'C', "Variation Operators" ).value(); // minimum check if ( (pCross < 0) || (pCross > 1) ) - throw runtime_error("Invalid pCross"); + throw eoParamException("Invalid pCross"); double pMut = parser.createParam(0.1, "pMut", "Probability of Mutation", 'M', "Variation Operators" ).value(); // minimum check if ( (pMut < 0) || (pMut > 1) ) - throw runtime_error("Invalid pMut"); + throw eoParamException("Invalid pMut"); // now create the generalOp eoSGAGenOp op(cross, pCross, mut, pMut); @@ -827,7 +827,7 @@ eoContinue & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu // now check that there is at least one! if (!continuator) - throw runtime_error("You MUST provide a stopping criterion"); + throw eoException("You MUST provide a stopping criterion"); // OK, it's there: store in the eoState _state.storeFunctor(continuator); diff --git a/eo/tutorial/Templates/MyStructSEA.cpp b/eo/tutorial/Templates/MyStructSEA.cpp index 5a05169ea..30dd296f0 100644 --- a/eo/tutorial/Templates/MyStructSEA.cpp +++ b/eo/tutorial/Templates/MyStructSEA.cpp @@ -206,12 +206,12 @@ try double pCross = parser.createParam(0.6, "pCross", "Probability of Crossover", 'C', "Variation Operators" ).value(); // minimum check if ( (pCross < 0) || (pCross > 1) ) - throw runtime_error("Invalid pCross"); + throw eoParamException("Invalid pCross"); double pMut = parser.createParam(0.1, "pMut", "Probability of Mutation", 'M', "Variation Operators" ).value(); // minimum check if ( (pMut < 0) || (pMut > 1) ) - throw runtime_error("Invalid pMut"); + throw eoParamException("Invalid pMut"); // now create the generalOp eoSGAGenOp op(cross, pCross, mut, pMut); @@ -278,7 +278,7 @@ try // first check the directory (and creates it if not exists already): if (fileMyStructStat || plotMyStructStat) if (! testDirRes(dirName, true) ) - throw runtime_error("Problem with resDir"); + throw eoParamException("Problem with resDir"); // should we write it to a file ? if (fileMyStructStat) diff --git a/eo/tutorial/Templates/make_op_MyStruct.h b/eo/tutorial/Templates/make_op_MyStruct.h index d857e8958..e37dfd6fd 100644 --- a/eo/tutorial/Templates/make_op_MyStruct.h +++ b/eo/tutorial/Templates/make_op_MyStruct.h @@ -182,12 +182,12 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit& pCrossParam = _parser.createParam(0.6, "pCross", "Probability of Crossover", 'C', "Variation Operators" ); // minimum check if ( (pCrossParam.value() < 0) || (pCrossParam.value() > 1) ) - throw runtime_error("Invalid pCross"); + throw eoParamException("Invalid pCross"); eoValueParam& pMutParam = _parser.createParam(0.1, "pMut", "Probability of Mutation", 'M', "Variation Operators" ); // minimum check if ( (pMutParam.value() < 0) || (pMutParam.value() > 1) ) - throw runtime_error("Invalid pMut"); + throw eoParamException("Invalid pMut"); // the crossover - with probability pCross diff --git a/mo/src/continuator/moVectorMonitor.h b/mo/src/continuator/moVectorMonitor.h index 853096448..67535219d 100644 --- a/mo/src/continuator/moVectorMonitor.h +++ b/mo/src/continuator/moVectorMonitor.h @@ -263,8 +263,8 @@ public: if (!os) { - std::string str = "moVectorMonitor: Could not open " + _filename; - throw std::runtime_error(str); + // std::string str = "moVectorMonitor: Could not open " + _filename; + throw eoFileError(_filename);; } for (unsigned int i = 0; i < size(); i++) { diff --git a/mo/src/problems/bitString/moBitNeighbor.h b/mo/src/problems/bitString/moBitNeighbor.h index 28cda0093..87f124c44 100644 --- a/mo/src/problems/bitString/moBitNeighbor.h +++ b/mo/src/problems/bitString/moBitNeighbor.h @@ -89,7 +89,7 @@ public: int pos = _is.tellg(); _is >> fitness_str; if (fitness_str == "INVALID") { - throw std::runtime_error("invalid fitness"); + throw eoInvalidFitnessError("invalid fitness"); } else { Fitness repFit; _is.seekg(pos); diff --git a/mo/src/sampling/moSampling.h b/mo/src/sampling/moSampling.h index c2db1fa73..90dee4707 100644 --- a/mo/src/sampling/moSampling.h +++ b/mo/src/sampling/moSampling.h @@ -156,8 +156,8 @@ public: os.open(_filename.c_str(), std::ios::app); if (!os) { - std::string str = "moSampling: Could not open " + _filename; - throw std::runtime_error(str); + // std::string str = "moSampling: Could not open " + _filename; + throw eoFileError(_filename); } // set the precision of the output @@ -199,7 +199,7 @@ public: void fileExport(unsigned int _col, std::string _filename, bool _openFile=false) { if (_col >= monitorVec.size()) { std::string str = "moSampling: Could not export into file the vector. The index does not exists (too large)"; - throw std::runtime_error(str); + throw eoException(str); } monitorVec[_col]->precision(precisionOutput); diff --git a/moeo/src/CMakeLists.txt b/moeo/src/CMakeLists.txt index c06351346..e98d91e4e 100644 --- a/moeo/src/CMakeLists.txt +++ b/moeo/src/CMakeLists.txt @@ -1,7 +1,7 @@ ###################################################################################### ### 0) Include directories ###################################################################################### -include_directories(${EO_SRC_DIR}) +include_directories(${EO_SRC_DIR}/src) include_directories(${MO_SRC_DIR}/src) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/moeo/src/algo/moeoEasyEA.h b/moeo/src/algo/moeoEasyEA.h index 8155bfaaa..5169b3c0a 100644 --- a/moeo/src/algo/moeoEasyEA.h +++ b/moeo/src/algo/moeoEasyEA.h @@ -132,8 +132,8 @@ public: bool firstTime = true; do { - try - { + // try + // { unsigned int pSize = _pop.size(); offspring.clear(); // new offspring // fitness and diversity assignment (if you want to or if it is the first generation) @@ -150,19 +150,19 @@ public: replace(_pop, offspring); // after replace, the new pop. is in _pop if (pSize > _pop.size()) { - throw std::runtime_error("Population shrinking!"); + throw eoPopSizeChangeException(_pop.size(), pSize,"Population shrinking!"); } else if (pSize < _pop.size()) { - throw std::runtime_error("Population growing!"); + throw eoPopSizeChangeException(_pop.size(), pSize,"Population growing!"); } - } - catch (std::exception& e) - { - std::string s = e.what(); - s.append( " in moeoEasyEA"); - throw std::runtime_error( s ); - } + // } + // catch (std::exception& e) + // { + // std::string s = e.what(); + // s.append( " in moeoEasyEA"); + // throw std::runtime_error( s ); + // } } while (continuator(_pop)); } diff --git a/moeo/src/comparator/moeoOneObjectiveComparator.h b/moeo/src/comparator/moeoOneObjectiveComparator.h index 32b7ca093..f3543853f 100644 --- a/moeo/src/comparator/moeoOneObjectiveComparator.h +++ b/moeo/src/comparator/moeoOneObjectiveComparator.h @@ -56,7 +56,7 @@ class moeoOneObjectiveComparator : public moeoComparator < MOEOT > { if (obj > MOEOT::ObjectiveVector::nObjectives()) { - throw std::runtime_error("Problem with the index of objective in moeoOneObjectiveComparator"); + throw eoException("Problem with the index of objective in moeoOneObjectiveComparator"); } } diff --git a/moeo/src/core/MOEO.h b/moeo/src/core/MOEO.h index 1a9e1b118..061af300f 100644 --- a/moeo/src/core/MOEO.h +++ b/moeo/src/core/MOEO.h @@ -133,7 +133,7 @@ class MOEO : public EO < MOEOObjectiveVector > { if ( invalidObjectiveVector() ) { - throw std::runtime_error("invalid objective vector in MOEO"); + throw eoInvalidFitnessError("invalid objective vector in MOEO"); } return objectiveVectorValue; } @@ -197,7 +197,7 @@ class MOEO : public EO < MOEOObjectiveVector > { if ( invalidFitness() ) { - throw std::runtime_error("invalid fitness in MOEO"); + throw eoInvalidFitnessError("invalid fitness in MOEO"); } // const_cast< Fitness& >( fitnessValue ).embededDataEx = objectiveVectorValue; @@ -241,7 +241,7 @@ class MOEO : public EO < MOEOObjectiveVector > { if ( invalidDiversity() ) { - throw std::runtime_error("invalid diversity in MOEO"); + throw eoInvalidFitnessError("invalid diversity in MOEO"); } return diversityValue; } diff --git a/moeo/src/core/moeoObjectiveVectorTraits.h b/moeo/src/core/moeoObjectiveVectorTraits.h index bf169371c..517e7bd04 100644 --- a/moeo/src/core/moeoObjectiveVectorTraits.h +++ b/moeo/src/core/moeoObjectiveVectorTraits.h @@ -42,6 +42,8 @@ #include #include +#include + /** * A traits class for moeoObjectiveVector to specify the number of objectives and which ones have to be minimized or maximized. */ @@ -70,7 +72,7 @@ class moeoObjectiveVectorTraits bObj = _bObjectives; // in case the number of objectives and the min/max vector size don't match if (nObj != bObj.size()) - throw std::runtime_error("Number of objectives and min/max size don't match in moeoObjectiveVectorTraits::setup"); + throw eoException("Number of objectives and min/max size don't match in moeoObjectiveVectorTraits::setup"); } @@ -81,7 +83,7 @@ class moeoObjectiveVectorTraits { // in case the number of objectives would not be assigned yet if (! nObj) - throw std::runtime_error("Number of objectives not assigned in moeoObjectiveVectorTraits"); + throw eoException("Number of objectives not assigned in moeoObjectiveVectorTraits"); return nObj; } @@ -94,7 +96,7 @@ class moeoObjectiveVectorTraits { // in case there would be a wrong index if (_i >= bObj.size()) - throw std::runtime_error("Wrong index in moeoObjectiveVectorTraits"); + throw eoException("Wrong index in moeoObjectiveVectorTraits"); return bObj[_i]; } diff --git a/moeo/src/core/moeoVector.h b/moeo/src/core/moeoVector.h index ea4bfc4e0..cf89186df 100644 --- a/moeo/src/core/moeoVector.h +++ b/moeo/src/core/moeoVector.h @@ -89,7 +89,7 @@ class moeoVector : public MOEO < MOEOObjectiveVector, MOEOFitness, MOEODiversity } else { - throw std::runtime_error("Size not initialized in moeoVector"); + throw eoException("Size not initialized in moeoVector"); } } std::copy(_v.begin(), _v.end(), begin()); diff --git a/moeo/src/do/make_continue_moeo.h b/moeo/src/do/make_continue_moeo.h index 84695d7ee..0267ca77a 100644 --- a/moeo/src/do/make_continue_moeo.h +++ b/moeo/src/do/make_continue_moeo.h @@ -121,7 +121,7 @@ eoContinue & do_make_continue_moeo(eoParser& _parser, eoState& _state, eo #endif // now check that there is at least one! if (!continuator) - throw std::runtime_error("You MUST provide a stopping criterion"); + throw eoException("You MUST provide a stopping criterion"); // OK, it's there: store in the eoState _state.storeFunctor(continuator); // and return diff --git a/moeo/src/do/make_ea_moeo.h b/moeo/src/do/make_ea_moeo.h index aa5a38ad9..aee4dcd0d 100644 --- a/moeo/src/do/make_ea_moeo.h +++ b/moeo/src/do/make_ea_moeo.h @@ -127,14 +127,14 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF else { std::string stmp = std::string("Invalid binary quality indicator: ") + indicatorParam; - throw std::runtime_error(stmp.c_str()); + throw eoException(stmp.c_str()); } fitnessAssignment = new moeoExpBinaryIndicatorBasedFitnessAssignment < MOEOT > (*metric, kappa); } else { std::string stmp = std::string("Invalid fitness assignment strategy: ") + fitnessParam; - throw std::runtime_error(stmp.c_str()); + throw eoException(stmp.c_str()); } _state.storeFunctor(fitnessAssignment); @@ -170,7 +170,7 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF else { std::string stmp = std::string("Invalid diversity assignment strategy: ") + diversityParamValue.first; - throw std::runtime_error(stmp.c_str()); + throw eoException(stmp.c_str()); } _state.storeFunctor(diversityAssignment); @@ -194,7 +194,7 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF else { std::string stmp = std::string("Invalid comparator strategy: ") + comparatorParam; - throw std::runtime_error(stmp.c_str()); + throw eoException(stmp.c_str()); } _state.storeFunctor(comparator); @@ -250,7 +250,7 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF else { std::string stmp = std::string("Invalid selection strategy: ") + ppSelect.first; - throw std::runtime_error(stmp.c_str()); + throw eoException(stmp.c_str()); } _state.storeFunctor(select); @@ -274,7 +274,7 @@ moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoEvalF else { std::string stmp = std::string("Invalid replacement strategy: ") + replacementParam; - throw std::runtime_error(stmp.c_str()); + throw eoException(stmp.c_str()); } _state.storeFunctor(replace); diff --git a/moeo/src/fitness/moeoDominanceDepthFitnessAssignment.h b/moeo/src/fitness/moeoDominanceDepthFitnessAssignment.h index c781b9a92..96f295be4 100644 --- a/moeo/src/fitness/moeoDominanceDepthFitnessAssignment.h +++ b/moeo/src/fitness/moeoDominanceDepthFitnessAssignment.h @@ -103,7 +103,7 @@ public: else { // problem with the number of objectives - throw std::runtime_error("Problem with the number of objectives in moeoDominanceDepthFitnessAssignment"); + throw eoInvalidFitnessError("Problem with the number of objectives in moeoDominanceDepthFitnessAssignment"); } // a higher fitness is better, so the values need to be inverted double max = _pop[0].fitness(); diff --git a/moeo/src/scalarStuffs/explorer/moeoHCMoveLoopExpl.h b/moeo/src/scalarStuffs/explorer/moeoHCMoveLoopExpl.h index 79f1b8003..83dd5f737 100644 --- a/moeo/src/scalarStuffs/explorer/moeoHCMoveLoopExpl.h +++ b/moeo/src/scalarStuffs/explorer/moeoHCMoveLoopExpl.h @@ -89,7 +89,7 @@ class moeoHCMoveLoopExpl:public moMoveLoopExpl < M > if( _old_solution.invalid() ) { - throw std::runtime_error("[moHCMoveLoopExpl.h]: The current solution has not been evaluated."); + throw eoInvalidFitnessError("[moHCMoveLoopExpl.h]: The current solution has not been evaluated."); } /* diff --git a/moeo/src/scalarStuffs/explorer/moeoTSMoveLoopExpl.h b/moeo/src/scalarStuffs/explorer/moeoTSMoveLoopExpl.h index 0f51d2a96..3485184fe 100644 --- a/moeo/src/scalarStuffs/explorer/moeoTSMoveLoopExpl.h +++ b/moeo/src/scalarStuffs/explorer/moeoTSMoveLoopExpl.h @@ -94,7 +94,7 @@ class moeoTSMoveLoopExpl:public moMoveLoopExpl < M > if( _old_solution.invalidFitness() || _old_solution.invalid() ) { - throw std::runtime_error("[moTSMoveLoopExpl.h]: The current solution has not been evaluated."); + throw eoInvalidFitnessError("[moTSMoveLoopExpl.h]: The current solution has not been evaluated."); } //At the begining, the new solution is equivalent to the old one. diff --git a/moeo/src/utils/moeoBestObjVecStat.h b/moeo/src/utils/moeoBestObjVecStat.h index 1d8d7294d..604ca90dd 100644 --- a/moeo/src/utils/moeoBestObjVecStat.h +++ b/moeo/src/utils/moeoBestObjVecStat.h @@ -65,7 +65,7 @@ public: */ const MOEOT & bestindividuals(unsigned int which) { typedef typename moeoObjVecStat::Traits traits; - if(which > traits::nObjectives() ) throw std::logic_error("which is larger than the number of objectives"); + if(which > traits::nObjectives() ) throw eoException("which is larger than the number of objectives"); return *(best_individuals[which]); } diff --git a/moeo/tutorial/examples/flowshop/FlowShopBenchmarkParser.cpp b/moeo/tutorial/examples/flowshop/FlowShopBenchmarkParser.cpp index f2de425a0..68059fc43 100644 --- a/moeo/tutorial/examples/flowshop/FlowShopBenchmarkParser.cpp +++ b/moeo/tutorial/examples/flowshop/FlowShopBenchmarkParser.cpp @@ -36,6 +36,7 @@ //----------------------------------------------------------------------------- #include #include +#include #include "FlowShopBenchmarkParser.h" FlowShopBenchmarkParser::FlowShopBenchmarkParser(const std::string _benchmarkFileName) @@ -96,7 +97,7 @@ void FlowShopBenchmarkParser::init(const std::string _benchmarkFileName) std::ifstream inputFile(_benchmarkFileName.data(), std::ios::in); // opening of the benchmark file if (! inputFile) - throw std::runtime_error("*** ERROR : Unable to open the benchmark file"); + throw eoFileError(_benchmarkFileName); // number of jobs (N) getline(inputFile, buffer, '\n'); N = atoi(buffer.data()); diff --git a/moeo/tutorial/examples/flowshop/make_op_FlowShop.h b/moeo/tutorial/examples/flowshop/make_op_FlowShop.h index 4316f7f65..428fe1d3a 100644 --- a/moeo/tutorial/examples/flowshop/make_op_FlowShop.h +++ b/moeo/tutorial/examples/flowshop/make_op_FlowShop.h @@ -104,12 +104,12 @@ eoGenOp & do_make_op(eoParameterLoader& _parser, eoState& _state) eoValueParam& pCrossParam = _parser.createParam(0.25, "pCross", "Probability of Crossover", 'c', "Variation Operators" ); // minimum check if ( (pCrossParam.value() < 0) || (pCrossParam.value() > 1) ) - throw std::runtime_error("Invalid pCross"); + throw eoParamException("Invalid pCross"); eoValueParam& pMutParam = _parser.createParam(0.35, "pMut", "Probability of Mutation", 'm', "Variation Operators" ); // minimum check if ( (pMutParam.value() < 0) || (pMutParam.value() > 1) ) - throw std::runtime_error("Invalid pMut"); + throw eoParamException("Invalid pMut"); // the crossover - with probability pCross eoProportionalOp * propOp = new eoProportionalOp ; diff --git a/problems/eval/maxSATeval.h b/problems/eval/maxSATeval.h index 87a3c4ca6..985b7d74a 100644 --- a/problems/eval/maxSATeval.h +++ b/problems/eval/maxSATeval.h @@ -111,8 +111,8 @@ public: std::fstream file(_fileName.c_str(), std::ios::in); if (!file) { - std::string str = "MaxSATeval: Could not open file [" + _fileName + "]." ; - throw std::runtime_error(str); + // std::string str = "MaxSATeval: Could not open file [" + _fileName + "]." ; + throw eoFileError(_fileName); } std::string s; @@ -128,12 +128,12 @@ public: // parameters if (s[0] != 'p') { std::string str = "MaxSATeval: could not read the parameters of the instance from file [" + _fileName + "]." ; - throw std::runtime_error(str); + throw eoException(_fileName); } file >> s; if (s != "cnf") { std::string str = "MaxSATeval: " + _fileName + " is not a file in cnf format."; - throw std::runtime_error(str); + throw eoException(_fileName); } file >> nbVar >> nbClauses; @@ -187,7 +187,7 @@ public: if (!file) { std::string str = "MaxSATeval: Could not open " + _fileName; - throw std::runtime_error(str); + throw eoFileError(_fileName); } // write some commentaries diff --git a/problems/eval/nkLandscapesEval.h b/problems/eval/nkLandscapesEval.h index f2e243021..cfdaab60a 100644 --- a/problems/eval/nkLandscapesEval.h +++ b/problems/eval/nkLandscapesEval.h @@ -154,13 +154,13 @@ public: // Read the parameters if (s[0] != 'p') { std::string str = "nkLandscapesEval.load: -- p -- expected in [" + _fileName + "] at the begining." ; - throw std::runtime_error(str); + throw eoException(str); } file >> s; if (s != "NK") { std::string str = "nkLandscapesEval.load: -- NK -- expected in [" + _fileName + "] at the begining." ; - throw std::runtime_error(str); + throw eoException(str); } // read parameters N and K @@ -170,7 +170,7 @@ public: // read the links if (s[0] != 'p') { std::string str = "nkLandscapesEval.load: -- p -- expected in [" + _fileName + "] after the parameters N and K." ; - throw std::runtime_error(str); + throw eoException(str); } file >> s; @@ -178,13 +178,13 @@ public: loadLinks(file); } else { std::string str = "nkLandscapesEval.load: -- links -- expected in [" + _fileName + "] after the parameters N and K." ; - throw std::runtime_error(str); + throw eoException(str); } // lecture des tables if (s[0] != 'p') { std::string str = "nkLandscapesEval.load: -- p -- expected in [" + _fileName + "] after the links." ; - throw std::runtime_error(str); + throw eoException(str); } file >> s; @@ -193,13 +193,13 @@ public: loadTables(file); } else { std::string str = "nkLandscapesEval.load: -- tables -- expected in [" + _fileName + "] after the links." ; - throw std::runtime_error(str); + throw eoException(str); } file.close(); } else { - std::string str = "nkLandscapesEval.load: Could not open file [" + _fileName + "]." ; - throw std::runtime_error(str); + // std::string str = "nkLandscapesEval.load: Could not open file [" + _fileName + "]." ; + throw eoFileError(_fileName); } }; diff --git a/problems/eval/nkpLandscapesEval.h b/problems/eval/nkpLandscapesEval.h index 5f2a5e932..343d25d68 100644 --- a/problems/eval/nkpLandscapesEval.h +++ b/problems/eval/nkpLandscapesEval.h @@ -115,13 +115,13 @@ public: // Read the parameters if (s[0] != 'p') { string str = "nkLandscapesEval.load: -- p -- expected in [" + _fileName + "] at the begining." ; - throw runtime_error(str); + throw eoException(str); } file >> s; if (s != "NKp") { string str = "nkpLandscapesEval.load: -- NKp -- expected in [" + _fileName + "] at the begining." ; - throw runtime_error(str); + throw eoException(str); } // read parameters N, K and p @@ -131,7 +131,7 @@ public: // read the links if (s[0] != 'p') { string str = "nkpLandscapesEval.load: -- p -- expected in [" + _fileName + "] after the parameters N, K, and p." ; - throw runtime_error(str); + throw eoException(str); } file >> s; @@ -139,13 +139,13 @@ public: loadLinks(file); } else { string str = "nkpLandscapesEval.load: -- links -- expected in [" + _fileName + "] after the parameters N, K, and q." ; - throw runtime_error(str); + throw eoException(str); } // lecture des tables if (s[0] != 'p') { string str = "nkpLandscapesEval.load: -- p -- expected in [" + _fileName + "] after the links." ; - throw runtime_error(str); + throw eoException(str); } file >> s; @@ -154,13 +154,13 @@ public: loadTables(file); } else { string str = "nkpLandscapesEval.load: -- tables -- expected in [" + _fileName + "] after the links." ; - throw runtime_error(str); + throw eoException(str); } file.close(); } else { - string str = "nkpLandscapesEval.load: Could not open file [" + _fileName + "]." ; - throw runtime_error(str); + // string str = "nkpLandscapesEval.load: Could not open file [" + _fileName + "]." ; + throw eoFileError(_fileName); } }; diff --git a/problems/eval/nkqLandscapesEval.h b/problems/eval/nkqLandscapesEval.h index d40bf3955..368bae969 100644 --- a/problems/eval/nkqLandscapesEval.h +++ b/problems/eval/nkqLandscapesEval.h @@ -114,13 +114,13 @@ public: // Read the parameters if (s[0] != 'p') { string str = "nkLandscapesEval.load: -- p -- expected in [" + _fileName + "] at the begining." ; - throw runtime_error(str); + throw eoException(str); } file >> s; if (s != "NKq") { string str = "nkqLandscapesEval.load: -- NKq -- expected in [" + _fileName + "] at the begining." ; - throw runtime_error(str); + throw eoException(str); } // read parameters N, K and q @@ -130,7 +130,7 @@ public: // read the links if (s[0] != 'p') { string str = "nkqLandscapesEval.load: -- p -- expected in [" + _fileName + "] after the parameters N, K, and q." ; - throw runtime_error(str); + throw eoException(str); } file >> s; @@ -138,13 +138,13 @@ public: loadLinks(file); } else { string str = "nkqLandscapesEval.load: -- links -- expected in [" + _fileName + "] after the parameters N, K, and q." ; - throw runtime_error(str); + throw eoException(str); } // lecture des tables if (s[0] != 'p') { string str = "nkqLandscapesEval.load: -- p -- expected in [" + _fileName + "] after the links." ; - throw runtime_error(str); + throw eoException(str); } file >> s; @@ -153,13 +153,13 @@ public: loadTables(file); } else { string str = "nkqLandscapesEval.load: -- tables -- expected in [" + _fileName + "] after the links." ; - throw runtime_error(str); + throw eoException(str); } file.close(); } else { - string str = "nkqLandscapesEval.load: Could not open file [" + _fileName + "]." ; - throw runtime_error(str); + // string str = "nkqLandscapesEval.load: Could not open file [" + _fileName + "]." ; + throw eoFileError(_fileName); } }; @@ -192,7 +192,7 @@ public: } else { string fname(_fileName); string str = "nkqLandscapesEval.save: Could not open file [" + fname + "]." ; - throw runtime_error(str); + throw eoFileError(fname); } }; diff --git a/problems/eval/qapEval.h b/problems/eval/qapEval.h index 40d763c9f..df0d79303 100644 --- a/problems/eval/qapEval.h +++ b/problems/eval/qapEval.h @@ -52,8 +52,8 @@ public: std::fstream file(_fileData.c_str(), std::ios::in); if (!file) { - std::string str = "QAPeval: Could not open file [" + _fileData + "]." ; - throw std::runtime_error(str); + // std::string str = "QAPeval: Could not open file [" + _fileData + "]." ; + throw eoFileError(_fileData); } unsigned i, j; diff --git a/problems/eval/ubqpEval.h b/problems/eval/ubqpEval.h index 6061954b9..094030d59 100644 --- a/problems/eval/ubqpEval.h +++ b/problems/eval/ubqpEval.h @@ -65,8 +65,8 @@ public: std::fstream file(_fileName.c_str(), std::ios::in); if (!file) { - std::string str = "UbqpEval: Could not open file [" + _fileName + "]." ; - throw std::runtime_error(str); + // std::string str = "UbqpEval: Could not open file [" + _fileName + "]." ; + throw eoFileError(_fileName); } unsigned int nbInstances; @@ -119,7 +119,7 @@ public: Q[i - 1][j - 1] = v; else { std::string str = "UbqpEval: some indices are 0 in the instance file (in format 0), please check." ; - throw std::runtime_error(str); + throw eoException(str); } } } else { diff --git a/smp/src/MWAlgo/eoEasyEA.cpp b/smp/src/MWAlgo/eoEasyEA.cpp index bf98c534d..6a2eb485c 100644 --- a/smp/src/MWAlgo/eoEasyEA.cpp +++ b/smp/src/MWAlgo/eoEasyEA.cpp @@ -1,3 +1,5 @@ +#include "eoExceptions.h" + template