RC for ParadisEO 2.0
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2709 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
59222069a4
commit
6f384f4a59
995 changed files with 136161 additions and 0 deletions
1
branches/rc2.0/.mpd.conf
Normal file
1
branches/rc2.0/.mpd.conf
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
secretword=Nothing
|
||||||
11
branches/rc2.0/.project
Normal file
11
branches/rc2.0/.project
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>trunk</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
||||||
12
branches/rc2.0/AUTHORS
Normal file
12
branches/rc2.0/AUTHORS
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
Jean-Charles Boisson
|
||||||
|
Sébastien Cahon
|
||||||
|
Clive Canape
|
||||||
|
Laetitia Jourdan
|
||||||
|
Thomas Legrand
|
||||||
|
Arnaud Liefooghe
|
||||||
|
Nouredine Melab
|
||||||
|
El-Ghazali Talbi
|
||||||
|
Alexandru-Adrian Tantar
|
||||||
|
Sebastien Verel
|
||||||
|
Jérémie Humeau
|
||||||
|
Karima Boufaras
|
||||||
1019
branches/rc2.0/LICENSE
Normal file
1019
branches/rc2.0/LICENSE
Normal file
File diff suppressed because it is too large
Load diff
10
branches/rc2.0/OldDartConfig.cmake
Normal file
10
branches/rc2.0/OldDartConfig.cmake
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Dart config for report submission
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
SET (DROP_METHOD "xmlrpc")
|
||||||
|
SET (DROP_SITE "http://dart.irisa.fr")
|
||||||
|
SET (DROP_LOCATION "ParadisEO")
|
||||||
|
SET (NIGHTLY_START_TIME "23:00:00 WEST")
|
||||||
|
#############################################################################
|
||||||
84
branches/rc2.0/README
Normal file
84
branches/rc2.0/README
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
|
||||||
|
==========================================================================================
|
||||||
|
RELEASE
|
||||||
|
==========================================================================================
|
||||||
|
|
||||||
|
The current release is paradisEO-1.4
|
||||||
|
|
||||||
|
==========================================================================================
|
||||||
|
INSTALLATION
|
||||||
|
==========================================================================================
|
||||||
|
The basic installation procedure must be done in the directory
|
||||||
|
which contains the extracted archive.
|
||||||
|
|
||||||
|
--> Example : bash installParadiseo.sh
|
||||||
|
|
||||||
|
Please try source installParadiseo.sh --help for further information
|
||||||
|
|
||||||
|
==========================================================================================
|
||||||
|
DIRECTORY STRUCTURE
|
||||||
|
==========================================================================================
|
||||||
|
After unpacking the archive file, you should end up with the following
|
||||||
|
structure:
|
||||||
|
|
||||||
|
.../ Installation directory (specified with ./installParadiseo.sh)
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- AUTHORS Author list
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- INSTALL INSTALL file
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- install.cmake ParadisEO main install config file
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- installParadiseo.sh Install script
|
||||||
|
|
|
||||||
|
+-- lib/
|
||||||
|
| | +-- /libxml2-2.7.3.tar.gz LIBXML2 archive (required for ParadisEO-PEO)
|
||||||
|
| | +-- /mpich2-1.0.8.tar.gz MPICH2 archive (required for ParadisEO-PEO)
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+ LICENCE Licence contents
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- paradiseo-eo paradiseo-eo dir
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- paradiseo-mo paradiseo-mo dir
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- paradiseo-moeo paradiseo-moeo dir
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- paradiseo-old-mo paradiseo-old-mo dir
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- paradiseo-peo paradiseo-peo dir
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- problems classical problems evaluation functions
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- README README file
|
||||||
|
|
||||||
|
==========================================================================================
|
||||||
|
NOTES
|
||||||
|
==========================================================================================
|
||||||
|
|
||||||
|
ParadisEO uses EO, a templates-based, ANSI-C++ compliant evolutionary computation library.
|
||||||
|
It contains classes for almost any kind of evolutionary computation you might come up to - at
|
||||||
|
least for the ones we could think of.
|
||||||
|
EO Website: http://eodev.sourceforge.net/.
|
||||||
|
EO is distributed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html
|
||||||
|
|
||||||
|
Please read README file of each extracted directory if you have
|
||||||
|
problems for the installation.
|
||||||
|
|
||||||
|
==========================================================================================
|
||||||
|
CONTACT
|
||||||
|
==========================================================================================
|
||||||
|
For further information about ParadisEO, help or to report any
|
||||||
|
problem : paradiseo-help@lists.gforge.inria.fr
|
||||||
|
|
||||||
130
branches/rc2.0/install.cmake
Normal file
130
branches/rc2.0/install.cmake
Normal file
|
|
@ -0,0 +1,130 @@
|
||||||
|
######################################################################################
|
||||||
|
### CMake basic configuration
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
# check cmake version compatibility
|
||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
|
# regular expression checking
|
||||||
|
INCLUDE_REGULAR_EXPRESSION("^.*$" "^$")
|
||||||
|
|
||||||
|
# set a language for the entire project.
|
||||||
|
ENABLE_LANGUAGE(CXX)
|
||||||
|
ENABLE_LANGUAGE(C)
|
||||||
|
|
||||||
|
####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
### Include required modules & utilities
|
||||||
|
#####################################################################################
|
||||||
|
INCLUDE(CMakeBackwardCompatibilityCXX)
|
||||||
|
|
||||||
|
INCLUDE(FindDoxygen)
|
||||||
|
|
||||||
|
INCLUDE(FindGnuplot)
|
||||||
|
|
||||||
|
INCLUDE(CheckLibraryExists)
|
||||||
|
|
||||||
|
INCLUDE(Dart OPTIONAL)
|
||||||
|
|
||||||
|
INCLUDE(CPack)
|
||||||
|
|
||||||
|
# Set a special flag if the environment is windows (should do the same in a config.g file)
|
||||||
|
IF (WIN32)
|
||||||
|
ADD_DEFINITIONS(-D_WINDOWS=1)
|
||||||
|
ENDIF (WIN32)
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
### 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)
|
||||||
|
|
||||||
|
FIND_PROGRAM(MEMORYCHECK_COMMAND
|
||||||
|
NAMES purify valgrind
|
||||||
|
PATHS
|
||||||
|
"/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
|
||||||
|
DOC "Path to the memory checking command, used for memory error detection.")
|
||||||
|
|
||||||
|
IF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
SET( CMAKE_BUILD_TYPE
|
||||||
|
${CMAKE_DEFAULT_BUILD_TYPE} CACHE STRING
|
||||||
|
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
|
||||||
|
FORCE)
|
||||||
|
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
IF(WIN32 AND NOT CYGWIN)
|
||||||
|
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||||
|
IF(NOT WITH_SHARED_LIBS)
|
||||||
|
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10")
|
||||||
|
SET(CMAKE_CXX_FLAGS "/nologo /Gy")
|
||||||
|
SET(CMAKE_CXX_FLAGS_DEBUG "/W3 /MTd /Z7 /Od")
|
||||||
|
SET(CMAKE_CXX_FLAGS_RELEASE "/w /MT /O2 /wd4530")
|
||||||
|
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" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10")
|
||||||
|
ENDIF(NOT WITH_SHARED_LIBS)
|
||||||
|
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||||
|
ELSE(WIN32 AND NOT CYGWIN)
|
||||||
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fprofile-arcs -ftest-coverage -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers")
|
||||||
|
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
||||||
|
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -O6")
|
||||||
|
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)
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
|
||||||
|
######################################################################################
|
||||||
|
### compilation of examples?
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
SET(ENABLE_CMAKE_EXAMPLE TRUE CACHE BOOL "Enable copy of benchs and parameters file?")
|
||||||
|
|
||||||
|
######################################################################################
|
||||||
|
### Test config
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
IF (ENABLE_CMAKE_TESTING OR ENABLE_MINIMAL_CMAKE_TESTING)
|
||||||
|
ENABLE_TESTING()
|
||||||
|
ENDIF (ENABLE_CMAKE_TESTING OR ENABLE_MINIMAL_CMAKE_TESTING)
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
#######################################################################################
|
||||||
|
### Paths to EO, MO and MOEO must be specified above.
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
|
SET(EO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-eo" CACHE PATH "ParadisEO-EO source directory" FORCE)
|
||||||
|
SET(EO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-eo/build" CACHE PATH "ParadisEO-EO binary directory" FORCE)
|
||||||
|
|
||||||
|
SET(MO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-mo" CACHE PATH "ParadisMO-MO source directory" FORCE)
|
||||||
|
SET(MO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-mo/build" CACHE PATH "ParadisMO-MO binary directory" FORCE)
|
||||||
|
|
||||||
|
SET(OLDMO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-old-mo" CACHE PATH "ParadisMO-MO source directory" FORCE)
|
||||||
|
SET(OLDMO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-old-mo/build" CACHE PATH "ParadisMO-MO binary directory" FORCE)
|
||||||
|
|
||||||
|
SET(MOEO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-moeo" CACHE PATH "ParadisMOEO-MOEO source directory" FORCE)
|
||||||
|
SET(MOEO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-moeo/build" CACHE PATH "ParadisMOEO-MOEO binary directory" FORCE)
|
||||||
|
|
||||||
|
SET(PROBLEMS_SRC_DIR "${CMAKE_SOURCE_DIR}/../problems" CACHE PATH "Problems dependant source directory" FORCE)
|
||||||
|
|
||||||
|
######################################################################################
|
||||||
|
######################################################################################
|
||||||
|
### Subdirectories that CMake should process for MO, MOEO and PEO
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
ADD_SUBDIRECTORY(doc)
|
||||||
|
ADD_SUBDIRECTORY(src)
|
||||||
|
ADD_SUBDIRECTORY(test)
|
||||||
|
ADD_SUBDIRECTORY(tutorial)
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
1371
branches/rc2.0/installParadiseo.sh
Executable file
1371
branches/rc2.0/installParadiseo.sh
Executable file
File diff suppressed because it is too large
Load diff
BIN
branches/rc2.0/lib/libxml2-2.7.3.tar.gz
Executable file
BIN
branches/rc2.0/lib/libxml2-2.7.3.tar.gz
Executable file
Binary file not shown.
BIN
branches/rc2.0/lib/mpich2-1.0.8.tar.gz
Normal file
BIN
branches/rc2.0/lib/mpich2-1.0.8.tar.gz
Normal file
Binary file not shown.
4
branches/rc2.0/paradiseo-mo/AUTHORS
Normal file
4
branches/rc2.0/paradiseo-mo/AUTHORS
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Authors:
|
||||||
|
Sebastien Verel
|
||||||
|
Arnaud Liefooghe
|
||||||
|
Jérémie Humeau
|
||||||
46
branches/rc2.0/paradiseo-mo/CMakeLists.txt
Normal file
46
branches/rc2.0/paradiseo-mo/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
|
##########################################################################################################################################
|
||||||
|
### 0) If you want to set your own variables in mo-conf.cmake and avoid the cmd line
|
||||||
|
##########################################################################################################################################
|
||||||
|
|
||||||
|
INCLUDE(mo-conf.cmake OPTIONAL)
|
||||||
|
|
||||||
|
##########################################################################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################################################################################################
|
||||||
|
### 1) Project properties
|
||||||
|
##########################################################################################################################################
|
||||||
|
|
||||||
|
# set the project name
|
||||||
|
PROJECT(ParadisEO-MO)
|
||||||
|
|
||||||
|
SET(PACKAGE_BUGREPORT "paradiseo-help@lists.gforge.inria.fr" CACHE STRING "Package bug report" FORCE)
|
||||||
|
SET(PACKAGE_NAME "ParadisEO-MO - Moving Objects" CACHE STRING "Package name" FORCE)
|
||||||
|
SET(PACKAGE_STRING "ParadisEO-MO 1.3" CACHE STRING "MO Package string full name" FORCE)
|
||||||
|
SET(PACKAGE_VERSION "1.3" CACHE STRING "Package version" FORCE)
|
||||||
|
SET(GLOBAL_VERSION "1.3" CACHE STRING "Global version" FORCE)
|
||||||
|
SET(VERSION "1.3.0" CACHE STRING "Version" FORCE)
|
||||||
|
##########################################################################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################################################################################################
|
||||||
|
### 2) Include the common CMake configuration
|
||||||
|
##########################################################################################################################################
|
||||||
|
|
||||||
|
# The "config" variable must be provided on the command line
|
||||||
|
IF(NOT DEFINED config OR NOT config)
|
||||||
|
MESSAGE(FATAL_ERROR "The \"config\" variable must be set on the command line to
|
||||||
|
give the path of the install configuration file. ")
|
||||||
|
ENDIF(NOT DEFINED config OR NOT config)
|
||||||
|
|
||||||
|
# Need the config file whose full path is given thanks to the "config" variable
|
||||||
|
INCLUDE(${config})
|
||||||
|
|
||||||
|
EXECUTE_PROCESS(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${MO_SRC_DIR}/CTestCustom.cmake
|
||||||
|
${MO_BIN_DIR}/CTestCustom.cmake)
|
||||||
|
##########################################################################################################################################
|
||||||
|
|
||||||
7
branches/rc2.0/paradiseo-mo/CTestConfig.cmake
Normal file
7
branches/rc2.0/paradiseo-mo/CTestConfig.cmake
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
set(CTEST_PROJECT_NAME "ParadisEO")
|
||||||
|
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
|
||||||
|
|
||||||
|
set(CTEST_DROP_METHOD "http")
|
||||||
|
set(CTEST_DROP_SITE "cdash.inria.fr")
|
||||||
|
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=ParadisEO")
|
||||||
|
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||||
7
branches/rc2.0/paradiseo-mo/CTestCustom.cmake
Normal file
7
branches/rc2.0/paradiseo-mo/CTestCustom.cmake
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||||
|
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||||
|
"test/"
|
||||||
|
"paradiseo-eo/"
|
||||||
|
"problems/"
|
||||||
|
"tutorial/"
|
||||||
|
)
|
||||||
79
branches/rc2.0/paradiseo-mo/README
Normal file
79
branches/rc2.0/paradiseo-mo/README
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
PARADISEO-MO README FILE
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
Welcome to PARADISEO-MO (Moving Objects), a part of the ParadisEO framework.
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
BUILDING PARADISEO-OLD-MO
|
||||||
|
=======================================================================
|
||||||
|
The basic installation procedure goes the following:
|
||||||
|
|
||||||
|
To compile paradiseo-mo in the default directory,
|
||||||
|
go to paradiseo-mo/build/ and run:
|
||||||
|
> cmake ../ -Dconfig=<absolute path to the install.cmake file>
|
||||||
|
> make
|
||||||
|
// for an easy-use of the provided lessons
|
||||||
|
> make install
|
||||||
|
// optional (if the documentation is not already available)
|
||||||
|
> make doc
|
||||||
|
|
||||||
|
To compile paradiseo-mo anywhere else, simply run:
|
||||||
|
> cmake $(MO) -Dconfig=<absolute path to the install.cmake file>
|
||||||
|
> make
|
||||||
|
// for an easy-use of the provided lessons
|
||||||
|
> make install
|
||||||
|
// optional (if the documentation is not already available)
|
||||||
|
> make doc
|
||||||
|
|
||||||
|
where $(MO) is the top-level directory of PARADISEO-MO.
|
||||||
|
|
||||||
|
To clean everything, simply run
|
||||||
|
> make clean
|
||||||
|
|
||||||
|
======================================================================
|
||||||
|
DIRECTORY STRUCTURE
|
||||||
|
======================================================================
|
||||||
|
After unpacking the archive file, you should end up with the following
|
||||||
|
structure:
|
||||||
|
|
||||||
|
.../ The MAIN PARADISEO-MO directory, created when unpacking.
|
||||||
|
|
|
||||||
|
+-- build Repertory where the executables will be produced.
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- src SOURCE directory contains most PARADISEO-MO .h files.
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- doc DOCUMENTATION directory (generated by Doxygen).
|
||||||
|
| |
|
||||||
|
| +- html HTML files - start at index.html.
|
||||||
|
| |
|
||||||
|
| +- latex latex files - use to generate Postcript doc.
|
||||||
|
| |
|
||||||
|
| +- man Unix man format documentation.
|
||||||
|
|
|
||||||
|
|
|
||||||
|
+-- tutorial TUTORIAL with lessons
|
||||||
|
|
|
||||||
|
+- Lesson1 How make a Hill Climbing. Example on the oneMax problem.
|
||||||
|
|
|
||||||
|
+- Lesson2 How make a Neighborhood.
|
||||||
|
|
|
||||||
|
+- Lesson3 How make a Simulated Annealing. Example on the QUEEN problem.
|
||||||
|
|
|
||||||
|
+- Lesson4 How make a Simple Tabu Search. Example on the QUEEN problem.
|
||||||
|
|
|
||||||
|
+- Lesson5 How make a Iterated Tabu Search on the QUEEN problem.
|
||||||
|
|
|
||||||
|
+- Lesson6 How make a Landscape analysis.
|
||||||
|
|
|
||||||
|
+- Lesson7 How make a Hybridization between a algorithm genetic and a local search.
|
||||||
|
|
||||||
|
|
||||||
|
===================================================================
|
||||||
|
NOTES
|
||||||
|
===================================================================
|
||||||
|
|
||||||
|
Mailing list : paradiseo-help@lists.gforge.inria.fr
|
||||||
26
branches/rc2.0/paradiseo-mo/doc/CMakeLists.txt
Executable file
26
branches/rc2.0/paradiseo-mo/doc/CMakeLists.txt
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
### MO Doc generation using Doxygen
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
IF (DOXYGEN_FOUND)
|
||||||
|
|
||||||
|
SET(DOC_DIR ${CMAKE_BINARY_DIR}/doc CACHE PATH "MO documentation directory")
|
||||||
|
SET(MO_DOC_CONFIG_FILE "mo.doxyfile" CACHE PATH "MO documentation configuration file")
|
||||||
|
# define the doc target
|
||||||
|
IF (DOXYGEN_EXECUTABLE)
|
||||||
|
ADD_CUSTOM_TARGET(doc
|
||||||
|
COMMAND ${DOXYGEN_EXECUTABLE} ${MO_DOC_CONFIG_FILE}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
)
|
||||||
|
ENDIF (DOXYGEN_EXECUTABLE)
|
||||||
|
|
||||||
|
# configure doxyfile file
|
||||||
|
CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/doc/${MO_DOC_CONFIG_FILE}.cmake"
|
||||||
|
"${CMAKE_BINARY_DIR}/doc/${MO_DOC_CONFIG_FILE}")
|
||||||
|
|
||||||
|
ELSE (DOXYGEN_FOUND)
|
||||||
|
MESSAGE(STATUS "Unable to generate the documentation, Doxygen package not found")
|
||||||
|
ENDIF (DOXYGEN_FOUND)
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
52
branches/rc2.0/paradiseo-mo/doc/index.h
Normal file
52
branches/rc2.0/paradiseo-mo/doc/index.h
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
/** @mainpage Welcome to ParadisEO-MO
|
||||||
|
|
||||||
|
@section Introduction
|
||||||
|
|
||||||
|
ParadisEO-MO is a white-box object-oriented generic framework dedicated to the flexible design of local search algorithms (hill-climbing, tabu search, simulated annealing, ...)
|
||||||
|
|
||||||
|
@section tutorials Tutorials
|
||||||
|
|
||||||
|
Tutorials for ParadisEO-MO are available in the "Tutorials section" of the <a href="http://paradiseo.gforge.inria.fr">ParadisEO website</a>.
|
||||||
|
|
||||||
|
@section Design
|
||||||
|
|
||||||
|
For an introduction to the design of ParadisEO-MO,
|
||||||
|
you can look at the <a href="http://paradiseo.gforge.inria.fr">ParadisEO website</a>.
|
||||||
|
|
||||||
|
@section LICENSE
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @page webpages Related webpages
|
||||||
|
|
||||||
|
- ParadisEO <a href="http://paradiseo.gforge.inria.fr">homepage</a>
|
||||||
|
- INRIA GForge <a href="http://gforge.inria.fr/projects/paradiseo/">project page</a>
|
||||||
|
- <a href="../../README">README</a>
|
||||||
|
*/
|
||||||
1523
branches/rc2.0/paradiseo-mo/doc/mo.doxyfile.cmake
Normal file
1523
branches/rc2.0/paradiseo-mo/doc/mo.doxyfile.cmake
Normal file
File diff suppressed because it is too large
Load diff
130
branches/rc2.0/paradiseo-mo/install.cmake
Normal file
130
branches/rc2.0/paradiseo-mo/install.cmake
Normal file
|
|
@ -0,0 +1,130 @@
|
||||||
|
######################################################################################
|
||||||
|
### CMake basic configuration
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
# check cmake version compatibility
|
||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
||||||
|
|
||||||
|
# regular expression checking
|
||||||
|
INCLUDE_REGULAR_EXPRESSION("^.*$" "^$")
|
||||||
|
|
||||||
|
# set a language for the entire project.
|
||||||
|
ENABLE_LANGUAGE(CXX)
|
||||||
|
ENABLE_LANGUAGE(C)
|
||||||
|
|
||||||
|
####################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
### Include required modules & utilities
|
||||||
|
#####################################################################################
|
||||||
|
INCLUDE(CMakeBackwardCompatibilityCXX)
|
||||||
|
|
||||||
|
INCLUDE(FindDoxygen)
|
||||||
|
|
||||||
|
INCLUDE(FindGnuplot)
|
||||||
|
|
||||||
|
INCLUDE(CheckLibraryExists)
|
||||||
|
|
||||||
|
INCLUDE(Dart OPTIONAL)
|
||||||
|
|
||||||
|
INCLUDE(CPack)
|
||||||
|
|
||||||
|
# Set a special flag if the environment is windows (should do the same in a config.g file)
|
||||||
|
IF (WIN32)
|
||||||
|
ADD_DEFINITIONS(-D_WINDOWS=1)
|
||||||
|
ENDIF (WIN32)
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
### 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)
|
||||||
|
|
||||||
|
FIND_PROGRAM(MEMORYCHECK_COMMAND
|
||||||
|
NAMES purify valgrind
|
||||||
|
PATHS
|
||||||
|
"/usr/local/bin /usr/bin [HKEY_LOCAL_MACHINE\\SOFTWARE\\Rational Software\\Purify\\Setup;InstallFolder]"
|
||||||
|
DOC "Path to the memory checking command, used for memory error detection.")
|
||||||
|
|
||||||
|
IF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
SET( CMAKE_BUILD_TYPE
|
||||||
|
${CMAKE_DEFAULT_BUILD_TYPE} CACHE STRING
|
||||||
|
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
|
||||||
|
FORCE)
|
||||||
|
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
IF(WIN32 AND NOT CYGWIN)
|
||||||
|
IF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||||
|
IF(NOT WITH_SHARED_LIBS)
|
||||||
|
IF(CMAKE_GENERATOR STREQUAL "Visual Studio 8 2005" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10")
|
||||||
|
SET(CMAKE_CXX_FLAGS "/nologo /Gy")
|
||||||
|
SET(CMAKE_CXX_FLAGS_DEBUG "/W3 /MTd /Z7 /Od")
|
||||||
|
SET(CMAKE_CXX_FLAGS_RELEASE "/w /MT /O2 /wd4530")
|
||||||
|
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" OR CMAKE_GENERATOR STREQUAL "Visual Studio 9 2008" OR CMAKE_GENERATOR STREQUAL "Visual Studio 10")
|
||||||
|
ENDIF(NOT WITH_SHARED_LIBS)
|
||||||
|
ENDIF(CMAKE_CXX_COMPILER MATCHES cl)
|
||||||
|
ELSE(WIN32 AND NOT CYGWIN)
|
||||||
|
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fprofile-arcs -ftest-coverage -Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers")
|
||||||
|
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
|
||||||
|
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -O6")
|
||||||
|
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)
|
||||||
|
|
||||||
|
#####################################################################################
|
||||||
|
|
||||||
|
######################################################################################
|
||||||
|
### compilation of examples?
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
SET(ENABLE_CMAKE_EXAMPLE TRUE CACHE BOOL "Enable copy of benchs and parameters file?")
|
||||||
|
|
||||||
|
######################################################################################
|
||||||
|
### Test config
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
IF (ENABLE_CMAKE_TESTING OR ENABLE_MINIMAL_CMAKE_TESTING)
|
||||||
|
ENABLE_TESTING()
|
||||||
|
ENDIF (ENABLE_CMAKE_TESTING OR ENABLE_MINIMAL_CMAKE_TESTING)
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
#######################################################################################
|
||||||
|
### Paths to EO, MO and MOEO must be specified above.
|
||||||
|
#######################################################################################
|
||||||
|
|
||||||
|
SET(EO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-eo" CACHE PATH "ParadisEO-EO source directory" FORCE)
|
||||||
|
SET(EO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-eo/build" CACHE PATH "ParadisEO-EO binary directory" FORCE)
|
||||||
|
|
||||||
|
SET(MO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-mo" CACHE PATH "ParadisMO-MO source directory" FORCE)
|
||||||
|
SET(MO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-mo/build" CACHE PATH "ParadisMO-MO binary directory" FORCE)
|
||||||
|
|
||||||
|
SET(OLDMO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-old-mo" CACHE PATH "ParadisMO-MO source directory" FORCE)
|
||||||
|
SET(OLDMO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-old-mo/build" CACHE PATH "ParadisMO-MO binary directory" FORCE)
|
||||||
|
|
||||||
|
SET(MOEO_SRC_DIR "${CMAKE_SOURCE_DIR}/../paradiseo-moeo" CACHE PATH "ParadisMOEO-MOEO source directory" FORCE)
|
||||||
|
SET(MOEO_BIN_DIR "${CMAKE_BINARY_DIR}/../../paradiseo-moeo/build" CACHE PATH "ParadisMOEO-MOEO binary directory" FORCE)
|
||||||
|
|
||||||
|
SET(PROBLEMS_SRC_DIR "${CMAKE_SOURCE_DIR}/../problems" CACHE PATH "Problems dependant source directory" FORCE)
|
||||||
|
|
||||||
|
######################################################################################
|
||||||
|
######################################################################################
|
||||||
|
### Subdirectories that CMake should process for MO, MOEO and PEO
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
|
ADD_SUBDIRECTORY(doc)
|
||||||
|
ADD_SUBDIRECTORY(src)
|
||||||
|
ADD_SUBDIRECTORY(test)
|
||||||
|
ADD_SUBDIRECTORY(tutorial)
|
||||||
|
######################################################################################
|
||||||
|
|
||||||
3
branches/rc2.0/paradiseo-mo/src/CMakeLists.txt
Normal file
3
branches/rc2.0/paradiseo-mo/src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
###############################################################
|
||||||
|
# This is a dummy file
|
||||||
|
###############################################################
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
<moAcceptanceCriterion.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moAcceptanceCriterion_h
|
||||||
|
#define _moAcceptanceCriterion_h
|
||||||
|
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
#include <memory/moMemory.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for Acceptance criteria
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moAcceptanceCriterion : public eoBF<typename Neighbor::EOT&, typename Neighbor::EOT&, bool>, virtual public moMemory<Neighbor> {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
<moAlwaysAcceptCrit.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moAlwaysAcceptCrit_h
|
||||||
|
#define _moAlwaysAcceptCrit_h
|
||||||
|
|
||||||
|
#include <acceptCrit/moAcceptanceCriterion.h>
|
||||||
|
#include <memory/moDummyMemory.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acceptance Criterion for extreme diversification : always accept new solution
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moAlwaysAcceptCrit : public moAcceptanceCriterion<Neighbor>, public moDummyMemory<Neighbor> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Always accept the new solution
|
||||||
|
* @param _sol1 the previous solution
|
||||||
|
* @param _sol2 the new solution after local search
|
||||||
|
* @return always true
|
||||||
|
*/
|
||||||
|
bool operator()(EOT& _sol1, EOT& _sol2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
<moBetterAcceptCrit.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moBetterAcceptCrit_h
|
||||||
|
#define _moBetterAcceptCrit_h
|
||||||
|
|
||||||
|
#include <acceptCrit/moAcceptanceCriterion.h>
|
||||||
|
#include <memory/moDummyMemory.h>
|
||||||
|
#include <comparator/moSolComparator.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acceptance Criterion for extreme intensification : accept if the new solution is better than previous one
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moBetterAcceptCrit : public moAcceptanceCriterion<Neighbor>, public moDummyMemory<Neighbor> {
|
||||||
|
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
/*
|
||||||
|
constructor with a specific comparator
|
||||||
|
|
||||||
|
@param _comparator the comparaison method of two solutions
|
||||||
|
*/
|
||||||
|
moBetterAcceptCrit(moSolComparator<EOT>& _comparator):comparator(_comparator) {}
|
||||||
|
|
||||||
|
/*
|
||||||
|
default constructor:
|
||||||
|
compare the fitness value: accept if the fitness is higher
|
||||||
|
*/
|
||||||
|
moBetterAcceptCrit():comparator(defaultComparator) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accept if the new solution is better than previous one according to the comparator
|
||||||
|
* @param _sol1 the previous solution
|
||||||
|
* @param _sol2 the new solution after local search
|
||||||
|
* @return true if the new solution is better than previous one
|
||||||
|
*/
|
||||||
|
bool operator()(EOT& _sol1, EOT& _sol2) {
|
||||||
|
return comparator(_sol1, _sol2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
moSolComparator<EOT>& comparator;
|
||||||
|
|
||||||
|
moSolComparator<EOT> defaultComparator;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
56
branches/rc2.0/paradiseo-mo/src/algo/eoDummyMonOp.h
Normal file
56
branches/rc2.0/paradiseo-mo/src/algo/eoDummyMonOp.h
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
<moDummyMonOp.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moDummyMonOp_h
|
||||||
|
#define _moDummyMonOp_h
|
||||||
|
|
||||||
|
#include <eoOp.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mutation operator that does nothing at all !
|
||||||
|
*/
|
||||||
|
template<class EOT>
|
||||||
|
class eoDummyMonOp: public eoMonOp<EOT> {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Do nothing on the solution
|
||||||
|
* @param _solution the related solution
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
71
branches/rc2.0/paradiseo-mo/src/algo/moDummyLS.h
Normal file
71
branches/rc2.0/paradiseo-mo/src/algo/moDummyLS.h
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
<moDummyLS.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moDummyLS_h
|
||||||
|
#define _moDummyLS_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moDummyExplorer.h>
|
||||||
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy Local Search:
|
||||||
|
*
|
||||||
|
* To do nothing, only the full evaluation of the solution if necessary ;-)
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moDummyLS: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
*/
|
||||||
|
moDummyLS(eoEvalFunc<EOT>& _fullEval):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moDummyLS";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// always true continuator
|
||||||
|
moTrueContinuator<Neighbor> trueCont;
|
||||||
|
// dummy Explorer
|
||||||
|
moDummyExplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
120
branches/rc2.0/paradiseo-mo/src/algo/moFirstImprHC.h
Normal file
120
branches/rc2.0/paradiseo-mo/src/algo/moFirstImprHC.h
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
/*
|
||||||
|
<moFirstImprHC.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moFirstImprHC_h
|
||||||
|
#define _moFirstImprHC_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moFirstImprHCexplorer.h>
|
||||||
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* First improvement HC:
|
||||||
|
* Hill-Climbing local search
|
||||||
|
*
|
||||||
|
* At each iteration,
|
||||||
|
* one of the random solution in the neighborhood is selected
|
||||||
|
* if the selected neighbor have higher fitness than the current solution
|
||||||
|
* then the solution is replaced by the selected neighbor
|
||||||
|
* the algorithm stops when there is no higher neighbor
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moFirstImprHC: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
*/
|
||||||
|
moFirstImprHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cont an external continuator
|
||||||
|
*/
|
||||||
|
moFirstImprHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cont an external continuator
|
||||||
|
* @param _compN a neighbor vs neighbor comparator
|
||||||
|
* @param _compSN a solution vs neighbor comparator
|
||||||
|
*/
|
||||||
|
moFirstImprHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, _compN, _compSN)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to never stop the hill climbing
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual void alwaysContinue() {
|
||||||
|
explorer.alwaysContinue();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class id.
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moFirstImprHV";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// always true continuator
|
||||||
|
moTrueContinuator<Neighbor> trueCont;
|
||||||
|
// compare the fitness values of neighbors: true if strictly greater
|
||||||
|
moNeighborComparator<Neighbor> defaultNeighborComp;
|
||||||
|
// compare the fitness values of the solution and the neighbor: true if strictly greater
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
// the explorer of the first improvement HC
|
||||||
|
moFirstImprHCexplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
118
branches/rc2.0/paradiseo-mo/src/algo/moILS.h
Normal file
118
branches/rc2.0/paradiseo-mo/src/algo/moILS.h
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
<moILS.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moILS_h
|
||||||
|
#define _moILS_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moILSexplorer.h>
|
||||||
|
#include <continuator/moIterContinuator.h>
|
||||||
|
#include <eoOp.h>
|
||||||
|
#include <neighborhood/moDummyNeighbor.h>
|
||||||
|
#include <perturb/moMonOpPerturb.h>
|
||||||
|
#include <perturb/moPerturbation.h>
|
||||||
|
#include <acceptCrit/moAlwaysAcceptCrit.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterated Local Search
|
||||||
|
*/
|
||||||
|
template<class Neighbor, class NeighborLO = moDummyNeighbor<typename Neighbor::EOT> >
|
||||||
|
class moILS: public moLocalSearch< NeighborLO >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor for Iterated Local Search
|
||||||
|
* @param _ls the local search to iterates
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _op the operator used to perturb solution
|
||||||
|
* @param _nbIteration the time limit for search
|
||||||
|
*/
|
||||||
|
moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, eoMonOp<EOT>& _op, unsigned int _nbIteration):
|
||||||
|
moLocalSearch< moDummyNeighbor<EOT> >(explorer, iterCont, _fullEval),
|
||||||
|
iterCont(_nbIteration),
|
||||||
|
defaultPerturb(_op, _fullEval),
|
||||||
|
explorer(_ls, defaultPerturb, defaultAccept)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for Iterated Local Search
|
||||||
|
* @param _ls the local search to iterates
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _op the operator used to perturb solution
|
||||||
|
* @param _cont a continuator
|
||||||
|
*/
|
||||||
|
moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, eoMonOp<EOT>& _op, moContinuator<NeighborLO>& _cont):
|
||||||
|
moLocalSearch< NeighborLO >(explorer, _cont, _fullEval),
|
||||||
|
iterCont(0),
|
||||||
|
defaultPerturb(_op, _fullEval),
|
||||||
|
explorer(_ls, defaultPerturb, defaultAccept)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for Iterated Local Search
|
||||||
|
* @param _ls the local search to iterates
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _cont a continuator
|
||||||
|
* @param _perturb a perturbation operator
|
||||||
|
* @param _accept a acceptance criteria
|
||||||
|
*/
|
||||||
|
// moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, moContinuator<moDummyNeighbor<EOT> >& _cont, moMonOpPerturb<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _accept):
|
||||||
|
// moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, moContinuator<NeighborLO>& _cont, moPerturbation<Neighbor>& _perturb):
|
||||||
|
moILS(moLocalSearch<Neighbor>& _ls, eoEvalFunc<EOT>& _fullEval, moContinuator<NeighborLO>& _cont, moPerturbation<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _accept):
|
||||||
|
moLocalSearch<NeighborLO>(explorer, _cont, _fullEval),
|
||||||
|
iterCont(0),
|
||||||
|
defaultPerturb(dummyOp, _fullEval),
|
||||||
|
explorer(_ls, _perturb, _accept)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
class dummmyMonOp: public eoMonOp<EOT> {
|
||||||
|
public:
|
||||||
|
bool operator()(EOT&) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} dummyOp;
|
||||||
|
|
||||||
|
moIterContinuator<moDummyNeighbor<EOT> > iterCont;
|
||||||
|
moMonOpPerturb<Neighbor> defaultPerturb;
|
||||||
|
moAlwaysAcceptCrit<Neighbor> defaultAccept;
|
||||||
|
moILSexplorer< Neighbor , NeighborLO > explorer; // inherits from moNeighborhoodExplorer< NeighborLO >
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
146
branches/rc2.0/paradiseo-mo/src/algo/moLocalSearch.h
Normal file
146
branches/rc2.0/paradiseo-mo/src/algo/moLocalSearch.h
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
/*
|
||||||
|
<moLocalSearch.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moLocalSearch_h
|
||||||
|
#define _moLocalSearch_h
|
||||||
|
|
||||||
|
#include <explorer/moNeighborhoodExplorer.h>
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
#include <eoOp.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the main algorithm of the local search
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moLocalSearch: public eoMonOp<typename Neighbor::EOT> {
|
||||||
|
public:
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood;
|
||||||
|
typedef moNeighborhoodExplorer<Neighbor> NeighborhoodExplorer;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of a moLocalSearch
|
||||||
|
* @param _searchExpl a neighborhood explorer
|
||||||
|
* @param _cont an external continuator (can be a checkpoint!)
|
||||||
|
* @param _fullEval a full evaluation function
|
||||||
|
*/
|
||||||
|
moLocalSearch(NeighborhoodExplorer& _searchExpl,
|
||||||
|
moContinuator<Neighbor> & _cont, eoEvalFunc<EOT>& _fullEval) :
|
||||||
|
searchExplorer(_searchExpl), cont(&_cont), fullEval(_fullEval) {
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the local search on a solution
|
||||||
|
* @param _solution the related solution
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
|
||||||
|
if (_solution.invalid())
|
||||||
|
fullEval(_solution);
|
||||||
|
|
||||||
|
// initialization of the parameter of the search (for example fill empty the tabu list)
|
||||||
|
searchExplorer.initParam(_solution);
|
||||||
|
|
||||||
|
// initialization of the external continuator (for example the time, or the number of generations)
|
||||||
|
cont->init(_solution);
|
||||||
|
|
||||||
|
bool b;
|
||||||
|
do {
|
||||||
|
// explore the neighborhood of the solution
|
||||||
|
searchExplorer(_solution);
|
||||||
|
// if a solution in the neighborhood can be accepted
|
||||||
|
if (searchExplorer.accept(_solution)) {
|
||||||
|
searchExplorer.move(_solution);
|
||||||
|
searchExplorer.moveApplied(true);
|
||||||
|
} else
|
||||||
|
searchExplorer.moveApplied(false);
|
||||||
|
|
||||||
|
// update the parameter of the search (for ex. Temperature of the SA)
|
||||||
|
searchExplorer.updateParam(_solution);
|
||||||
|
|
||||||
|
b = (*cont)(_solution);
|
||||||
|
} while (b && searchExplorer.isContinue(_solution));
|
||||||
|
|
||||||
|
searchExplorer.terminate(_solution);
|
||||||
|
|
||||||
|
cont->lastCall(_solution);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an external continuator
|
||||||
|
* @param _cont the external continuator
|
||||||
|
*/
|
||||||
|
void setContinuator(moContinuator<Neighbor> & _cont) {
|
||||||
|
cont = &_cont;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* external continuator object
|
||||||
|
*
|
||||||
|
* @overload
|
||||||
|
* @return the external continuator
|
||||||
|
*/
|
||||||
|
moContinuator<Neighbor>* getContinuator() const {
|
||||||
|
return cont;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to get the neighborhood explorer
|
||||||
|
*
|
||||||
|
* @overload
|
||||||
|
* @return the neighborhood explorer
|
||||||
|
*/
|
||||||
|
moNeighborhoodExplorer<Neighbor> & getNeighborhoodExplorer() const {
|
||||||
|
return searchExplorer;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// make the exploration of the neighborhood according to a local search heuristic
|
||||||
|
moNeighborhoodExplorer<Neighbor>& searchExplorer;
|
||||||
|
|
||||||
|
// external continuator
|
||||||
|
moContinuator<Neighbor> * cont;
|
||||||
|
|
||||||
|
//full evaluation function
|
||||||
|
eoEvalFunc<EOT>& fullEval;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
110
branches/rc2.0/paradiseo-mo/src/algo/moMetropolisHasting.h
Normal file
110
branches/rc2.0/paradiseo-mo/src/algo/moMetropolisHasting.h
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
<moMetropolisHasting.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moMetropolisHasting_h
|
||||||
|
#define _moMetropolisHasting_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moMetropolisHastingExplorer.h>
|
||||||
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metropolis-Hasting local search
|
||||||
|
* Only the symetric case is considered when Q(x,y) = Q(y,x)
|
||||||
|
* Fitness must be > 0
|
||||||
|
*
|
||||||
|
* At each iteration,
|
||||||
|
* one of the random solution in the neighborhood is selected
|
||||||
|
* if the selected neighbor have higher or equal fitness than the current solution
|
||||||
|
* then the solution is replaced by the selected neighbor
|
||||||
|
* if a random number from [0,1] is lower than fitness(neighbor) / fitness(solution)
|
||||||
|
* then the solution is replaced by the selected neighbor
|
||||||
|
* the algorithm stops when the number of iterations is too large
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moMetropolisHasting: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor of the Metropolis-Hasting
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStep maximum step to do
|
||||||
|
*/
|
||||||
|
moMetropolisHasting(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor of the Metropolis-Hasting
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStep maximum step to do
|
||||||
|
* @param _cont an external continuator
|
||||||
|
*/
|
||||||
|
moMetropolisHasting(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor of the Metropolis-Hasting
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStep maximum step to do
|
||||||
|
* @param _cont an external continuator
|
||||||
|
* @param _compN a neighbor vs neighbor comparator
|
||||||
|
* @param _compSN a solution vs neighbor comparator
|
||||||
|
*/
|
||||||
|
moMetropolisHasting(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, _compN, _compSN, _nbStep)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// always true continuator
|
||||||
|
moTrueContinuator<Neighbor> trueCont;
|
||||||
|
// compare the fitness values of neighbors
|
||||||
|
moNeighborComparator<Neighbor> defaultNeighborComp;
|
||||||
|
// compare the fitness values of the solution and the neighbor
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
// MetropolisHasting explorer
|
||||||
|
moMetropolisHastingExplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
106
branches/rc2.0/paradiseo-mo/src/algo/moNeutralHC.h
Normal file
106
branches/rc2.0/paradiseo-mo/src/algo/moNeutralHC.h
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*
|
||||||
|
<moNeutralHC.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moNeutralHC_h
|
||||||
|
#define _moNeutralHC_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moNeutralHCexplorer.h>
|
||||||
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hill-Climbing local search
|
||||||
|
*
|
||||||
|
* At each iteration,
|
||||||
|
* one of the random best solution in the neighborhood is selected
|
||||||
|
* if the selected neighbor have higher or equal fitness than the current solution
|
||||||
|
* then the solution is replaced by the selected neighbor
|
||||||
|
* the algorithm stops when there is no higher or equal neighbor, or if the number of iterations is too large
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moNeutralHC: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStep maximum step to do
|
||||||
|
*/
|
||||||
|
moNeutralHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStep maximum step to do
|
||||||
|
* @param _cont an external continuator
|
||||||
|
*/
|
||||||
|
moNeutralHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _nbStep)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStep maximum step to do
|
||||||
|
* @param _cont an external continuator
|
||||||
|
* @param _compN a neighbor vs neighbor comparator
|
||||||
|
* @param _compSN a solution vs neighbor comparator
|
||||||
|
*/
|
||||||
|
moNeutralHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned int _nbStep, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, _compN, _compSN, _nbStep)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// always true continuator
|
||||||
|
moTrueContinuator<Neighbor> trueCont;
|
||||||
|
// compare the fitness values of neighbors
|
||||||
|
moNeighborComparator<Neighbor> defaultNeighborComp;
|
||||||
|
// compare the fitness values of the solution and the neighbor
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
// the explorer of the HC with neutral move (equals fitness move)
|
||||||
|
moNeutralHCexplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
104
branches/rc2.0/paradiseo-mo/src/algo/moRandomBestHC.h
Normal file
104
branches/rc2.0/paradiseo-mo/src/algo/moRandomBestHC.h
Normal file
|
|
@ -0,0 +1,104 @@
|
||||||
|
/*
|
||||||
|
<moRandomBestHC.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moRandomBestHC_h
|
||||||
|
#define _moRandomBestHC_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moRandomBestHCexplorer.h>
|
||||||
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Random Best HC:
|
||||||
|
* Hill-Climbing local search
|
||||||
|
*
|
||||||
|
* At each iteration,
|
||||||
|
* one of the random best solution in the neighborhood is selected
|
||||||
|
* if the selected neighbor have higher fitness than the current solution
|
||||||
|
* then the solution is replaced by the selected neighbor
|
||||||
|
* the algorithm stops when there is no higher neighbor
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moRandomBestHC: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
*/
|
||||||
|
moRandomBestHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cont an external continuator
|
||||||
|
*/
|
||||||
|
moRandomBestHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cont an external continuator
|
||||||
|
* @param _compN a neighbor vs neighbor comparator
|
||||||
|
* @param _compSN a solution vs neighbor comparator
|
||||||
|
*/
|
||||||
|
moRandomBestHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, _compN, _compSN)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// always true continuator
|
||||||
|
moTrueContinuator<Neighbor> trueCont;
|
||||||
|
// compare the fitness values of neighbors
|
||||||
|
moNeighborComparator<Neighbor> defaultNeighborComp;
|
||||||
|
// compare the fitness values of the solution and the neighbor
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
// the explorer of the HC with random choice of the best solution
|
||||||
|
moRandomBestHCexplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
102
branches/rc2.0/paradiseo-mo/src/algo/moRandomNeutralWalk.h
Normal file
102
branches/rc2.0/paradiseo-mo/src/algo/moRandomNeutralWalk.h
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
<moRandomNeutralWalk.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moRandomNeutralWalk_h
|
||||||
|
#define _moRandomNeutralWalk_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moRandomNeutralWalkExplorer.h>
|
||||||
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Random Neutral Walk:
|
||||||
|
* Random Neutral walk local search
|
||||||
|
*
|
||||||
|
* At each iteration,
|
||||||
|
* one random neighbor with the same fitness is selected and replace the current solution
|
||||||
|
* the algorithm stops when the number of steps is reached
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moRandomNeutralWalk: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor for a random walk
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStepMax number of step of the walk
|
||||||
|
*/
|
||||||
|
moRandomNeutralWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultSolNeighborComp, _nbStepMax)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a random walk
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStepMax number of step of the walk
|
||||||
|
* @param _cont an external continuator
|
||||||
|
*/
|
||||||
|
moRandomNeutralWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultSolNeighborComp, _nbStepMax)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a random walk
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStepMax number of step of the walk
|
||||||
|
* @param _cont an external continuator
|
||||||
|
* @param _comp a solution vs neighbor comparator
|
||||||
|
*/
|
||||||
|
moRandomNeutralWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax, moContinuator<Neighbor>& _cont, moSolNeighborComparator<Neighbor>& _comp):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, _comp, _nbStepMax)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// always true continuator
|
||||||
|
moTrueContinuator<Neighbor> trueCont;
|
||||||
|
// the explorer of the random walk
|
||||||
|
moRandomNeutralWalkExplorer<Neighbor> explorer;
|
||||||
|
// compare the fitness values of the solution and the neighbor
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
90
branches/rc2.0/paradiseo-mo/src/algo/moRandomSearch.h
Normal file
90
branches/rc2.0/paradiseo-mo/src/algo/moRandomSearch.h
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
<moRandomSearch.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moRandomSearch_h
|
||||||
|
#define _moRandomSearch_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moRandomSearchExplorer.h>
|
||||||
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
#include <eoInit.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Random Search:
|
||||||
|
* Pure random search local search
|
||||||
|
*
|
||||||
|
* At each iteration,
|
||||||
|
* one random solution is selected and replace the current solution
|
||||||
|
* the algorithm stops when the number of solution is reached
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moRandomSearch: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a random search
|
||||||
|
* @param _init the solution initializer, to explore at random the search space
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _nbSolMax number of solutions
|
||||||
|
*/
|
||||||
|
moRandomSearch(eoInit<EOT> & _init, eoEvalFunc<EOT>& _fullEval, unsigned _nbSolMax):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||||
|
explorer(_init, _fullEval, _nbSolMax>0?_nbSolMax - 1:0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a random search
|
||||||
|
* @param _init the solution initializer, to explore at random the search space
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _nbSolMax number of solutions
|
||||||
|
* @param _cont external continuator
|
||||||
|
*/
|
||||||
|
moRandomSearch(eoInit<EOT> & _init, eoEvalFunc<EOT>& _fullEval, unsigned _nbSolMax, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_init, _fullEval, _nbSolMax>0?_nbSolMax - 1:0)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moRandomSearch";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// always true continuator
|
||||||
|
moTrueContinuator<Neighbor> trueCont;
|
||||||
|
// the explorer of the random walk
|
||||||
|
moRandomSearchExplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
87
branches/rc2.0/paradiseo-mo/src/algo/moRandomWalk.h
Normal file
87
branches/rc2.0/paradiseo-mo/src/algo/moRandomWalk.h
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
<moRandomWalk.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moRandomWalk_h
|
||||||
|
#define _moRandomWalk_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moRandomWalkExplorer.h>
|
||||||
|
#include <continuator/moIterContinuator.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Random Walk:
|
||||||
|
* Random walk local search
|
||||||
|
*
|
||||||
|
* At each iteration,
|
||||||
|
* one random neighbor is selected and replace the current solution
|
||||||
|
* the algorithm stops when the number of steps is reached
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moRandomWalk: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a random walk
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _nbStepMax number of step of the walk
|
||||||
|
*/
|
||||||
|
moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax):
|
||||||
|
moLocalSearch<Neighbor>(explorer, iterCont, _fullEval),
|
||||||
|
iterCont(_nbStepMax),
|
||||||
|
explorer(_neighborhood, _eval)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a random walk
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cont a user-defined continuator
|
||||||
|
*/
|
||||||
|
moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
iterCont(0),
|
||||||
|
explorer(_neighborhood, _eval)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// the continuator to stop on a maximum number of step
|
||||||
|
moIterContinuator<Neighbor> iterCont;
|
||||||
|
// the explorer of the random walk
|
||||||
|
moRandomWalkExplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
120
branches/rc2.0/paradiseo-mo/src/algo/moSA.h
Normal file
120
branches/rc2.0/paradiseo-mo/src/algo/moSA.h
Normal file
|
|
@ -0,0 +1,120 @@
|
||||||
|
/*
|
||||||
|
<moSA.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moSA_h
|
||||||
|
#define _moSA_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moSAexplorer.h>
|
||||||
|
#include <coolingSchedule/moCoolingSchedule.h>
|
||||||
|
#include <coolingSchedule/moSimpleCoolingSchedule.h>
|
||||||
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simulated Annealing
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moSA: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor for a simulated annealing
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _initT initial temperature for cooling schedule (default = 10)
|
||||||
|
* @param _alpha factor of decreasing for cooling schedule (default = 0.9)
|
||||||
|
* @param _span number of iteration with equal temperature for cooling schedule (default = 100)
|
||||||
|
* @param _finalT final temperature, threshold of the stopping criteria for cooling schedule (default = 0.01)
|
||||||
|
*/
|
||||||
|
moSA(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, double _initT=10, double _alpha=0.9, unsigned _span=100, double _finalT=0.01):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||||
|
defaultCool(_initT, _alpha, _span, _finalT),
|
||||||
|
explorer(_neighborhood, _eval, defaultSolNeighborComp, defaultCool)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a simulated annealing
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cool a cooling schedule
|
||||||
|
*/
|
||||||
|
moSA(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moCoolingSchedule<EOT>& _cool):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||||
|
defaultCool(0, 0, 0, 0),
|
||||||
|
explorer(_neighborhood, _eval, defaultSolNeighborComp, _cool)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a simulated annealing
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cool a cooling schedule
|
||||||
|
* @param _cont an external continuator
|
||||||
|
*/
|
||||||
|
moSA(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moCoolingSchedule<EOT>& _cool, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
defaultCool(0, 0, 0, 0),
|
||||||
|
explorer(_neighborhood, _eval, defaultSolNeighborComp, _cool)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a simulated annealing
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cool a cooling schedule
|
||||||
|
* @param _comp a solution vs neighbor comparator
|
||||||
|
* @param _cont an external continuator
|
||||||
|
*/
|
||||||
|
moSA(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moCoolingSchedule<EOT>& _cool, moSolNeighborComparator<Neighbor>& _comp, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
defaultCool(0, 0, 0, 0),
|
||||||
|
explorer(_neighborhood, _eval, _comp, _cool)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
moTrueContinuator<Neighbor> trueCont;
|
||||||
|
moSimpleCoolingSchedule<EOT> defaultCool;
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
moSAexplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
104
branches/rc2.0/paradiseo-mo/src/algo/moSimpleHC.h
Normal file
104
branches/rc2.0/paradiseo-mo/src/algo/moSimpleHC.h
Normal file
|
|
@ -0,0 +1,104 @@
|
||||||
|
/*
|
||||||
|
<moSimpleHC.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moSimpleHC_h
|
||||||
|
#define _moSimpleHC_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moSimpleHCexplorer.h>
|
||||||
|
#include <continuator/moTrueContinuator.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple HC:
|
||||||
|
* Hill-Climbing local search
|
||||||
|
*
|
||||||
|
* At each iteration,
|
||||||
|
* the first best solution in the neighborhood is selected
|
||||||
|
* if the selected neighbor have higher fitness than the current solution
|
||||||
|
* then the solution is replaced by the selected neighbor
|
||||||
|
* the algorithm stops when there is no higher neighbor
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moSimpleHC: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
*/
|
||||||
|
moSimpleHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval):
|
||||||
|
moLocalSearch<Neighbor>(explorer, trueCont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cont an external continuator
|
||||||
|
*/
|
||||||
|
moSimpleHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a hill-climber
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cont an external continuator
|
||||||
|
* @param _compN a neighbor vs neighbor comparator
|
||||||
|
* @param _compSN a solution vs neighbor comparator
|
||||||
|
*/
|
||||||
|
moSimpleHC(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, moContinuator<Neighbor>& _cont, moNeighborComparator<Neighbor>& _compN, moSolNeighborComparator<Neighbor>& _compSN):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_neighborhood, _eval, _compN, _compSN)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// always true continuator
|
||||||
|
moTrueContinuator<Neighbor> trueCont;
|
||||||
|
// compare the fitness values of neighbors
|
||||||
|
moNeighborComparator<Neighbor> defaultNeighborComp;
|
||||||
|
// compare the fitness values of the solution and the neighbor
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
// the explorer of the simple HC
|
||||||
|
moSimpleHCexplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
164
branches/rc2.0/paradiseo-mo/src/algo/moTS.h
Normal file
164
branches/rc2.0/paradiseo-mo/src/algo/moTS.h
Normal file
|
|
@ -0,0 +1,164 @@
|
||||||
|
/*
|
||||||
|
<moTS.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moTS_h
|
||||||
|
#define _moTS_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <explorer/moTSexplorer.h>
|
||||||
|
#include <memory/moNeighborVectorTabuList.h>
|
||||||
|
#include <memory/moIntensification.h>
|
||||||
|
#include <memory/moDummyIntensification.h>
|
||||||
|
#include <memory/moDiversification.h>
|
||||||
|
#include <memory/moDummyDiversification.h>
|
||||||
|
#include <memory/moAspiration.h>
|
||||||
|
#include <memory/moBestImprAspiration.h>
|
||||||
|
#include <continuator/moTimeContinuator.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tabu Search
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moTS: public moLocalSearch<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic constructor for a tabu search
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _time the time limit for stopping criteria
|
||||||
|
* @param _tabuListSize the size of the tabu list
|
||||||
|
*/
|
||||||
|
moTS(Neighborhood& _neighborhood,
|
||||||
|
eoEvalFunc<EOT>& _fullEval,
|
||||||
|
moEval<Neighbor>& _eval,
|
||||||
|
unsigned int _time,
|
||||||
|
unsigned int _tabuListSize
|
||||||
|
):
|
||||||
|
moLocalSearch<Neighbor>(explorer, timeCont, _fullEval),
|
||||||
|
timeCont(_time),
|
||||||
|
tabuList(_tabuListSize,0),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, tabuList, dummyIntensification, dummyDiversification, defaultAspiration)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple constructor for a tabu search
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _time the time limit for stopping criteria
|
||||||
|
* @param _tabuList the tabu list
|
||||||
|
*/
|
||||||
|
moTS(Neighborhood& _neighborhood,
|
||||||
|
eoEvalFunc<EOT>& _fullEval,
|
||||||
|
moEval<Neighbor>& _eval,
|
||||||
|
unsigned int _time,
|
||||||
|
moTabuList<Neighbor>& _tabuList):
|
||||||
|
moLocalSearch<Neighbor>(explorer, timeCont, _fullEval),
|
||||||
|
timeCont(_time),
|
||||||
|
tabuList(0,0),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _tabuList, dummyIntensification, dummyDiversification, defaultAspiration)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a tabu search
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _cont an external continuator
|
||||||
|
* @param _tabuList the tabu list
|
||||||
|
* @param _aspiration the aspiration Criteria
|
||||||
|
*/
|
||||||
|
moTS(Neighborhood& _neighborhood,
|
||||||
|
eoEvalFunc<EOT>& _fullEval,
|
||||||
|
moEval<Neighbor>& _eval,
|
||||||
|
moContinuator<Neighbor>& _cont,
|
||||||
|
moTabuList<Neighbor>& _tabuList,
|
||||||
|
moAspiration<Neighbor>& _aspiration):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
timeCont(0),
|
||||||
|
tabuList(0,0),
|
||||||
|
explorer(_neighborhood, _eval, defaultNeighborComp, defaultSolNeighborComp, _tabuList, dummyIntensification, dummyDiversification, _aspiration)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* General constructor for a tabu search
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _eval neighbor's evaluation function
|
||||||
|
* @param _neighborComp a comparator between 2 neighbors
|
||||||
|
* @param _solNeighborComp a solution vs neighbor comparator
|
||||||
|
* @param _cont an external continuator
|
||||||
|
* @param _tabuList the tabu list
|
||||||
|
* @param _intensification the intensification strategy
|
||||||
|
* @param _diversification the diversification strategy
|
||||||
|
* @param _aspiration the aspiration Criteria
|
||||||
|
*/
|
||||||
|
moTS(Neighborhood& _neighborhood,
|
||||||
|
eoEvalFunc<EOT>& _fullEval,
|
||||||
|
moEval<Neighbor>& _eval,
|
||||||
|
moNeighborComparator<Neighbor>& _neighborComp,
|
||||||
|
moSolNeighborComparator<Neighbor>& _solNeighborComp,
|
||||||
|
moContinuator<Neighbor>& _cont,
|
||||||
|
moTabuList<Neighbor>& _tabuList,
|
||||||
|
moIntensification<Neighbor>& _intensification,
|
||||||
|
moDiversification<Neighbor>& _diversification,
|
||||||
|
moAspiration<Neighbor>& _aspiration):
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
timeCont(0),
|
||||||
|
tabuList(0,0),
|
||||||
|
explorer(_neighborhood, _eval, _neighborComp, _solNeighborComp, _tabuList, _intensification, _diversification, _aspiration)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To get the explorer and then to be abble to get the best solution so far
|
||||||
|
* @return the TS explorer
|
||||||
|
*/
|
||||||
|
moTSexplorer<Neighbor>& getExplorer() {
|
||||||
|
return explorer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
moTimeContinuator<Neighbor> timeCont;
|
||||||
|
moNeighborComparator<Neighbor> defaultNeighborComp;
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
moNeighborVectorTabuList<Neighbor> tabuList;
|
||||||
|
moDummyIntensification<Neighbor> dummyIntensification;
|
||||||
|
moDummyDiversification<Neighbor> dummyDiversification;
|
||||||
|
moBestImprAspiration<Neighbor> defaultAspiration;
|
||||||
|
moTSexplorer<Neighbor> explorer;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
75
branches/rc2.0/paradiseo-mo/src/algo/moVNS.h
Normal file
75
branches/rc2.0/paradiseo-mo/src/algo/moVNS.h
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
<moVNS.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moVNS_h
|
||||||
|
#define _moVNS_h
|
||||||
|
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <eoOp.h>
|
||||||
|
#include <comparator/moSolComparator.h>
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
|
||||||
|
#include <explorer/moVNSexplorer.h>
|
||||||
|
#include <neighborhood/moVariableNeighborhoodSelection.h>
|
||||||
|
#include <acceptCrit/moAcceptanceCriterion.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the "Variable Neighborhood Search" metaheuristic
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moVNS: public moLocalSearch< Neighbor >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* full constructor for a VNS
|
||||||
|
* @param _selection selection the "neighborhood" search heuristics during the search
|
||||||
|
* @param _acceptCrit acceptance criteria which compare and accept or not the two solutions
|
||||||
|
* @param _fullEval the full evaluation function
|
||||||
|
* @param _cont an external continuator
|
||||||
|
*/
|
||||||
|
moVNS(moVariableNeighborhoodSelection<EOT> & _selection,
|
||||||
|
moAcceptanceCriterion<Neighbor>& _acceptCrit,
|
||||||
|
eoEvalFunc<EOT>& _fullEval,
|
||||||
|
moContinuator<Neighbor>& _cont) :
|
||||||
|
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
|
||||||
|
explorer(_selection, _acceptCrit)
|
||||||
|
{}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// the explorer of the VNS
|
||||||
|
moVNSexplorer<Neighbor> explorer;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
60
branches/rc2.0/paradiseo-mo/src/comparator/moComparator.h
Normal file
60
branches/rc2.0/paradiseo-mo/src/comparator/moComparator.h
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
<moComparator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moComparator_h
|
||||||
|
#define _moComparator_h
|
||||||
|
|
||||||
|
#include <EO.h>
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparator of two types
|
||||||
|
*/
|
||||||
|
template< class T1, class T2 >
|
||||||
|
class moComparator : public eoBF<const T1 & , const T2 & , bool>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param _ref1 a reference on a variable of type T1
|
||||||
|
* @param _ref2 a reference on a variable of type T2
|
||||||
|
* @return true if _ref1 and _ref2 are equals
|
||||||
|
*/
|
||||||
|
virtual bool equals(const T1& _ref1, const T2& _ref2) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
<moEqualNeighborComparator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moEqualNeighborComparator_h
|
||||||
|
#define _moEqualNeighborComparator_h
|
||||||
|
|
||||||
|
#include <neighborhood/moNeighbor.h>
|
||||||
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparator of two neighbors : a neighbor is better if the fitness is higher or equal
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moEqualNeighborComparator : public moNeighborComparator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two neighbors
|
||||||
|
* @param _neighbor1 the first neighbor
|
||||||
|
* @param _neighbor2 the second neighbor
|
||||||
|
* @return true if the neighbor2 is better or equal than neighbor1
|
||||||
|
*/
|
||||||
|
virtual bool operator()(const Neighbor& _neighbor1, const Neighbor& _neighbor2) {
|
||||||
|
return (_neighbor1.fitness() <= _neighbor2.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moEqualNeighborComparator";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
<moEqualSolComparator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moEqualSolComparator_h
|
||||||
|
#define _moEqualSolComparator_h
|
||||||
|
|
||||||
|
#include <comparator/moSolComparator.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparator of two solutions : a neighbor is better if the fitness is higher or equal
|
||||||
|
*/
|
||||||
|
template< class EOT >
|
||||||
|
class moEqualSolComparator : public moSolComparator<EOT>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two solutions
|
||||||
|
* @param _sol1 the first solution
|
||||||
|
* @param _sol2 the second solution
|
||||||
|
* @return true if the solution2 is better than solution1
|
||||||
|
*/
|
||||||
|
virtual bool operator()(const EOT& _sol1, const EOT& _sol2) {
|
||||||
|
return (_sol1.fitness() <= _sol2.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moEqualSolComparator";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
<moEqualSolNeighborComparator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moEqualSolNeighborComparator_h
|
||||||
|
#define _moEqualSolNeighborComparator_h
|
||||||
|
|
||||||
|
#include <EO.h>
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
|
||||||
|
#include <neighborhood/moNeighbor.h>
|
||||||
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparator of a solution and its neighbor : a neighbor is better if the fitness is higher or equal
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moEqualSolNeighborComparator : public moSolNeighborComparator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two neighbors
|
||||||
|
* @param _sol the solution
|
||||||
|
* @param _neighbor the neighbor
|
||||||
|
* @return true if the neighbor is better or equal than sol
|
||||||
|
*/
|
||||||
|
virtual bool operator()(const EOT& _sol, const Neighbor& _neighbor) {
|
||||||
|
return (_sol.fitness() <= _neighbor.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moEqualSolNeighborComparator";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
<moNeighborComparator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moNeighborComparator_h
|
||||||
|
#define _moNeighborComparator_h
|
||||||
|
|
||||||
|
#include <neighborhood/moNeighbor.h>
|
||||||
|
#include <comparator/moComparator.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparator of two neighbors
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moNeighborComparator : public moComparator<Neighbor, Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two neighbors
|
||||||
|
* @param _neighbor1 the first neighbor
|
||||||
|
* @param _neighbor2 the second neighbor
|
||||||
|
* @return true if the neighbor2 is better than neighbor1
|
||||||
|
*/
|
||||||
|
virtual bool operator()(const Neighbor& _neighbor1, const Neighbor& _neighbor2) {
|
||||||
|
return (_neighbor1.fitness() < _neighbor2.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two neighbors
|
||||||
|
* @param _neighbor1 the first neighbor
|
||||||
|
* @param _neighbor2 the second neighbor
|
||||||
|
* @return true if the neighbor2 is equal to neighbor1
|
||||||
|
*/
|
||||||
|
virtual bool equals(const Neighbor& _neighbor1, const Neighbor& _neighbor2) {
|
||||||
|
return (_neighbor1.fitness() == _neighbor2.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moNeighborComparator";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
72
branches/rc2.0/paradiseo-mo/src/comparator/moSolComparator.h
Normal file
72
branches/rc2.0/paradiseo-mo/src/comparator/moSolComparator.h
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*
|
||||||
|
<moSolComparator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moSolComparator_h
|
||||||
|
#define _moSolComparator_h
|
||||||
|
|
||||||
|
#include <comparator/moComparator.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparator of two solutions
|
||||||
|
*/
|
||||||
|
template< class EOT >
|
||||||
|
class moSolComparator : public moComparator<EOT, EOT>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two solutions
|
||||||
|
* @param _sol1 the first solution
|
||||||
|
* @param _sol2 the second solution
|
||||||
|
* @return true if the solution2 is better than solution1
|
||||||
|
*/
|
||||||
|
virtual bool operator()(const EOT& _sol1, const EOT& _sol2) {
|
||||||
|
return (_sol1.fitness() < _sol2.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the equality between two solutions
|
||||||
|
* @param _sol1 the first solution
|
||||||
|
* @param _sol2 the second solution
|
||||||
|
* @return true if the solution2 is equal to solution1
|
||||||
|
*/
|
||||||
|
virtual bool equals(const EOT& _sol1, const EOT& _sol2) {
|
||||||
|
return (_sol1.fitness() == _sol2.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moSolComparator";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
<moSolNeighborComparator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moSolNeighborComparator_h
|
||||||
|
#define _moSolNeighborComparator_h
|
||||||
|
|
||||||
|
#include <EO.h>
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
|
||||||
|
#include <neighborhood/moNeighbor.h>
|
||||||
|
#include <comparator/moComparator.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comparator of a solution and its neighbor
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moSolNeighborComparator : public moComparator<typename Neighbor::EOT, Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare two neighbors
|
||||||
|
* @param _sol the solution
|
||||||
|
* @param _neighbor the neighbor
|
||||||
|
* @return true if the neighbor is better than sol
|
||||||
|
*/
|
||||||
|
virtual bool operator()(const EOT& _sol, const Neighbor& _neighbor) {
|
||||||
|
return (_sol.fitness() < _neighbor.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the equality between two neighbors
|
||||||
|
* @param _sol the solution
|
||||||
|
* @param _neighbor the neighbor
|
||||||
|
* @return true if the neighbor is equal to the solution
|
||||||
|
*/
|
||||||
|
virtual bool equals(const EOT& _sol, const Neighbor& _neighbor) {
|
||||||
|
return (_sol.fitness() == _neighbor.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moSolNeighborComparator";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
<moAverageFitnessNeighborStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moAverageFitnessNeighborStat_h
|
||||||
|
#define moAverageFitnessNeighborStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <continuator/moNeighborhoodStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From moNeighborhoodStat, to compute the average of fitness in the neighborhood
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moAverageFitnessNeighborStat : public moStat<typename Neighbor::EOT, double >
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, double >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _nhStat a neighborhoodStat
|
||||||
|
*/
|
||||||
|
moAverageFitnessNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||||
|
moStat<EOT, double >(0.0, "average"), nhStat(_nhStat) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the average of fitness in the neighborhood
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = nhStat.getMean();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the average of fitness in the neighborhood
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = nhStat.getMean();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moAverageFitnessNeighborStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** moNeighborhoodStat */
|
||||||
|
moNeighborhoodStat<Neighbor> & nhStat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
/*
|
||||||
|
<moBestFitnessStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moBestFitnessStat_h
|
||||||
|
#define moBestFitnessStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic which save the best solution found during the search
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moBestFitnessStat : public moStat<EOT, typename EOT::Fitness>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename EOT::Fitness Fitness;
|
||||||
|
using moStat< EOT , typename EOT::Fitness >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
* @param _reInitSol when true the best so far is reinitialized
|
||||||
|
*/
|
||||||
|
moBestFitnessStat(bool _reInitSol = true): moStat<EOT, typename EOT::Fitness>(Fitness(), "best"), reInitSol(_reInitSol), firstTime(true) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the best solution on the first one
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
if (reInitSol)
|
||||||
|
value() = _sol.fitness();
|
||||||
|
else if (firstTime)
|
||||||
|
{
|
||||||
|
value() = _sol.fitness();
|
||||||
|
firstTime = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the best solution
|
||||||
|
* @param _sol the current solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
if (value() < _sol.fitness())
|
||||||
|
{
|
||||||
|
value() = _sol.fitness();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moBestFitnessStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool reInitSol;
|
||||||
|
bool firstTime;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
<moBestNoImproveContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moBestNoImproveContinuator_h
|
||||||
|
#define _moBestNoImproveContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
#include <comparator/moSolComparator.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop when the best solution cannot be improved
|
||||||
|
* within a given number of iterations
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moBestNoImproveContinuator : public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param _bestSol the best solution
|
||||||
|
* @param _maxNoImprove number maximum of iterations
|
||||||
|
* @param _solComparator a comparator between solutions
|
||||||
|
* @param _verbose true/false : verbose mode on/off
|
||||||
|
*/
|
||||||
|
moBestNoImproveContinuator(const EOT & _bestSol,
|
||||||
|
unsigned int _maxNoImprove,
|
||||||
|
moSolComparator<EOT>& _solComparator,
|
||||||
|
bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(_solComparator), verbose(_verbose) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor where the comparator of solutions is the default comparator
|
||||||
|
*
|
||||||
|
* @param _bestSol the best solution
|
||||||
|
* @param _maxNoImprove number maximum of iterations
|
||||||
|
* @param _verbose true/false : verbose mode on/off
|
||||||
|
*/
|
||||||
|
moBestNoImproveContinuator(const EOT & _bestSol,
|
||||||
|
unsigned int _maxNoImprove,
|
||||||
|
bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(defaultSolComp), verbose(_verbose) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count and test the number of non improvement of the best solution
|
||||||
|
* improvement: if the current solution is STRICTLY better than the current best solution
|
||||||
|
*
|
||||||
|
*@param _solution a solution
|
||||||
|
*@return true if counter < maxNoImprove
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
if (solComparator(_solution, bestSol) || solComparator.equals(_solution, bestSol))
|
||||||
|
cpt++;
|
||||||
|
else
|
||||||
|
cpt = 0;
|
||||||
|
|
||||||
|
bool res = (cpt < maxNoImprove);
|
||||||
|
|
||||||
|
if (!res && verbose)
|
||||||
|
std::cout << "STOP in moBestNoImproveContinuator: Reached maximum number of iterations without improvement [" << cpt << "/" << maxNoImprove << "]" << std::endl;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset the counter of iteration
|
||||||
|
* @param _solution a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
cpt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the current number of iteration without improvement
|
||||||
|
* @return the number of iteration
|
||||||
|
*/
|
||||||
|
unsigned int value() {
|
||||||
|
return cpt ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const EOT & bestSol;
|
||||||
|
unsigned int maxNoImprove;
|
||||||
|
unsigned int cpt;
|
||||||
|
// comparator between solutions
|
||||||
|
moSolComparator<EOT>& solComparator;
|
||||||
|
bool verbose;
|
||||||
|
moSolComparator<EOT> defaultSolComp;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*
|
||||||
|
<moBestSoFarStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moBestSoFarStat_h
|
||||||
|
#define moBestSoFarStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic which save the best solution found during the search
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moBestSoFarStat : public moStat<EOT, EOT>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
using moStat< EOT , EOT >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
* @param _reInitSol when true the best so far is reinitialized
|
||||||
|
*/
|
||||||
|
moBestSoFarStat(bool _reInitSol = true): moStat<EOT, EOT>(EOT(), "best"), reInitSol(_reInitSol), firstTime(true) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization of the best solution on the first one
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
if (reInitSol)
|
||||||
|
value() = _sol;
|
||||||
|
else if (firstTime)
|
||||||
|
{
|
||||||
|
value() = _sol;
|
||||||
|
firstTime = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the best solution
|
||||||
|
* @param _sol the current solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
if (value().fitness() < _sol.fitness())
|
||||||
|
{
|
||||||
|
value() = _sol;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moBestSoFarStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool reInitSol;
|
||||||
|
bool firstTime;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
82
branches/rc2.0/paradiseo-mo/src/continuator/moBooleanStat.h
Normal file
82
branches/rc2.0/paradiseo-mo/src/continuator/moBooleanStat.h
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
<moBooleanStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moBooleanStat_h
|
||||||
|
#define moBooleanStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic gives from a boolean variable
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moBooleanStat : public moStat<EOT, bool>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
using moStat< EOT, bool>::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
*/
|
||||||
|
moBooleanStat(bool * _b): moStat<EOT, bool>(*_b, "boolean"), b(_b) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = *b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = *b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moBooleanStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool * b;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
197
branches/rc2.0/paradiseo-mo/src/continuator/moCheckpoint.h
Normal file
197
branches/rc2.0/paradiseo-mo/src/continuator/moCheckpoint.h
Normal file
|
|
@ -0,0 +1,197 @@
|
||||||
|
/*
|
||||||
|
<moCheckpoint.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moCheckpoint_h
|
||||||
|
#define moCheckpoint_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
#include <utils/eoMonitor.h>
|
||||||
|
#include <continuator/moStatBase.h>
|
||||||
|
#include <utils/eoUpdater.h>
|
||||||
|
#include <continuator/moUpdater.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continuator allowing to add others (continuators, stats, monitors or updaters)
|
||||||
|
*/
|
||||||
|
template <class Neighbor>
|
||||||
|
class moCheckpoint : public moContinuator<Neighbor> {
|
||||||
|
public :
|
||||||
|
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor (moCheckpoint must have at least one continuator)
|
||||||
|
* @param _cont a continuator
|
||||||
|
* @param _interval frequency to compute statistical operators
|
||||||
|
*/
|
||||||
|
moCheckpoint(moContinuator<Neighbor>& _cont, unsigned int _interval=1):interval(_interval), counter(0) {
|
||||||
|
continuators.push_back(&_cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a continuator to the checkpoint
|
||||||
|
* @param _cont a continuator
|
||||||
|
*/
|
||||||
|
void add(moContinuator<Neighbor>& _cont) {
|
||||||
|
continuators.push_back(&_cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a statistic operator to the checkpoint
|
||||||
|
* @param _stat a statistic operator
|
||||||
|
*/
|
||||||
|
void add(moStatBase<EOT>& _stat) {
|
||||||
|
stats.push_back(&_stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a monitor to the checkpoint
|
||||||
|
* @param _mon a monitor
|
||||||
|
*/
|
||||||
|
void add(eoMonitor& _mon) {
|
||||||
|
monitors.push_back(&_mon);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a updater to the checkpoint
|
||||||
|
* @param _upd an updater
|
||||||
|
*/
|
||||||
|
void add(eoUpdater& _upd) {
|
||||||
|
updaters.push_back(&_upd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a MO updater to the checkpoint
|
||||||
|
* @param _moupd an mo updater
|
||||||
|
*/
|
||||||
|
void add(moUpdater& _moupd) {
|
||||||
|
moupdaters.push_back(&_moupd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* init all continuators containing in the checkpoint regarding a solution
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT& _sol) {
|
||||||
|
for (unsigned i = 0; i < stats.size(); ++i)
|
||||||
|
stats[i]->init(_sol);
|
||||||
|
counter=1;
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < moupdaters.size(); ++i)
|
||||||
|
moupdaters[i]->init();
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < monitors.size(); ++i)
|
||||||
|
(*monitors[i])();
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < continuators.size(); ++i)
|
||||||
|
continuators[i]->init(_sol);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moCheckpoint";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apply operator of checkpoint's containers
|
||||||
|
* @param _sol reference of the solution
|
||||||
|
* @return true if all continuator return true
|
||||||
|
*/
|
||||||
|
bool operator()(EOT & _sol) {
|
||||||
|
unsigned i;
|
||||||
|
bool bContinue = true;
|
||||||
|
|
||||||
|
for (i = 0; i < stats.size(); ++i) {
|
||||||
|
if (counter % interval == 0)
|
||||||
|
(*stats[i])(_sol);
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < updaters.size(); ++i)
|
||||||
|
(*updaters[i])();
|
||||||
|
|
||||||
|
for (i = 0; i < moupdaters.size(); ++i)
|
||||||
|
(*moupdaters[i])();
|
||||||
|
|
||||||
|
for (i = 0; i < monitors.size(); ++i)
|
||||||
|
(*monitors[i])();
|
||||||
|
|
||||||
|
for (i = 0; i < continuators.size(); ++i)
|
||||||
|
if ( !(*continuators[i])(_sol) )
|
||||||
|
bContinue = false;
|
||||||
|
|
||||||
|
return bContinue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* last call of statistic operators, monitors and updaters
|
||||||
|
* @param _sol reference of the solution
|
||||||
|
*/
|
||||||
|
void lastCall(EOT& _sol) {
|
||||||
|
unsigned int i;
|
||||||
|
for (i = 0; i < stats.size(); ++i)
|
||||||
|
stats[i]->lastCall(_sol);
|
||||||
|
|
||||||
|
for (i = 0; i < updaters.size(); ++i)
|
||||||
|
updaters[i]->lastCall();
|
||||||
|
|
||||||
|
for (i = 0; i < moupdaters.size(); ++i)
|
||||||
|
moupdaters[i]->lastCall();
|
||||||
|
|
||||||
|
for (i = 0; i < monitors.size(); ++i)
|
||||||
|
monitors[i]->lastCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
private :
|
||||||
|
/** continuators vector */
|
||||||
|
std::vector<moContinuator<Neighbor>*> continuators;
|
||||||
|
/** statistic operators vector */
|
||||||
|
std::vector<moStatBase<EOT>*> stats;
|
||||||
|
/** monitors vector */
|
||||||
|
std::vector<eoMonitor*> monitors;
|
||||||
|
/** updaters vector */
|
||||||
|
std::vector<eoUpdater*> updaters;
|
||||||
|
/** MO updaters vector */
|
||||||
|
std::vector<moUpdater*> moupdaters;
|
||||||
|
|
||||||
|
unsigned int interval;
|
||||||
|
unsigned int counter;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
<moCombinedContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moCombinedContinuator_h
|
||||||
|
#define _moCombinedContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combined several continuators.
|
||||||
|
* Continue until one of the continuators returns false
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moCombinedContinuator : public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor (moCheckpoint must have at least one continuator)
|
||||||
|
* @param _cont a continuator
|
||||||
|
*/
|
||||||
|
moCombinedContinuator(moContinuator<Neighbor>& _cont) {
|
||||||
|
continuators.push_back(&_cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add a continuator to the combined continuator
|
||||||
|
* @param _cont a continuator
|
||||||
|
*/
|
||||||
|
void add(moContinuator<Neighbor>& _cont) {
|
||||||
|
continuators.push_back(&_cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* init all continuators
|
||||||
|
* @param _solution a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
for (unsigned int i = 0; i < continuators.size(); ++i)
|
||||||
|
continuators[i]->init(_solution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@param _solution a solution
|
||||||
|
*@return true all the continuators are true
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
bool bContinue = true;
|
||||||
|
|
||||||
|
// some data may be update in each continuator.
|
||||||
|
// So, all continuators are tested
|
||||||
|
for (unsigned int i = 0; i < continuators.size(); ++i)
|
||||||
|
if ( !(*continuators[i])(_solution) )
|
||||||
|
bContinue = false;
|
||||||
|
|
||||||
|
return bContinue;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** continuators vector */
|
||||||
|
std::vector< moContinuator<Neighbor>* > continuators;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
64
branches/rc2.0/paradiseo-mo/src/continuator/moContinuator.h
Normal file
64
branches/rc2.0/paradiseo-mo/src/continuator/moContinuator.h
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
<moContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moContinuator_h
|
||||||
|
#define _moContinuator_h
|
||||||
|
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To make specific continuator from a solution
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moContinuator : public eoUF<typename Neighbor::EOT &, bool>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init Continuator parameters
|
||||||
|
* @param _solution the related solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT& _solution) {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Last Call to terminate the checkpoint
|
||||||
|
* @param _solution the related solution
|
||||||
|
*/
|
||||||
|
virtual void lastCall(EOT& _solution) {};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
/*
|
||||||
|
<moCounterMonitorSaver.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moCounterMonitorSaver_h
|
||||||
|
#define moCounterMonitorSaver_h
|
||||||
|
|
||||||
|
#include <utils/eoUpdater.h>
|
||||||
|
#include <utils/eoMonitor.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class calling monitors with a given frequency
|
||||||
|
*/
|
||||||
|
class moCounterMonitorSaver : public eoUpdater {
|
||||||
|
public :
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _interval frequency to call monitors
|
||||||
|
* @param _mon a monitor
|
||||||
|
*/
|
||||||
|
moCounterMonitorSaver(unsigned _interval, eoMonitor& _mon) : interval(_interval), counter(0) {
|
||||||
|
monitors.push_back(&_mon);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* call monitors if interval is reach by a counter
|
||||||
|
*/
|
||||||
|
void operator()(void) {
|
||||||
|
if (counter++ % interval == 0)
|
||||||
|
for (unsigned i = 0; i < monitors.size(); i++)
|
||||||
|
(*monitors[i])();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* last call of monitors
|
||||||
|
*/
|
||||||
|
void lastCall(void) {
|
||||||
|
for (unsigned i = 0; i < monitors.size(); i++)
|
||||||
|
monitors[i]->lastCall();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* attach another monitor to this class
|
||||||
|
* @param _mon the monitor to attach
|
||||||
|
*/
|
||||||
|
void add(eoMonitor& _mon) {
|
||||||
|
monitors.push_back(&_mon);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moCounterMonitorSaver";
|
||||||
|
}
|
||||||
|
|
||||||
|
private :
|
||||||
|
/** interval and counter value */
|
||||||
|
unsigned int interval, counter;
|
||||||
|
|
||||||
|
/** monitor's vector */
|
||||||
|
std::vector<eoMonitor*> monitors;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
80
branches/rc2.0/paradiseo-mo/src/continuator/moCounterStat.h
Normal file
80
branches/rc2.0/paradiseo-mo/src/continuator/moCounterStat.h
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
<moCounterStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moCounterStat_h
|
||||||
|
#define moCounterStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic gives the number of iteration
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moCounterStat : public moStat<EOT, unsigned int>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
using moStat< EOT, unsigned int>::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
*/
|
||||||
|
moCounterStat(): moStat<EOT, unsigned int>(0, "counter") {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = value() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moCounterStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
93
branches/rc2.0/paradiseo-mo/src/continuator/moDistanceStat.h
Normal file
93
branches/rc2.0/paradiseo-mo/src/continuator/moDistanceStat.h
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
<moDistanceStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moDistanceStat_h
|
||||||
|
#define moDistanceStat_h
|
||||||
|
|
||||||
|
#include <utils/eoDistance.h>
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic gives the distance to a reference solution
|
||||||
|
* The reference solution could be the global optimum, or the best knowed solution
|
||||||
|
* It allows to compute the Fitness-Distance correlation (FDC)
|
||||||
|
*/
|
||||||
|
template <class EOT, class T = double>
|
||||||
|
class moDistanceStat : public moStat<EOT, T>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
using moStat< EOT, T >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _dist a distance
|
||||||
|
* @param _ref the reference solution
|
||||||
|
*/
|
||||||
|
moDistanceStat(eoDistance<EOT> & _dist, EOT & _ref): moStat<EOT, T>(0, "distance"), dist(_dist), refSolution(_ref) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute distance between the first solution and the reference solution
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = dist(_sol, refSolution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute distance between a solution and the reference solution
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = dist(_sol, refSolution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moDistanceStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** the distance */
|
||||||
|
eoDistance<EOT> & dist;
|
||||||
|
/**
|
||||||
|
* the reference solution does not change during the run
|
||||||
|
* it could be the best solution knowed of the problem
|
||||||
|
*/
|
||||||
|
EOT refSolution;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
<moEvalsContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moEvalsContinuator_h
|
||||||
|
#define _moEvalsContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
#include <eoEvalFuncCounter.h>
|
||||||
|
#include <eval/moEvalCounter.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continue until a maximum fixed number of full evaluation and neighbor evaluation is reached (total number of evaluation = full evaluation + incremental evaluation)
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Becareful 1: if restartCounter is true, then the number of neighbor evaluations (for example incremental evaluations) is considered during the local search (not before it)
|
||||||
|
*
|
||||||
|
* Becareful 2: Can not be used if the evaluation function is used in parallel
|
||||||
|
*
|
||||||
|
* Becareful 3: Check if the incremental does not use full evaluation, otherwise the total number of evaluations is not correct
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moEvalsContinuator : public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _fullEval full evaluation function to count
|
||||||
|
* @param _neighborEval neighbor evaluation function to count
|
||||||
|
* @param _maxEvals number maximum of evaluations (full and incremental evaluations)
|
||||||
|
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
|
||||||
|
*/
|
||||||
|
moEvalsContinuator(eoEvalFuncCounter<EOT> & _fullEval, moEvalCounter<Neighbor> & _neighborEval, unsigned int _maxEvals, bool _restartCounter = true): fullEval(_fullEval), neighborEval(_neighborEval), maxEvals(_maxEvals), restartCounter(_restartCounter) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if continue
|
||||||
|
* @param _solution a solution
|
||||||
|
* @return true if number of evaluations < maxEvals
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
return (fullEval.value() + neighborEval.value() - nbEval_start < maxEvals);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the number of evaluations
|
||||||
|
* @param _solution a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
if (restartCounter)
|
||||||
|
nbEval_start = fullEval.value() + neighborEval.value();
|
||||||
|
else
|
||||||
|
nbEval_start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the current number of evaluation from the begining
|
||||||
|
* @return the number of evaluation
|
||||||
|
*/
|
||||||
|
unsigned int value() {
|
||||||
|
return fullEval.value() + neighborEval.value() - nbEval_start ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
eoEvalFuncCounter<EOT> & fullEval;
|
||||||
|
moEvalCounter<Neighbor> & neighborEval;
|
||||||
|
unsigned int maxEvals;
|
||||||
|
bool restartCounter;
|
||||||
|
unsigned int nbEval_start ;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
<moFitContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moFitContinuator_h
|
||||||
|
#define _moFitContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continue until a maximum fitness is reached
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moFitContinuator : public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param _maxFit maximum fitness to reach
|
||||||
|
*/
|
||||||
|
moFitContinuator(Fitness _maxFit): maxFit(_maxFit) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@param _solution a solution
|
||||||
|
*@return true if counter < maxFit
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
return (_solution.fitness() < maxFit);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Fitness maxFit;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
83
branches/rc2.0/paradiseo-mo/src/continuator/moFitnessStat.h
Normal file
83
branches/rc2.0/paradiseo-mo/src/continuator/moFitnessStat.h
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
<moFitnessStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moFitnessStat_h
|
||||||
|
#define moFitnessStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stat given the fitness of the current solution
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moFitnessStat : public moStat<EOT, typename EOT::Fitness>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename EOT::Fitness Fitness;
|
||||||
|
using moStat< EOT, Fitness >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _description a description of the stat
|
||||||
|
*/
|
||||||
|
moFitnessStat(std::string _description = "fitness"):
|
||||||
|
moStat<EOT, Fitness>(Fitness(), _description) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* store the initial fitness value
|
||||||
|
* @param _sol the initial solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol)
|
||||||
|
{
|
||||||
|
value() = _sol.fitness();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* store fitness value
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol)
|
||||||
|
{
|
||||||
|
value() = _sol.fitness();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moFitnessStat";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
<moFullEvalContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moFullEvalContinuator_h
|
||||||
|
#define _moFullEvalContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
#include <eoEvalFuncCounter.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continue until a maximum fixed number of full evaluation is reached
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Becareful 1: if restartCounter is true, then the number of full evaluations is considered during the local search (not before it)
|
||||||
|
*
|
||||||
|
* Becareful 2: Can not be used if the evaluation function is used in parallel
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moFullEvalContinuator : public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _eval evaluation function to count
|
||||||
|
* @param _maxFullEval number maximum of iterations
|
||||||
|
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
|
||||||
|
*/
|
||||||
|
moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval, bool _restartCounter = true): eval(_eval), maxFullEval(_maxFullEval), restartCounter(_restartCounter) {
|
||||||
|
nbEval_start = eval.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if continue
|
||||||
|
* @param _solution a solution
|
||||||
|
* @return true if number of evaluations < maxFullEval
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
return (eval.value() - nbEval_start < maxFullEval);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the number of evaluations
|
||||||
|
* @param _solution a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
if (restartCounter)
|
||||||
|
nbEval_start = eval.value();
|
||||||
|
else
|
||||||
|
nbEval_start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the current number of evaluation from the begining
|
||||||
|
* @return the number of evaluation
|
||||||
|
*/
|
||||||
|
unsigned int value() {
|
||||||
|
return eval.value() - nbEval_start ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
eoEvalFuncCounter<EOT> & eval;
|
||||||
|
unsigned int nbEval_start ;
|
||||||
|
bool restartCounter;
|
||||||
|
unsigned int maxFullEval ;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
/*
|
||||||
|
<moIterContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moIterContinuator_h
|
||||||
|
#define _moIterContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continue until a maximum fixed number of iterations is reached
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moIterContinuator : public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param _maxIter number maximum of iterations
|
||||||
|
* @param _verbose true/false : verbose mode on/off
|
||||||
|
*/
|
||||||
|
moIterContinuator(unsigned int _maxIter, bool _verbose=true): maxIter(_maxIter), verbose(_verbose) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@param _solution a solution
|
||||||
|
*@return true if counter < maxIter
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
bool res;
|
||||||
|
cpt++;
|
||||||
|
res = (cpt < maxIter);
|
||||||
|
if (!res && verbose)
|
||||||
|
std::cout << "STOP in moIterContinuator: Reached maximum number of iterations [" << cpt << "/" << maxIter << "]" << std::endl;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset the counter of iteration
|
||||||
|
* @param _solution a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
cpt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the current number of iteration
|
||||||
|
* @return the number of iteration
|
||||||
|
*/
|
||||||
|
unsigned int value() {
|
||||||
|
return cpt ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int maxIter;
|
||||||
|
unsigned int cpt;
|
||||||
|
bool verbose;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
<moMaxNeighborStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moMaxNeighborStat_h
|
||||||
|
#define moMaxNeighborStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <continuator/moNeighborhoodStat.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From moNeighborhoodStat, to compute the max fitness in the neighborhood
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moMaxNeighborStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, Fitness >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _nhStat a neighborhoodStat
|
||||||
|
*/
|
||||||
|
moMaxNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||||
|
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the max fitness in the neighborhood
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = nhStat.getMax();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the max fitness in the neighborhood
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = nhStat.getMax();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moMaxNeighborStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** moNeighborhoodStat */
|
||||||
|
moNeighborhoodStat<Neighbor> & nhStat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
<moMinNeighborStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moMinNeighborStat_h
|
||||||
|
#define moMinNeighborStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <continuator/moNeighborhoodStat.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From moNeighborhoodStat, to compute the min fitness in the neighborhood
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moMinNeighborStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, Fitness >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _nhStat a neighborhoodStat
|
||||||
|
*/
|
||||||
|
moMinNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||||
|
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the worst fitness in the neighborhood
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = nhStat.getMin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the worst fitness in the neighborhood
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = nhStat.getMin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moMinNeighborStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** moNeighborhoodStat */
|
||||||
|
moNeighborhoodStat<Neighbor> & nhStat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
<moMinusOneCounterStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moMinusOneCounterStat_h
|
||||||
|
#define moMinusOneCounterStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic gives the number of iteration minus 1
|
||||||
|
* then the last iteration is not counted (for example for length of adaptive walk)
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moMinusOneCounterStat : public moStat<EOT, unsigned int>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
using moStat< EOT, unsigned int>::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
*/
|
||||||
|
moMinusOneCounterStat(): moStat<EOT, unsigned int>(0, "counter") {
|
||||||
|
counter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
counter = 0;
|
||||||
|
value() = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
counter++;
|
||||||
|
if (counter > 0)
|
||||||
|
value() = counter - 1;
|
||||||
|
else
|
||||||
|
value() = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moMinusOneCounterStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int counter;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
<moNbInfNeighborStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moNbInfNeighborStat_h
|
||||||
|
#define moNbInfNeighborStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <continuator/moNeighborhoodStat.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
|
||||||
|
* with (strictly) lower fitness than the current solution
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moNbInfNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, unsigned >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _nhStat a neighborhoodStat
|
||||||
|
*/
|
||||||
|
moNbInfNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||||
|
moStat<EOT, unsigned>(0, "nb inf"), nhStat(_nhStat) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = nhStat.getNbInf();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = nhStat.getNbInf();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moNbInfNeighborStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** moNeighborhoodStat */
|
||||||
|
moNeighborhoodStat<Neighbor> & nhStat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
<moNbSupNeighborStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moNbSupNeighborStat_h
|
||||||
|
#define moNbSupNeighborStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <continuator/moNeighborhoodStat.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
|
||||||
|
* with higher fitness than the current solution
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moNbSupNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, unsigned >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _nhStat a neighborhoodStat
|
||||||
|
*/
|
||||||
|
moNbSupNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||||
|
moStat<EOT, unsigned>(0, "nb sup"), nhStat(_nhStat) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of solutions in the neighborhood with better fitness than the current solution
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = nhStat.getNbSup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of solutions in the neighborhood with better fitness than the current solution
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = nhStat.getNbSup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moNbSupNeighborStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** moNeighborhoodStat */
|
||||||
|
moNeighborhoodStat<Neighbor> & nhStat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
167
branches/rc2.0/paradiseo-mo/src/continuator/moNeighborBestStat.h
Normal file
167
branches/rc2.0/paradiseo-mo/src/continuator/moNeighborBestStat.h
Normal file
|
|
@ -0,0 +1,167 @@
|
||||||
|
/*
|
||||||
|
<moNeighborBestStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moNeighborBestStat_h
|
||||||
|
#define moNeighborBestStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
#include <explorer/moNeighborhoodExplorer.h>
|
||||||
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the fitness of the best solution among k neighbor or all neighbors
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moNeighborBestStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, Fitness >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhood a neighborhood
|
||||||
|
* @param _eval an evaluation function
|
||||||
|
* @param _neighborComparator a neighbor Comparator
|
||||||
|
* @param _solNeighborComparator a comparator between a solution and a neighbor
|
||||||
|
* @param _k number of neighbors visited
|
||||||
|
*/
|
||||||
|
moNeighborBestStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator, unsigned int _k = 0):
|
||||||
|
moStat<EOT, Fitness>(true, "neighborhood"),
|
||||||
|
neighborhood(_neighborhood), eval(_eval),
|
||||||
|
neighborComparator(_neighborComparator),
|
||||||
|
solNeighborComparator(_solNeighborComparator),
|
||||||
|
kmax(_k)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
* where the comparators are basic, there only compare the fitness values
|
||||||
|
*
|
||||||
|
* @param _neighborhood a neighborhood
|
||||||
|
* @param _eval an evaluation function
|
||||||
|
* @param _k number of neighbors visited (default all)
|
||||||
|
*/
|
||||||
|
moNeighborBestStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, unsigned _k = 0):
|
||||||
|
moStat<EOT, Fitness>(Fitness(), "best"),
|
||||||
|
neighborhood(_neighborhood), eval(_eval),
|
||||||
|
neighborComparator(defaultNeighborComp),
|
||||||
|
solNeighborComparator(defaultSolNeighborComp),
|
||||||
|
kmax(_k)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute classical statistics of the first solution's neighborhood
|
||||||
|
* @param _solution the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
operator()(_solution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the best fitness amoung all neighbors or k neighbors
|
||||||
|
* @param _solution the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _solution) {
|
||||||
|
Neighbor current ;
|
||||||
|
Neighbor best ;
|
||||||
|
|
||||||
|
if (neighborhood.hasNeighbor(_solution)) {
|
||||||
|
//init the first neighbor
|
||||||
|
neighborhood.init(_solution, current);
|
||||||
|
|
||||||
|
//eval the _solution moved with the neighbor and stock the result in the neighbor
|
||||||
|
eval(_solution, current);
|
||||||
|
|
||||||
|
//initialize the best neighbor
|
||||||
|
best = current;
|
||||||
|
|
||||||
|
// number of visited neighbors
|
||||||
|
unsigned int k = 1;
|
||||||
|
|
||||||
|
//test all others neighbors
|
||||||
|
while ( ( (kmax == 0) || (k < kmax) ) && neighborhood.cont(_solution)) {
|
||||||
|
//next neighbor
|
||||||
|
neighborhood.next(_solution, current);
|
||||||
|
//eval
|
||||||
|
eval(_solution, current);
|
||||||
|
|
||||||
|
//if we found a better neighbor, update the best
|
||||||
|
if (neighborComparator(best, current))
|
||||||
|
best = current;
|
||||||
|
|
||||||
|
k++;
|
||||||
|
}
|
||||||
|
|
||||||
|
value() = best.fitness();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//if _solution hasn't neighbor,
|
||||||
|
value() = Fitness();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moNeighborBestStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// to explore the neighborhood
|
||||||
|
Neighborhood& neighborhood ;
|
||||||
|
moEval<Neighbor>& eval;
|
||||||
|
|
||||||
|
// comparator betwenn solution and neighbor or between neighbors
|
||||||
|
moNeighborComparator<Neighbor>& neighborComparator;
|
||||||
|
moSolNeighborComparator<Neighbor>& solNeighborComparator;
|
||||||
|
|
||||||
|
// default comparators
|
||||||
|
// compare the fitness values of neighbors
|
||||||
|
moNeighborComparator<Neighbor> defaultNeighborComp;
|
||||||
|
// compare the fitness values of the solution and the neighbor
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
|
||||||
|
// number of neighbor to explore
|
||||||
|
unsigned int kmax;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
/*
|
||||||
|
<moNeighborEvalContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moNeighborEvalContinuator_h
|
||||||
|
#define _moNeighborEvalContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
#include <eval/moEvalCounter.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continue until a maximum fixed number of neighbor evaluation is reached
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Becareful 1: if restartCounter is true, then the number of neighbor evaluations (for example incremental evaluations) is considered during the local search (not before it)
|
||||||
|
*
|
||||||
|
* Becareful 2: Can not be used if the evaluation function is used in parallel
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moNeighborEvalContinuator : public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _eval neighbor evaluation function to count
|
||||||
|
* @param _maxNeighborEval number maximum of iterations
|
||||||
|
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
|
||||||
|
*/
|
||||||
|
moNeighborEvalContinuator(moEvalCounter<Neighbor> & _eval, unsigned int _maxNeighborEval, bool _restartCounter = true): eval(_eval), maxNeighborEval(_maxNeighborEval), restartCounter(_restartCounter) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if continue
|
||||||
|
* @param _solution a solution
|
||||||
|
* @return true if number of evaluations < maxNeighborEval
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
return (eval.value() - nbEval_start < maxNeighborEval);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the number of evaluations
|
||||||
|
* @param _solution a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
if (restartCounter)
|
||||||
|
nbEval_start = eval.value();
|
||||||
|
else
|
||||||
|
nbEval_start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the current number of evaluation from the begining
|
||||||
|
* @return the number of evaluation
|
||||||
|
*/
|
||||||
|
unsigned int value() {
|
||||||
|
return eval.value() - nbEval_start ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
moEvalCounter<Neighbor> & eval;
|
||||||
|
unsigned int maxNeighborEval;
|
||||||
|
bool restartCounter;
|
||||||
|
unsigned int nbEval_start ;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
/*
|
||||||
|
<moNeighborFitnessStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
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 moNeighborFitnessStat_h
|
||||||
|
#define moNeighborFitnessStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the fitness of one random neighbor
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moNeighborFitnessStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, Fitness >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhood a neighborhood
|
||||||
|
* @param _eval an evaluation function
|
||||||
|
*/
|
||||||
|
moNeighborFitnessStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval):
|
||||||
|
moStat<EOT, Fitness>(Fitness(), "neighborhood"),
|
||||||
|
neighborhood(_neighborhood), eval(_eval)
|
||||||
|
{
|
||||||
|
if (!neighborhood.isRandom()) {
|
||||||
|
std::cout << "moNeighborFitnessStat::Warning -> the neighborhood used is not random, the neighbor will not be random" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the fitness of one random neighbor
|
||||||
|
* @param _solution the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
operator()(_solution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute the fitness of one random neighbor
|
||||||
|
* @param _solution the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _solution) {
|
||||||
|
if (neighborhood.hasNeighbor(_solution)) {
|
||||||
|
Neighbor current ;
|
||||||
|
|
||||||
|
//init the first neighbor which is supposed to be random
|
||||||
|
neighborhood.init(_solution, current);
|
||||||
|
|
||||||
|
//eval the _solution moved with the neighbor and stock the result in the neighbor
|
||||||
|
eval(_solution, current);
|
||||||
|
|
||||||
|
// the fitness value is collected
|
||||||
|
value() = current.fitness();
|
||||||
|
} else {
|
||||||
|
//if _solution hasn't neighbor,
|
||||||
|
value() = Fitness();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moNeighborFitnessStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// the neighborhood
|
||||||
|
Neighborhood& neighborhood ;
|
||||||
|
moEval<Neighbor>& eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
264
branches/rc2.0/paradiseo-mo/src/continuator/moNeighborhoodStat.h
Normal file
264
branches/rc2.0/paradiseo-mo/src/continuator/moNeighborhoodStat.h
Normal file
|
|
@ -0,0 +1,264 @@
|
||||||
|
/*
|
||||||
|
<moNeighborhoodStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moNeighborhoodStat_h
|
||||||
|
#define moNeighborhoodStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
#include <explorer/moNeighborhoodExplorer.h>
|
||||||
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All possible statitic on the neighborhood fitness
|
||||||
|
* to combine with other specific statistic to print them
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moNeighborhoodStat : public moStat<typename Neighbor::EOT, bool>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, bool >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhood a neighborhood
|
||||||
|
* @param _eval an evaluation function
|
||||||
|
* @param _neighborComparator a neighbor Comparator
|
||||||
|
* @param _solNeighborComparator a comparator between a solution and a neighbor
|
||||||
|
*/
|
||||||
|
moNeighborhoodStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator):
|
||||||
|
moStat<EOT, bool>(true, "neighborhood"),
|
||||||
|
neighborhood(_neighborhood), eval(_eval),
|
||||||
|
neighborComparator(_neighborComparator),
|
||||||
|
solNeighborComparator(_solNeighborComparator)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
* where the comparators are basic, there only compare the fitness values
|
||||||
|
*
|
||||||
|
* @param _neighborhood a neighborhood
|
||||||
|
* @param _eval an evaluation function
|
||||||
|
*/
|
||||||
|
moNeighborhoodStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval):
|
||||||
|
moStat<EOT, bool>(true, "neighborhood"),
|
||||||
|
neighborhood(_neighborhood), eval(_eval),
|
||||||
|
neighborComparator(defaultNeighborComp),
|
||||||
|
solNeighborComparator(defaultSolNeighborComp)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute classical statistics of the first solution's neighborhood
|
||||||
|
* @param _solution the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
operator()(_solution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compute classical statistics of a solution's neighborhood
|
||||||
|
* @param _solution the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _solution) {
|
||||||
|
Neighbor current ;
|
||||||
|
Neighbor best ;
|
||||||
|
Neighbor lowest ;
|
||||||
|
|
||||||
|
if (neighborhood.hasNeighbor(_solution)) {
|
||||||
|
//init the first neighbor
|
||||||
|
neighborhood.init(_solution, current);
|
||||||
|
|
||||||
|
//eval the _solution moved with the neighbor and stock the result in the neighbor
|
||||||
|
eval(_solution, current);
|
||||||
|
|
||||||
|
// init the statistics
|
||||||
|
value() = true;
|
||||||
|
|
||||||
|
mean = current.fitness();
|
||||||
|
sd = mean * mean;
|
||||||
|
nb = 1;
|
||||||
|
nbInf = 0;
|
||||||
|
nbEqual = 0;
|
||||||
|
nbSup = 0;
|
||||||
|
|
||||||
|
if (solNeighborComparator.equals(_solution, current))
|
||||||
|
nbEqual++;
|
||||||
|
else if (solNeighborComparator(_solution, current))
|
||||||
|
nbSup++;
|
||||||
|
else
|
||||||
|
nbInf++;
|
||||||
|
|
||||||
|
//initialize the best neighbor
|
||||||
|
best = current;
|
||||||
|
lowest = current;
|
||||||
|
|
||||||
|
//test all others neighbors
|
||||||
|
while (neighborhood.cont(_solution)) {
|
||||||
|
//next neighbor
|
||||||
|
neighborhood.next(_solution, current);
|
||||||
|
//eval
|
||||||
|
eval(_solution, current);
|
||||||
|
|
||||||
|
mean += current.fitness();
|
||||||
|
sd += current.fitness() * current.fitness();
|
||||||
|
nb++;
|
||||||
|
|
||||||
|
if (solNeighborComparator.equals(_solution, current))
|
||||||
|
nbEqual++;
|
||||||
|
else if (solNeighborComparator(_solution, current))
|
||||||
|
nbSup++;
|
||||||
|
else
|
||||||
|
nbInf++;
|
||||||
|
|
||||||
|
//if we found a better neighbor, update the best
|
||||||
|
if (neighborComparator(best, current))
|
||||||
|
best = current;
|
||||||
|
|
||||||
|
if (neighborComparator(current, lowest))
|
||||||
|
lowest = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
max = best.fitness();
|
||||||
|
min = lowest.fitness();
|
||||||
|
|
||||||
|
mean /= nb;
|
||||||
|
if (nb > 1)
|
||||||
|
sd = sqrt( (sd - nb * mean * mean) / (nb - 1.0) );
|
||||||
|
else
|
||||||
|
sd = 0.0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//if _solution hasn't neighbor,
|
||||||
|
value() = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the worst fitness value found in the neighborhood
|
||||||
|
*/
|
||||||
|
Fitness getMin() {
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the best fitness value found in the neighborhood
|
||||||
|
*/
|
||||||
|
Fitness getMax() {
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the mean fitness value of the neighborhood
|
||||||
|
*/
|
||||||
|
double getMean() {
|
||||||
|
return mean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the standard deviation value of the neighborhood
|
||||||
|
*/
|
||||||
|
double getSD() {
|
||||||
|
return sd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the size of the neighborhood
|
||||||
|
*/
|
||||||
|
unsigned getSize() {
|
||||||
|
return nb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the number of neighbors having a better fitness than the current solution
|
||||||
|
*/
|
||||||
|
unsigned getNbSup() {
|
||||||
|
return nbSup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the number of neighbors having the same fitness than the current solution
|
||||||
|
*/
|
||||||
|
unsigned getNbEqual() {
|
||||||
|
return nbEqual;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the number of neighbors having a worst fitness than the current solution
|
||||||
|
*/
|
||||||
|
unsigned getNbInf() {
|
||||||
|
return nbInf;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moNeighborhoodStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
//the neighborhood
|
||||||
|
Neighborhood& neighborhood ;
|
||||||
|
moEval<Neighbor>& eval;
|
||||||
|
|
||||||
|
// comparator betwenn solution and neighbor or between neighbors
|
||||||
|
moNeighborComparator<Neighbor>& neighborComparator;
|
||||||
|
moSolNeighborComparator<Neighbor>& solNeighborComparator;
|
||||||
|
|
||||||
|
// default comparators
|
||||||
|
// compare the fitness values of neighbors
|
||||||
|
moNeighborComparator<Neighbor> defaultNeighborComp;
|
||||||
|
// compare the fitness values of the solution and the neighbor
|
||||||
|
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||||
|
|
||||||
|
// the stastics of the fitness
|
||||||
|
Fitness max, min;
|
||||||
|
//mean and standard deviation
|
||||||
|
double mean, sd ;
|
||||||
|
|
||||||
|
// number of neighbors in the neighborhood;
|
||||||
|
unsigned int nb;
|
||||||
|
|
||||||
|
// number of neighbors with lower, equal and higher fitness
|
||||||
|
unsigned int nbInf, nbEqual, nbSup ;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
<moNeutralDegreeNeighborStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moNeutralDegreeNeighborStat_h
|
||||||
|
#define moNeutralDegreeNeighborStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <continuator/moNeighborhoodStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From moNeighborhoodStat, to compute the neutral degree of the solution
|
||||||
|
* which is the number of solutions in the neighborhood
|
||||||
|
* with equals fitness
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moNeutralDegreeNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, unsigned >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _nhStat a neighborhoodStat
|
||||||
|
*/
|
||||||
|
moNeutralDegreeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||||
|
moStat<EOT, unsigned>(0, "neutral degree"), nhStat(_nhStat) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = nhStat.getNbEqual();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = nhStat.getNbEqual();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moNeutralDegreeNeighborStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** moNeighborhoodStat */
|
||||||
|
moNeighborhoodStat<Neighbor> & nhStat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
<moSecondMomentNeighborStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moSecondMomentNeighborStat_h
|
||||||
|
#define moSecondMomentNeighborStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <continuator/moNeighborhoodStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From moNeighborhoodStat, to compute the average and the standard deviation of fitness in the neighborhood
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moSecondMomentNeighborStat : public moStat<typename Neighbor::EOT, std::pair<double, double> >
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, std::pair<double, double> >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _nhStat a neighborhoodStat
|
||||||
|
*/
|
||||||
|
moSecondMomentNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||||
|
moStat<EOT, std::pair<double, double> >(std::make_pair(0.0,0.0), "average and stdev"), nhStat(_nhStat) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the average and the standard deviation of fitness in the neighborhood
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value().first = nhStat.getMean();
|
||||||
|
value().second = nhStat.getSD();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the average and the standard deviation of fitness in the neighborhood
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value().first = nhStat.getMean();
|
||||||
|
value().second = nhStat.getSD();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moSecondMomentNeighborStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** moNeighborhoodStat */
|
||||||
|
moNeighborhoodStat<Neighbor> & nhStat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
/*
|
||||||
|
<moSizeNeighborStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moSizeNeighborStat_h
|
||||||
|
#define moSizeNeighborStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <continuator/moNeighborhoodStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moSizeNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, unsigned >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _nhStat a neighborhoodStat
|
||||||
|
*/
|
||||||
|
moSizeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||||
|
moStat<EOT, unsigned>(0, "size"), nhStat(_nhStat) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of solutions in the neighborhood
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = nhStat.getSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of solutions in the neighborhood
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = nhStat.getSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moSizeNeighborStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** moNeighborhoodStat */
|
||||||
|
moNeighborhoodStat<Neighbor> & nhStat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
82
branches/rc2.0/paradiseo-mo/src/continuator/moSolutionStat.h
Normal file
82
branches/rc2.0/paradiseo-mo/src/continuator/moSolutionStat.h
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
<moSolutionStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moSolutionStat_h
|
||||||
|
#define moSolutionStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic which only give the current solution.
|
||||||
|
* Be careful, the solution is given by copy
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moSolutionStat : public moStat<EOT, EOT>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
using moStat< EOT, EOT >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _description a description of the parameter
|
||||||
|
*/
|
||||||
|
moSolutionStat(std::string _description = "solution"):
|
||||||
|
moStat<EOT, EOT>(EOT(), _description) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialization the solution by copy
|
||||||
|
* @param _sol the intial solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = _sol;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the solution by copy
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = _sol;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moSolutionStat";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
61
branches/rc2.0/paradiseo-mo/src/continuator/moStat.h
Normal file
61
branches/rc2.0/paradiseo-mo/src/continuator/moStat.h
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
<moStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moStat_h
|
||||||
|
#define moStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStatBase.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The actual class that will be used as base for all statistics
|
||||||
|
* that need to be calculated over the solution
|
||||||
|
* It is a moStatBase AND an eoValueParam so it can be used in Monitors.
|
||||||
|
*/
|
||||||
|
template <class EOT, class T>
|
||||||
|
class moStat : public eoValueParam<T>, public moStatBase<EOT>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _value a default parameter's value
|
||||||
|
* @param _description a description of the parameter
|
||||||
|
*/
|
||||||
|
moStat(T _value, std::string _description):
|
||||||
|
eoValueParam<T>(_value, _description) {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
61
branches/rc2.0/paradiseo-mo/src/continuator/moStatBase.h
Normal file
61
branches/rc2.0/paradiseo-mo/src/continuator/moStatBase.h
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
<moStatBase.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moStatBase_h
|
||||||
|
#define moStatBase_h
|
||||||
|
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
#include <utils/eoParam.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for all statistics that need to be calculated
|
||||||
|
* over the solution
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moStatBase : public eoUF<EOT &, void>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* last call of a statistical operator
|
||||||
|
*/
|
||||||
|
virtual void lastCall(EOT &) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* first call of a statistical operator
|
||||||
|
*/
|
||||||
|
virtual void init(EOT &) {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
83
branches/rc2.0/paradiseo-mo/src/continuator/moStatFromStat.h
Normal file
83
branches/rc2.0/paradiseo-mo/src/continuator/moStatFromStat.h
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
<moStatFromStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moStatFromStat_h
|
||||||
|
#define moStatFromStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic which copy another statistic
|
||||||
|
*/
|
||||||
|
template <class EOT, class T>
|
||||||
|
class moStatFromStat : public moStat<EOT, T>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
using moStat< EOT , T >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _stat a stat
|
||||||
|
*/
|
||||||
|
moStatFromStat(moStat<EOT,T> & _stat): moStat<EOT, T>(0, _stat.description()), stat(_stat) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value of this stat is a copy of the value of the initial stat
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = stat.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value of this stat is a copy of the value of the initial stat
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = stat.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moStatFromStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
moStat<EOT, T> & stat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*
|
||||||
|
<moStdFitnessNeighborStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moStdFitnessNeighborStat_h
|
||||||
|
#define moStdFitnessNeighborStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <continuator/moNeighborhoodStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From moNeighborhoodStat, to compute the average and the standard deviation of fitness in the neighborhood
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moStdFitnessNeighborStat : public moStat<typename Neighbor::EOT, double >
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
using moStat< EOT, double >::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _nhStat a neighborhoodStat
|
||||||
|
*/
|
||||||
|
moStdFitnessNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
|
||||||
|
moStat<EOT, double >(0.0, "stdev"), nhStat(_nhStat) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the average and the standard deviation of fitness in the neighborhood
|
||||||
|
* @param _sol the first solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = nhStat.getSD();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the average and the standard deviation of fitness in the neighborhood
|
||||||
|
* @param _sol the corresponding solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = nhStat.getSD();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moStdFitnessNeighborStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** moNeighborhoodStat */
|
||||||
|
moNeighborhoodStat<Neighbor> & nhStat;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
131
branches/rc2.0/paradiseo-mo/src/continuator/moTimeContinuator.h
Normal file
131
branches/rc2.0/paradiseo-mo/src/continuator/moTimeContinuator.h
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*
|
||||||
|
<moTimeContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moTimeContinuator_h
|
||||||
|
#define _moTimeContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Termination condition until a running time is reached.
|
||||||
|
*/
|
||||||
|
template < class Neighbor >
|
||||||
|
class moTimeContinuator: public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _max maximum running time (in second)
|
||||||
|
* @param _verbose verbose mode true/false -> on/off
|
||||||
|
*/
|
||||||
|
moTimeContinuator(time_t _max, bool _verbose = true): max(_max), verbose(_verbose) {
|
||||||
|
external = false;
|
||||||
|
start = time(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Synchronize the whole time with an external starting time
|
||||||
|
* @param _externalStart external starting time
|
||||||
|
*/
|
||||||
|
virtual void setStartingTime(time_t _externalStart) {
|
||||||
|
external = true;
|
||||||
|
start = _externalStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To get the starting time
|
||||||
|
* @return starting time
|
||||||
|
*/
|
||||||
|
virtual time_t getStartingTime() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To set the maximum running time
|
||||||
|
*
|
||||||
|
* @param _maxTime maximum running time
|
||||||
|
*/
|
||||||
|
virtual void maxTime(time_t _maxTime) {
|
||||||
|
max = _maxTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns false when the running time is reached.
|
||||||
|
* @param _sol the current solution
|
||||||
|
*/
|
||||||
|
virtual bool operator() (EOT& _sol)
|
||||||
|
{
|
||||||
|
bool res;
|
||||||
|
time_t elapsed = (time_t) difftime(time(NULL), start);
|
||||||
|
res = (elapsed < max);
|
||||||
|
if (!res && verbose)
|
||||||
|
std::cout << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reset the start time
|
||||||
|
* @param _solution a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
if (!external)
|
||||||
|
start = time(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const
|
||||||
|
{
|
||||||
|
return "moTimeContinuator";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** maximum running time */
|
||||||
|
time_t max;
|
||||||
|
/** starting time */
|
||||||
|
time_t start;
|
||||||
|
/** external start flag */
|
||||||
|
bool external;
|
||||||
|
/** verbose mode */
|
||||||
|
bool verbose;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
<moTrueContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moTrueContinuator_h
|
||||||
|
#define _moTrueContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continuator always return True
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moTrueContinuator : public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
// empty constructor
|
||||||
|
moTrueContinuator() {} ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param _solution a solution
|
||||||
|
* @return always true
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTHING TO DO
|
||||||
|
* @param _solution a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
82
branches/rc2.0/paradiseo-mo/src/continuator/moUnsignedStat.h
Normal file
82
branches/rc2.0/paradiseo-mo/src/continuator/moUnsignedStat.h
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
<moUnsignedStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moUnsignedStat_h
|
||||||
|
#define moUnsignedStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic gives from a boolean variable
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moUnsignedStat : public moStat<EOT, unsigned int>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
using moStat< EOT, unsigned int>::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
*/
|
||||||
|
moUnsignedStat(unsigned int * _b): moStat<EOT, unsigned int>(*_b, "unsigned"), b(_b) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = *b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = *b;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moUnsignedStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned int * b;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
67
branches/rc2.0/paradiseo-mo/src/continuator/moUpdater.h
Normal file
67
branches/rc2.0/paradiseo-mo/src/continuator/moUpdater.h
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
/*
|
||||||
|
<moUpdater.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
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 moUpdater_h
|
||||||
|
#define moUpdater_h
|
||||||
|
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
#include <utils/eoParam.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for to update what ever you want
|
||||||
|
* similar to eoUpdater
|
||||||
|
* But there is an init method !
|
||||||
|
*/
|
||||||
|
class moUpdater : public eoF<void>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* first call of the updater
|
||||||
|
*/
|
||||||
|
virtual void init() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* last call of the updater
|
||||||
|
*/
|
||||||
|
virtual void lastCall() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class name
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const
|
||||||
|
{ return "moUpdater"; }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
<moValueParamContinuator.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moValueParamContinuator_h
|
||||||
|
#define _moValueParamContinuator_h
|
||||||
|
|
||||||
|
#include <continuator/moContinuator.h>
|
||||||
|
//#include <neighborhood/moNeighborhood.h>
|
||||||
|
#include <utils/eoParam.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Continue until a maximum fixed number of full evaluation is reached
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Becareful 1: if restartCounter is true, then the number of full evaluations is considered during the local search (not before it)
|
||||||
|
*
|
||||||
|
* Becareful 2: Can not be used if the evaluation function is used in parallel
|
||||||
|
*/
|
||||||
|
template< class Neighbor, class ValueType >
|
||||||
|
class moValueParamContinuator : public moContinuator<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _eval evaluation function to count
|
||||||
|
* @param _maxValue bound of the value
|
||||||
|
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
|
||||||
|
*/
|
||||||
|
moValueParamContinuator(eoValueParam<ValueType> & _valueParam, unsigned int _maxValue, bool _restartCounter = true): valueParam(_valueParam), maxValue(_maxValue), restartCounter(_restartCounter) {
|
||||||
|
value_start = valueParam.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if continue
|
||||||
|
* @param _solution a solution
|
||||||
|
* @return true if number of evaluations < maxValue
|
||||||
|
*/
|
||||||
|
virtual bool operator()(EOT & _solution) {
|
||||||
|
return (valueParam.value() - value_start < maxValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the number of evaluations
|
||||||
|
* @param _solution a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _solution) {
|
||||||
|
if (restartCounter)
|
||||||
|
value_start = valueParam.value();
|
||||||
|
else
|
||||||
|
value_start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the current number of evaluation from the begining
|
||||||
|
* @return the number of evaluation
|
||||||
|
*/
|
||||||
|
unsigned int value() {
|
||||||
|
return valueParam.value() - value_start ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
eoValueParam<ValueType> & valueParam;
|
||||||
|
ValueType value_start ;
|
||||||
|
bool restartCounter;
|
||||||
|
unsigned int maxValue ;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
84
branches/rc2.0/paradiseo-mo/src/continuator/moValueStat.h
Normal file
84
branches/rc2.0/paradiseo-mo/src/continuator/moValueStat.h
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
<moValueStat.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moValueStat_h
|
||||||
|
#define moValueStat_h
|
||||||
|
|
||||||
|
#include <continuator/moStat.h>
|
||||||
|
#include <utils/eoParam.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The statistic gives the number of iteration
|
||||||
|
*/
|
||||||
|
template <class EOT, class ValueType>
|
||||||
|
class moValueStat : public moStat<EOT, double>
|
||||||
|
{
|
||||||
|
public :
|
||||||
|
using moStat< EOT, double>::value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
*/
|
||||||
|
moValueStat(eoValueParam<ValueType> & _valueParam): moStat<EOT, double>(0, "value"), valueParam(_valueParam) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void init(EOT & _sol) {
|
||||||
|
value() = (double) valueParam.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the number of iteration
|
||||||
|
* @param _sol a solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _sol) {
|
||||||
|
value() = (double) valueParam.value() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moValueStat";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
eoValueParam<ValueType> & valueParam;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
241
branches/rc2.0/paradiseo-mo/src/continuator/moVectorMonitor.h
Normal file
241
branches/rc2.0/paradiseo-mo/src/continuator/moVectorMonitor.h
Normal file
|
|
@ -0,0 +1,241 @@
|
||||||
|
/*
|
||||||
|
<moVectorMonitor.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moVectorMonitor_h
|
||||||
|
#define moVectorMonitor_h
|
||||||
|
|
||||||
|
#include <fstream>
|
||||||
|
#include <utils/eoMonitor.h>
|
||||||
|
#include <utils/eoParam.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To save the values of the same type (double, unsigned int, or EOT) in a vector
|
||||||
|
* It is similar to eoFileMonitor
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template <class EOT>
|
||||||
|
class moVectorMonitor : public eoMonitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _param the parameter of type double to save in the vector
|
||||||
|
*/
|
||||||
|
moVectorMonitor(eoValueParam<double> & _param) : doubleParam(&_param), intParam(NULL), eotParam(NULL)
|
||||||
|
{
|
||||||
|
// precision of the output by default
|
||||||
|
precisionOutput = std::cout.precision();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
* @param _param the parameter of type unsigned int to save in the vector
|
||||||
|
*/
|
||||||
|
moVectorMonitor(eoValueParam<unsigned int> & _param) : doubleParam(NULL), intParam(&_param), eotParam(NULL)
|
||||||
|
{
|
||||||
|
// precision of the output by default
|
||||||
|
precisionOutput = std::cout.precision();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
* @param _param the parameter of type EOT to save in the vector
|
||||||
|
*/
|
||||||
|
moVectorMonitor(eoValueParam<EOT> & _param) : doubleParam(NULL), intParam(NULL), eotParam(&_param)
|
||||||
|
{
|
||||||
|
// precision of the output by default
|
||||||
|
precisionOutput = std::cout.precision();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
* @param _param the parameter of type eoScalarFitness to save in the vector
|
||||||
|
*/
|
||||||
|
template <class ScalarType, class Compare>
|
||||||
|
moVectorMonitor(eoValueParam<eoScalarFitness<ScalarType, Compare> > & _param) : doubleParam( & (eoValueParam<double>&)_param), intParam(NULL), eotParam(NULL)
|
||||||
|
{
|
||||||
|
// precision of the output by default
|
||||||
|
precisionOutput = std::cout.precision();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
* @param _param unvalid Parameter
|
||||||
|
*/
|
||||||
|
template <class T>
|
||||||
|
moVectorMonitor(eoValueParam<T> & _param) : doubleParam(NULL), intParam(NULL), eotParam(NULL)
|
||||||
|
{
|
||||||
|
std::cerr << "Sorry the type can not be in a vector of moVectorMonitor" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To test if the value are basic type (double or unsigned int), or EOT type
|
||||||
|
*
|
||||||
|
* @return true if the type is a EOT type
|
||||||
|
*/
|
||||||
|
bool solutionType() {
|
||||||
|
return eotParam != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To "print" the value of the parameter in the vector
|
||||||
|
*
|
||||||
|
* @return this monitor (sorry I don't why, but it is like this in EO)
|
||||||
|
*/
|
||||||
|
eoMonitor& operator()(void) {
|
||||||
|
if (doubleParam != NULL)
|
||||||
|
valueVec.push_back(doubleParam->value());
|
||||||
|
else
|
||||||
|
if (intParam != NULL)
|
||||||
|
valueVec.push_back((double) intParam->value());
|
||||||
|
else
|
||||||
|
eotVec.push_back(eotParam->value());
|
||||||
|
return *this ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To have all the values
|
||||||
|
*
|
||||||
|
* @return the vector of values
|
||||||
|
*/
|
||||||
|
const std::vector<double>& getValues() const {
|
||||||
|
return valueVec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To have all the solutions
|
||||||
|
*
|
||||||
|
* @return the vector of solutions
|
||||||
|
*/
|
||||||
|
const std::vector<EOT>& getSolutions() const {
|
||||||
|
return eotVec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to get the value out.
|
||||||
|
* @return the string of the value
|
||||||
|
*/
|
||||||
|
std::string getValue(unsigned int i) const {
|
||||||
|
std::ostringstream os;
|
||||||
|
|
||||||
|
// set the precision of the output
|
||||||
|
os.precision(precisionOutput);
|
||||||
|
|
||||||
|
if (eotParam == NULL)
|
||||||
|
os << (valueVec[i]) ;
|
||||||
|
else
|
||||||
|
os << (eotVec[i]) ;
|
||||||
|
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clear the vector
|
||||||
|
*/
|
||||||
|
void clear() {
|
||||||
|
valueVec.clear();
|
||||||
|
eotVec.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* number of value
|
||||||
|
* @return size of the vector
|
||||||
|
*/
|
||||||
|
unsigned int size() {
|
||||||
|
if (eotParam == NULL)
|
||||||
|
return valueVec.size();
|
||||||
|
else
|
||||||
|
return eotVec.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to set the precision of the output file
|
||||||
|
* @param _precision precision of the output (number of digit)
|
||||||
|
*/
|
||||||
|
void precision(unsigned int _precision) {
|
||||||
|
precisionOutput = _precision;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to export the vector of values into one file
|
||||||
|
* @param _filename file name
|
||||||
|
* @param _openFile to specify if it writes at the following of the file
|
||||||
|
*/
|
||||||
|
void fileExport(std::string _filename, bool _openFile=false) {
|
||||||
|
// create file
|
||||||
|
std::ofstream os;
|
||||||
|
|
||||||
|
if(! _openFile)
|
||||||
|
os.open(_filename.c_str());
|
||||||
|
|
||||||
|
else
|
||||||
|
os.open(_filename.c_str(),std::ios::app);
|
||||||
|
|
||||||
|
|
||||||
|
if (!os) {
|
||||||
|
std::string str = "moVectorMonitor: Could not open " + _filename;
|
||||||
|
throw std::runtime_error(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < size(); i++) {
|
||||||
|
os << getValue(i);
|
||||||
|
|
||||||
|
os << std::endl ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return name of the class
|
||||||
|
*/
|
||||||
|
virtual std::string className(void) const {
|
||||||
|
return "moVectorMonitor";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
eoValueParam<double> * doubleParam ;
|
||||||
|
eoValueParam<unsigned int> * intParam ;
|
||||||
|
eoValueParam<EOT> * eotParam ;
|
||||||
|
|
||||||
|
std::vector<double> valueVec;
|
||||||
|
std::vector<EOT> eotVec;
|
||||||
|
|
||||||
|
// precision of the output
|
||||||
|
unsigned int precisionOutput;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
<moCoolingSchedule.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moCoolingSchedule_h
|
||||||
|
#define _moCoolingSchedule_h
|
||||||
|
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cooling Schedule of the temperature in the simulated algorithm
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template< class EOT >
|
||||||
|
class moCoolingSchedule : public eoUF<double, bool>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Init the solution with the initial temperature
|
||||||
|
* @param _solution initial solution
|
||||||
|
*/
|
||||||
|
virtual double init(EOT & _solution) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update the temperature
|
||||||
|
* @param _temp current temperature to update
|
||||||
|
* @param _acceptedMove true when the move is accepted, false otherwise
|
||||||
|
*/
|
||||||
|
virtual void update(double& _temp, bool _acceptedMove) = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
/*
|
||||||
|
<moDynSpanCoolingSchedule.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moDynSpanCoolingSchedule_h
|
||||||
|
#define _moDynSpanCoolingSchedule_h
|
||||||
|
|
||||||
|
#include <coolingSchedule/moCoolingSchedule.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cooling Schedule of the temperature in the simulated algorithm
|
||||||
|
* dynamic span : maximum number of tries and maximum number of moves
|
||||||
|
* stop on the number of span with no move
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template< class EOT >
|
||||||
|
class moDynSpanCoolingSchedule : public moCoolingSchedule<EOT>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* default constructor
|
||||||
|
* @param _initT initial temperature
|
||||||
|
* @param _alpha factor of decreasing
|
||||||
|
* @param _spanTriesMax maximum number of total move at equal temperature
|
||||||
|
* @param _spanMoveMax maximum number of moves at equal temperature
|
||||||
|
* @param _nbSpanMax maximum number of span with no move before stopping the search
|
||||||
|
*/
|
||||||
|
moDynSpanCoolingSchedule(double _initT, double _alpha, unsigned int _spanTriesMax, unsigned int _spanMoveMax, unsigned int _nbSpanMax) :
|
||||||
|
initT(_initT), alpha(_alpha), spanTriesMax(_spanTriesMax), spanMoveMax(_spanMoveMax), nbSpanMax(_nbSpanMax) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initial temperature
|
||||||
|
* @param _solution initial solution
|
||||||
|
*/
|
||||||
|
virtual double init(EOT & _solution) {
|
||||||
|
// number of tries since the last temperature change
|
||||||
|
spanTries = 0;
|
||||||
|
|
||||||
|
// number of move since the last temperature change
|
||||||
|
spanMove = 0;
|
||||||
|
|
||||||
|
// number of successive span with no move
|
||||||
|
nbSpan = 0;
|
||||||
|
|
||||||
|
return initT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update the temperature by a factor
|
||||||
|
* @param _temp current temperature to update
|
||||||
|
* @param _acceptedMove true when the move is accepted, false otherwise
|
||||||
|
*/
|
||||||
|
virtual void update(double& _temp, bool _acceptedMove) {
|
||||||
|
spanTries++;
|
||||||
|
|
||||||
|
if (_acceptedMove)
|
||||||
|
spanMove++;
|
||||||
|
|
||||||
|
if (spanTries >= spanTriesMax || spanMove >= spanMoveMax) {
|
||||||
|
_temp *= alpha;
|
||||||
|
|
||||||
|
if (spanMove == 0) // no move during this span ?
|
||||||
|
nbSpan++;
|
||||||
|
else
|
||||||
|
nbSpan = 0;
|
||||||
|
|
||||||
|
spanTries = 0;
|
||||||
|
spanMove = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* compare the number of span with no move
|
||||||
|
* @param _temp current temperature
|
||||||
|
* @return true if the search can continue
|
||||||
|
*/
|
||||||
|
virtual bool operator()(double _temp) {
|
||||||
|
return nbSpan <= nbSpanMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// initial temperature
|
||||||
|
double initT;
|
||||||
|
|
||||||
|
// coefficient of decrease
|
||||||
|
double alpha;
|
||||||
|
|
||||||
|
// number of total move at equal temperature
|
||||||
|
unsigned int spanTries;
|
||||||
|
|
||||||
|
// number of move at equal temperature
|
||||||
|
unsigned int spanMove;
|
||||||
|
|
||||||
|
// number of successive spans with no move
|
||||||
|
unsigned int nbSpan;
|
||||||
|
|
||||||
|
// maximum number of total move at equal temperature
|
||||||
|
unsigned int spanTriesMax;
|
||||||
|
|
||||||
|
// maximum number of move at equal temperature
|
||||||
|
unsigned int spanMoveMax;
|
||||||
|
|
||||||
|
// maximum number of successive spans with no move
|
||||||
|
unsigned int nbSpanMax;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
/*
|
||||||
|
<moSimpleCoolingSchedule.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moSimpleCoolingSchedule_h
|
||||||
|
#define _moSimpleCoolingSchedule_h
|
||||||
|
|
||||||
|
#include <coolingSchedule/moCoolingSchedule.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classical cooling Schedule of the temperature in the simulated algorithm with initial and final temperature and a factor of decrease
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template< class EOT >
|
||||||
|
class moSimpleCoolingSchedule : public moCoolingSchedule<EOT>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _initT initial temperature
|
||||||
|
* @param _alpha factor of decreasing
|
||||||
|
* @param _span number of iteration with equal temperature
|
||||||
|
* @param _finalT final temperature, threshold of the stopping criteria
|
||||||
|
*/
|
||||||
|
moSimpleCoolingSchedule(double _initT, double _alpha, unsigned _span, double _finalT) : initT(_initT), alpha(_alpha), span(_span), finalT(_finalT) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter on the initial temperature
|
||||||
|
* @param _solution initial solution
|
||||||
|
* @return the initial temperature
|
||||||
|
*/
|
||||||
|
virtual double init(EOT & _solution) {
|
||||||
|
// number of iteration with the same temperature
|
||||||
|
step = 0;
|
||||||
|
|
||||||
|
return initT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update the temperature by a factor
|
||||||
|
* @param _temp current temperature to update
|
||||||
|
* @param _acceptedMove true when the move is accepted, false otherwise
|
||||||
|
*/
|
||||||
|
virtual void update(double& _temp, bool _acceptedMove) {
|
||||||
|
if (step >= span) {
|
||||||
|
_temp *= alpha;
|
||||||
|
step = 0;
|
||||||
|
} else
|
||||||
|
step++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* compare the temperature to the threshold
|
||||||
|
* @param _temp current temperature
|
||||||
|
* @return true if the current temperature is over the threshold (final temperature)
|
||||||
|
*/
|
||||||
|
virtual bool operator()(double _temp) {
|
||||||
|
return _temp > finalT;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// initial temperature
|
||||||
|
double initT;
|
||||||
|
// coefficient of decrease
|
||||||
|
double alpha;
|
||||||
|
// maximum number of iterations at the same temperature
|
||||||
|
unsigned int span;
|
||||||
|
// threshold temperature
|
||||||
|
double finalT;
|
||||||
|
// number of steps with the same temperature
|
||||||
|
unsigned int step;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
104
branches/rc2.0/paradiseo-mo/src/eval/moDoubleIncrEvaluation.h
Normal file
104
branches/rc2.0/paradiseo-mo/src/eval/moDoubleIncrEvaluation.h
Normal file
|
|
@ -0,0 +1,104 @@
|
||||||
|
/*
|
||||||
|
<moDoubleIncrEvaluation.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
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 moDoubleIncrEvaluation_H
|
||||||
|
#define moDoubleIncrEvaluation_H
|
||||||
|
|
||||||
|
#include <eval/moNeighborhoodEvaluation.h>
|
||||||
|
#include <continuator/moUpdater.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for the double incremental evaluation of the neighborhood
|
||||||
|
*
|
||||||
|
* The sizes of the neighborhoods are equal
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moDoubleIncrEvaluation : public moNeighborhoodEvaluation<Neighbor>, public moUpdater
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef typename EOT::Fitness Fitness;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param _neighborhoodSize the size of the neighborhood
|
||||||
|
*/
|
||||||
|
moDoubleIncrEvaluation(unsigned int _neighborhoodSize) : moNeighborhoodEvaluation<Neighbor>(), moUpdater(), neighborhoodSize(_neighborhoodSize), firstEval(true) {
|
||||||
|
deltaFitness = new Fitness[neighborhoodSize];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
~moDoubleIncrEvaluation() {
|
||||||
|
if (deltaFitness != NULL)
|
||||||
|
delete [] deltaFitness;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialisation of the evaluation process
|
||||||
|
* The first evaluation will be a simple incremental evaluation
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual void init() {
|
||||||
|
firstEval = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void operator()() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluation of the neighborhood
|
||||||
|
* Here nothing to do
|
||||||
|
*
|
||||||
|
* @param _solution the current solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _solution) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/** the delta of fitness for each neighbors
|
||||||
|
* The fitness of the neighbor i is given by : fitness(solution) + deltaFitness[i]
|
||||||
|
*/
|
||||||
|
Fitness * deltaFitness;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** the neighborhood size */
|
||||||
|
unsigned int neighborhoodSize;
|
||||||
|
|
||||||
|
/** flag : true when it is the first evaluation */
|
||||||
|
bool firstEval;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
<moDoubleIncrNeighborhoodEval.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
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 moDoubleIncrNeighborhoodEval_H
|
||||||
|
#define moDoubleIncrNeighborhoodEval_H
|
||||||
|
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <eval/moDoubleIncrEvaluation.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluation of a neighbor from the full evaluation f the neighborhood
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moDoubleIncrNeighborhoodEval : public moEval<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename moEval<Neighbor>::EOT EOT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _evaluation the double incremental evaluation of the neighborhood
|
||||||
|
*/
|
||||||
|
moDoubleIncrNeighborhoodEval(moDoubleIncrEvaluation<Neighbor>& _evaluation) : evaluation(_evaluation) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* evaluation of a neighbor with the double incremental evaluation
|
||||||
|
*
|
||||||
|
* @param _sol current solution
|
||||||
|
* @param _neighbor the neighbor to be evaluated
|
||||||
|
*/
|
||||||
|
void operator()(EOT & _sol, Neighbor & _neighbor)
|
||||||
|
{
|
||||||
|
_neighbor.fitness(_sol.fitness() + evaluation.deltaFitness[_neighbor.index()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** the evaluation of the neighborhood */
|
||||||
|
moDoubleIncrEvaluation<Neighbor> & evaluation;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
53
branches/rc2.0/paradiseo-mo/src/eval/moDummyEval.h
Normal file
53
branches/rc2.0/paradiseo-mo/src/eval/moDummyEval.h
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
<moDummyEval.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moDummyEval_h
|
||||||
|
#define _moDummyEval_h
|
||||||
|
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy Evaluation function
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moDummyEval : public moEval<Neighbor> {
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef typename EOT::Fitness Fitness;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTHING TO DO
|
||||||
|
* @param _sol unused solution
|
||||||
|
* @param _n unused neighbor
|
||||||
|
*/
|
||||||
|
void operator()(EOT& _sol, Neighbor& _n) {}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
51
branches/rc2.0/paradiseo-mo/src/eval/moEval.h
Normal file
51
branches/rc2.0/paradiseo-mo/src/eval/moEval.h
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
/*
|
||||||
|
<moEval.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
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 moEval_H
|
||||||
|
#define moEval_H
|
||||||
|
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for the evaluation
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moEval : public eoBF<typename Neighbor::EOT &, Neighbor&, void>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef typename EOT::Fitness Fitness;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
66
branches/rc2.0/paradiseo-mo/src/eval/moEvalCounter.h
Normal file
66
branches/rc2.0/paradiseo-mo/src/eval/moEvalCounter.h
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
<moEvalCounter.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
This software is governed by the CeCILL license under French law and
|
||||||
|
abiding by the rules of distribution of free software. You can ue,
|
||||||
|
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".
|
||||||
|
|
||||||
|
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 _moEvalCounter_h
|
||||||
|
#define _moEvalCounter_h
|
||||||
|
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
#include <utils/eoParam.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
Counts the number of neighbor evaluations actually performed, thus checks first
|
||||||
|
if it has to evaluate.. etc.
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moEvalCounter : public moEval<Neighbor>, public eoValueParam<unsigned long>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef typename EOT::Fitness Fitness;
|
||||||
|
|
||||||
|
moEvalCounter(moEval<Neighbor>& _eval, std::string _name = "Neighbor Eval. ")
|
||||||
|
: eoValueParam<unsigned long>(0, _name), eval(_eval) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increase the number of neighbor evaluations and perform the evaluation
|
||||||
|
*
|
||||||
|
* @param _solution a solution
|
||||||
|
* @param _neighbor a neighbor
|
||||||
|
*/
|
||||||
|
void operator()(EOT& _solution, Neighbor& _neighbor) {
|
||||||
|
value()++;
|
||||||
|
eval(_solution, _neighbor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
moEval<Neighbor> & eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
82
branches/rc2.0/paradiseo-mo/src/eval/moFullEvalByCopy.h
Normal file
82
branches/rc2.0/paradiseo-mo/src/eval/moFullEvalByCopy.h
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
<moFullEvalByCopy.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moFullEvalByCopy_H
|
||||||
|
#define moFullEvalByCopy_H
|
||||||
|
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluation by copy
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moFullEvalByCopy : public moEval<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename moEval<Neighbor>::EOT EOT;
|
||||||
|
typedef typename moEval<Neighbor>::Fitness Fitness;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _eval the full evaluation object
|
||||||
|
*/
|
||||||
|
moFullEvalByCopy(eoEvalFunc<EOT> & _eval) : eval(_eval) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full evaluation of the neighbor by copy
|
||||||
|
* @param _sol current solution
|
||||||
|
* @param _neighbor the neighbor to be evaluated
|
||||||
|
*/
|
||||||
|
void operator()(EOT & _sol, Neighbor & _neighbor)
|
||||||
|
{
|
||||||
|
// tmp solution
|
||||||
|
EOT tmp(_sol);
|
||||||
|
// move tmp solution wrt _neighbor
|
||||||
|
_neighbor.move(tmp);
|
||||||
|
// eval copy
|
||||||
|
tmp.invalidate();
|
||||||
|
eval(tmp);
|
||||||
|
// set the fitness value to the neighbor
|
||||||
|
_neighbor.fitness(tmp.fitness());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** the full evaluation object */
|
||||||
|
eoEvalFunc<EOT> & eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
96
branches/rc2.0/paradiseo-mo/src/eval/moFullEvalByModif.h
Normal file
96
branches/rc2.0/paradiseo-mo/src/eval/moFullEvalByModif.h
Normal file
|
|
@ -0,0 +1,96 @@
|
||||||
|
/*
|
||||||
|
<moFullEvalByModif.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 moFullEvalByModif_H
|
||||||
|
#define moFullEvalByModif_H
|
||||||
|
|
||||||
|
#include <eoEvalFunc.h>
|
||||||
|
#include <eval/moEval.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full evaluation to use with a moBackableNeighbor
|
||||||
|
* !!!WARNING!!! Use only when your solution is composed by a fitness Value and a "genotype"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template<class BackableNeighbor>
|
||||||
|
class moFullEvalByModif : public moEval<BackableNeighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename moEval<BackableNeighbor>::EOT EOT;
|
||||||
|
typedef typename moEval<BackableNeighbor>::Fitness Fitness;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor
|
||||||
|
* @param _eval the full evaluation object
|
||||||
|
*/
|
||||||
|
moFullEvalByModif(eoEvalFunc<EOT>& _eval) : eval(_eval) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full evaluation of the neighbor by copy
|
||||||
|
* @param _sol current solution
|
||||||
|
* @param _neighbor the neighbor to be evaluated
|
||||||
|
*/
|
||||||
|
void operator()(EOT & _sol, BackableNeighbor & _neighbor)
|
||||||
|
{
|
||||||
|
// tmp fitness value of the current solution
|
||||||
|
Fitness tmpFit;
|
||||||
|
|
||||||
|
// save current fitness value
|
||||||
|
tmpFit = _sol.fitness();
|
||||||
|
|
||||||
|
// move the current solution wrt _neighbor
|
||||||
|
_neighbor.move(_sol);
|
||||||
|
|
||||||
|
// eval the modified solution
|
||||||
|
_sol.invalidate();
|
||||||
|
eval(_sol);
|
||||||
|
|
||||||
|
// set the fitness value to the neighbor
|
||||||
|
_neighbor.fitness(_sol.fitness());
|
||||||
|
|
||||||
|
// move the current solution back
|
||||||
|
_neighbor.moveBack(_sol);
|
||||||
|
|
||||||
|
// set the fitness back
|
||||||
|
_sol.fitness(tmpFit);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** the full evaluation object */
|
||||||
|
eoEvalFunc<EOT> & eval;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
/*
|
||||||
|
<moNeighborhoodEvaluation.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||||
|
|
||||||
|
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 moNeighborhoodEvaluation_H
|
||||||
|
#define moNeighborhoodEvaluation_H
|
||||||
|
|
||||||
|
#include <eoFunctor.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for the evaluation
|
||||||
|
* of all the neighborhood
|
||||||
|
* in one step
|
||||||
|
*
|
||||||
|
* It is usefull for example in a double incremental evaluation (QAP, UBQP problems)
|
||||||
|
* This class is used in combinaison with the class moEvaluatedNeighborhood
|
||||||
|
*/
|
||||||
|
template<class Neighbor>
|
||||||
|
class moNeighborhoodEvaluation : public eoUF<typename Neighbor::EOT &, void>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef typename EOT::Fitness Fitness;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
111
branches/rc2.0/paradiseo-mo/src/explorer/moDummyExplorer.h
Normal file
111
branches/rc2.0/paradiseo-mo/src/explorer/moDummyExplorer.h
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
<moDummyExplorer.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moDummyExplorer_h
|
||||||
|
#define _moDummyExplorer_h
|
||||||
|
|
||||||
|
#include <explorer/moNeighborhoodExplorer.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dummy Explorer the neighborhood: nothing is explored
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moDummyExplorer : public moNeighborhoodExplorer<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef typename EOT::Fitness Fitness ;
|
||||||
|
|
||||||
|
moDummyExplorer(): moNeighborhoodExplorer<Neighbor>() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
void initParam (EOT& _solution) { } ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
void updateParam (EOT& _solution) { } ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
* @return always false
|
||||||
|
*/
|
||||||
|
bool isContinue(EOT& _solution) {
|
||||||
|
return false;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
void move(EOT& _solution) { } ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
* @return always false
|
||||||
|
*/
|
||||||
|
virtual bool accept(EOT& _solution) {
|
||||||
|
return false;
|
||||||
|
} ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
virtual void terminate(EOT& _solution) { } ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
void operator()(EOT & _solution) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moDummyExplorer";
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
171
branches/rc2.0/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h
Normal file
171
branches/rc2.0/paradiseo-mo/src/explorer/moFirstImprHCexplorer.h
Normal file
|
|
@ -0,0 +1,171 @@
|
||||||
|
/*
|
||||||
|
<moFirstImprHCexplorer.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moFirstImprHCexplorer_h
|
||||||
|
#define _moFirstImprHCexplorer_h
|
||||||
|
|
||||||
|
#include <explorer/moNeighborhoodExplorer.h>
|
||||||
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explorer for a first improvement heuristic
|
||||||
|
*/
|
||||||
|
template< class Neighbor>
|
||||||
|
class moFirstImprHCexplorer : public moNeighborhoodExplorer<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
using moNeighborhoodExplorer<Neighbor>::neighborhood;
|
||||||
|
using moNeighborhoodExplorer<Neighbor>::eval;
|
||||||
|
using moNeighborhoodExplorer<Neighbor>::currentNeighbor;
|
||||||
|
using moNeighborhoodExplorer<Neighbor>::selectedNeighbor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _eval the evaluation function
|
||||||
|
* @param _neighborComparator a neighbor comparator
|
||||||
|
* @param _solNeighborComparator a solution vs neighbor comparator
|
||||||
|
*/
|
||||||
|
moFirstImprHCexplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) {
|
||||||
|
isAccept = false;
|
||||||
|
stop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
~moFirstImprHCexplorer() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to never stop the hill climbing
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
virtual void alwaysContinue() {
|
||||||
|
stop = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initParam: NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
virtual void initParam(EOT & _solution) {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* updateParam: NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
virtual void updateParam(EOT & _solution) {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* terminate: NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
virtual void terminate(EOT & _solution) {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explore the neighborhood of a solution until an ameliorated neighbor is found
|
||||||
|
* @param _solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _solution) {
|
||||||
|
|
||||||
|
//Test if _solution has a Neighbor
|
||||||
|
if (neighborhood.hasNeighbor(_solution)) {
|
||||||
|
//init the first neighbor
|
||||||
|
neighborhood.init(_solution, currentNeighbor);
|
||||||
|
|
||||||
|
//eval the _solution moved with the neighbor and stock the result in the neighbor
|
||||||
|
eval(_solution, currentNeighbor);
|
||||||
|
|
||||||
|
//test all others neighbors
|
||||||
|
while (! solNeighborComparator(_solution, currentNeighbor) && neighborhood.cont(_solution)) {
|
||||||
|
//next neighbor
|
||||||
|
neighborhood.next(_solution, currentNeighbor);
|
||||||
|
//eval
|
||||||
|
eval(_solution, currentNeighbor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the selected neighbor
|
||||||
|
selectedNeighbor = currentNeighbor;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//if _solution hasn't neighbor,
|
||||||
|
isAccept=false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* continue if a move is accepted, or according to the flag 'stop'
|
||||||
|
* @param _solution the solution
|
||||||
|
* @return true if an ameliorated neighbor was found
|
||||||
|
*/
|
||||||
|
virtual bool isContinue(EOT & _solution) {
|
||||||
|
if (stop)
|
||||||
|
return isAccept ;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* accept test if an ameliorated neighbor was found
|
||||||
|
* @param _solution the solution
|
||||||
|
* @return true if the best neighbor ameliorate the fitness
|
||||||
|
*/
|
||||||
|
virtual bool accept(EOT & _solution) {
|
||||||
|
if (neighborhood.hasNeighbor(_solution)) {
|
||||||
|
isAccept = solNeighborComparator(_solution, selectedNeighbor) ;
|
||||||
|
}
|
||||||
|
return isAccept;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
// comparator betwenn solution and neighbor or between neighbors
|
||||||
|
moNeighborComparator<Neighbor>& neighborComparator;
|
||||||
|
moSolNeighborComparator<Neighbor>& solNeighborComparator;
|
||||||
|
|
||||||
|
// true if the move is accepted
|
||||||
|
bool isAccept ;
|
||||||
|
|
||||||
|
// if true the HC stop when to improving solution is found
|
||||||
|
// if false : never stop, always continue (external continuator)
|
||||||
|
bool stop ;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
179
branches/rc2.0/paradiseo-mo/src/explorer/moILSexplorer.h
Normal file
179
branches/rc2.0/paradiseo-mo/src/explorer/moILSexplorer.h
Normal file
|
|
@ -0,0 +1,179 @@
|
||||||
|
/*
|
||||||
|
<moILSexplorer.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moILSexplorer_h
|
||||||
|
#define _moILSexplorer_h
|
||||||
|
|
||||||
|
#include <explorer/moNeighborhoodExplorer.h>
|
||||||
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
#include <algo/moLocalSearch.h>
|
||||||
|
#include <perturb/moPerturbation.h>
|
||||||
|
#include <acceptCrit/moAcceptanceCriterion.h>
|
||||||
|
//#include <neighborhood/moDummyNeighborhood.h>
|
||||||
|
//#include <neighborhood/moDummyNeighbor.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explorer for an Iterated Local Search
|
||||||
|
*/
|
||||||
|
|
||||||
|
//template< class Neighbor >
|
||||||
|
//class moILSexplorer : public moNeighborhoodExplorer< moDummyNeighbor<typename Neighbor::EOT> >
|
||||||
|
|
||||||
|
template< class Neighbor, class NeighborLO >
|
||||||
|
class moILSexplorer : public moNeighborhoodExplorer< NeighborLO >
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
typedef typename Neighbor::EOT EOT;
|
||||||
|
typedef moNeighborhood<NeighborLO> NeighborhoodLO;
|
||||||
|
|
||||||
|
//typedef moDummyNeighbor<EOT> dummyNeighbor;
|
||||||
|
//typedef moDummyNeighborhood<dummyNeighbor> dummyNeighborhood;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _ls a local search
|
||||||
|
* @param _perturb a perturbation operator
|
||||||
|
* @param _acceptCrit a acceptance criteria
|
||||||
|
*/
|
||||||
|
moILSexplorer(moLocalSearch<Neighbor>& _ls, moPerturbation<Neighbor>& _perturb, moAcceptanceCriterion<Neighbor>& _acceptCrit) : moNeighborhoodExplorer<NeighborLO>(), ls(_ls), perturb(_perturb), acceptCrit(_acceptCrit) {
|
||||||
|
firstIteration=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
~moILSexplorer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init perturbation and acceptance criteria
|
||||||
|
* @param _solution the current solution
|
||||||
|
*/
|
||||||
|
virtual void initParam(EOT & _solution) {
|
||||||
|
firstIteration=true;
|
||||||
|
perturb.init(_solution);
|
||||||
|
acceptCrit.init(_solution);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update perturbation and acceptance criteria
|
||||||
|
* @param _solution the current solution
|
||||||
|
*/
|
||||||
|
virtual void updateParam(EOT & _solution) {
|
||||||
|
if ((*this).moveApplied()) {
|
||||||
|
perturb.add(_solution,emptyNeighbor);
|
||||||
|
acceptCrit.add(_solution,emptyNeighbor);
|
||||||
|
}
|
||||||
|
perturb.update(_solution, emptyNeighbor);
|
||||||
|
acceptCrit.update(_solution, emptyNeighbor);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* terminate: NOTHING TO DO
|
||||||
|
* @param _solution a solution (unused)
|
||||||
|
*/
|
||||||
|
virtual void terminate(EOT & _solution) {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perturb and apply local search on a solution
|
||||||
|
* @param _solution the solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _solution) {
|
||||||
|
//copy the solution to perform new local search
|
||||||
|
currentSol=_solution;
|
||||||
|
|
||||||
|
//perturb solution exept at the first iteration
|
||||||
|
if (!firstIteration) {
|
||||||
|
perturb(currentSol);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
firstIteration=false;
|
||||||
|
|
||||||
|
//apply the local search on the copy
|
||||||
|
ls(currentSol);
|
||||||
|
|
||||||
|
// std::cout << "(solution)\t" << current << std::endl;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Always continue
|
||||||
|
* @param _solution the solution
|
||||||
|
* @return always true
|
||||||
|
*/
|
||||||
|
virtual bool isContinue(EOT & _solution) {
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* copy the solution found by the local search
|
||||||
|
* @param _solution the solution
|
||||||
|
*/
|
||||||
|
virtual void move(EOT & _solution) {
|
||||||
|
_solution=currentSol;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* accept test if an ameliorated neighbor was found
|
||||||
|
* @param _solution the solution
|
||||||
|
* @return true if acceptance criteria is verified
|
||||||
|
*/
|
||||||
|
virtual bool accept(EOT & _solution) {
|
||||||
|
return acceptCrit(_solution, currentSol);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the class Name
|
||||||
|
* @return the class name as a std::string
|
||||||
|
*/
|
||||||
|
virtual std::string className() const {
|
||||||
|
return "moILSexplorer";
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
//Usefull to use the momory of tabuSearch
|
||||||
|
Neighbor emptyNeighbor;
|
||||||
|
EOT currentSol;
|
||||||
|
moLocalSearch<Neighbor>& ls;
|
||||||
|
moPerturbation<Neighbor> & perturb;
|
||||||
|
moAcceptanceCriterion<Neighbor>& acceptCrit;
|
||||||
|
|
||||||
|
bool firstIteration;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,180 @@
|
||||||
|
/*
|
||||||
|
<moMetropolisHastingExplorer.h>
|
||||||
|
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||||
|
|
||||||
|
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||||
|
|
||||||
|
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 _moMetropolisHastingExplorer_h
|
||||||
|
#define _moMetropolisHastingExplorer_h
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#include <explorer/moNeighborhoodExplorer.h>
|
||||||
|
#include <comparator/moNeighborComparator.h>
|
||||||
|
#include <comparator/moSolNeighborComparator.h>
|
||||||
|
#include <neighborhood/moNeighborhood.h>
|
||||||
|
|
||||||
|
#include <utils/eoRNG.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explorer for the Metropolis-Hasting Sampling.
|
||||||
|
* Only the symetric case is considered when Q(x,y) = Q(y,x)
|
||||||
|
* Fitness must be > 0
|
||||||
|
*/
|
||||||
|
template< class Neighbor >
|
||||||
|
class moMetropolisHastingExplorer : public moNeighborhoodExplorer<Neighbor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef typename Neighbor::EOT EOT ;
|
||||||
|
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||||
|
|
||||||
|
using moNeighborhoodExplorer<Neighbor>::neighborhood;
|
||||||
|
using moNeighborhoodExplorer<Neighbor>::eval;
|
||||||
|
using moNeighborhoodExplorer<Neighbor>::selectedNeighbor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param _neighborhood the neighborhood
|
||||||
|
* @param _eval the evaluation function
|
||||||
|
* @param _neighborComparator a neighbor comparator
|
||||||
|
* @param _solNeighborComparator a solution vs neighbor comparator
|
||||||
|
* @param _nbStep maximum number of step to do
|
||||||
|
*/
|
||||||
|
moMetropolisHastingExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) {
|
||||||
|
isAccept = false;
|
||||||
|
if (!neighborhood.isRandom()) {
|
||||||
|
std::cout << "moMetropolisHastingExplorer::Warning -> the neighborhood used is not random" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destructor
|
||||||
|
*/
|
||||||
|
~moMetropolisHastingExplorer() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* initialization of the number of step to be done
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
virtual void initParam(EOT & _solution) {
|
||||||
|
step = 0;
|
||||||
|
isAccept = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* increase the number of step
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
virtual void updateParam(EOT & _solution) {
|
||||||
|
step++;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* terminate: NOTHING TO DO
|
||||||
|
* @param _solution unused solution
|
||||||
|
*/
|
||||||
|
virtual void terminate(EOT & _solution) {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explore the neighborhood of a solution
|
||||||
|
* @param _solution
|
||||||
|
*/
|
||||||
|
virtual void operator()(EOT & _solution) {
|
||||||
|
//Test if _solution has a Neighbor
|
||||||
|
if (neighborhood.hasNeighbor(_solution)) {
|
||||||
|
//init the first neighbor
|
||||||
|
neighborhood.init(_solution, selectedNeighbor);
|
||||||
|
|
||||||
|
//eval the _solution moved with the neighbor and stock the result in the neighbor
|
||||||
|
eval(_solution, selectedNeighbor);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//if _solution hasn't neighbor,
|
||||||
|
isAccept=false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* continue if there is a neighbor and it is remainds some steps to do
|
||||||
|
* @param _solution the solution
|
||||||
|
* @return true there is some steps to do
|
||||||
|
*/
|
||||||
|
virtual bool isContinue(EOT & _solution) {
|
||||||
|
return (step < nbStep) ;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* accept test if an ameliorated neighbor was found
|
||||||
|
* @param _solution the solution
|
||||||
|
* @return true if the best neighbor ameliorate the fitness
|
||||||
|
*/
|
||||||
|
virtual bool accept(EOT & _solution) {
|
||||||
|
double alpha=0.0;
|
||||||
|
if (neighborhood.hasNeighbor(_solution)) {
|
||||||
|
if (solNeighborComparator(_solution, selectedNeighbor))
|
||||||
|
isAccept = true;
|
||||||
|
else {
|
||||||
|
if (_solution.fitness() != 0) {
|
||||||
|
if ( (double)selectedNeighbor.fitness() < (double)_solution.fitness()) // maximizing
|
||||||
|
alpha = (double) selectedNeighbor.fitness() / (double) _solution.fitness();
|
||||||
|
else //minimizing
|
||||||
|
alpha = (double) _solution.fitness() / (double) selectedNeighbor.fitness();
|
||||||
|
isAccept = (rng.uniform() < alpha) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if ( (double) selectedNeighbor.fitness() < (double) _solution.fitness()) // maximizing
|
||||||
|
isAccept = true;
|
||||||
|
else
|
||||||
|
isAccept = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isAccept;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
// comparator betwenn solution and neighbor or between neighbors
|
||||||
|
moNeighborComparator<Neighbor>& neighborComparator;
|
||||||
|
moSolNeighborComparator<Neighbor>& solNeighborComparator;
|
||||||
|
|
||||||
|
// current number of step
|
||||||
|
unsigned int step;
|
||||||
|
|
||||||
|
// maximum number of steps to do
|
||||||
|
unsigned int nbStep;
|
||||||
|
|
||||||
|
// true if the move is accepted
|
||||||
|
bool isAccept ;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue