deleted cl compiler flags and updated cmake config - also deleted lessons 6,7,8
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@947 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
0692b053e5
commit
fd8a7ef0af
37 changed files with 45 additions and 2868 deletions
|
|
@ -1,28 +1,4 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Preliminary checking: no WIN and libxml2
|
||||
######################################################################################
|
||||
|
||||
#IF(WIN32)
|
||||
# MESSAGE (FATAL_ERROR "ParadisEO-PEO can not be generated on Windows systems")
|
||||
#ENDIF(WIN32)
|
||||
|
||||
# check libxml2
|
||||
FIND_PROGRAM(XML2_CONFIG_PROGRAM NAMES xml2-config PATHS /usr/local/bin /usr/bin DOC "The libxml2 (www.xmlsoft.org) configuration tool")
|
||||
|
||||
IF(NOT XML2_CONFIG_PROGRAM)
|
||||
#MESSAGE(FATAL_ERROR "Libxml2 cannot be found on your system. Libxml2 is required for ParadisEO-PEO install")
|
||||
ENDIF(NOT XML2_CONFIG_PROGRAM)
|
||||
|
||||
# set libxml2 cflags in XML2_CFLAGS
|
||||
EXECUTE_PROCESS(COMMAND ${XML2_CONFIG_PROGRAM} --cflags OUTPUT_VARIABLE XML2_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
SET(XML2_CFLAGS_WITH_WHITESPACE " ${XML2_CFLAGS}")
|
||||
|
||||
# set libxml2 libs in XML2_LIBS
|
||||
EXECUTE_PROCESS(COMMAND ${XML2_CONFIG_PROGRAM} --libs OUTPUT_VARIABLE XML2_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) If you want to set your variables in peo-conf.cmake and avoid the cmd line
|
||||
######################################################################################
|
||||
|
|
@ -40,43 +16,17 @@ INCLUDE(peo-conf.cmake OPTIONAL)
|
|||
PROJECT(ParadisEO-PEO)
|
||||
|
||||
SET(PACKAGE_BUGREPORT "paradiseo-help@lists.gforge.inria.fr" CACHE STRING "Package bug report" FORCE)
|
||||
SET(PACKAGE_NAME "ParadisEO-PEO Moving Objects" CACHE STRING "Package name" FORCE)
|
||||
SET(PACKAGE_NAME "ParadisEO-PEO - Parallel and Distributed Evolving Objects" CACHE STRING "Package name" FORCE)
|
||||
SET(PACKAGE_STRING "ParadisEO-PEO 1.0" CACHE STRING "Package string full name" FORCE)
|
||||
SET(PACKAGE_VERSION "1.0" CACHE STRING "Package version" FORCE)
|
||||
SET(GLOBAL_VERSION "1.0" CACHE STRING "Global version" FORCE)
|
||||
SET(VERSION "1.0" CACHE STRING "Version" FORCE)
|
||||
|
||||
# check cmake version compatibility
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4 FATAL_ERROR)
|
||||
|
||||
# regular expression checking
|
||||
INCLUDE_REGULAR_EXPRESSION("^.*$" "^$")
|
||||
|
||||
# set a language for the entire project.
|
||||
ENABLE_LANGUAGE(CXX)
|
||||
ENABLE_LANGUAGE(C)
|
||||
|
||||
#####################################################################################
|
||||
|
||||
|
||||
#####################################################################################
|
||||
### 3) Include required modules
|
||||
#####################################################################################
|
||||
INCLUDE(CMakeBackwardCompatibilityCXX)
|
||||
|
||||
INCLUDE(FindDoxygen)
|
||||
|
||||
INCLUDE(FindGnuplot)
|
||||
|
||||
# check for some functions
|
||||
INCLUDE(CheckLibraryExists)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Include the main configuration variables
|
||||
######################################################################################
|
||||
|
||||
# The "config" variable must be provided on the command line
|
||||
IF(NOT DEFINED config OR NOT config)
|
||||
|
|
@ -94,71 +44,47 @@ INCLUDE(${config})
|
|||
### 4) Paths checking
|
||||
######################################################################################
|
||||
|
||||
#IF(WIN32)
|
||||
# SET (ABSOLUTE_PATH_REGEX "^[A-Z]:|^[a-z]:")
|
||||
#ELSE(WIN32)
|
||||
# SET (ABSOLUTE_PATH_REGEX "^/")
|
||||
#ENDIF(WIN32)
|
||||
|
||||
#SET(REQUIRED_PATHS "EO_SRC_DIR" "EO_BIN_DIR" "MO_SRC_DIR" "MO_BIN_DIR" "MOEO_SRC_DIR" "MOEO_BIN_DIR")
|
||||
#FOREACH (path ${REQUIRED_PATHS})
|
||||
# IF(EXISTS ${${path}})
|
||||
# MESSAGE (STATUS "Using ${path}=${${path}}")
|
||||
# ELSE(EXISTS ${${path}})
|
||||
# MESSAGE (FATAL_ERROR "\n Cannot find \"${${path}}\". Please, fill \"${config}\" with a correct value for ${path} variable")
|
||||
# ENDIF(EXISTS ${${path}})
|
||||
#
|
||||
# IF(NOT ${${path}} MATCHES "${ABSOLUTE_PATH_REGEX}")
|
||||
# MESSAGE (FATAL_ERROR "${${path}} MUST BE an absolute path")
|
||||
# ENDIF(NOT ${${path}} MATCHES "${ABSOLUTE_PATH_REGEX}")
|
||||
#ENDFOREACH (path ${REQUIRED_PATHS})
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 0) Preliminary checking: no WIN and libxml2
|
||||
######################################################################################
|
||||
|
||||
IF(WIN32)
|
||||
SET (ABSOLUTE_PATH_REGEX "^[A-Z]:|^[a-z]:")
|
||||
ELSE(WIN32)
|
||||
SET (ABSOLUTE_PATH_REGEX "^/")
|
||||
MESSAGE (FATAL_ERROR "ParadisEO-PEO can not be generated on Windows systems")
|
||||
ENDIF(WIN32)
|
||||
|
||||
SET(REQUIRED_PATHS "EO_SRC_DIR" "EO_BIN_DIR" "MO_SRC_DIR" "MO_BIN_DIR" "MOEO_SRC_DIR" "MOEO_BIN_DIR")
|
||||
FOREACH (path ${REQUIRED_PATHS})
|
||||
IF(EXISTS ${${path}})
|
||||
MESSAGE (STATUS "Using ${path}=${${path}}")
|
||||
ELSE(EXISTS ${${path}})
|
||||
MESSAGE (FATAL_ERROR "\n Cannot find \"${${path}}\". Please, fill \"${config}\" with a correct value for ${path} variable")
|
||||
ENDIF(EXISTS ${${path}})
|
||||
|
||||
IF(NOT ${${path}} MATCHES "${ABSOLUTE_PATH_REGEX}")
|
||||
MESSAGE (FATAL_ERROR "${${path}} MUST BE an absolute path")
|
||||
ENDIF(NOT ${${path}} MATCHES "${ABSOLUTE_PATH_REGEX}")
|
||||
ENDFOREACH (path ${REQUIRED_PATHS})
|
||||
# check libxml2
|
||||
FIND_PROGRAM(XML2_CONFIG_PROGRAM NAMES xml2-config PATHS /usr/local/bin /usr/bin DOC "The libxml2 (www.xmlsoft.org) configuration tool")
|
||||
|
||||
IF(NOT XML2_CONFIG_PROGRAM)
|
||||
#MESSAGE(FATAL_ERROR "Libxml2 cannot be found on your system. Libxml2 is required for ParadisEO-PEO install")
|
||||
ENDIF(NOT XML2_CONFIG_PROGRAM)
|
||||
|
||||
# set libxml2 cflags in XML2_CFLAGS
|
||||
EXECUTE_PROCESS(COMMAND ${XML2_CONFIG_PROGRAM} --cflags OUTPUT_VARIABLE XML2_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# set libxml2 libs in XML2_LIBS
|
||||
EXECUTE_PROCESS(COMMAND ${XML2_CONFIG_PROGRAM} --libs OUTPUT_VARIABLE XML2_LIBS)
|
||||
######################################################################################
|
||||
|
||||
|
||||
#####################################################################################
|
||||
### 5) Manage the build type
|
||||
#####################################################################################
|
||||
|
||||
# the user should choose the build type on windows environments,excepted under cygwin (default=none)
|
||||
SET(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "Variable that stores the default CMake build type" FORCE)
|
||||
|
||||
IF(WIN32 AND NOT CYGWIN)
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET( CMAKE_BUILD_TYPE
|
||||
${CMAKE_DEFAULT_BUILD_TYPE} CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||
FORCE)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
ELSE(WIN32 AND NOT CYGWIN)
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -Wno-import -Winit-self -Wmissing-include-dirs -Wunused-parameter -Wundef -Wshadow -Wunsafe-loop-optimizations -Wcast-align -Wconversion -Wsign-compare -Winline -Wdisabled-optimization")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ENDIF(WIN32 AND NOT CYGWIN)
|
||||
|
||||
IF(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
ADD_DEFINITIONS(-DCMAKE_VERBOSE_MAKEFILE=ON)
|
||||
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
|
||||
#####################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 6) Where must cmake go now ?
|
||||
######################################################################################
|
||||
|
||||
SUBDIRS(doc src test tutorial)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 7) Test config
|
||||
######################################################################################
|
||||
|
||||
SET(ENABLE_CMAKE_TESTING TRUE CACHE BOOL "Should we test using Dart")
|
||||
|
||||
IF (ENABLE_CMAKE_TESTING)
|
||||
ENABLE_TESTING()
|
||||
ENDIF (ENABLE_CMAKE_TESTING)
|
||||
|
||||
######################################################################################
|
||||
|
|
|
|||
9
trunk/paradiseo-peo/DartConfig.cmake
Normal file
9
trunk/paradiseo-peo/DartConfig.cmake
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
#############################################################################
|
||||
# Dart config for report submission
|
||||
#############################################################################
|
||||
|
||||
SET (DROP_METHOD "xmlrpc")
|
||||
SET (DROP_SITE "http://dart.irisa.fr")
|
||||
SET (DROP_LOCATION "ParadisEO")
|
||||
#############################################################################
|
||||
|
|
@ -75,7 +75,7 @@ FILE_VERSION_FILTER =
|
|||
QUIET = YES
|
||||
WARNINGS = NO
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
|
|
|
|||
|
|
@ -43,35 +43,3 @@ SET(CORE_VERSION ${GLOBAL_VERSION})
|
|||
SET_TARGET_PROPERTIES(peo PROPERTIES VERSION "${CORE_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Windows advanced config - especially for Microsoft Visual Studio 8
|
||||
######################################################################################
|
||||
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Where must cmake go now ?
|
||||
######################################################################################
|
||||
|
||||
# nothing to be compiled in the subdirs
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ SET(CMAKE_CXX_FLAGS_RELEASE "-O0 -g")
|
|||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "-O0 -g")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O0 -g")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${XML2_CFLAGS}")
|
||||
######################################################################################
|
||||
### 0) Set the compiler
|
||||
######################################################################################
|
||||
|
|
@ -19,7 +20,7 @@ SET (CMAKE_CXX_COMPILER mpicxx)
|
|||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${XML2_CFLAGS_WITH_WHITESPACE})
|
||||
#INCLUDE_DIRECTORIES(${XML2_CFLAGS_WITH_WHITESPACE})
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -71,32 +72,3 @@ SET_TARGET_PROPERTIES(rmc_mpi PROPERTIES VERSION "${RMC_MPI_VERSION}")
|
|||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Windows advanced config - especially for Microsoft Visual Studio 8
|
||||
######################################################################################
|
||||
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 6) Where must cmake go now ?
|
||||
######################################################################################
|
||||
|
||||
# nothing to be compiled in the subdirs
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@ SET(FLOWSHOP_BIN_DIR "${MOEO_BIN_DIR}/tutorial/examples/flowshop" CACHE PATH "Fl
|
|||
### 2) Where must cmake go now ?
|
||||
######################################################################################
|
||||
|
||||
SUBDIRS(examples Lesson1 Lesson2 Lesson3 Lesson4 Lesson5 Lesson6 Lesson7 Lesson8)
|
||||
SUBDIRS(examples Lesson1 Lesson2 Lesson3 Lesson4 Lesson5)
|
||||
|
||||
######################################################################################
|
||||
|
|
|
|||
|
|
@ -78,26 +78,3 @@ TARGET_LINK_LIBRARIES(pso ${XML2_LIBS} peo rmc_mpi eo eoutils)
|
|||
TARGET_LINK_LIBRARIES(ea ${XML2_LIBS} peo rmc_mpi eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 6) Windows advanced config - especially for Microsoft Visual Studio 8
|
||||
######################################################################################
|
||||
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
######################################################################################
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -74,26 +74,3 @@ SET_TARGET_PROPERTIES(ea PROPERTIES VERSION "${LESSON2_VERSION}")
|
|||
TARGET_LINK_LIBRARIES(ea ${XML2_LIBS} peo rmc_mpi eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 6) Windows advanced config - especially for Microsoft Visual Studio 8
|
||||
######################################################################################
|
||||
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
######################################################################################
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -79,25 +79,3 @@ TARGET_LINK_LIBRARIES(ea ${XML2_LIBS} peo rmc_mpi eo eoutils)
|
|||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 6) Windows advanced config - especially for Microsoft Visual Studio 8
|
||||
######################################################################################
|
||||
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
######################################################################################
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -81,26 +81,3 @@ TARGET_LINK_LIBRARIES(lsea ${XML2_LIBS} tsp peo rmc_mpi eo eoutils)
|
|||
TARGET_LINK_LIBRARIES(eals ${XML2_LIBS} tsp peo rmc_mpi eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 6) Windows advanced config - especially for Microsoft Visual Studio 8
|
||||
######################################################################################
|
||||
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
######################################################################################
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -79,24 +79,3 @@ SET_TARGET_PROPERTIES(pso PROPERTIES VERSION "${WALKTHROUGH_VERSION}")
|
|||
TARGET_LINK_LIBRARIES(pso ${XML2_LIBS} peo rmc_mpi eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 6) Windows advanced config - especially for Microsoft Visual Studio 8
|
||||
######################################################################################
|
||||
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
######################################################################################
|
||||
|
||||
|
|
|
|||
|
|
@ -1,82 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Set the compiler and define targets to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
SET (CMAKE_CXX_COMPILER mpicxx)
|
||||
SET(MAKE_SRC_DIR "${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/make" CACHE PATH "Make source directory" FORCE)
|
||||
|
||||
ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/FlowShopEA.param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET install
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/FlowShopEA.param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET install
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET install
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson6/schema.xml
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson6)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src ${MOEO_SRC_DIR}/src ${FLOWSHOP_SRC_DIR} ${MO_SRC_DIR}/src ${ParadisEO-PEO_SOURCE_DIR}/src ${TSP_SRC_DIR} ${MAKE_SRC_DIR})
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries (mandatory: before 3) )
|
||||
######################################################################################
|
||||
|
||||
IF(NOT WIN32 OR CYGWIN)
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${MOEO_BIN_DIR}/lib ${FLOWSHOP_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib ${TSP_BINARY_DIR}/lib)
|
||||
ENDIF(NOT WIN32 OR CYGWIN)
|
||||
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(example main.cpp)
|
||||
ADD_DEPENDENCIES(example flowshop moeo peo rmc_mpi)
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Optionnal: define your target(s)'s version: no effect for windows
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
######################################################################################
|
||||
### 5) Link the librairies
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(example ${XML2_LIBS} flowshop moeo peo rmc_mpi eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
###### General ######
|
||||
--help=0 # -h : Prints this message
|
||||
--stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
# --seed=1183379758 # -S : Random number seed
|
||||
|
||||
###### Evolution Engine ######
|
||||
--popSize=20 # -P : Population Size
|
||||
--updateArch=1 # Update the archive at each gen.
|
||||
--fitness=FastNonDominatedSorting # -F : Fitness assignment scheme: Dummy, FastNonDominatedSorting or IndicatorBased
|
||||
--indicator=Epsilon # -i : Binary indicator for IndicatorBased: Epsilon, Hypervolume
|
||||
--rho=1.1 # -r : reference point for the hypervolume indicator
|
||||
--kappa=0.05 # -k : Scaling factor kappa for IndicatorBased
|
||||
--diversity=Crowding # -D : Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding
|
||||
--comparator=FitnessThenDiversity # -C : Comparator scheme: FitnessThenDiversity, DiversityThenFitness or Aggregative
|
||||
--selection=DetTour(2) # -S : Selection scheme: DetTour(T), StochTour(t) or Random
|
||||
--replacement=Elitist # -R : Replacement scheme: Elitist, Environmental or Generational
|
||||
--nbOffspring=100% # -O : Number of offspring (percentage or absolute)
|
||||
|
||||
###### Output ######
|
||||
#--resDir=Res # Directory to store DISK outputs
|
||||
--eraseDir=1 # erase files in dirName if any
|
||||
--printPop=0 # Print sorted pop. every gen.
|
||||
--storeArch=0 # Store the archive's objective vectors at each gen.
|
||||
--contribution=0 # Store the contribution of the archive at each gen.
|
||||
--entropy=0 # Store the entropy of the archive at each gen.
|
||||
|
||||
###### Persistence ######
|
||||
--Load= # -L : A save file to restart from
|
||||
--recomputeFitness=0 # -r : Recompute the fitness after re-loading the pop.?
|
||||
--saveFrequency=0 # Save every F generation (0 = only final state, absent = never)
|
||||
--saveTimeInterval=0 # Save every T seconds (0 or absent = never)
|
||||
--status=./FlowShopEA.status # Status file
|
||||
|
||||
###### Representation ######
|
||||
--BenchmarkFile=../../../../paradiseo-moeo/tutorial/examples/flowshop/benchs/020_10_01.txt # -B : Benchmark file name REQUIRED
|
||||
|
||||
###### Stopping criterion ######
|
||||
--maxGen=100 # -G : Maximum number of generations (0 = none)
|
||||
--maxEval=0 # -E : Maximum number of evaluations (0 = none)
|
||||
--maxTime=0 # -T : Maximum running time in seconds (0 = none)
|
||||
#--CtrlC=1 # -C : Terminate current generation upon Ctrl C (only available on Unix platforms)
|
||||
|
||||
###### Variation Operators ######
|
||||
--crossRate=1 # Relative rate for the only crossover
|
||||
--shiftMutRate=0.5 # Relative rate for shift mutation
|
||||
--exchangeMutRate=0.5 # Relative rate for exchange mutation
|
||||
--pCross=0.25 # -c : Probability of Crossover
|
||||
--pMut=0.35 # -m : Probability of Mutation
|
||||
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* <main.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, INRIA, 2007
|
||||
*
|
||||
* Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#include <peo>
|
||||
#include <moeo>
|
||||
#include <make_library.h>
|
||||
#include <FlowShop.h>
|
||||
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
peo :: init( argc,argv );
|
||||
eoParser parser(argc, argv);
|
||||
eoState state;
|
||||
peoMoeoPopEval<FlowShop>& eval = do_make_para_eval(parser, state);
|
||||
eoInit<FlowShop>& init = do_make_genotype(parser, state);
|
||||
eoGenOp<FlowShop>& op = do_make_op(parser, state);
|
||||
eoPop<FlowShop>& pop = do_make_pop(parser, state, init);
|
||||
moeoArchive<FlowShop> arch;
|
||||
eoContinue<FlowShop>& term = do_make_continue_moeo(parser, state, eval);
|
||||
eoCheckPoint<FlowShop>& checkpoint = do_make_checkpoint_moeo(parser, state, eval, term, pop, arch);
|
||||
eoAlgo<FlowShop>& algo = do_make_ea_moeo(parser, state, eval, checkpoint, op, arch);
|
||||
peoWrapper parallelMOEO( algo, pop);
|
||||
eval.setOwner(parallelMOEO);
|
||||
peo :: run();
|
||||
peo :: finalize();
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
std::cout << "Final population :\n" << pop << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,201 +0,0 @@
|
|||
/*
|
||||
* <make_checkpoint_moeo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MAKE_CHECKPOINT_MOEO_H_
|
||||
#define MAKE_CHECKPOINT_MOEO_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFuncCounter.h>
|
||||
#include <utils/checkpointing>
|
||||
#include <utils/selectors.h>
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
#include <metric/moeoContributionMetric.h>
|
||||
#include <metric/moeoEntropyMetric.h>
|
||||
#include <utils/moeoArchiveUpdater.h>
|
||||
#include <utils/moeoArchiveObjectiveVectorSavingUpdater.h>
|
||||
#include <utils/moeoBinaryMetricSavingUpdater.h>
|
||||
|
||||
bool testDirRes(std::string _dirName, bool _erase);
|
||||
|
||||
/**
|
||||
* This functions allows to build an eoCheckPoint for multi-objective optimization from the parser (partly taken from make_checkpoint_pareto.h)
|
||||
* @param _parser the parser
|
||||
* @param _state to store allocated objects
|
||||
* @param _eval the funtions evaluator
|
||||
* @param _continue the stopping crietria
|
||||
* @param _pop the population
|
||||
* @param _archive the archive of non-dominated solutions
|
||||
*/
|
||||
template < class MOEOT >
|
||||
eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState & _state, eoPopEvalFunc < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _archive)
|
||||
{
|
||||
eoCheckPoint < MOEOT > & checkpoint = _state.storeFunctor(new eoCheckPoint < MOEOT > (_continue));
|
||||
/* the objective vector type */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
///////////////////
|
||||
// Counters
|
||||
//////////////////
|
||||
// is nb Eval to be used as counter?
|
||||
//bool useEval = _parser.getORcreateParam(true, "useEval", "Use nb of eval. as counter (vs nb of gen.)", '\0', "Output").value();
|
||||
// Create anyway a generation-counter parameter
|
||||
eoValueParam<unsigned int> *generationCounter = new eoValueParam<unsigned int>(0, "Gen.");
|
||||
// Create an incrementor (sub-class of eoUpdater).
|
||||
eoIncrementor<unsigned int> & increment = _state.storeFunctor( new eoIncrementor<unsigned int>(generationCounter->value()) );
|
||||
// Add it to the checkpoint
|
||||
checkpoint.add(increment);
|
||||
// dir for DISK output
|
||||
std::string & dirName = _parser.getORcreateParam(std::string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output").value();
|
||||
// shoudl we empty it if exists
|
||||
eoValueParam<bool>& eraseParam = _parser.getORcreateParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output");
|
||||
bool dirOK = false; // not tested yet
|
||||
|
||||
// Dump of the whole population
|
||||
//-----------------------------
|
||||
bool printPop = _parser.getORcreateParam(false, "printPop", "Print sorted pop. every gen.", '\0', "Output").value();
|
||||
eoSortedPopStat<MOEOT> * popStat;
|
||||
if ( printPop ) // we do want pop dump
|
||||
{
|
||||
popStat = & _state.storeFunctor(new eoSortedPopStat<MOEOT>);
|
||||
checkpoint.add(*popStat);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
// State savers
|
||||
//////////////////////////////
|
||||
// feed the state to state savers
|
||||
// save state every N generation
|
||||
eoValueParam<unsigned int>& saveFrequencyParam = _parser.createParam((unsigned int)(0), "saveFrequency", "Save every F generation (0 = only final state, absent = never)", '\0', "Persistence" );
|
||||
if (_parser.isItThere(saveFrequencyParam))
|
||||
{
|
||||
// first make sure dirName is OK
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
unsigned int freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\generations";
|
||||
#else
|
||||
std::string stmp = dirName + "/generations";
|
||||
#endif
|
||||
eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp);
|
||||
_state.storeFunctor(stateSaver1);
|
||||
checkpoint.add(*stateSaver1);
|
||||
}
|
||||
// save state every T seconds
|
||||
eoValueParam<unsigned int>& saveTimeIntervalParam = _parser.getORcreateParam((unsigned int)(0), "saveTimeInterval", "Save every T seconds (0 or absent = never)", '\0',"Persistence" );
|
||||
if (_parser.isItThere(saveTimeIntervalParam) && saveTimeIntervalParam.value()>0)
|
||||
{
|
||||
// first make sure dirName is OK
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\time";
|
||||
#else
|
||||
std::string stmp = dirName + "/time";
|
||||
#endif
|
||||
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
|
||||
_state.storeFunctor(stateSaver2);
|
||||
checkpoint.add(*stateSaver2);
|
||||
}
|
||||
|
||||
///////////////////
|
||||
// Archive
|
||||
//////////////////
|
||||
// update the archive every generation
|
||||
bool updateArch = _parser.getORcreateParam(true, "updateArch", "Update the archive at each gen.", '\0', "Evolution Engine").value();
|
||||
if (updateArch)
|
||||
{
|
||||
moeoArchiveUpdater < MOEOT > * updater = new moeoArchiveUpdater < MOEOT > (_archive, _pop);
|
||||
_state.storeFunctor(updater);
|
||||
checkpoint.add(*updater);
|
||||
}
|
||||
// store the objective vectors contained in the archive every generation
|
||||
bool storeArch = _parser.getORcreateParam(false, "storeArch", "Store the archive's objective vectors at each gen.", '\0', "Output").value();
|
||||
if (storeArch)
|
||||
{
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\arch";
|
||||
#else
|
||||
std::string stmp = dirName + "/arch";
|
||||
#endif
|
||||
moeoArchiveObjectiveVectorSavingUpdater < MOEOT > * save_updater = new moeoArchiveObjectiveVectorSavingUpdater < MOEOT > (_archive, stmp);
|
||||
_state.storeFunctor(save_updater);
|
||||
checkpoint.add(*save_updater);
|
||||
}
|
||||
// store the contribution of the non-dominated solutions
|
||||
bool cont = _parser.getORcreateParam(false, "contribution", "Store the contribution of the archive at each gen.", '\0', "Output").value();
|
||||
if (cont)
|
||||
{
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\contribution";
|
||||
#else
|
||||
std::string stmp = dirName + "/contribution";
|
||||
#endif
|
||||
moeoContributionMetric < ObjectiveVector > * contribution = new moeoContributionMetric < ObjectiveVector >;
|
||||
moeoBinaryMetricSavingUpdater < MOEOT > * contribution_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*contribution, _archive, stmp);
|
||||
_state.storeFunctor(contribution_updater);
|
||||
checkpoint.add(*contribution_updater);
|
||||
}
|
||||
// store the entropy of the non-dominated solutions
|
||||
bool ent = _parser.getORcreateParam(false, "entropy", "Store the entropy of the archive at each gen.", '\0', "Output").value();
|
||||
if (ent)
|
||||
{
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\entropy";
|
||||
#else
|
||||
std::string stmp = dirName + "/entropy";
|
||||
#endif
|
||||
moeoEntropyMetric < ObjectiveVector > * entropy = new moeoEntropyMetric < ObjectiveVector >;
|
||||
moeoBinaryMetricSavingUpdater < MOEOT > * entropy_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*entropy, _archive, stmp);
|
||||
_state.storeFunctor(entropy_updater);
|
||||
checkpoint.add(*entropy_updater);
|
||||
}
|
||||
|
||||
// and that's it for the (control and) output
|
||||
return checkpoint;
|
||||
}
|
||||
|
||||
#endif /*MAKE_CHECKPOINT_MOEO_H_*/
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* <make_continue_moeo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MAKE_CONTINUE_MOEO_H_
|
||||
#define MAKE_CONTINUE_MOEO_H_
|
||||
#include <eoCombinedContinue.h>
|
||||
#include <eoGenContinue.h>
|
||||
#include <eoEvalContinue.h>
|
||||
#include <eoFitContinue.h>
|
||||
#include <eoTimeContinue.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <eoCtrlCContinue.h>
|
||||
#endif
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
|
||||
|
||||
/**
|
||||
* Helper function
|
||||
* @param _combined the eoCombinedContinue object
|
||||
* @param _cont the eoContinue to add
|
||||
*/
|
||||
template <class MOEOT>
|
||||
eoCombinedContinue<MOEOT> * make_combinedContinue(eoCombinedContinue<MOEOT> *_combined, eoContinue<MOEOT> *_cont)
|
||||
{
|
||||
if (_combined) // already exists
|
||||
_combined->add(*_cont);
|
||||
else
|
||||
_combined = new eoCombinedContinue<MOEOT>(*_cont);
|
||||
return _combined;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This functions allows to build a eoContinue for multi-objective optimization from the parser (partly taken from make_continue_pareto.h)
|
||||
* @param _parser the parser
|
||||
* @param _state to store allocated objects
|
||||
* @param _eval the funtions evaluator
|
||||
*/
|
||||
template <class MOEOT>
|
||||
eoContinue<MOEOT> & do_make_continue_moeo(eoParser& _parser, eoState& _state, eoPopEvalFunc<MOEOT> & _eval)
|
||||
{
|
||||
// the combined continue - to be filled
|
||||
eoCombinedContinue<MOEOT> *continuator = NULL;
|
||||
// First the eoGenContinue - need a default value so you can run blind
|
||||
// but we also need to be able to avoid it <--> 0
|
||||
eoValueParam<unsigned int>& maxGenParam = _parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations (0 = none)",'G',"Stopping criterion");
|
||||
if (maxGenParam.value()) // positive: -> define and store
|
||||
{
|
||||
eoGenContinue<MOEOT> *genCont = new eoGenContinue<MOEOT>(maxGenParam.value());
|
||||
_state.storeFunctor(genCont);
|
||||
// and "add" to combined
|
||||
continuator = make_combinedContinue<MOEOT>(continuator, genCont);
|
||||
}
|
||||
// maxEval
|
||||
eoValueParam<unsigned long>& maxEvalParam = _parser.getORcreateParam((unsigned long)(0), "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion");
|
||||
/* if (maxEvalParam.value())
|
||||
{
|
||||
eoEvalContinue<MOEOT> *evalCont = new eoEvalContinue<MOEOT>(_eval, maxEvalParam.value());
|
||||
_state.storeFunctor(evalCont);
|
||||
// and "add" to combined
|
||||
continuator = make_combinedContinue<MOEOT>(continuator, evalCont);
|
||||
}*/
|
||||
// maxTime
|
||||
eoValueParam<unsigned long>& maxTimeParam = _parser.getORcreateParam((unsigned long)(0), "maxTime", "Maximum running time in seconds (0 = none)", 'T', "Stopping criterion");
|
||||
if (maxTimeParam.value()) // positive: -> define and store
|
||||
{
|
||||
eoTimeContinue<MOEOT> *timeCont = new eoTimeContinue<MOEOT>(maxTimeParam.value());
|
||||
_state.storeFunctor(timeCont);
|
||||
// and "add" to combined
|
||||
continuator = make_combinedContinue<MOEOT>(continuator, timeCont);
|
||||
}
|
||||
// CtrlC
|
||||
#ifndef _MSC_VER
|
||||
// the CtrlC interception (Linux only I'm afraid)
|
||||
eoCtrlCContinue<MOEOT> *ctrlCCont;
|
||||
eoValueParam<bool>& ctrlCParam = _parser.createParam(true, "CtrlC", "Terminate current generation upon Ctrl C",'C', "Stopping criterion");
|
||||
if (_parser.isItThere(ctrlCParam))
|
||||
{
|
||||
ctrlCCont = new eoCtrlCContinue<MOEOT>;
|
||||
// store
|
||||
_state.storeFunctor(ctrlCCont);
|
||||
// add to combinedContinue
|
||||
continuator = make_combinedContinue<MOEOT>(continuator, ctrlCCont);
|
||||
}
|
||||
#endif
|
||||
// now check that there is at least one!
|
||||
if (!continuator)
|
||||
throw std::runtime_error("You MUST provide a stopping criterion");
|
||||
// OK, it's there: store in the eoState
|
||||
_state.storeFunctor(continuator);
|
||||
// and return
|
||||
return *continuator;
|
||||
}
|
||||
|
||||
#endif /*MAKE_CONTINUE_MOEO_H_*/
|
||||
|
|
@ -1,297 +0,0 @@
|
|||
/*
|
||||
* <make_ea_moeo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MAKE_EA_MOEO_H_
|
||||
#define MAKE_EA_MOEO_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoGeneralBreeder.h>
|
||||
#include <eoGenOp.h>
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
|
||||
#include <algo/moeoEA.h>
|
||||
#include <algo/moeoEasyEA.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <comparator/moeoAggregativeComparator.h>
|
||||
#include <comparator/moeoComparator.h>
|
||||
#include <comparator/moeoDiversityThenFitnessComparator.h>
|
||||
#include <comparator/moeoFitnessThenDiversityComparator.h>
|
||||
#include <diversity/moeoDiversityAssignment.h>
|
||||
#include <diversity/moeoDummyDiversityAssignment.h>
|
||||
#include <diversity/moeoFrontByFrontCrowdingDiversityAssignment.h>
|
||||
#include <diversity/moeoFrontByFrontSharingDiversityAssignment.h>
|
||||
#include <fitness/moeoDummyFitnessAssignment.h>
|
||||
#include <fitness/moeoExpBinaryIndicatorBasedFitnessAssignment.h>
|
||||
#include <fitness/moeoFastNonDominatedSortingFitnessAssignment.h>
|
||||
#include <fitness/moeoFitnessAssignment.h>
|
||||
#include <metric/moeoAdditiveEpsilonBinaryMetric.h>
|
||||
#include <metric/moeoHypervolumeBinaryMetric.h>
|
||||
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
|
||||
#include <replacement/moeoElitistReplacement.h>
|
||||
#include <replacement/moeoEnvironmentalReplacement.h>
|
||||
#include <replacement/moeoGenerationalReplacement.h>
|
||||
#include <replacement/moeoReplacement.h>
|
||||
#include <selection/moeoDetTournamentSelect.h>
|
||||
#include <selection/moeoRandomSelect.h>
|
||||
#include <selection/moeoStochTournamentSelect.h>
|
||||
#include <selection/moeoSelectOne.h>
|
||||
#include <selection/moeoSelectors.h>
|
||||
|
||||
|
||||
/**
|
||||
* This functions allows to build a moeoEA from the parser
|
||||
* @param _parser the parser
|
||||
* @param _state to store allocated objects
|
||||
* @param _eval the funtions evaluator
|
||||
* @param _continue the stopping crietria
|
||||
* @param _op the variation operators
|
||||
* @param _archive the archive of non-dominated solutions
|
||||
*/
|
||||
template < class MOEOT >
|
||||
moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoPopEvalFunc < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT > & _archive)
|
||||
{
|
||||
|
||||
/* the objective vector type */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
|
||||
/* the fitness assignment strategy */
|
||||
std::string & fitnessParam = _parser.createParam(std::string("FastNonDominatedSorting"), "fitness",
|
||||
"Fitness assignment scheme: Dummy, FastNonDominatedSorting or IndicatorBased", 'F',
|
||||
"Evolution Engine").value();
|
||||
std::string & indicatorParam = _parser.createParam(std::string("Epsilon"), "indicator",
|
||||
"Binary indicator for IndicatorBased: Epsilon, Hypervolume", 'i',
|
||||
"Evolution Engine").value();
|
||||
double rho = _parser.createParam(1.1, "rho", "reference point for the hypervolume indicator", 'r',
|
||||
"Evolution Engine").value();
|
||||
double kappa = _parser.createParam(0.05, "kappa", "Scaling factor kappa for IndicatorBased", 'k',
|
||||
"Evolution Engine").value();
|
||||
moeoFitnessAssignment < MOEOT > * fitnessAssignment;
|
||||
if (fitnessParam == std::string("Dummy"))
|
||||
{
|
||||
fitnessAssignment = new moeoDummyFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == std::string("FastNonDominatedSorting"))
|
||||
{
|
||||
fitnessAssignment = new moeoFastNonDominatedSortingFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == std::string("IndicatorBased"))
|
||||
{
|
||||
// metric
|
||||
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > *metric;
|
||||
if (indicatorParam == std::string("Epsilon"))
|
||||
{
|
||||
metric = new moeoAdditiveEpsilonBinaryMetric < ObjectiveVector >;
|
||||
}
|
||||
else if (indicatorParam == std::string("Hypervolume"))
|
||||
{
|
||||
metric = new moeoHypervolumeBinaryMetric < ObjectiveVector > (rho);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid binary quality indicator: ") + indicatorParam;
|
||||
throw std::runtime_error(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());
|
||||
}
|
||||
_state.storeFunctor(fitnessAssignment);
|
||||
|
||||
|
||||
/* the diversity assignment strategy */
|
||||
eoValueParam<eoParamParamType> & diversityParam = _parser.createParam(eoParamParamType("Dummy"), "diversity",
|
||||
"Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding", 'D', "Evolution Engine");
|
||||
eoParamParamType & diversityParamValue = diversityParam.value();
|
||||
moeoDiversityAssignment < MOEOT > * diversityAssignment;
|
||||
if (diversityParamValue.first == std::string("Dummy"))
|
||||
{
|
||||
diversityAssignment = new moeoDummyDiversityAssignment < MOEOT> ();
|
||||
}
|
||||
else if (diversityParamValue.first == std::string("Sharing"))
|
||||
{
|
||||
double nicheSize;
|
||||
if (!diversityParamValue.second.size()) // no parameter added
|
||||
{
|
||||
std::cerr << "WARNING, no niche size given for Sharing, using 0.5" << std::endl;
|
||||
nicheSize = 0.5;
|
||||
diversityParamValue.second.push_back(std::string("0.5"));
|
||||
}
|
||||
else
|
||||
{
|
||||
nicheSize = atoi(diversityParamValue.second[0].c_str());
|
||||
}
|
||||
diversityAssignment = new moeoFrontByFrontSharingDiversityAssignment < MOEOT> (nicheSize);
|
||||
}
|
||||
else if (diversityParamValue.first == std::string("Crowding"))
|
||||
{
|
||||
diversityAssignment = new moeoFrontByFrontCrowdingDiversityAssignment < MOEOT> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid diversity assignment strategy: ") + diversityParamValue.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(diversityAssignment);
|
||||
|
||||
|
||||
/* the comparator strategy */
|
||||
std::string & comparatorParam = _parser.createParam(std::string("FitnessThenDiversity"), "comparator",
|
||||
"Comparator scheme: FitnessThenDiversity, DiversityThenFitness or Aggregative", 'C', "Evolution Engine").value();
|
||||
moeoComparator < MOEOT > * comparator;
|
||||
if (comparatorParam == std::string("FitnessThenDiversity"))
|
||||
{
|
||||
comparator = new moeoFitnessThenDiversityComparator < MOEOT> ();
|
||||
}
|
||||
else if (comparatorParam == std::string("DiversityThenFitness"))
|
||||
{
|
||||
comparator = new moeoDiversityThenFitnessComparator < MOEOT> ();
|
||||
}
|
||||
else if (comparatorParam == std::string("Aggregative"))
|
||||
{
|
||||
comparator = new moeoAggregativeComparator < MOEOT> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid comparator strategy: ") + comparatorParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(comparator);
|
||||
|
||||
|
||||
/* the selection strategy */
|
||||
eoValueParam < eoParamParamType > & selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection",
|
||||
"Selection scheme: DetTour(T), StochTour(t) or Random", 'S', "Evolution Engine");
|
||||
eoParamParamType & ppSelect = selectionParam.value();
|
||||
moeoSelectOne < MOEOT > * select;
|
||||
if (ppSelect.first == std::string("DetTour"))
|
||||
{
|
||||
unsigned int tSize;
|
||||
if (!ppSelect.second.size()) // no parameter added
|
||||
{
|
||||
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
|
||||
tSize = 2;
|
||||
// put back 2 in parameter for consistency (and status file)
|
||||
ppSelect.second.push_back(std::string("2"));
|
||||
}
|
||||
else // parameter passed by user as DetTour(T)
|
||||
{
|
||||
tSize = atoi(ppSelect.second[0].c_str());
|
||||
}
|
||||
select = new moeoDetTournamentSelect < MOEOT > (*comparator, tSize);
|
||||
}
|
||||
else if (ppSelect.first == std::string("StochTour"))
|
||||
{
|
||||
double tRate;
|
||||
if (!ppSelect.second.size()) // no parameter added
|
||||
{
|
||||
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
|
||||
tRate = 1;
|
||||
// put back 1 in parameter for consistency (and status file)
|
||||
ppSelect.second.push_back(std::string("1"));
|
||||
}
|
||||
else // parameter passed by user as StochTour(T)
|
||||
{
|
||||
tRate = atof(ppSelect.second[0].c_str());
|
||||
}
|
||||
select = new moeoStochTournamentSelect < MOEOT > (*comparator, tRate);
|
||||
}
|
||||
/*
|
||||
else if (ppSelect.first == string("Roulette"))
|
||||
{
|
||||
// TO DO !
|
||||
// ...
|
||||
}
|
||||
*/
|
||||
else if (ppSelect.first == std::string("Random"))
|
||||
{
|
||||
select = new moeoRandomSelect <MOEOT > ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid selection strategy: ") + ppSelect.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(select);
|
||||
|
||||
|
||||
/* the replacement strategy */
|
||||
std::string & replacementParam = _parser.createParam(std::string("Elitist"), "replacement",
|
||||
"Replacement scheme: Elitist, Environmental or Generational", 'R', "Evolution Engine").value();
|
||||
moeoReplacement < MOEOT > * replace;
|
||||
if (replacementParam == std::string("Elitist"))
|
||||
{
|
||||
replace = new moeoElitistReplacement < MOEOT> (*fitnessAssignment, *diversityAssignment, *comparator);
|
||||
}
|
||||
else if (replacementParam == std::string("Environmental"))
|
||||
{
|
||||
replace = new moeoEnvironmentalReplacement < MOEOT> (*fitnessAssignment, *diversityAssignment, *comparator);
|
||||
}
|
||||
else if (replacementParam == std::string("Generational"))
|
||||
{
|
||||
replace = new moeoGenerationalReplacement < MOEOT> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid replacement strategy: ") + replacementParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(replace);
|
||||
|
||||
|
||||
/* the number of offspring */
|
||||
eoValueParam < eoHowMany > & offspringRateParam = _parser.createParam(eoHowMany(1.0), "nbOffspring",
|
||||
"Number of offspring (percentage or absolute)", 'O', "Evolution Engine");
|
||||
|
||||
|
||||
// the general breeder
|
||||
eoGeneralBreeder < MOEOT > * breed = new eoGeneralBreeder < MOEOT > (*select, _op, offspringRateParam.value());
|
||||
_state.storeFunctor(breed);
|
||||
// the eoEasyEA
|
||||
moeoEA < MOEOT > * algo = new moeoEasyEA < MOEOT > (_continue, _eval, *breed, *replace, *fitnessAssignment, *diversityAssignment);
|
||||
_state.storeFunctor(algo);
|
||||
return *algo;
|
||||
|
||||
}
|
||||
|
||||
#endif /*MAKE_EA_MOEO_H_*/
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* <make_library.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <make_eval_FlowShop.h>
|
||||
#include <make_genotype_FlowShop.h>
|
||||
#include <make_op_FlowShop.h>
|
||||
#include <do/make_pop.h>
|
||||
#include <make_continue_moeo.h>
|
||||
#include <make_ea_moeo.h>
|
||||
#include <make_para_eval.h>
|
||||
#include <make_checkpoint_moeo.h>
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* <make_para_eval.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <peo>
|
||||
#include <es.h>
|
||||
#include <moeo>
|
||||
|
||||
peoMoeoPopEval<FlowShop> & do_make_para_eval(eoParser& _parser, eoState& _state)
|
||||
{
|
||||
std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks)", 'B',"Representation", true).value();
|
||||
if (benchmarkFileName == "")
|
||||
{
|
||||
std::string stmp = "*** Missing name of the benchmark file\n";
|
||||
stmp += " Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n";
|
||||
stmp += " Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks";
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
FlowShopBenchmarkParser fParser(benchmarkFileName);
|
||||
unsigned int M = fParser.getM();
|
||||
unsigned int N = fParser.getN();
|
||||
std::vector< std::vector<unsigned int> > p = fParser.getP();
|
||||
std::vector<unsigned int> d = fParser.getD();
|
||||
|
||||
FlowShopEval* plainEval = new FlowShopEval(M, N, p, d);
|
||||
peoMoeoPopEval<FlowShop>* eval = new peoMoeoPopEval<FlowShop> (* plainEval);
|
||||
_state.storeFunctor(eval);
|
||||
return *eval;
|
||||
}
|
||||
|
|
@ -1,242 +0,0 @@
|
|||
# Doxyfile 1.4.7
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "ParadisEO-PEO Lesson6"
|
||||
PROJECT_NUMBER = 0.1
|
||||
OUTPUT_DIRECTORY = ../../../doc/html/lesson6
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH =
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = .
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.h \
|
||||
NEWS \
|
||||
README
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH = ../../docs/images
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 3
|
||||
IGNORE_PREFIX = peo
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = YES
|
||||
USE_PDFLATEX = YES
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = ../../../paradiseo-mo/docs/eo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../../paradiseo-mo/docs/mo.doxytag=../../../../../paradiseo-mo/docs/html \
|
||||
../../docs/paradiseo-peo.doxytag=../../ \
|
||||
../shared/paradiseo-peo-lsn-shared.doxytag=../../lsnshared/html
|
||||
GENERATE_TAGFILE = ../../docs/paradiseo-peo-lsn.doxytag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 0
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = YES
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
## miscallenous parameters
|
||||
|
||||
--debug=false
|
||||
|
||||
## deployment schema
|
||||
|
||||
--schema=schema.xml
|
||||
|
||||
## parameters
|
||||
|
||||
--inst=../examples/tsp/benchs/eil101.tsp
|
||||
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<schema>
|
||||
<group scheduler="0">
|
||||
<node name="0" num_workers="0">
|
||||
</node>
|
||||
<node name="1" num_workers="0">
|
||||
<runner>1</runner>
|
||||
</node>
|
||||
<node name="2" num_workers="1">
|
||||
</node>
|
||||
<node name="3" num_workers="1">
|
||||
</node>
|
||||
</group>
|
||||
</schema>
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Set the compiler and define targets to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
SET (CMAKE_CXX_COMPILER mpicxx)
|
||||
|
||||
ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson7/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson7/schema.xml)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET install
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson7/param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson7)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET install
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson7/schema.xml
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson7)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src ${MOEO_SRC_DIR}/src ${MO_SRC_DIR}/src ${ParadisEO-PEO_SOURCE_DIR}/src)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries
|
||||
######################################################################################
|
||||
|
||||
IF(NOT WIN32 OR CYGWIN)
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib)
|
||||
ENDIF(NOT WIN32 OR CYGWIN)
|
||||
|
||||
# especially for Visual Studio
|
||||
IF(WIN32 AND NOT CYGWIN)
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}\\lib\\${CMAKE_BUILD_TYPE} ${ParadisEO-PEO_BINARY_DIR}\\lib\\${CMAKE_BUILD_TYPE})
|
||||
ENDIF(WIN32 AND NOT CYGWIN)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(algo main.cpp)
|
||||
ADD_DEPENDENCIES(algo peo rmc_mpi)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Optionnal: define properties
|
||||
######################################################################################
|
||||
|
||||
SET(Lesson7_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(algo PROPERTIES VERSION "${Lesson7_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Link the librairies
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(algo ${XML2_LIBS} peo rmc_mpi eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
#include <peo>
|
||||
#include <es.h>
|
||||
|
||||
typedef eoReal<double> Indi;
|
||||
|
||||
double f (const Indi & _indi)
|
||||
{
|
||||
double sum;
|
||||
sum=_indi[1]-pow(_indi[0],2);
|
||||
sum=100*pow(sum,2);
|
||||
sum+=pow((1-_indi[0]),2);
|
||||
return (-sum);
|
||||
}
|
||||
|
||||
// Communications between 2 EA and 1 archive
|
||||
|
||||
|
||||
int main (int __argc, char *__argv[])
|
||||
{
|
||||
|
||||
peo :: init( __argc, __argv );
|
||||
const unsigned int VEC_SIZE = 2;
|
||||
const unsigned int POP_SIZE = 20;
|
||||
const unsigned int MAX_GEN = 100;
|
||||
const double INIT_POSITION_MIN = -2.0;
|
||||
const double INIT_POSITION_MAX = 2.0;
|
||||
const float CROSS_RATE = 0.8;
|
||||
const double EPSILON = 0.01;
|
||||
const float MUT_RATE = 0.3;
|
||||
const unsigned int MIG_FREQ = 2;
|
||||
const unsigned int MIG_SIZE = 2;
|
||||
rng.reseed (time(0));
|
||||
|
||||
|
||||
// Archive
|
||||
|
||||
peoEvalFunc<Indi > plainEval(f);
|
||||
eoEvalFuncCounter < Indi > firstEval(plainEval);
|
||||
eoPopLoopEval < Indi > evalArchive(firstEval);
|
||||
eoUniformGenerator < double > uGenArchive (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > randomArchive (VEC_SIZE, uGenArchive);
|
||||
eoPop < Indi > empty_pop,archive;
|
||||
archive.append(POP_SIZE, randomArchive);
|
||||
evalArchive (empty_pop,archive);
|
||||
archive.sort();
|
||||
if (getNodeRank()==1)
|
||||
std::cout << "Archive before :\n" << archive << std::endl;
|
||||
|
||||
|
||||
|
||||
// First algorithm
|
||||
/*****************************************************************************************/
|
||||
|
||||
RingTopology topology;
|
||||
|
||||
eoGenContinue < Indi > genContPara (MAX_GEN);
|
||||
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
||||
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
||||
peoEvalFunc<Indi> mainEval( f );
|
||||
peoPopEval <Indi> eval(mainEval);
|
||||
eoUniformGenerator < double >uGen (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > random (VEC_SIZE, uGen);
|
||||
eoBestSelect<Indi> selectionStrategy;
|
||||
eoSelectNumber<Indi> select(selectionStrategy,POP_SIZE);
|
||||
eoSegmentCrossover<Indi> crossover;
|
||||
eoUniformMutation<Indi> mutation(EPSILON);
|
||||
peoTransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
||||
eoPop < Indi > pop;
|
||||
pop.append (POP_SIZE, random);
|
||||
eoPlusReplacement<Indi> replace;
|
||||
eoBestSelect <Indi> mig_select_one;
|
||||
eoSelector <Indi, eoPop<Indi> > mig_select (mig_select_one,MIG_SIZE,pop);
|
||||
eoReplace <Indi, eoPop<Indi> > mig_replace (replace,pop);
|
||||
eoPeriodicContinue< Indi > mig_cont( MIG_FREQ );
|
||||
eoContinuator<Indi> cont(mig_cont, pop);
|
||||
peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > mig(cont,mig_select, mig_replace, topology);
|
||||
checkpoint.add(mig);
|
||||
|
||||
|
||||
eoRandomSelect<Indi> mig_select_oneArchive;
|
||||
eoSelector <Indi, eoPop<Indi> > mig_selectArchive (mig_select_oneArchive,MIG_SIZE,archive);
|
||||
eoReplace <Indi, eoPop<Indi> > mig_replaceArchive (replace,archive);
|
||||
eoPeriodicContinue< Indi > mig_contArchive( MIG_FREQ );
|
||||
eoContinuator<Indi> contArchive(mig_contArchive, pop);
|
||||
peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > migArchive(contArchive,mig_selectArchive, mig_replaceArchive, topology);
|
||||
checkpoint.add(migArchive);
|
||||
|
||||
eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace );
|
||||
peoWrapper parallelEA( eaAlg, pop);
|
||||
eval.setOwner(parallelEA);
|
||||
transform.setOwner(parallelEA);
|
||||
mig.setOwner(parallelEA);
|
||||
migArchive.setOwner(parallelEA);
|
||||
|
||||
// Second algorithm
|
||||
/*****************************************************************************************/
|
||||
|
||||
eoGenContinue < Indi > genContPara2 (MAX_GEN);
|
||||
eoCombinedContinue <Indi> continuatorPara2 (genContPara2);
|
||||
eoCheckPoint<Indi> checkpoint2(continuatorPara2);
|
||||
peoEvalFunc<Indi> mainEval2( f );
|
||||
peoPopEval <Indi> eval2(mainEval2);
|
||||
eoUniformGenerator < double >uGen2 (INIT_POSITION_MIN, INIT_POSITION_MAX);
|
||||
eoInitFixedLength < Indi > random2 (VEC_SIZE, uGen2);
|
||||
eoBestSelect<Indi> selectionStrategy2;
|
||||
eoSelectNumber<Indi> select2(selectionStrategy2,POP_SIZE);
|
||||
eoSegmentCrossover<Indi> crossover2;
|
||||
eoUniformMutation<Indi> mutation2(EPSILON);
|
||||
peoTransform<Indi> transform2(crossover2,CROSS_RATE,mutation2,MUT_RATE);
|
||||
eoPop < Indi > pop2;
|
||||
pop2.append (POP_SIZE, random2);
|
||||
eoPlusReplacement<Indi> replace2;
|
||||
eoBestSelect <Indi> mig_select_one2;
|
||||
eoSelector <Indi, eoPop<Indi> > mig_select2 (mig_select_one2,MIG_SIZE,pop2);
|
||||
eoReplace <Indi, eoPop<Indi> > mig_replace2 (replace2,pop2);
|
||||
eoPeriodicContinue< Indi > mig_cont2( MIG_FREQ );
|
||||
eoContinuator<Indi> cont2(mig_cont2, pop2);
|
||||
peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > mig2(cont2,mig_select2, mig_replace2, topology);
|
||||
checkpoint2.add(mig2);
|
||||
|
||||
|
||||
eoRandomSelect<Indi> mig_select_oneArchive2;
|
||||
eoSelector <Indi, eoPop<Indi> > mig_selectArchive2 (mig_select_oneArchive2,MIG_SIZE,archive);
|
||||
eoReplace <Indi, eoPop<Indi> > mig_replaceArchive2 (replace2,archive);
|
||||
eoPeriodicContinue< Indi > mig_contArchive2( MIG_FREQ );
|
||||
eoContinuator<Indi> contArchive2(mig_contArchive2, pop2);
|
||||
peoAsyncIslandMig< eoPop<Indi>, eoPop<Indi> > migArchive2(contArchive2,mig_selectArchive2, mig_replaceArchive2, topology);
|
||||
checkpoint2.add(migArchive2);
|
||||
|
||||
|
||||
|
||||
eoEasyEA< Indi > eaAlg2( checkpoint2, eval2, select2, transform2, replace2 );
|
||||
peoWrapper parallelEA2( eaAlg2, pop2);
|
||||
eval2.setOwner(parallelEA2);
|
||||
transform2.setOwner(parallelEA2);
|
||||
mig2.setOwner(parallelEA2);
|
||||
migArchive2.setOwner(parallelEA2);
|
||||
|
||||
|
||||
peo :: run();
|
||||
peo :: finalize();
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
pop2.sort();
|
||||
archive.sort();
|
||||
std::cout << "Final population 1 :\n" << pop << std::endl;
|
||||
std::cout << "Final population 2 :\n" << pop2 << std::endl;
|
||||
std::cout << "Archive after :\n" << archive << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
## miscallenous parameters
|
||||
|
||||
--debug=false
|
||||
|
||||
## deployment schema
|
||||
|
||||
--schema=schema.xml
|
||||
|
||||
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<schema>
|
||||
<group scheduler="0">
|
||||
<node name="0" num_workers="0">
|
||||
</node>
|
||||
|
||||
<node name="1" num_workers="0">
|
||||
<runner>1</runner>
|
||||
<runner>2</runner>
|
||||
</node>
|
||||
|
||||
<node name="2" num_workers="1">
|
||||
</node>
|
||||
<node name="3" num_workers="1">
|
||||
</node>
|
||||
|
||||
</group>
|
||||
</schema>
|
||||
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
|
||||
######################################################################################
|
||||
### 0) Set the compiler and define targets to easily run the lessons
|
||||
######################################################################################
|
||||
|
||||
SET (CMAKE_CXX_COMPILER mpicxx)
|
||||
SET(MAKE_SRC_DIR "${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson8/make" CACHE PATH "Make source directory" FORCE)
|
||||
|
||||
ADD_CUSTOM_TARGET(install DEPENDS ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson8/param ${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson8/schema.xml)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET install
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson8/param
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson8)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
TARGET install
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy_if_different
|
||||
${ParadisEO-PEO_SOURCE_DIR}/tutorial/Lesson8/schema.xml
|
||||
${ParadisEO-PEO_BINARY_DIR}/tutorial/Lesson8)
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src ${MOEO_SRC_DIR}/src ${FLOWSHOP_SRC_DIR} ${MO_SRC_DIR}/src ${ParadisEO-PEO_SOURCE_DIR}/src ${TSP_SRC_DIR} ${MAKE_SRC_DIR})
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Specify where CMake can find the libraries (mandatory: before 3) )
|
||||
######################################################################################
|
||||
|
||||
IF(NOT WIN32 OR CYGWIN)
|
||||
LINK_DIRECTORIES(${EO_BIN_DIR}/lib ${MOEO_BIN_DIR}/lib ${FLOWSHOP_BIN_DIR}/lib ${ParadisEO-PEO_BINARY_DIR}/lib ${TSP_BINARY_DIR}/lib)
|
||||
ENDIF(NOT WIN32 OR CYGWIN)
|
||||
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Define your target(s): just an executable here
|
||||
######################################################################################
|
||||
|
||||
ADD_EXECUTABLE(example main.cpp)
|
||||
ADD_DEPENDENCIES(example flowshop moeo peo rmc_mpi)
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Optionnal: define your target(s)'s version: no effect for windows
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
|
||||
######################################################################################
|
||||
### 5) Link the librairies
|
||||
######################################################################################
|
||||
|
||||
TARGET_LINK_LIBRARIES(example ${XML2_LIBS} flowshop moeo peo rmc_mpi eo eoutils)
|
||||
|
||||
######################################################################################
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
#include <peo>
|
||||
#include <moeo>
|
||||
#include "parallelStruct.h"
|
||||
#include <make_library.h>
|
||||
#include <FlowShop.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
peo :: init( argc,argv );
|
||||
const unsigned int MIG_FREQ = 10;
|
||||
const unsigned int MIG_SIZE = 1;
|
||||
rng.reseed (time(0));
|
||||
|
||||
|
||||
// Global archive
|
||||
moeoArchive<FlowShop> globalArch;
|
||||
if (getNodeRank()==1)
|
||||
std::cout << "Archive before :\n" << globalArch << std::endl;
|
||||
|
||||
/***************************************************/
|
||||
/***************** First algorithm *****************/
|
||||
/***************************************************/
|
||||
|
||||
// Topology
|
||||
RingTopology topology;
|
||||
|
||||
// Algorithm
|
||||
eoParser parser(argc, argv);
|
||||
eoState state;
|
||||
peoMoeoPopEval<FlowShop>& eval = do_make_para_eval(parser, state);
|
||||
eoInit<FlowShop>& init = do_make_genotype(parser, state);
|
||||
eoGenOp<FlowShop>& op = do_make_op(parser, state);
|
||||
eoPop<FlowShop>& pop = do_make_pop(parser, state, init); // peoMoeoPop is defined in parallelStruct.h
|
||||
moeoArchive<FlowShop> arch;
|
||||
eoContinue<FlowShop>& term = do_make_continue_moeo(parser, state, eval);
|
||||
eoCheckPoint < FlowShop> & checkpoint = state.storeFunctor(new eoCheckPoint < FlowShop > (term));
|
||||
|
||||
// Communication between EA and the global archive
|
||||
|
||||
// Selection mode in the EA
|
||||
moeoRandomSelect <FlowShop> mig_select_one;
|
||||
moeoSelector <FlowShop, eoPop<FlowShop> > mig_select (mig_select_one,MIG_SIZE,pop); // moeoSelector is defined in parallelStruct.h
|
||||
// Mode of replacement in the EA
|
||||
moeoReplace < moeoArchive<FlowShop>, eoPop<FlowShop> > mig_replace (pop); // moeoReplace is defined in parallelStruct.h
|
||||
// Continuator for the island
|
||||
eoPeriodicContinue< FlowShop> mig_cont( MIG_FREQ );
|
||||
eoContinuator<FlowShop> cont(mig_cont, pop);
|
||||
// Communication : EA ---> global archive
|
||||
peoAsyncIslandMig< eoPop<FlowShop>, moeoArchive<FlowShop> > mig(cont,mig_select, mig_replace, topology);
|
||||
checkpoint.add(mig);
|
||||
// Selection mode in the global archive
|
||||
moeoSelectorArchive < moeoArchive<FlowShop> > mig_selectArchive (globalArch); // moeoSelectorArchive is defined in parallelStruct.h
|
||||
// Mode of replacement in the global archive
|
||||
moeoReplaceArchive < eoPop<FlowShop>, moeoArchive<FlowShop> > mig_replaceArchive (globalArch); // moeoReplaceArchive is defined in parallelStruct.h
|
||||
// Continuator for the island
|
||||
eoPeriodicContinue< FlowShop> mig_contArchive( MIG_FREQ );
|
||||
eoContinuator<FlowShop> contArchive(mig_contArchive, pop);
|
||||
// Communication : global archive ---> EA
|
||||
peoAsyncIslandMig< moeoArchive<FlowShop>, eoPop<FlowShop> > migArchive(contArchive, mig_selectArchive, mig_replaceArchive, topology);
|
||||
checkpoint.add(migArchive);
|
||||
|
||||
eoAlgo<FlowShop>& algo = do_make_ea_moeo(parser, state, eval, checkpoint, op, arch);
|
||||
peoWrapper parallelMOEO( algo, pop);
|
||||
eval.setOwner(parallelMOEO);
|
||||
// Migrations
|
||||
mig.setOwner(parallelMOEO);
|
||||
migArchive.setOwner(parallelMOEO);
|
||||
|
||||
/***************************************************/
|
||||
/***************************************************/
|
||||
/***************************************************/
|
||||
|
||||
// The same one
|
||||
|
||||
RingTopology topology2;
|
||||
eoParser parser2(argc, argv);
|
||||
eoState state2;
|
||||
peoMoeoPopEval<FlowShop>& eval2 = do_make_para_eval(parser2, state2);
|
||||
eoInit<FlowShop>& init2 = do_make_genotype(parser2, state2);
|
||||
eoGenOp<FlowShop>& op2 = do_make_op(parser2, state2);
|
||||
eoPop<FlowShop>& pop2 = do_make_pop(parser2, state2, init2);
|
||||
moeoArchive<FlowShop> arch2;
|
||||
eoContinue<FlowShop>& term2 = do_make_continue_moeo(parser2, state2, eval2);
|
||||
eoCheckPoint < FlowShop> & checkpoint2 = state2.storeFunctor(new eoCheckPoint < FlowShop > (term2));
|
||||
moeoRandomSelect <FlowShop> mig_select_one2;
|
||||
moeoSelector <FlowShop, eoPop<FlowShop> > mig_select2 (mig_select_one2,MIG_SIZE,pop2);
|
||||
moeoReplace < moeoArchive<FlowShop>, eoPop<FlowShop> > mig_replace2 (pop2);
|
||||
eoPeriodicContinue< FlowShop> mig_cont2( MIG_FREQ );
|
||||
eoContinuator<FlowShop> cont2(mig_cont2, pop2);
|
||||
peoAsyncIslandMig< eoPop<FlowShop>, moeoArchive<FlowShop> > mig2(cont2,mig_select2, mig_replace2, topology2);
|
||||
checkpoint2.add(mig2);
|
||||
moeoSelectorArchive < moeoArchive<FlowShop> > mig_selectArchive2 (globalArch);
|
||||
moeoReplaceArchive < eoPop<FlowShop>, moeoArchive<FlowShop> > mig_replaceArchive2 (globalArch);
|
||||
eoPeriodicContinue< FlowShop> mig_contArchive2( MIG_FREQ );
|
||||
eoContinuator<FlowShop> contArchive2(mig_contArchive2, pop2);
|
||||
peoAsyncIslandMig< moeoArchive<FlowShop>, eoPop<FlowShop> > migArchive2(contArchive2, mig_selectArchive2, mig_replaceArchive2, topology2);
|
||||
checkpoint2.add(migArchive2);
|
||||
eoAlgo<FlowShop>& algo2 = do_make_ea_moeo(parser2, state2, eval2, checkpoint2, op2, arch2);
|
||||
peoWrapper parallelMOEO2( algo2, pop2);
|
||||
eval2.setOwner(parallelMOEO2);
|
||||
mig2.setOwner(parallelMOEO2);
|
||||
migArchive2.setOwner(parallelMOEO2);
|
||||
|
||||
peo :: run();
|
||||
peo :: finalize();
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
std::cout << "Final population :\n" << pop << std::endl;
|
||||
pop2.sort();
|
||||
std::cout << "Final population :\n" << pop2 << std::endl;
|
||||
globalArch.sort();
|
||||
std::cout << "Archive after :\n" << globalArch << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,201 +0,0 @@
|
|||
/*
|
||||
* <make_checkpoint_moeo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MAKE_CHECKPOINT_MOEO_H_
|
||||
#define MAKE_CHECKPOINT_MOEO_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFuncCounter.h>
|
||||
#include <utils/checkpointing>
|
||||
#include <utils/selectors.h>
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
#include <metric/moeoContributionMetric.h>
|
||||
#include <metric/moeoEntropyMetric.h>
|
||||
#include <utils/moeoArchiveUpdater.h>
|
||||
#include <utils/moeoArchiveObjectiveVectorSavingUpdater.h>
|
||||
#include <utils/moeoBinaryMetricSavingUpdater.h>
|
||||
|
||||
bool testDirRes(std::string _dirName, bool _erase);
|
||||
|
||||
/**
|
||||
* This functions allows to build an eoCheckPoint for multi-objective optimization from the parser (partly taken from make_checkpoint_pareto.h)
|
||||
* @param _parser the parser
|
||||
* @param _state to store allocated objects
|
||||
* @param _eval the funtions evaluator
|
||||
* @param _continue the stopping crietria
|
||||
* @param _pop the population
|
||||
* @param _archive the archive of non-dominated solutions
|
||||
*/
|
||||
template < class MOEOT >
|
||||
eoCheckPoint < MOEOT > & do_make_checkpoint_moeo (eoParser & _parser, eoState & _state, eoPopEvalFunc < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoPop < MOEOT > & _pop, moeoArchive < MOEOT > & _archive)
|
||||
{
|
||||
eoCheckPoint < MOEOT > & checkpoint = _state.storeFunctor(new eoCheckPoint < MOEOT > (_continue));
|
||||
/* the objective vector type */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
///////////////////
|
||||
// Counters
|
||||
//////////////////
|
||||
// is nb Eval to be used as counter?
|
||||
//bool useEval = _parser.getORcreateParam(true, "useEval", "Use nb of eval. as counter (vs nb of gen.)", '\0', "Output").value();
|
||||
// Create anyway a generation-counter parameter
|
||||
eoValueParam<unsigned int> *generationCounter = new eoValueParam<unsigned int>(0, "Gen.");
|
||||
// Create an incrementor (sub-class of eoUpdater).
|
||||
eoIncrementor<unsigned int> & increment = _state.storeFunctor( new eoIncrementor<unsigned int>(generationCounter->value()) );
|
||||
// Add it to the checkpoint
|
||||
checkpoint.add(increment);
|
||||
// dir for DISK output
|
||||
std::string & dirName = _parser.getORcreateParam(std::string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output").value();
|
||||
// shoudl we empty it if exists
|
||||
eoValueParam<bool>& eraseParam = _parser.getORcreateParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output");
|
||||
bool dirOK = false; // not tested yet
|
||||
|
||||
// Dump of the whole population
|
||||
//-----------------------------
|
||||
bool printPop = _parser.getORcreateParam(false, "printPop", "Print sorted pop. every gen.", '\0', "Output").value();
|
||||
eoSortedPopStat<MOEOT> * popStat;
|
||||
if ( printPop ) // we do want pop dump
|
||||
{
|
||||
popStat = & _state.storeFunctor(new eoSortedPopStat<MOEOT>);
|
||||
checkpoint.add(*popStat);
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
// State savers
|
||||
//////////////////////////////
|
||||
// feed the state to state savers
|
||||
// save state every N generation
|
||||
eoValueParam<unsigned int>& saveFrequencyParam = _parser.createParam((unsigned int)(0), "saveFrequency", "Save every F generation (0 = only final state, absent = never)", '\0', "Persistence" );
|
||||
if (_parser.isItThere(saveFrequencyParam))
|
||||
{
|
||||
// first make sure dirName is OK
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
unsigned int freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\generations";
|
||||
#else
|
||||
std::string stmp = dirName + "/generations";
|
||||
#endif
|
||||
eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp);
|
||||
_state.storeFunctor(stateSaver1);
|
||||
checkpoint.add(*stateSaver1);
|
||||
}
|
||||
// save state every T seconds
|
||||
eoValueParam<unsigned int>& saveTimeIntervalParam = _parser.getORcreateParam((unsigned int)(0), "saveTimeInterval", "Save every T seconds (0 or absent = never)", '\0',"Persistence" );
|
||||
if (_parser.isItThere(saveTimeIntervalParam) && saveTimeIntervalParam.value()>0)
|
||||
{
|
||||
// first make sure dirName is OK
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\time";
|
||||
#else
|
||||
std::string stmp = dirName + "/time";
|
||||
#endif
|
||||
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
|
||||
_state.storeFunctor(stateSaver2);
|
||||
checkpoint.add(*stateSaver2);
|
||||
}
|
||||
|
||||
///////////////////
|
||||
// Archive
|
||||
//////////////////
|
||||
// update the archive every generation
|
||||
bool updateArch = _parser.getORcreateParam(true, "updateArch", "Update the archive at each gen.", '\0', "Evolution Engine").value();
|
||||
if (updateArch)
|
||||
{
|
||||
moeoArchiveUpdater < MOEOT > * updater = new moeoArchiveUpdater < MOEOT > (_archive, _pop);
|
||||
_state.storeFunctor(updater);
|
||||
checkpoint.add(*updater);
|
||||
}
|
||||
// store the objective vectors contained in the archive every generation
|
||||
bool storeArch = _parser.getORcreateParam(false, "storeArch", "Store the archive's objective vectors at each gen.", '\0', "Output").value();
|
||||
if (storeArch)
|
||||
{
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\arch";
|
||||
#else
|
||||
std::string stmp = dirName + "/arch";
|
||||
#endif
|
||||
moeoArchiveObjectiveVectorSavingUpdater < MOEOT > * save_updater = new moeoArchiveObjectiveVectorSavingUpdater < MOEOT > (_archive, stmp);
|
||||
_state.storeFunctor(save_updater);
|
||||
checkpoint.add(*save_updater);
|
||||
}
|
||||
// store the contribution of the non-dominated solutions
|
||||
bool cont = _parser.getORcreateParam(false, "contribution", "Store the contribution of the archive at each gen.", '\0', "Output").value();
|
||||
if (cont)
|
||||
{
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\contribution";
|
||||
#else
|
||||
std::string stmp = dirName + "/contribution";
|
||||
#endif
|
||||
moeoContributionMetric < ObjectiveVector > * contribution = new moeoContributionMetric < ObjectiveVector >;
|
||||
moeoBinaryMetricSavingUpdater < MOEOT > * contribution_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*contribution, _archive, stmp);
|
||||
_state.storeFunctor(contribution_updater);
|
||||
checkpoint.add(*contribution_updater);
|
||||
}
|
||||
// store the entropy of the non-dominated solutions
|
||||
bool ent = _parser.getORcreateParam(false, "entropy", "Store the entropy of the archive at each gen.", '\0', "Output").value();
|
||||
if (ent)
|
||||
{
|
||||
if (! dirOK )
|
||||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
#ifdef _MSVC
|
||||
std::string stmp = dirName + "\entropy";
|
||||
#else
|
||||
std::string stmp = dirName + "/entropy";
|
||||
#endif
|
||||
moeoEntropyMetric < ObjectiveVector > * entropy = new moeoEntropyMetric < ObjectiveVector >;
|
||||
moeoBinaryMetricSavingUpdater < MOEOT > * entropy_updater = new moeoBinaryMetricSavingUpdater < MOEOT > (*entropy, _archive, stmp);
|
||||
_state.storeFunctor(entropy_updater);
|
||||
checkpoint.add(*entropy_updater);
|
||||
}
|
||||
|
||||
// and that's it for the (control and) output
|
||||
return checkpoint;
|
||||
}
|
||||
|
||||
#endif /*MAKE_CHECKPOINT_MOEO_H_*/
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* <make_continue_moeo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MAKE_CONTINUE_MOEO_H_
|
||||
#define MAKE_CONTINUE_MOEO_H_
|
||||
#include <eoCombinedContinue.h>
|
||||
#include <eoGenContinue.h>
|
||||
#include <eoEvalContinue.h>
|
||||
#include <eoFitContinue.h>
|
||||
#include <eoTimeContinue.h>
|
||||
#ifndef _MSC_VER
|
||||
#include <eoCtrlCContinue.h>
|
||||
#endif
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
|
||||
|
||||
/**
|
||||
* Helper function
|
||||
* @param _combined the eoCombinedContinue object
|
||||
* @param _cont the eoContinue to add
|
||||
*/
|
||||
template <class MOEOT>
|
||||
eoCombinedContinue<MOEOT> * make_combinedContinue(eoCombinedContinue<MOEOT> *_combined, eoContinue<MOEOT> *_cont)
|
||||
{
|
||||
if (_combined) // already exists
|
||||
_combined->add(*_cont);
|
||||
else
|
||||
_combined = new eoCombinedContinue<MOEOT>(*_cont);
|
||||
return _combined;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This functions allows to build a eoContinue for multi-objective optimization from the parser (partly taken from make_continue_pareto.h)
|
||||
* @param _parser the parser
|
||||
* @param _state to store allocated objects
|
||||
* @param _eval the funtions evaluator
|
||||
*/
|
||||
template <class MOEOT>
|
||||
eoContinue<MOEOT> & do_make_continue_moeo(eoParser& _parser, eoState& _state, eoPopEvalFunc<MOEOT> & _eval)
|
||||
{
|
||||
// the combined continue - to be filled
|
||||
eoCombinedContinue<MOEOT> *continuator = NULL;
|
||||
// First the eoGenContinue - need a default value so you can run blind
|
||||
// but we also need to be able to avoid it <--> 0
|
||||
eoValueParam<unsigned int>& maxGenParam = _parser.createParam((unsigned int)(100), "maxGen", "Maximum number of generations (0 = none)",'G',"Stopping criterion");
|
||||
if (maxGenParam.value()) // positive: -> define and store
|
||||
{
|
||||
eoGenContinue<MOEOT> *genCont = new eoGenContinue<MOEOT>(maxGenParam.value());
|
||||
_state.storeFunctor(genCont);
|
||||
// and "add" to combined
|
||||
continuator = make_combinedContinue<MOEOT>(continuator, genCont);
|
||||
}
|
||||
// maxEval
|
||||
eoValueParam<unsigned long>& maxEvalParam = _parser.getORcreateParam((unsigned long)(0), "maxEval", "Maximum number of evaluations (0 = none)", 'E', "Stopping criterion");
|
||||
/* if (maxEvalParam.value())
|
||||
{
|
||||
eoEvalContinue<MOEOT> *evalCont = new eoEvalContinue<MOEOT>(_eval, maxEvalParam.value());
|
||||
_state.storeFunctor(evalCont);
|
||||
// and "add" to combined
|
||||
continuator = make_combinedContinue<MOEOT>(continuator, evalCont);
|
||||
}*/
|
||||
// maxTime
|
||||
eoValueParam<unsigned long>& maxTimeParam = _parser.getORcreateParam((unsigned long)(0), "maxTime", "Maximum running time in seconds (0 = none)", 'T', "Stopping criterion");
|
||||
if (maxTimeParam.value()) // positive: -> define and store
|
||||
{
|
||||
eoTimeContinue<MOEOT> *timeCont = new eoTimeContinue<MOEOT>(maxTimeParam.value());
|
||||
_state.storeFunctor(timeCont);
|
||||
// and "add" to combined
|
||||
continuator = make_combinedContinue<MOEOT>(continuator, timeCont);
|
||||
}
|
||||
// CtrlC
|
||||
#ifndef _MSC_VER
|
||||
// the CtrlC interception (Linux only I'm afraid)
|
||||
eoCtrlCContinue<MOEOT> *ctrlCCont;
|
||||
eoValueParam<bool>& ctrlCParam = _parser.createParam(true, "CtrlC", "Terminate current generation upon Ctrl C",'C', "Stopping criterion");
|
||||
if (_parser.isItThere(ctrlCParam))
|
||||
{
|
||||
ctrlCCont = new eoCtrlCContinue<MOEOT>;
|
||||
// store
|
||||
_state.storeFunctor(ctrlCCont);
|
||||
// add to combinedContinue
|
||||
continuator = make_combinedContinue<MOEOT>(continuator, ctrlCCont);
|
||||
}
|
||||
#endif
|
||||
// now check that there is at least one!
|
||||
if (!continuator)
|
||||
throw std::runtime_error("You MUST provide a stopping criterion");
|
||||
// OK, it's there: store in the eoState
|
||||
_state.storeFunctor(continuator);
|
||||
// and return
|
||||
return *continuator;
|
||||
}
|
||||
|
||||
#endif /*MAKE_CONTINUE_MOEO_H_*/
|
||||
|
|
@ -1,297 +0,0 @@
|
|||
/*
|
||||
* <make_ea_moeo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef MAKE_EA_MOEO_H_
|
||||
#define MAKE_EA_MOEO_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <eoContinue.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoGeneralBreeder.h>
|
||||
#include <eoGenOp.h>
|
||||
#include <utils/eoParser.h>
|
||||
#include <utils/eoState.h>
|
||||
|
||||
#include <algo/moeoEA.h>
|
||||
#include <algo/moeoEasyEA.h>
|
||||
#include <archive/moeoArchive.h>
|
||||
#include <comparator/moeoAggregativeComparator.h>
|
||||
#include <comparator/moeoComparator.h>
|
||||
#include <comparator/moeoDiversityThenFitnessComparator.h>
|
||||
#include <comparator/moeoFitnessThenDiversityComparator.h>
|
||||
#include <diversity/moeoDiversityAssignment.h>
|
||||
#include <diversity/moeoDummyDiversityAssignment.h>
|
||||
#include <diversity/moeoFrontByFrontCrowdingDiversityAssignment.h>
|
||||
#include <diversity/moeoFrontByFrontSharingDiversityAssignment.h>
|
||||
#include <fitness/moeoDummyFitnessAssignment.h>
|
||||
#include <fitness/moeoExpBinaryIndicatorBasedFitnessAssignment.h>
|
||||
#include <fitness/moeoFastNonDominatedSortingFitnessAssignment.h>
|
||||
#include <fitness/moeoFitnessAssignment.h>
|
||||
#include <metric/moeoAdditiveEpsilonBinaryMetric.h>
|
||||
#include <metric/moeoHypervolumeBinaryMetric.h>
|
||||
#include <metric/moeoNormalizedSolutionVsSolutionBinaryMetric.h>
|
||||
#include <replacement/moeoElitistReplacement.h>
|
||||
#include <replacement/moeoEnvironmentalReplacement.h>
|
||||
#include <replacement/moeoGenerationalReplacement.h>
|
||||
#include <replacement/moeoReplacement.h>
|
||||
#include <selection/moeoDetTournamentSelect.h>
|
||||
#include <selection/moeoRandomSelect.h>
|
||||
#include <selection/moeoStochTournamentSelect.h>
|
||||
#include <selection/moeoSelectOne.h>
|
||||
#include <selection/moeoSelectors.h>
|
||||
|
||||
|
||||
/**
|
||||
* This functions allows to build a moeoEA from the parser
|
||||
* @param _parser the parser
|
||||
* @param _state to store allocated objects
|
||||
* @param _eval the funtions evaluator
|
||||
* @param _continue the stopping crietria
|
||||
* @param _op the variation operators
|
||||
* @param _archive the archive of non-dominated solutions
|
||||
*/
|
||||
template < class MOEOT >
|
||||
moeoEA < MOEOT > & do_make_ea_moeo(eoParser & _parser, eoState & _state, eoPopEvalFunc < MOEOT > & _eval, eoContinue < MOEOT > & _continue, eoGenOp < MOEOT > & _op, moeoArchive < MOEOT > & _archive)
|
||||
{
|
||||
|
||||
/* the objective vector type */
|
||||
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||
|
||||
|
||||
/* the fitness assignment strategy */
|
||||
std::string & fitnessParam = _parser.createParam(std::string("FastNonDominatedSorting"), "fitness",
|
||||
"Fitness assignment scheme: Dummy, FastNonDominatedSorting or IndicatorBased", 'F',
|
||||
"Evolution Engine").value();
|
||||
std::string & indicatorParam = _parser.createParam(std::string("Epsilon"), "indicator",
|
||||
"Binary indicator for IndicatorBased: Epsilon, Hypervolume", 'i',
|
||||
"Evolution Engine").value();
|
||||
double rho = _parser.createParam(1.1, "rho", "reference point for the hypervolume indicator", 'r',
|
||||
"Evolution Engine").value();
|
||||
double kappa = _parser.createParam(0.05, "kappa", "Scaling factor kappa for IndicatorBased", 'k',
|
||||
"Evolution Engine").value();
|
||||
moeoFitnessAssignment < MOEOT > * fitnessAssignment;
|
||||
if (fitnessParam == std::string("Dummy"))
|
||||
{
|
||||
fitnessAssignment = new moeoDummyFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == std::string("FastNonDominatedSorting"))
|
||||
{
|
||||
fitnessAssignment = new moeoFastNonDominatedSortingFitnessAssignment < MOEOT> ();
|
||||
}
|
||||
else if (fitnessParam == std::string("IndicatorBased"))
|
||||
{
|
||||
// metric
|
||||
moeoNormalizedSolutionVsSolutionBinaryMetric < ObjectiveVector, double > *metric;
|
||||
if (indicatorParam == std::string("Epsilon"))
|
||||
{
|
||||
metric = new moeoAdditiveEpsilonBinaryMetric < ObjectiveVector >;
|
||||
}
|
||||
else if (indicatorParam == std::string("Hypervolume"))
|
||||
{
|
||||
metric = new moeoHypervolumeBinaryMetric < ObjectiveVector > (rho);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid binary quality indicator: ") + indicatorParam;
|
||||
throw std::runtime_error(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());
|
||||
}
|
||||
_state.storeFunctor(fitnessAssignment);
|
||||
|
||||
|
||||
/* the diversity assignment strategy */
|
||||
eoValueParam<eoParamParamType> & diversityParam = _parser.createParam(eoParamParamType("Dummy"), "diversity",
|
||||
"Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding", 'D', "Evolution Engine");
|
||||
eoParamParamType & diversityParamValue = diversityParam.value();
|
||||
moeoDiversityAssignment < MOEOT > * diversityAssignment;
|
||||
if (diversityParamValue.first == std::string("Dummy"))
|
||||
{
|
||||
diversityAssignment = new moeoDummyDiversityAssignment < MOEOT> ();
|
||||
}
|
||||
else if (diversityParamValue.first == std::string("Sharing"))
|
||||
{
|
||||
double nicheSize;
|
||||
if (!diversityParamValue.second.size()) // no parameter added
|
||||
{
|
||||
std::cerr << "WARNING, no niche size given for Sharing, using 0.5" << std::endl;
|
||||
nicheSize = 0.5;
|
||||
diversityParamValue.second.push_back(std::string("0.5"));
|
||||
}
|
||||
else
|
||||
{
|
||||
nicheSize = atoi(diversityParamValue.second[0].c_str());
|
||||
}
|
||||
diversityAssignment = new moeoFrontByFrontSharingDiversityAssignment < MOEOT> (nicheSize);
|
||||
}
|
||||
else if (diversityParamValue.first == std::string("Crowding"))
|
||||
{
|
||||
diversityAssignment = new moeoFrontByFrontCrowdingDiversityAssignment < MOEOT> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid diversity assignment strategy: ") + diversityParamValue.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(diversityAssignment);
|
||||
|
||||
|
||||
/* the comparator strategy */
|
||||
std::string & comparatorParam = _parser.createParam(std::string("FitnessThenDiversity"), "comparator",
|
||||
"Comparator scheme: FitnessThenDiversity, DiversityThenFitness or Aggregative", 'C', "Evolution Engine").value();
|
||||
moeoComparator < MOEOT > * comparator;
|
||||
if (comparatorParam == std::string("FitnessThenDiversity"))
|
||||
{
|
||||
comparator = new moeoFitnessThenDiversityComparator < MOEOT> ();
|
||||
}
|
||||
else if (comparatorParam == std::string("DiversityThenFitness"))
|
||||
{
|
||||
comparator = new moeoDiversityThenFitnessComparator < MOEOT> ();
|
||||
}
|
||||
else if (comparatorParam == std::string("Aggregative"))
|
||||
{
|
||||
comparator = new moeoAggregativeComparator < MOEOT> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid comparator strategy: ") + comparatorParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(comparator);
|
||||
|
||||
|
||||
/* the selection strategy */
|
||||
eoValueParam < eoParamParamType > & selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection",
|
||||
"Selection scheme: DetTour(T), StochTour(t) or Random", 'S', "Evolution Engine");
|
||||
eoParamParamType & ppSelect = selectionParam.value();
|
||||
moeoSelectOne < MOEOT > * select;
|
||||
if (ppSelect.first == std::string("DetTour"))
|
||||
{
|
||||
unsigned int tSize;
|
||||
if (!ppSelect.second.size()) // no parameter added
|
||||
{
|
||||
std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
|
||||
tSize = 2;
|
||||
// put back 2 in parameter for consistency (and status file)
|
||||
ppSelect.second.push_back(std::string("2"));
|
||||
}
|
||||
else // parameter passed by user as DetTour(T)
|
||||
{
|
||||
tSize = atoi(ppSelect.second[0].c_str());
|
||||
}
|
||||
select = new moeoDetTournamentSelect < MOEOT > (*comparator, tSize);
|
||||
}
|
||||
else if (ppSelect.first == std::string("StochTour"))
|
||||
{
|
||||
double tRate;
|
||||
if (!ppSelect.second.size()) // no parameter added
|
||||
{
|
||||
std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
|
||||
tRate = 1;
|
||||
// put back 1 in parameter for consistency (and status file)
|
||||
ppSelect.second.push_back(std::string("1"));
|
||||
}
|
||||
else // parameter passed by user as StochTour(T)
|
||||
{
|
||||
tRate = atof(ppSelect.second[0].c_str());
|
||||
}
|
||||
select = new moeoStochTournamentSelect < MOEOT > (*comparator, tRate);
|
||||
}
|
||||
/*
|
||||
else if (ppSelect.first == string("Roulette"))
|
||||
{
|
||||
// TO DO !
|
||||
// ...
|
||||
}
|
||||
*/
|
||||
else if (ppSelect.first == std::string("Random"))
|
||||
{
|
||||
select = new moeoRandomSelect <MOEOT > ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid selection strategy: ") + ppSelect.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(select);
|
||||
|
||||
|
||||
/* the replacement strategy */
|
||||
std::string & replacementParam = _parser.createParam(std::string("Elitist"), "replacement",
|
||||
"Replacement scheme: Elitist, Environmental or Generational", 'R', "Evolution Engine").value();
|
||||
moeoReplacement < MOEOT > * replace;
|
||||
if (replacementParam == std::string("Elitist"))
|
||||
{
|
||||
replace = new moeoElitistReplacement < MOEOT> (*fitnessAssignment, *diversityAssignment, *comparator);
|
||||
}
|
||||
else if (replacementParam == std::string("Environmental"))
|
||||
{
|
||||
replace = new moeoEnvironmentalReplacement < MOEOT> (*fitnessAssignment, *diversityAssignment, *comparator);
|
||||
}
|
||||
else if (replacementParam == std::string("Generational"))
|
||||
{
|
||||
replace = new moeoGenerationalReplacement < MOEOT> ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string stmp = std::string("Invalid replacement strategy: ") + replacementParam;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
_state.storeFunctor(replace);
|
||||
|
||||
|
||||
/* the number of offspring */
|
||||
eoValueParam < eoHowMany > & offspringRateParam = _parser.createParam(eoHowMany(1.0), "nbOffspring",
|
||||
"Number of offspring (percentage or absolute)", 'O', "Evolution Engine");
|
||||
|
||||
|
||||
// the general breeder
|
||||
eoGeneralBreeder < MOEOT > * breed = new eoGeneralBreeder < MOEOT > (*select, _op, offspringRateParam.value());
|
||||
_state.storeFunctor(breed);
|
||||
// the eoEasyEA
|
||||
moeoEA < MOEOT > * algo = new moeoEasyEA < MOEOT > (_continue, _eval, *breed, *replace, *fitnessAssignment, *diversityAssignment);
|
||||
_state.storeFunctor(algo);
|
||||
return *algo;
|
||||
|
||||
}
|
||||
|
||||
#endif /*MAKE_EA_MOEO_H_*/
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* <make_library.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <make_eval_FlowShop.h>
|
||||
#include <make_genotype_FlowShop.h>
|
||||
#include <make_op_FlowShop.h>
|
||||
#include <do/make_pop.h>
|
||||
#include <make_continue_moeo.h>
|
||||
#include <make_ea_moeo.h>
|
||||
#include <make_para_eval.h>
|
||||
#include <make_checkpoint_moeo.h>
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* <make_para_eval.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <peo>
|
||||
#include <es.h>
|
||||
#include <moeo>
|
||||
|
||||
peoMoeoPopEval<FlowShop> & do_make_para_eval(eoParser& _parser, eoState& _state)
|
||||
{
|
||||
std::string benchmarkFileName = _parser.getORcreateParam(std::string(), "BenchmarkFile", "Benchmark file name (benchmarks are available at www.lifl.fr/~liefooga/benchmarks)", 'B',"Representation", true).value();
|
||||
if (benchmarkFileName == "")
|
||||
{
|
||||
std::string stmp = "*** Missing name of the benchmark file\n";
|
||||
stmp += " Type '-B=the_benchmark_file_name' or '--BenchmarkFile=the_benchmark_file_name'\n";
|
||||
stmp += " Benchmarks files are available at www.lifl.fr/~liefooga/benchmarks";
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
FlowShopBenchmarkParser fParser(benchmarkFileName);
|
||||
unsigned int M = fParser.getM();
|
||||
unsigned int N = fParser.getN();
|
||||
std::vector< std::vector<unsigned int> > p = fParser.getP();
|
||||
std::vector<unsigned int> d = fParser.getD();
|
||||
|
||||
FlowShopEval* plainEval = new FlowShopEval(M, N, p, d);
|
||||
peoMoeoPopEval<FlowShop>* eval = new peoMoeoPopEval<FlowShop> (* plainEval);
|
||||
_state.storeFunctor(eval);
|
||||
return *eval;
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
template < class EOT, class TYPE> class moeoSelector : public selector< TYPE >
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
moeoSelector(moeoSelectOne<EOT> & _select, unsigned _nb_select, const TYPE & _source): selector (_select), nb_select(_nb_select), source(_source)
|
||||
{}
|
||||
|
||||
// Example
|
||||
virtual void operator()(TYPE & _dest)
|
||||
{
|
||||
size_t target = static_cast<size_t>(nb_select);
|
||||
_dest.resize(target);
|
||||
for (size_t i = 0; i < _dest.size(); ++i)
|
||||
_dest[i] = selector(source);
|
||||
}
|
||||
|
||||
protected:
|
||||
moeoSelectOne<EOT> & selector ;
|
||||
unsigned nb_select;
|
||||
const TYPE & source;
|
||||
};
|
||||
|
||||
|
||||
template < class TYPESOUR, class TYPEDEST> class moeoReplaceArchive : public replacement< TYPESOUR >
|
||||
{
|
||||
public:
|
||||
|
||||
moeoReplaceArchive(TYPEDEST & _destination): destination(_destination)
|
||||
{}
|
||||
|
||||
// Example
|
||||
virtual void operator()(TYPESOUR & _source)
|
||||
{
|
||||
destination.update (_source);
|
||||
}
|
||||
|
||||
protected:
|
||||
TYPEDEST & destination;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < class TYPESOUR, class TYPEDEST> class moeoReplace : public replacement< TYPESOUR >
|
||||
{
|
||||
public:
|
||||
|
||||
moeoReplace(TYPEDEST & _destination): destination(_destination)
|
||||
{}
|
||||
|
||||
// Example
|
||||
virtual void operator()(TYPESOUR & _source)
|
||||
{
|
||||
for(unsigned i=0;i<_source.size();i++)
|
||||
{
|
||||
unsigned ind=0;
|
||||
double worst=destination[0].fitness();
|
||||
for (unsigned j=1;j<destination.size();j++)
|
||||
if ( destination[j].fitness()< worst)
|
||||
{
|
||||
ind=j;
|
||||
worst=destination[j].fitness();
|
||||
}
|
||||
destination[ind]=_source[i];
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
TYPEDEST & destination;
|
||||
};
|
||||
|
||||
|
||||
template <class TYPE> class moeoSelectorArchive : public selector< TYPE >
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
moeoSelectorArchive(const TYPE & _source): source(_source)
|
||||
{}
|
||||
|
||||
// Example
|
||||
virtual void operator()(TYPE & _dest)
|
||||
{
|
||||
_dest.update (source);
|
||||
}
|
||||
|
||||
protected:
|
||||
const TYPE & source;
|
||||
};
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
###### General ######
|
||||
--help=0 # -h : Prints this message
|
||||
#--stopOnUnknownParam=1 # Stop if unkown param entered
|
||||
# --seed=1183379758 # -S : Random number seed
|
||||
|
||||
###### Evolution Engine ######
|
||||
--popSize=20 # -P : Population Size
|
||||
--updateArch=1 # Update the archive at each gen.
|
||||
--fitness=FastNonDominatedSorting # -F : Fitness assignment scheme: Dummy, FastNonDominatedSorting or IndicatorBased
|
||||
--indicator=Epsilon # -i : Binary indicator for IndicatorBased: Epsilon, Hypervolume
|
||||
--rho=1.1 # -r : reference point for the hypervolume indicator
|
||||
--kappa=0.05 # -k : Scaling factor kappa for IndicatorBased
|
||||
--diversity=Crowding # -D : Diversity assignment scheme: Dummy, Sharing(nicheSize) or Crowding
|
||||
--comparator=FitnessThenDiversity # -C : Comparator scheme: FitnessThenDiversity, DiversityThenFitness or Aggregative
|
||||
--selection=DetTour(2) # -S : Selection scheme: DetTour(T), StochTour(t) or Random
|
||||
--replacement=Elitist # -R : Replacement scheme: Elitist, Environmental or Generational
|
||||
--nbOffspring=100% # -O : Number of offspring (percentage or absolute)
|
||||
|
||||
###### Output ######
|
||||
#--resDir=Res # Directory to store DISK outputs
|
||||
#--eraseDir=1 # erase files in dirName if any
|
||||
--printPop=0 # Print sorted pop. every gen.
|
||||
--storeArch=0 # Store the archive's objective vectors at each gen.
|
||||
--contribution=0 # Store the contribution of the archive at each gen.
|
||||
--entropy=0 # Store the entropy of the archive at each gen.
|
||||
|
||||
###### Persistence ######
|
||||
--Load= # -L : A save file to restart from
|
||||
--recomputeFitness=0 # -r : Recompute the fitness after re-loading the pop.?
|
||||
--saveFrequency=0 # Save every F generation (0 = only final state, absent = never)
|
||||
--saveTimeInterval=0 # Save every T seconds (0 or absent = never)
|
||||
#--status=./FlowShopEA.status # Status file
|
||||
|
||||
###### Representation ######
|
||||
--BenchmarkFile=../../../../paradiseo-moeo/tutorial/examples/flowshop/benchs/020_10_01.txt # -B : Benchmark file name REQUIRED
|
||||
|
||||
###### Stopping criterion ######
|
||||
--maxGen=100 # -G : Maximum number of generations (0 = none)
|
||||
--maxEval=0 # -E : Maximum number of evaluations (0 = none)
|
||||
--maxTime=0 # -T : Maximum running time in seconds (0 = none)
|
||||
#--CtrlC=1 # -C : Terminate current generation upon Ctrl C (only available on Unix platforms)
|
||||
|
||||
###### Variation Operators ######
|
||||
--crossRate=1 # Relative rate for the only crossover
|
||||
--shiftMutRate=0.5 # Relative rate for shift mutation
|
||||
--exchangeMutRate=0.5 # Relative rate for exchange mutation
|
||||
--pCross=0.25 # -c : Probability of Crossover
|
||||
--pMut=0.35 # -m : Probability of Mutation
|
||||
|
||||
|
||||
|
||||
## miscallenous parameters
|
||||
|
||||
--debug=false
|
||||
|
||||
## deployment schema
|
||||
|
||||
--schema=schema.xml
|
||||
|
||||
## parameters
|
||||
|
||||
--inst=../examples/tsp/benchs/eil101.tsp
|
||||
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<schema>
|
||||
<group scheduler="0">
|
||||
<node name="0" num_workers="0">
|
||||
</node>
|
||||
<node name="1" num_workers="0">
|
||||
<runner>1</runner>
|
||||
<runner>2</runner>
|
||||
</node>
|
||||
<node name="2" num_workers="1">
|
||||
</node>
|
||||
<node name="3" num_workers="1">
|
||||
</node>
|
||||
</group>
|
||||
</schema>
|
||||
|
|
@ -80,31 +80,3 @@ SET(TSP_VERSION ${GLOBAL_VERSION})
|
|||
SET_TARGET_PROPERTIES(tsp PROPERTIES VERSION "${TSP_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 4) Windows advanced config - especially for Microsoft Visual Studio 8
|
||||
######################################################################################
|
||||
|
||||
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
IF(NOT WITH_SHARED_LIBS)
|
||||
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
SET(CMAKE_CXX_FLAGS "/nologo /W3 /Gy")
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "/MTd /Z7 /Od")
|
||||
SET(CMAKE_CXX_FLAGS_RELEASE "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O2")
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MTd /Z7 /Od")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:CONSOLE")
|
||||
|
||||
ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005")
|
||||
ENDIF(NOT WITH_SHARED_LIBS)
|
||||
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 5) Where must cmake go now ?
|
||||
######################################################################################
|
||||
|
||||
# nothing to be compiled in the subdirs
|
||||
|
||||
######################################################################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue