git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1874 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
jhumeau 2010-06-28 15:06:26 +00:00
commit 18922d3435
1393 changed files with 168773 additions and 0 deletions

View file

@ -0,0 +1 @@
secretword=Nothing

View file

@ -0,0 +1,11 @@
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

File diff suppressed because it is too large Load diff

View 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")
#############################################################################

View file

@ -0,0 +1,84 @@
==========================================================================================
RELEASE
==========================================================================================
The current release is paradisEO-1.3
==========================================================================================
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

View 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)
######################################################################################

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,4 @@
Authors:
Sebastien Verel
Arnaud Liefooghe
Jérémie Humeau

View 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)
##########################################################################################################################################

View 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)

View file

@ -0,0 +1,7 @@
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
"test/"
"paradiseo-eo/"
"problems/"
"tutorial/"
)

View 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=<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=<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

View 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)
##########################################################################################

View 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>
*/

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
###############################################################
# This is a dummy file
###############################################################

View 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

View file

@ -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

View file

@ -0,0 +1,63 @@
/*
<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;
moBetterAcceptCrit(moSolComparator<EOT>& _comparator):comparator(_comparator) {}
/**
* Accept if the new solution is better than previous one
* @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;
};
#endif

View 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

View file

@ -0,0 +1,104 @@
/*
<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)
{}
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

View file

@ -0,0 +1,113 @@
/*
<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 <acceptCrit/moAlwaysAcceptCrit.h>
#include <eval/moEval.h>
#include <eoEvalFunc.h>
/**
* Iterated Local Search
*/
template<class Neighbor>
class moILS: public moLocalSearch<moDummyNeighbor<typename Neighbor::EOT> >
{
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<moDummyNeighbor<EOT> >& _cont):
moLocalSearch<moDummyNeighbor<EOT> >(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):
moLocalSearch<moDummyNeighbor<EOT> >(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> explorer;
};
#endif

View file

@ -0,0 +1,134 @@
/*
<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 ;
}
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

View 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

View 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

View 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

View 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

View 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

View file

@ -0,0 +1,86 @@
/*
<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/moTrueContinuator.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, trueCont, _fullEval),
explorer(_neighborhood, _eval, _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
*/
moRandomWalk(Neighborhood& _neighborhood, eoEvalFunc<EOT>& _fullEval, moEval<Neighbor>& _eval, unsigned _nbStepMax, moContinuator<Neighbor>& _cont):
moLocalSearch<Neighbor>(explorer, _cont, _fullEval),
explorer(_neighborhood, _eval, _nbStepMax)
{}
private:
// always true continuator
moTrueContinuator<Neighbor> trueCont;
// the explorer of the random walk
moRandomWalkExplorer<Neighbor> explorer;
};
#endif

View file

@ -0,0 +1,106 @@
/*
<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 _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

View 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

View file

@ -0,0 +1,136 @@
/*
<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 _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)
{}
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

View 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

View file

@ -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

View 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

View file

@ -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 two neighbors
*/
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

View file

@ -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

View file

@ -0,0 +1,81 @@
/*
<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
*/
moBestSoFarStat(): moStat<EOT, EOT&>(EOT(), "best") {
}
/**
* Initialization of the best solution on the first one
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = _sol;
}
/**
* 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";
}
};
#endif

View file

@ -0,0 +1,177 @@
/*
<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 <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);
}
/**
* 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 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 < 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 < 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;
unsigned int interval;
unsigned int counter;
};
#endif

View file

@ -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

View 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

View file

@ -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

View 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

View 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

View file

@ -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

View 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

View file

@ -0,0 +1,89 @@
/*
<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: The number of full evaluations considered is within 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
*/
moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval): eval(_eval), maxFullEval(_maxFullEval) {
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) {
nbEval_start = eval.value();
}
/**
* 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 ;
unsigned int maxFullEval ;
};
#endif

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View 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

View file

@ -0,0 +1,87 @@
/*
<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: The number of neighbor evaluations (for example incremental evaluations) considered is within 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
*/
moNeighborEvalContinuator(moEvalCounter<Neighbor> & _eval, unsigned int _maxNeighborEval): eval(_eval), maxNeighborEval(_maxNeighborEval) {}
/**
* 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) {
nbEval_start = eval.value();
}
/**
* 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;
unsigned int nbEval_start ;
};
#endif

View file

@ -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

View 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";
}
private:
//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

View file

@ -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

View file

@ -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

View file

@ -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

View 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

View 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

View 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

View 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

View file

@ -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

View file

@ -0,0 +1,98 @@
/*
<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
* @param _verbose verbose mode true/false -> on/off
*/
moTimeContinuator(time_t _max, bool _verbose=true): max(_max), verbose(_verbose) {
start = time(NULL);
}
/**
* 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) {
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;
/** verbose mode */
bool verbose;
};
#endif

View file

@ -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

View file

@ -0,0 +1,207 @@
/*
<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)
{ }
/**
* 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)
{ }
/**
* Default Constructor
* @param _param the parameter of type EOT to save in the vector
*/
moVectorMonitor(eoValueParam<EOT> & _param) : doubleParam(NULL), intParam(NULL), eotParam(&_param)
{ }
/**
* 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)
{ }
/**
* 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;
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 export the vector of values into one file
* @param _filename file name
*/
void fileExport(std::string _filename) {
// create file
std::ofstream os(_filename.c_str());
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;
};
#endif

View file

@ -0,0 +1,63 @@
/*
<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
*/
virtual void update(double& _temp) = 0;
};
#endif

View file

@ -0,0 +1,125 @@
/*
<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
*
*/
template< class EOT >
class moDynSpanCoolingSchedule : public moCoolingSchedule<EOT>
{
public:
/**
* default constructor
* @param _initT initial temperature
* @param _alpha factor of decreasing
* @param _spanMove maximum number of move with equal temperature
* @param _spanNoMove maximum number of no improvement with equal temperature
* @param _nbSpan maximum number of span with no improvmement before stopping the search
*/
moDynSpanCoolingSchedule(double _initT, double _alpha, unsigned int _spanMove, unsigned int _spanNoMove, unsigned int _nbSpan) : initT(_initT), alpha(_alpha), spanMove(_spanMove), spanNoMove(_spanNoMove), nbSpan(_nbSpan) {
}
/**
* Initial temperature
* @param _solution initial solution
*/
virtual double init(EOT & _solution) {
// number of successive moves since the last temperature change
nbMove = 0;
// number of no improvement since the last temperature change
nbNoMove = 0;
// number of span with no improvement
nbSpan = 0;
return initT;
}
/**
* update the temperature by a factor
* @param _temp current temperature to update
*/
virtual void update(double& _temp) {
if (nbMove >= spanMove || nbNoMove >= spanNoMove) {
_temp *= alpha;
nbMove = 0;
nbNoMove = 0;
} else {
nbMove++;
nbNoMove++;
}
}
/**
* 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;
//
unsigned int spanMove;
//
unsigned int spanNoMove;
// maximum number of iterations at the same temperature
unsigned int nbSpan;
// threshold temperature
double finalT;
// number of steps with the same temperature
unsigned int step;
};
#endif

View file

@ -0,0 +1,104 @@
/*
<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
*/
virtual void update(double& _temp) {
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

View 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

View file

@ -0,0 +1,51 @@
/*
<moEval.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 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

View 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

View 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

View 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

View 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

View file

@ -0,0 +1,166 @@
/*
<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;
/**
* 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;
current=new Neighbor();
}
/**
* Destructor
*/
~moFirstImprHCexplorer() {
delete current;
}
/**
* 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, (*current));
//eval the _solution moved with the neighbor and stock the result in the neighbor
eval(_solution, (*current));
//test all others neighbors
while (! solNeighborComparator(_solution, *current) && neighborhood.cont(_solution)) {
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
}
}
else {
//if _solution hasn't neighbor,
isAccept=false;
}
};
/**
* continue if a move is accepted
* @param _solution the solution
* @return true if an ameliorated neighbor was found
*/
virtual bool isContinue(EOT & _solution) {
return isAccept ;
};
/**
* move the solution with the best neighbor
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
//move the solution
(*current).move(_solution);
//update its fitness
_solution.fitness((*current).fitness());
};
/**
* 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, (*current)) ;
}
return isAccept;
};
private:
// comparator betwenn solution and neighbor or between neighbors
moNeighborComparator<Neighbor>& neighborComparator;
moSolNeighborComparator<Neighbor>& solNeighborComparator;
//Pointer on the best and the current neighbor
Neighbor* current;
// true if the move is accepted
bool isAccept ;
};
#endif

View file

@ -0,0 +1,172 @@
/*
<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> >
{
public:
typedef moNeighborhood<Neighbor> Neighborhood ;
typedef typename Neighbor::EOT EOT;
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<dummyNeighbor>(), 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
current=_solution;
//perturb solution exept at the first iteration
if (!firstIteration) {
perturb(current);
}
else
firstIteration=false;
//apply the local search on the copy
ls(current);
};
/**
* 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=current;
};
/**
* 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, current);
};
/**
* 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 current;
moLocalSearch<Neighbor>& ls;
moPerturbation<Neighbor> & perturb;
moAcceptanceCriterion<Neighbor>& acceptCrit;
bool firstIteration;
};
#endif

View file

@ -0,0 +1,195 @@
/*
<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;
/**
* 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;
current=new Neighbor();
if (!neighborhood.isRandom()) {
std::cout << "moMetropolisHastingExplorer::Warning -> the neighborhood used is not random" << std::endl;
}
}
/**
* Destructor
*/
~moMetropolisHastingExplorer() {
delete current;
}
/**
* 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, (*current));
//eval the _solution moved with the neighbor and stock the result in the neighbor
eval(_solution, (*current));
}
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) ;
};
/**
* move the solution with the best neighbor
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
//move the solution
(*current).move(_solution);
//update its fitness
_solution.fitness((*current).fitness());
};
/**
* 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, *current))
isAccept = true;
else {
if (_solution.fitness() != 0) {
if ( (double)current->fitness() < (double)_solution.fitness()) // maximizing
alpha = (double) current->fitness() / (double) _solution.fitness();
else //minimizing
alpha = (double) _solution.fitness() / (double) current->fitness();
isAccept = (rng.uniform() < alpha) ;
}
else {
if ( (double)current->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;
//Pointer on the best and the current neighbor
Neighbor* current;
// true if the move is accepted
bool isAccept ;
};
#endif

View file

@ -0,0 +1,128 @@
/*
<moNeighborhoodExplorer.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 _neighborhoodExplorer_h
#define _neighborhoodExplorer_h
//EO inclusion
#include <eoFunctor.h>
#include <neighborhood/moNeighborhood.h>
#include <eval/moEval.h>
#include <neighborhood/moDummyNeighborhood.h>
#include <eval/moDummyEval.h>
/**
* Explore the neighborhood
*/
template< class Neighbor >
class moNeighborhoodExplorer : public eoUF<typename Neighbor::EOT&, void>
{
public:
typedef moNeighborhood<Neighbor> Neighborhood;
typedef typename Neighbor::EOT EOT;
typedef typename EOT::Fitness Fitness ;
moNeighborhoodExplorer():neighborhood(dummyNeighborhood), eval(dummyEval), isMoved(false) {}
/**
* Constructor with a Neighborhood and evaluation function
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
*/
moNeighborhoodExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval):neighborhood(_neighborhood), eval(_eval), isMoved(false) {}
/**
* Init Search parameters
* @param _solution the solution to explore
*/
virtual void initParam (EOT& _solution) = 0 ;
/**
* Update Search parameters
* @param _solution the solution to explore
*/
virtual void updateParam (EOT& _solution) = 0 ;
/**
* Test if the exploration continue or not
* @param _solution the solution to explore
* @return true if the exploration continue, else return false
*/
virtual bool isContinue(EOT& _solution) = 0 ;
/**
* Move a solution
* @param _solution the solution to explore
*/
virtual void move(EOT& _solution) = 0 ;
/**
* Test if a solution is accepted
* @param _solution the solution to explore
* @return true if the solution is accepted, else return false
*/
virtual bool accept(EOT& _solution) = 0 ;
/**
* Terminate the search
* @param _solution the solution to explore
*/
virtual void terminate(EOT& _solution) = 0 ;
/**
* Getter of "isMoved"
* @return true if move is applied
*/
bool moveApplied() {
return isMoved;
}
/**
* Setter of "isMoved"
* @param _isMoved
*/
void moveApplied(bool _isMoved) {
isMoved=_isMoved;
}
protected:
moDummyNeighborhood<Neighbor> dummyNeighborhood;
moDummyEval<Neighbor> dummyEval;
Neighborhood & neighborhood;
moEval<Neighbor>& eval;
bool isMoved;
};
#endif

View file

@ -0,0 +1,133 @@
/*
<moNeutralHCexplorer.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 _moNeutralHCexplorer_h
#define _moNeutralHCexplorer_h
#include <explorer/moRandomBestHCexplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a neutral Hill-climbing
*/
template< class Neighbor >
class moNeutralHCexplorer : public moRandomBestHCexplorer<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moRandomBestHCexplorer<Neighbor>::solNeighborComparator;
using moRandomBestHCexplorer<Neighbor>::isAccept;
using moRandomBestHCexplorer<Neighbor>::bestVector;
using moRandomBestHCexplorer<Neighbor>::initParam;
using moRandomBestHCexplorer<Neighbor>::updateParam;
/**
* 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 step to do
*/
moNeutralHCexplorer(Neighborhood& _neighborhood,
moEval<Neighbor>& _eval,
moNeighborComparator<Neighbor>& _neighborComparator,
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
unsigned _nbStep) :
moRandomBestHCexplorer<Neighbor>(_neighborhood, _eval, _neighborComparator, _solNeighborComparator),nbStep(_nbStep) {
//Some cycle is possible with equals fitness solutions if the neighborhood is not random
}
/**
* Destructor
*/
~moNeutralHCexplorer() {
}
/**
* initial number of step
* @param _solution the current solution
*/
virtual void initParam(EOT & _solution) {
moRandomBestHCexplorer<Neighbor>::initParam(_solution);
step = 0;
};
/**
* one more step
* @param _solution the current solution
*/
virtual void updateParam(EOT & _solution) {
moRandomBestHCexplorer<Neighbor>::updateParam(_solution);
step++;
};
/**
* continue if there is a neighbor and it is remains some steps to do
* @param _solution the solution
* @return true there is some steps to do
*/
virtual bool isContinue(EOT & _solution) {
return (step < nbStep) && isAccept ;
};
/**
* accept test if an ameliorated or an equal neighbor was be found
* @param _solution the solution
* @return true if the best neighbor ameliorate the fitness or is equals
*/
virtual bool accept(EOT & _solution) {
if (neighborhood.hasNeighbor(_solution))
isAccept = solNeighborComparator(_solution, bestVector[0]) || solNeighborComparator.equals(_solution, bestVector[0]) ;
return isAccept;
};
private:
// current number of step
unsigned int step;
// maximum number of steps to do
unsigned int nbStep;
};
#endif

View file

@ -0,0 +1,198 @@
/*
<moRandomBestHCexplorer.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 _moRandomBestHCexplorer_h
#define _moRandomBestHCexplorer_h
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
#include <vector>
#include <utils/eoRNG.h>
/**
* Explorer for Hill-Climbing
* which choose randomly one of the best solution in the neighborhood at each iteration
*/
template< class Neighbor >
class moRandomBestHCexplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
* @param _neighborComparator a neighbor comparator
* @param _solNeighborComparator solution vs neighbor comparator
*/
moRandomBestHCexplorer(Neighborhood& _neighborhood,
moEval<Neighbor>& _eval,
moNeighborComparator<Neighbor>& _neighborComparator,
moSolNeighborComparator<Neighbor>& _solNeighborComparator) :
moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval),
neighborComparator(_neighborComparator),
solNeighborComparator(_solNeighborComparator) {
isAccept = false;
current=new Neighbor();
}
/**
* Destructor
*/
~moRandomBestHCexplorer() {
delete current;
}
/**
* empty the vector of best solutions
* @param _solution unused solution
*/
virtual void initParam(EOT & _solution) {
// delete all the best solutions
bestVector.clear();
};
/**
* empty the vector of best solutions
* @param _solution unused solution
*/
virtual void updateParam(EOT & _solution) {
// delete all the best solutions
bestVector.clear();
};
/**
* terminate: NOTHING TO DO
* @param _solution unused solution
*/
virtual void terminate(EOT & _solution) {};
/**
* Explore the neighborhood of a solution
* @param _solution the current solution
*/
virtual void operator()(EOT & _solution) {
//Test if _solution has a Neighbor
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
bestVector.push_back(*current);
//test all others neighbors
while (neighborhood.cont(_solution)) {
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
//if we found a better neighbor, update the best
if (neighborComparator(bestVector[0], (*current))) {
bestVector.clear();
bestVector.push_back(*current);
}
else if (neighborComparator.equals((*current), bestVector[0])) //if the current is equals to previous best solutions then update vector of the best solution
bestVector.push_back(*current);
}
}
else {
//if _solution hasn't neighbor,
isAccept=false;
}
};
/**
* continue if a move is accepted
* @param _solution the solution
* @return true if an ameliorated neighbor was be found
*/
virtual bool isContinue(EOT & _solution) {
return isAccept ;
};
/**
* move the solution with the best neighbor
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
// choose randomly one of the best solutions
unsigned int i = rng.random(bestVector.size());
//move the solution
bestVector[i].move(_solution);
//update its fitness
_solution.fitness(bestVector[i].fitness());
};
/**
* accept test if an amelirated 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, bestVector[0]) ;
return isAccept;
};
protected:
// comparator betwenn solution and neighbor or between neighbors
moNeighborComparator<Neighbor>& neighborComparator;
moSolNeighborComparator<Neighbor>& solNeighborComparator;
// the best solutions in the neighborhood
std::vector<Neighbor> bestVector;
//Pointer on the current neighbor
Neighbor* current;
// true if the move is accepted
bool isAccept ;
};
#endif

View file

@ -0,0 +1,185 @@
/*
<moRandomNeutralWalkExplorer.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 _moRandomNeutralWalkexplorer_h
#define _moRandomNeutralWalkexplorer_h
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a random neutral walk
* accept the movement when the neighbor has the same fitnes
* To sample the neutral networks by random walk, there is no memory
* neighborhood must be explored in random order
*/
template< class Neighbor >
class moRandomNeutralWalkExplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<Neighbor> Neighborhood;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
* @param _solNeighborComparator a solution vs neighbor comparator
* @param _nbStep maximum number of step to do
*/
moRandomNeutralWalkExplorer(Neighborhood& _neighborhood,
moEval<Neighbor>& _eval,
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
unsigned _nbStep):
moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval),
solNeighborComparator(_solNeighborComparator),
nbStep(_nbStep) {
isAccept = false;
current=new Neighbor();
if (!neighborhood.isRandom()) {
std::cout << "moRandomNeutralWalkExplorer::Warning -> the neighborhood used is not random" << std::endl;
}
}
/**
* Destructor
*/
~moRandomNeutralWalkExplorer() {
delete current;
}
/**
* 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, (*current));
//eval the _solution moved with the neighbor and stock the result in the neighbor
eval(_solution, (*current));
//test all others neighbors
while (! solNeighborComparator.equals(_solution, *current) && neighborhood.cont(_solution)) {
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
}
}
else {
//if _solution hasn't neighbor,
isAccept=false;
}
};
/**
* continue if there is a neighbor and it is remains some steps to do
* @param _solution the solution
* @return true there is some steps to do
*/
virtual bool isContinue(EOT & _solution) {
return (step < nbStep) && isAccept ;
};
/**
* move the solution with the best neighbor
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
//move the solution
(*current).move(_solution);
//update its fitness
_solution.fitness((*current).fitness());
};
/**
* accept test if an equals neighbor was be 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.equals(_solution, (*current)) ;
return isAccept;
};
private:
// comparator betwenn solution and neighbor or between neighbors
moSolNeighborComparator<Neighbor>& solNeighborComparator;
// current number of step
unsigned int step;
// maximum number of steps to do
unsigned int nbStep;
//Pointer on the best and the current neighbor
Neighbor* current;
// true if the move is accepted
bool isAccept ;
};
#endif

View file

@ -0,0 +1,149 @@
/*
<moRandomSearchExplorer.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 _moRandomSearchexplorer_h
#define _moRandomSearchexplorer_h
#include <explorer/moNeighborhoodExplorer.h>
#include <neighborhood/moNeighborhood.h>
#include <eoEvalFunc.h>
#include <eoInit.h>
/**
* Explorer for a pure random search:
* the solution is initialized at each step
*/
template< class Neighbor >
class moRandomSearchExplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
* @param _init the solution initializer, to explore at random the search space
* @param _fulleval the evaluation function
* @param _nbStep maximum number of step to do
*/
moRandomSearchExplorer(eoInit<EOT>& _init, eoEvalFunc<EOT>& _fulleval, unsigned _nbStep) : moNeighborhoodExplorer<Neighbor>(), init(_init), fulleval(_fulleval), nbStep(_nbStep) {
// number of step done
step = 0;
}
/**
* Destructor
*/
~moRandomSearchExplorer() {}
/**
* initialization of the number of step to be done
* @param _solution unused solution
*/
virtual void initParam(EOT & _solution) {
step = 0;
};
/**
* 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 with only one random solution
* we supposed that the first neighbor is uniformly selected in the neighborhood
* @param _solution
*/
virtual void operator()(EOT & _solution) {
//init the first neighbor
init(_solution);
//eval the _solution moved with the neighbor and stock the result in the neighbor
fulleval(_solution);
};
/**
* continue if it is remains some steps to do
* @param _solution the solution
* @return true there is some steps to do
*/
virtual bool isContinue(EOT & _solution) {
return (step < nbStep) ;
};
/**
* move the solution with the best neighbor
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
// the solution is already move. So nothing to do !
};
/**
* accept test : always accept
* @param _solution the solution
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution) {
return true;
};
private:
// initialization method to explore at random the search space
eoInit<EOT> & init;
// the full eval function
eoEvalFunc<EOT> & fulleval;
// current number of step
unsigned int step;
// maximum number of steps to do
unsigned int nbStep;
};
#endif

View file

@ -0,0 +1,171 @@
/*
<moRandomWalkExplorer.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 _moRandomWalkexplorer_h
#define _moRandomWalkexplorer_h
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a random walk
*/
template< class Neighbor >
class moRandomWalkExplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
* @param _nbStep maximum number of step to do
*/
moRandomWalkExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, unsigned _nbStep) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), nbStep(_nbStep) {
isAccept = false;
current=new Neighbor();
// number of step done
step = 0;
if (!neighborhood.isRandom()) {
std::cout << "moRandomWalkExplorer::Warning -> the neighborhood used is not random" << std::endl;
}
}
/**
* Destructor
*/
~moRandomWalkExplorer() {
delete current;
}
/**
* 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 with only one random solution
* we supposed that the first neighbor is uniformly selected in the neighborhood
* @param _solution a solution
*/
virtual void operator()(EOT & _solution) {
//Test if _solution has a Neighbor
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));
isAccept = true;
}
else {
//if _solution hasn't neighbor,
isAccept=false;
}
};
/**
* continue if there is a neighbor and it is remains some steps to do
* @param _solution the solution
* @return true there is some steps to do
*/
virtual bool isContinue(EOT & _solution) {
return (step < nbStep) && isAccept ;
};
/**
* move the solution with the best neighbor
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
//move the solution
(*current).move(_solution);
//update its fitness
_solution.fitness((*current).fitness());
};
/**
* accept test if an amelirated neighbor was be found
* @param _solution the solution
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution) {
if (neighborhood.hasNeighbor(_solution))
isAccept = true ;
return isAccept;
};
private:
// current number of step
unsigned int step;
// maximum number of steps to do
unsigned int nbStep;
//Pointer on the best and the current neighbor
Neighbor* current;
// true if the move is accepted
bool isAccept ;
};
#endif

View file

@ -0,0 +1,194 @@
/*
<moSAexplorer.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 _moSAexplorer_h
#define _moSAexplorer_h
#include <cstdlib>
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moSolNeighborComparator.h>
#include <coolingSchedule/moCoolingSchedule.h>
#include <neighborhood/moNeighborhood.h>
#include <utils/eoRNG.h>
/**
* Explorer for the Simulated Annealing
* Only the symetric case is considered when Q(x,y) = Q(y,x)
* Fitness must be > 0
*
*/
template< class Neighbor >
class moSAexplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
* @param _solNeighborComparator a solution vs neighbor comparator
* @param _coolingSchedule the cooling schedule
*/
moSAexplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moSolNeighborComparator<Neighbor>& _solNeighborComparator, moCoolingSchedule<EOT>& _coolingSchedule) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), solNeighborComparator(_solNeighborComparator), coolingSchedule(_coolingSchedule) {
isAccept = false;
if (!neighborhood.isRandom()) {
std::cout << "moSAexplorer::Warning -> the neighborhood used is not random" << std::endl;
}
}
/**
* Destructor
*/
~moSAexplorer() {
}
/**
* initialization of the initial temperature
* @param _solution the solution
*/
virtual void initParam(EOT & _solution) {
temperature = coolingSchedule.init(_solution);
isAccept = true;
};
/**
* decrease the temperature if necessary
* @param _solution unused solution
*/
virtual void updateParam(EOT & _solution) {
coolingSchedule.update(temperature);
};
/**
* terminate: NOTHING TO DO
* @param _solution unused solution
*/
virtual void terminate(EOT & _solution) {};
/**
* Explore one random solution in the neighborhood
* @param _solution the solution
*/
virtual void operator()(EOT & _solution) {
//Test if _solution has a Neighbor
if (neighborhood.hasNeighbor(_solution)) {
//init on the first neighbor: supposed to be random solution in the neighborhood
neighborhood.init(_solution, current);
//eval the _solution moved with the neighbor and stock the result in the neighbor
eval(_solution, current);
}
else {
//if _solution hasn't neighbor,
isAccept=false;
}
};
/**
* continue if the temperature is not too low
* @param _solution the solution
* @return true if the criteria from the cooling schedule is true
*/
virtual bool isContinue(EOT & _solution) {
return coolingSchedule(temperature);
};
/**
* move the solution to the accepted solution
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
//move the solution
current.move(_solution);
//update its fitness
_solution.fitness(current.fitness());
};
/**
* acceptance criterion according to the boltzmann criterion
* @param _solution the solution
* @return true if better neighbor or rnd < exp(delta f / T)
*/
virtual bool accept(EOT & _solution) {
double alpha=0.0;
double fit1, fit2;
if (neighborhood.hasNeighbor(_solution)) {
if (solNeighborComparator(_solution, current)) // accept if the current neighbor is better than the solution
isAccept = true;
else {
fit1=(double)current.fitness();
fit2=(double)_solution.fitness();
if (fit1 < fit2) // this is a maximization
alpha = exp((fit1 - fit2) / temperature );
else // this is a minimization
alpha = exp((fit2 - fit1) / temperature );
isAccept = (rng.uniform() < alpha) ;
}
}
return isAccept;
};
/**
* Getter
* @return the temperature
*/
double getTemperature() {
return temperature;
}
private:
// comparator betwenn solution and neighbor
moSolNeighborComparator<Neighbor>& solNeighborComparator;
moCoolingSchedule<EOT>& coolingSchedule;
double temperature;
//Pointer on the best and the current neighbor
Neighbor current;
// true if the move is accepted
bool isAccept ;
};
#endif

View file

@ -0,0 +1,186 @@
/*
<moSimpleHCExplorer.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 _moSimpleHCexplorer_h
#define _moSimpleHCexplorer_h
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a simple Hill-climbing
*/
template< class Neighbor >
class moSimpleHCexplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
/**
* Constructor
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
* @param _neighborComparator a neighbor comparator
* @param _solNeighborComparator solution vs neighbor comparator
*/
moSimpleHCexplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) {
isAccept = false;
current=new Neighbor();
best=new Neighbor();
}
/**
* Destructor
*/
~moSimpleHCexplorer() {
delete current;
delete best;
}
/**
* 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
* @param _solution the current solution
*/
virtual void operator()(EOT & _solution) {
//Test if _solution has a Neighbor
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);
//test all others neighbors
while (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);
}
}
}
else {
//if _solution hasn't neighbor,
isAccept=false;
}
};
/**
* continue if a move is accepted
* @param _solution the solution
* @return true if an ameliorated neighbor was be found
*/
virtual bool isContinue(EOT & _solution) {
return isAccept ;
};
/**
* move the solution with the best neighbor
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
//move the solution
(*best).move(_solution);
//update its fitness
_solution.fitness((*best).fitness());
};
/**
* accept test if an amelirated neighbor was be 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, (*best)) ;
}
return isAccept;
};
/**
* Return the class Name
* @return the class name as a std::string
*/
virtual std::string className() const {
return "moSimpleHCexplorer";
}
private:
// comparator betwenn solution and neighbor or between neighbors
moNeighborComparator<Neighbor>& neighborComparator;
moSolNeighborComparator<Neighbor>& solNeighborComparator;
//Pointer on the best and the current neighbor
Neighbor* best;
Neighbor* current;
// true if the move is accepted
bool isAccept ;
};
#endif

View file

@ -0,0 +1,255 @@
/*
<moTSexplorer.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 _moTSexplorer_h
#define _moTSexplorer_h
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <memory/moAspiration.h>
#include <memory/moTabuList.h>
#include <memory/moIntensification.h>
#include <memory/moDiversification.h>
#include <neighborhood/moNeighborhood.h>
/**
* Explorer for a Tabu Search
*/
template< class Neighbor >
class moTSexplorer : public moNeighborhoodExplorer<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
/**
* Constructor
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
* @param _neighborComparator a neighbor comparator
* @param _solNeighborComparator a comparator between a solution and a neighbor
* @param _tabuList the tabu list
* @param _intensification the intensification box
* @param _diversification the diversification box
* @param _aspiration the aspiration criteria
*/
moTSexplorer(Neighborhood& _neighborhood,
moEval<Neighbor>& _eval,
moNeighborComparator<Neighbor>& _neighborComparator,
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
moTabuList<Neighbor> & _tabuList,
moIntensification<Neighbor> & _intensification,
moDiversification<Neighbor> & _diversification,
moAspiration<Neighbor> & _aspiration
) :
moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator),
tabuList(_tabuList), intensification(_intensification), diversification(_diversification), aspiration(_aspiration)
{
isAccept = false;
current=new Neighbor();
best=new Neighbor();
}
/**
* Destructor
*/
~moTSexplorer() {
delete current;
delete best;
}
/**
* init tabu list, intensification box, diversification box and aspiration criteria
* @param _solution
*/
virtual void initParam(EOT& _solution)
{
tabuList.init(_solution);
intensification.init(_solution);
diversification.init(_solution);
aspiration.init(_solution);
bestSoFar=_solution;
};
/**
* update params of tabu list, intensification box, diversification box and aspiration criteria
* @param _solution
*/
virtual void updateParam(EOT& _solution)
{
if ((*this).moveApplied()) {
tabuList.add(_solution, *best);
intensification.add(_solution, *best);
diversification.add(_solution, *best);
if (_solution.fitness() > bestSoFar.fitness())
bestSoFar = _solution;
}
tabuList.update(_solution, *best);
intensification.update(_solution, *best);
diversification.update(_solution, *best);
aspiration.update(_solution, *best);
};
/**
* terminate : _solution becomes the best so far
*/
virtual void terminate(EOT & _solution) {
_solution= bestSoFar;
};
/**
* Explore the neighborhood of a solution
* @param _solution
*/
virtual void operator()(EOT & _solution)
{
bool found=false;
intensification(_solution);
diversification(_solution);
if (neighborhood.hasNeighbor(_solution))
{
//init the current neighbor
neighborhood.init(_solution, *current);
//eval the current neighbor
eval(_solution, *current);
//Find the first non-tabu element
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ) {
// set best
(*best)= (*current);
found=true;
}
while (neighborhood.cont(_solution) && !found) {
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
if ( (!tabuList.check(_solution, *current)) || aspiration(_solution, *current) ) {
// set best
(*best)=(*current);
found=true;
}
}
//Explore the neighborhood
if (found) {
isAccept=true;
while (neighborhood.cont(_solution)) {
//next neighbor
neighborhood.next(_solution, (*current));
//eval
eval(_solution, (*current));
//check if the current is better than the best and is not tabu or if it is aspirat (by the aspiration criteria of course)
if ( (!tabuList.check(_solution, *current) || aspiration(_solution, (*current))) && neighborComparator((*best),(*current))) {
// set best
(*best)=(*current);
}
}
}
else {
isAccept=false;
}
}
else {
isAccept=false;
}
};
/**
* always continue
* @param _solution the solution
* @return true
*/
virtual bool isContinue(EOT & _solution) {
return true;
};
/**
* move the solution with the best neighbor
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
//move the solution
best->move(_solution);
//update its fitness
_solution.fitness(best->fitness());
};
/**
* 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) {
return isAccept;
};
protected:
using moNeighborhoodExplorer<Neighbor>::neighborhood;
using moNeighborhoodExplorer<Neighbor>::eval;
// comparator between solution and neighbor or between neighbors
moNeighborComparator<Neighbor>& neighborComparator;
moSolNeighborComparator<Neighbor>& solNeighborComparator;
// Tabu components
moTabuList<Neighbor> & tabuList;
moIntensification<Neighbor> & intensification;
moDiversification<Neighbor> & diversification;
moAspiration<Neighbor> & aspiration;
//Current and best neighbor
Neighbor* best;
Neighbor* current;
//Best so far Solution
EOT bestSoFar;
// true if the move is accepted
bool isAccept ;
};
#endif

View file

@ -0,0 +1,133 @@
/*
<moVNSexplorer.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 _moVNSexplorer_h
#define _moVNSexplorer_h
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
/**
* Explorer for Variiable Neighborhood Search
*/
template< class EOT >
class moVNSexplorer : public moNeighborhoodExplorer< moNeighborhood< moNeighbor<EOT, typename EOT::Fitness> > >
{
public:
typedef typename EOT::Fitness Fitness ;
typedef moNeighbor<EOT, Fitness> Neighbor ;
typedef moNeighborhood<Neighbor> Neighborhood ;
using moNeighborhoodExplorer<Neighborhood>::neighborhood;
using moNeighborhoodExplorer<Neighborhood>::eval;
/**
* Constructor
* @param _neighborhood the neighborhood
* @param _eval the evaluation function
* @param _neighborComparator a neighbor comparator
* @param _solNeighborComparator solution vs neighbor comparator
*/
moVNSexplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) {
}
/**
* Destructor
*/
~moVNSexplorer() {
}
/**
* initParam: NOTHING TO DO
*/
virtual void initParam(EOT & solution) {};
/**
* updateParam: NOTHING TO DO
*/
virtual void updateParam(EOT & solution) {};
/**
* terminate: NOTHING TO DO
*/
virtual void terminate(EOT & solution) {};
/**
* Explore the neighborhood of a solution
* @param _solution
*/
virtual void operator()(EOT & _solution) {
};
/**
* continue if a move is accepted
* @param _solution the solution
* @return true if an ameliorated neighbor was be found
*/
virtual bool isContinue(EOT & _solution) {
return isAccept ;
};
/**
* move the solution with the best neighbor
* @param _solution the solution to move
*/
virtual void move(EOT & _solution) {
//move the solution
(*best).move(_solution);
//update its fitness
_solution.fitness((*best).fitness());
};
/**
* accept test if an amelirated neighbor was be found
* @param _solution the solution
* @return true if the best neighbor ameliorate the fitness
*/
virtual bool accept(EOT & _solution) {
};
/**
* Return the class id.
* @return the class name as a std::string
*/
virtual std::string className() const {
return "moVNSexplorer";
}
private:
// comparator betwenn solution and neighbor or between neighbors
moNeighborComparator<Neighbor>& neighborComparator;
moSolNeighborComparator<Neighbor>& solNeighborComparator;
};
#endif

View file

@ -0,0 +1,59 @@
/*
<moAspiration.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 _moAspiration_h
#define _moAspiration_h
#include <eoFunctor.h>
/**
* Abstract class for Aspiration Criteria
*/
template< class Neighbor >
class moAspiration : public eoBF<typename Neighbor::EOT &, Neighbor &, bool>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Virtual Init
* @param _sol the current solution
*/
virtual void init(EOT & _sol) = 0;
/**
* Virtual update
* @param _sol the current solution
* @param _neighbor the current neighbor
*/
virtual void update(EOT & _sol, Neighbor & _neighbor) = 0;
};
#endif

View file

@ -0,0 +1,87 @@
/*
<moBestImprAspiration.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 _moBestImprAspiration_h
#define _moBestImprAspiration_h
#include <memory/moAspiration.h>
/**
* Aspiration criteria accepts a solution better than the best so far
*/
template< class Neighbor >
class moBestImprAspiration : public moAspiration<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* init the best solution
* @param _sol the best solution found
*/
void init(EOT & _sol) {
bestFoundSoFar = _sol;
}
/**
* update the "bestFoundSoFar" if a best solution is found
* @param _sol a solution
* @param _neighbor a neighbor
*/
void update(EOT & _sol, Neighbor & _neighbor) {
if (bestFoundSoFar.fitness() < _sol.fitness())
bestFoundSoFar = _sol;
}
/**
* Test the tabu feature of the neighbor:
* test if the neighbor's fitness is better than the "bestFoundSoFar" fitness
* @param _sol a solution
* @param _neighbor a neighbor
* @return true if _neighbor fitness is better than the "bestFoundSoFar"
*/
bool operator()(EOT & _sol, Neighbor & _neighbor) {
return (bestFoundSoFar.fitness() < _neighbor.fitness());
}
/**
* Getter
* @return a reference on the best found so far solution
*/
EOT& getBest() {
return bestFoundSoFar;
}
private:
EOT bestFoundSoFar;
};
#endif

View file

@ -0,0 +1,119 @@
/*
<moCountMoveMemory.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 _moCountMoveMemory_h
#define _moCountMoveMemory_h
#include <memory/moMemory.h>
/**
* Count the number of move, no move and the successive stagnation since the last Move
*/
template< class Neighbor >
class moCountMoveMemory : virtual public moMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
/**
* Init all the counters
* @param _sol unused solution
*/
void init(EOT & _sol) {
nbMove=0;
nbNoMove=0;
counter=0;
}
/**
* @param _sol unused solution
* @param _neighbor unused neighbor
*/
void add(EOT & _sol, Neighbor & _neighbor) {
nbMove++;
counter=0;
}
/**
* @param _sol unused solution
* @param _neighbor unused neighbor
*/
void update(EOT & _sol, Neighbor & _neighbor) {
nbNoMove++;
counter++;
}
/**
* ClearMemory : Reinit all the counters
*/
void clearMemory() {
nbMove=0;
nbNoMove=0;
counter=0;
}
/**
* Getter of the number of move
* @return the counter
*/
unsigned int getNbMove() {
return nbMove;
}
/**
* Getter of the number of no move
* @return the counter
*/
unsigned int getNbNoMove() {
return nbNoMove;
}
/**
* Getter of the number of successive stagnation since the last Move
* @return the counter
*/
unsigned int getCounter() {
return counter;
}
/**
* Init counter
*/
void initCounter() {
counter=0;
}
private:
unsigned int nbMove;
unsigned int nbNoMove;
unsigned int counter;
};
#endif

View file

@ -0,0 +1,42 @@
/*
<moDiversification.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 _moDiversification_h
#define _moDiversification_h
#include <memory/moMemory.h>
#include <eoFunctor.h>
/**
* Abstract class for diversification strategy
*/
template< class Neighbor >
class moDiversification : virtual public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool> {};
#endif

View file

@ -0,0 +1,53 @@
/*
<moDummyDiversification.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 _moDummyDiversification_h
#define _moDummyDiversification_h
#include <memory/moDiversification.h>
#include <memory/moDummyMemory.h>
/**
* Dummy diversification strategy
*/
template< class Neighbor >
class moDummyDiversification : public moDiversification<Neighbor>, public moDummyMemory<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* @return always false
*/
bool operator()(EOT &) {
return false;
}
};
#endif

View file

@ -0,0 +1,53 @@
/*
<moDummyIntensification.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 _moDummyIntensification_h
#define _moDummyIntensification_h
#include <memory/moIntensification.h>
#include <memory/moDummyMemory.h>
/**
* Dummy intensification strategy
*/
template< class Neighbor >
class moDummyIntensification : public moIntensification<Neighbor>, public moDummyMemory<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* @return always false
*/
bool operator()(EOT &) {
return false;
}
};
#endif

View file

@ -0,0 +1,67 @@
/*
<moDummyMemory.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 _moDummyMemory_h
#define _moDummyMemory_h
#include <memory/moMemory.h>
/**
* Dummy memory to make an empty memory
*/
template< class Neighbor >
class moDummyMemory : virtual public moMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
/**
* Init : NOTHIING TO DO
*/
void init(EOT & _sol) {}
/**
* Add : NOTHIING TO DO
*/
void add(EOT & _sol, Neighbor & _neighbor) {}
/**
* Update : NOTHIING TO DO
*/
void update(EOT & _sol, Neighbor & _neighbor) {}
/**
* ClearMemory : NOTHIING TO DO
*/
void clearMemory() {}
};
#endif

View file

@ -0,0 +1,121 @@
/*
<moIndexedVectorTabuList.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 _moIndexedVectorTabuList_h
#define _moIndexedVectorTabuList_h
#include <memory/moTabuList.h>
#include <vector>
#include <iostream>
/**
* Tabu List of indexed neighbors save in a vector
* each neighbor can not used during howlong iterations
*/
template<class Neighbor >
class moIndexedVectorTabuList : public moTabuList<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Constructor
* @param _maxSize maximum size of the tabu list
* @param _howlong how many iteration a move is tabu
*/
moIndexedVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong) {
tabuList.resize(_maxSize);
}
/**
* init the tabuList by clearing the memory
* @param _sol the current solution
*/
virtual void init(EOT & _sol) {
clearMemory();
}
/**
* add a new neighbor in the tabuList
* @param _sol unused solution
* @param _neighbor the current neighbor
*/
virtual void add(EOT & _sol, Neighbor & _neighbor) {
if (_neighbor.index() < maxSize)
tabuList[_neighbor.index()] = howlong;
}
/**
* update the tabulist by decreasing the number of tabu iteration
* @param _sol unused solution
* @param _neighbor unused neighbor
*/
virtual void update(EOT & _sol, Neighbor & _neighbor) {
for (unsigned int i = 0; i < maxSize; i++)
if (tabuList[i] > 0)
tabuList[i]--;
}
/**
* check if the move is tabu
* @param _sol unused solution
* @param _neighbor the current neighbor
* @return true if tabuList contains _sol
*/
virtual bool check(EOT & _sol, Neighbor & _neighbor) {
return (tabuList[_neighbor.index()] > 0);
}
/**
* clearMemory: remove all solution of the tabuList
*/
virtual void clearMemory() {
for (unsigned int i = 0; i < maxSize; i++)
tabuList[i] = 0;
}
void print(){
std::cout << "Tabulist:" << std::endl;
for(int i=0; i<tabuList.size(); i++)
std::cout << i << ": " << tabuList[i] << std::endl;
}
private:
//tabu list
std::vector< unsigned int > tabuList;
//maximum size of the tabu list
unsigned int maxSize;
//how many iteration a move is tabu
unsigned int howlong;
};
#endif

Some files were not shown because too many files have changed in this diff Show more