git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2704 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
7a4952b768
commit
abe9f76cc2
101 changed files with 0 additions and 9679 deletions
|
|
@ -1,7 +0,0 @@
|
|||
SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
|
||||
${CTEST_CUSTOM_COVERAGE_EXCLUDE}
|
||||
"test/"
|
||||
"paradiseo-eo/"
|
||||
"problems/"
|
||||
"tutorial/"
|
||||
)
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
######################################################################################
|
||||
### 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)
|
||||
######################################################################################
|
||||
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
<moBestFitnessStat.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moBestFitnessStat_h
|
||||
#define moBestFitnessStat_h
|
||||
|
||||
#include <continuator/moStat.h>
|
||||
|
||||
/**
|
||||
* The statistic which save the best solution found during the search
|
||||
*/
|
||||
template <class EOT>
|
||||
class moBestFitnessStat : public moStat<EOT, typename EOT::Fitness>
|
||||
{
|
||||
public :
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
using moStat< EOT , typename EOT::Fitness >::value;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
* @param _reInitSol when true the best so far is reinitialized
|
||||
*/
|
||||
moBestFitnessStat(bool _reInitSol = true): moStat<EOT, typename EOT::Fitness>(Fitness(), "best"), reInitSol(_reInitSol), firstTime(true) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of the best solution on the first one
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
if (reInitSol)
|
||||
value() = _sol.fitness();
|
||||
else if (firstTime)
|
||||
{
|
||||
value() = _sol.fitness();
|
||||
firstTime = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the best solution
|
||||
* @param _sol the current solution
|
||||
*/
|
||||
virtual void operator()(EOT & _sol) {
|
||||
if (value() < _sol.fitness())
|
||||
{
|
||||
value() = _sol.fitness();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of the class
|
||||
*/
|
||||
virtual std::string className(void) const {
|
||||
return "moBestFitnessStat";
|
||||
}
|
||||
|
||||
protected:
|
||||
bool reInitSol;
|
||||
bool firstTime;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
<moBestNoImproveContinuator.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef _moBestNoImproveContinuator_h
|
||||
#define _moBestNoImproveContinuator_h
|
||||
|
||||
#include <continuator/moContinuator.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <comparator/moSolComparator.h>
|
||||
|
||||
/**
|
||||
* Stop when the best solution cannot be improved
|
||||
* within a given number of iterations
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moBestNoImproveContinuator : public moContinuator<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param _bestSol the best solution
|
||||
* @param _maxNoImprove number maximum of iterations
|
||||
* @param _solComparator a comparator between solutions
|
||||
* @param _verbose true/false : verbose mode on/off
|
||||
*/
|
||||
moBestNoImproveContinuator(const EOT & _bestSol,
|
||||
unsigned int _maxNoImprove,
|
||||
moSolComparator<EOT>& _solComparator,
|
||||
bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(_solComparator), verbose(_verbose) {}
|
||||
|
||||
/**
|
||||
* Constructor where the comparator of solutions is the default comparator
|
||||
*
|
||||
* @param _bestSol the best solution
|
||||
* @param _maxNoImprove number maximum of iterations
|
||||
* @param _verbose true/false : verbose mode on/off
|
||||
*/
|
||||
moBestNoImproveContinuator(const EOT & _bestSol,
|
||||
unsigned int _maxNoImprove,
|
||||
bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(defaultSolComp), verbose(_verbose) {}
|
||||
|
||||
/**
|
||||
* Count and test the number of non improvement of the best solution
|
||||
* improvement: if the current solution is STRICTLY better than the current best solution
|
||||
*
|
||||
*@param _solution a solution
|
||||
*@return true if counter < maxNoImprove
|
||||
*/
|
||||
virtual bool operator()(EOT & _solution) {
|
||||
if (solComparator(_solution, bestSol) || solComparator.equals(_solution, bestSol))
|
||||
cpt++;
|
||||
else
|
||||
cpt = 0;
|
||||
|
||||
bool res = (cpt < maxNoImprove);
|
||||
|
||||
if (!res && verbose)
|
||||
std::cout << "STOP in moBestNoImproveContinuator: Reached maximum number of iterations without improvement [" << cpt << "/" << maxNoImprove << "]" << std::endl;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* reset the counter of iteration
|
||||
* @param _solution a solution
|
||||
*/
|
||||
virtual void init(EOT & _solution) {
|
||||
cpt = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* the current number of iteration without improvement
|
||||
* @return the number of iteration
|
||||
*/
|
||||
unsigned int value() {
|
||||
return cpt ;
|
||||
}
|
||||
|
||||
private:
|
||||
const EOT & bestSol;
|
||||
unsigned int maxNoImprove;
|
||||
unsigned int cpt;
|
||||
// comparator between solutions
|
||||
moSolComparator<EOT>& solComparator;
|
||||
bool verbose;
|
||||
moSolComparator<EOT> defaultSolComp;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
<moBestSoFarStat.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moBestSoFarStat_h
|
||||
#define moBestSoFarStat_h
|
||||
|
||||
#include <continuator/moStat.h>
|
||||
|
||||
/**
|
||||
* The statistic which save the best solution found during the search
|
||||
*/
|
||||
template <class EOT>
|
||||
class moBestSoFarStat : public moStat<EOT, EOT>
|
||||
{
|
||||
public :
|
||||
using moStat< EOT , EOT >::value;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
* @param _reInitSol when true the best so far is reinitialized
|
||||
*/
|
||||
moBestSoFarStat(bool _reInitSol = true): moStat<EOT, EOT>(EOT(), "best"), reInitSol(_reInitSol), firstTime(true) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of the best solution on the first one
|
||||
* @param _sol the first solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
if (reInitSol)
|
||||
value() = _sol;
|
||||
else if (firstTime)
|
||||
{
|
||||
value() = _sol;
|
||||
firstTime = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the best solution
|
||||
* @param _sol the current solution
|
||||
*/
|
||||
virtual void operator()(EOT & _sol) {
|
||||
if (value().fitness() < _sol.fitness())
|
||||
{
|
||||
value() = _sol;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of the class
|
||||
*/
|
||||
virtual std::string className(void) const {
|
||||
return "moBestSoFarStat";
|
||||
}
|
||||
|
||||
protected:
|
||||
bool reInitSol;
|
||||
bool firstTime;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
<moBooleanStat.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moBooleanStat_h
|
||||
#define moBooleanStat_h
|
||||
|
||||
#include <continuator/moStat.h>
|
||||
|
||||
/**
|
||||
* The statistic gives from a boolean variable
|
||||
*/
|
||||
template <class EOT>
|
||||
class moBooleanStat : public moStat<EOT, bool>
|
||||
{
|
||||
public :
|
||||
using moStat< EOT, bool>::value;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
moBooleanStat(bool * _b): moStat<EOT, bool>(*_b, "boolean"), b(_b) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the number of iteration
|
||||
* @param _sol a solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = *b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of iteration
|
||||
* @param _sol a solution
|
||||
*/
|
||||
virtual void operator()(EOT & _sol) {
|
||||
value() = *b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of the class
|
||||
*/
|
||||
virtual std::string className(void) const {
|
||||
return "moBooleanStat";
|
||||
}
|
||||
|
||||
private:
|
||||
bool * b;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
/*
|
||||
<moCheckpoint.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moCheckpoint_h
|
||||
#define moCheckpoint_h
|
||||
|
||||
#include <continuator/moContinuator.h>
|
||||
#include <utils/eoMonitor.h>
|
||||
#include <continuator/moStatBase.h>
|
||||
#include <utils/eoUpdater.h>
|
||||
#include <continuator/moUpdater.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* Continuator allowing to add others (continuators, stats, monitors or updaters)
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moCheckpoint : public moContinuator<Neighbor> {
|
||||
public :
|
||||
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Constructor (moCheckpoint must have at least one continuator)
|
||||
* @param _cont a continuator
|
||||
* @param _interval frequency to compute statistical operators
|
||||
*/
|
||||
moCheckpoint(moContinuator<Neighbor>& _cont, unsigned int _interval=1):interval(_interval), counter(0) {
|
||||
continuators.push_back(&_cont);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a continuator to the checkpoint
|
||||
* @param _cont a continuator
|
||||
*/
|
||||
void add(moContinuator<Neighbor>& _cont) {
|
||||
continuators.push_back(&_cont);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a statistic operator to the checkpoint
|
||||
* @param _stat a statistic operator
|
||||
*/
|
||||
void add(moStatBase<EOT>& _stat) {
|
||||
stats.push_back(&_stat);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a monitor to the checkpoint
|
||||
* @param _mon a monitor
|
||||
*/
|
||||
void add(eoMonitor& _mon) {
|
||||
monitors.push_back(&_mon);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a updater to the checkpoint
|
||||
* @param _upd an updater
|
||||
*/
|
||||
void add(eoUpdater& _upd) {
|
||||
updaters.push_back(&_upd);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a MO updater to the checkpoint
|
||||
* @param _moupd an mo updater
|
||||
*/
|
||||
void add(moUpdater& _moupd) {
|
||||
moupdaters.push_back(&_moupd);
|
||||
}
|
||||
|
||||
/**
|
||||
* init all continuators containing in the checkpoint regarding a solution
|
||||
* @param _sol the corresponding solution
|
||||
*/
|
||||
virtual void init(EOT& _sol) {
|
||||
for (unsigned i = 0; i < stats.size(); ++i)
|
||||
stats[i]->init(_sol);
|
||||
counter=1;
|
||||
|
||||
for (unsigned i = 0; i < moupdaters.size(); ++i)
|
||||
moupdaters[i]->init();
|
||||
|
||||
for (unsigned int i = 0; i < monitors.size(); ++i)
|
||||
(*monitors[i])();
|
||||
|
||||
for (unsigned i = 0; i < continuators.size(); ++i)
|
||||
continuators[i]->init(_sol);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return class name
|
||||
*/
|
||||
virtual std::string className(void) const {
|
||||
return "moCheckpoint";
|
||||
}
|
||||
|
||||
/**
|
||||
* apply operator of checkpoint's containers
|
||||
* @param _sol reference of the solution
|
||||
* @return true if all continuator return true
|
||||
*/
|
||||
bool operator()(EOT & _sol) {
|
||||
unsigned i;
|
||||
bool bContinue = true;
|
||||
|
||||
for (i = 0; i < stats.size(); ++i) {
|
||||
if (counter % interval == 0)
|
||||
(*stats[i])(_sol);
|
||||
counter++;
|
||||
}
|
||||
|
||||
for (i = 0; i < updaters.size(); ++i)
|
||||
(*updaters[i])();
|
||||
|
||||
for (i = 0; i < moupdaters.size(); ++i)
|
||||
(*moupdaters[i])();
|
||||
|
||||
for (i = 0; i < monitors.size(); ++i)
|
||||
(*monitors[i])();
|
||||
|
||||
for (i = 0; i < continuators.size(); ++i)
|
||||
if ( !(*continuators[i])(_sol) )
|
||||
bContinue = false;
|
||||
|
||||
return bContinue;
|
||||
}
|
||||
|
||||
/**
|
||||
* last call of statistic operators, monitors and updaters
|
||||
* @param _sol reference of the solution
|
||||
*/
|
||||
void lastCall(EOT& _sol) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < stats.size(); ++i)
|
||||
stats[i]->lastCall(_sol);
|
||||
|
||||
for (i = 0; i < updaters.size(); ++i)
|
||||
updaters[i]->lastCall();
|
||||
|
||||
for (i = 0; i < moupdaters.size(); ++i)
|
||||
moupdaters[i]->lastCall();
|
||||
|
||||
for (i = 0; i < monitors.size(); ++i)
|
||||
monitors[i]->lastCall();
|
||||
}
|
||||
|
||||
private :
|
||||
/** continuators vector */
|
||||
std::vector<moContinuator<Neighbor>*> continuators;
|
||||
/** statistic operators vector */
|
||||
std::vector<moStatBase<EOT>*> stats;
|
||||
/** monitors vector */
|
||||
std::vector<eoMonitor*> monitors;
|
||||
/** updaters vector */
|
||||
std::vector<eoUpdater*> updaters;
|
||||
/** MO updaters vector */
|
||||
std::vector<moUpdater*> moupdaters;
|
||||
|
||||
unsigned int interval;
|
||||
unsigned int counter;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
<moEvalsContinuator.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef _moEvalsContinuator_h
|
||||
#define _moEvalsContinuator_h
|
||||
|
||||
#include <continuator/moContinuator.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eoEvalFuncCounter.h>
|
||||
#include <eval/moEvalCounter.h>
|
||||
|
||||
/**
|
||||
* Continue until a maximum fixed number of full evaluation and neighbor evaluation is reached (total number of evaluation = full evaluation + incremental evaluation)
|
||||
*
|
||||
*
|
||||
* Becareful 1: if restartCounter is true, then the number of neighbor evaluations (for example incremental evaluations) is considered during the local search (not before it)
|
||||
*
|
||||
* Becareful 2: Can not be used if the evaluation function is used in parallel
|
||||
*
|
||||
* Becareful 3: Check if the incremental does not use full evaluation, otherwise the total number of evaluations is not correct
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moEvalsContinuator : public moContinuator<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _fullEval full evaluation function to count
|
||||
* @param _neighborEval neighbor evaluation function to count
|
||||
* @param _maxEvals number maximum of evaluations (full and incremental evaluations)
|
||||
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
|
||||
*/
|
||||
moEvalsContinuator(eoEvalFuncCounter<EOT> & _fullEval, moEvalCounter<Neighbor> & _neighborEval, unsigned int _maxEvals, bool _restartCounter = true): fullEval(_fullEval), neighborEval(_neighborEval), maxEvals(_maxEvals), restartCounter(_restartCounter) {}
|
||||
|
||||
/**
|
||||
* Test if continue
|
||||
* @param _solution a solution
|
||||
* @return true if number of evaluations < maxEvals
|
||||
*/
|
||||
virtual bool operator()(EOT & _solution) {
|
||||
return (fullEval.value() + neighborEval.value() - nbEval_start < maxEvals);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the number of evaluations
|
||||
* @param _solution a solution
|
||||
*/
|
||||
virtual void init(EOT & _solution) {
|
||||
if (restartCounter)
|
||||
nbEval_start = fullEval.value() + neighborEval.value();
|
||||
else
|
||||
nbEval_start = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* the current number of evaluation from the begining
|
||||
* @return the number of evaluation
|
||||
*/
|
||||
unsigned int value() {
|
||||
return fullEval.value() + neighborEval.value() - nbEval_start ;
|
||||
}
|
||||
|
||||
private:
|
||||
eoEvalFuncCounter<EOT> & fullEval;
|
||||
moEvalCounter<Neighbor> & neighborEval;
|
||||
unsigned int maxEvals;
|
||||
bool restartCounter;
|
||||
unsigned int nbEval_start ;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
<moFullEvalContinuator.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef _moFullEvalContinuator_h
|
||||
#define _moFullEvalContinuator_h
|
||||
|
||||
#include <continuator/moContinuator.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eoEvalFuncCounter.h>
|
||||
|
||||
/**
|
||||
* Continue until a maximum fixed number of full evaluation is reached
|
||||
*
|
||||
*
|
||||
* Becareful 1: if restartCounter is true, then the number of full evaluations is considered during the local search (not before it)
|
||||
*
|
||||
* Becareful 2: Can not be used if the evaluation function is used in parallel
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moFullEvalContinuator : public moContinuator<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _eval evaluation function to count
|
||||
* @param _maxFullEval number maximum of iterations
|
||||
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
|
||||
*/
|
||||
moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval, bool _restartCounter = true): eval(_eval), maxFullEval(_maxFullEval), restartCounter(_restartCounter) {
|
||||
nbEval_start = eval.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if continue
|
||||
* @param _solution a solution
|
||||
* @return true if number of evaluations < maxFullEval
|
||||
*/
|
||||
virtual bool operator()(EOT & _solution) {
|
||||
return (eval.value() - nbEval_start < maxFullEval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the number of evaluations
|
||||
* @param _solution a solution
|
||||
*/
|
||||
virtual void init(EOT & _solution) {
|
||||
if (restartCounter)
|
||||
nbEval_start = eval.value();
|
||||
else
|
||||
nbEval_start = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* the current number of evaluation from the begining
|
||||
* @return the number of evaluation
|
||||
*/
|
||||
unsigned int value() {
|
||||
return eval.value() - nbEval_start ;
|
||||
}
|
||||
|
||||
private:
|
||||
eoEvalFuncCounter<EOT> & eval;
|
||||
unsigned int nbEval_start ;
|
||||
bool restartCounter;
|
||||
unsigned int maxFullEval ;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
<moNeighborEvalContinuator.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can ue,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef _moNeighborEvalContinuator_h
|
||||
#define _moNeighborEvalContinuator_h
|
||||
|
||||
#include <continuator/moContinuator.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eval/moEvalCounter.h>
|
||||
|
||||
/**
|
||||
* Continue until a maximum fixed number of neighbor evaluation is reached
|
||||
*
|
||||
*
|
||||
* Becareful 1: if restartCounter is true, then the number of neighbor evaluations (for example incremental evaluations) is considered during the local search (not before it)
|
||||
*
|
||||
* Becareful 2: Can not be used if the evaluation function is used in parallel
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moNeighborEvalContinuator : public moContinuator<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _eval neighbor evaluation function to count
|
||||
* @param _maxNeighborEval number maximum of iterations
|
||||
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
|
||||
*/
|
||||
moNeighborEvalContinuator(moEvalCounter<Neighbor> & _eval, unsigned int _maxNeighborEval, bool _restartCounter = true): eval(_eval), maxNeighborEval(_maxNeighborEval), restartCounter(_restartCounter) {}
|
||||
|
||||
/**
|
||||
* Test if continue
|
||||
* @param _solution a solution
|
||||
* @return true if number of evaluations < maxNeighborEval
|
||||
*/
|
||||
virtual bool operator()(EOT & _solution) {
|
||||
return (eval.value() - nbEval_start < maxNeighborEval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the number of evaluations
|
||||
* @param _solution a solution
|
||||
*/
|
||||
virtual void init(EOT & _solution) {
|
||||
if (restartCounter)
|
||||
nbEval_start = eval.value();
|
||||
else
|
||||
nbEval_start = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* the current number of evaluation from the begining
|
||||
* @return the number of evaluation
|
||||
*/
|
||||
unsigned int value() {
|
||||
return eval.value() - nbEval_start ;
|
||||
}
|
||||
|
||||
private:
|
||||
moEvalCounter<Neighbor> & eval;
|
||||
unsigned int maxNeighborEval;
|
||||
bool restartCounter;
|
||||
unsigned int nbEval_start ;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,264 +0,0 @@
|
|||
/*
|
||||
<moNeighborhoodStat.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moNeighborhoodStat_h
|
||||
#define moNeighborhoodStat_h
|
||||
|
||||
#include <continuator/moStat.h>
|
||||
|
||||
#include <explorer/moNeighborhoodExplorer.h>
|
||||
#include <comparator/moNeighborComparator.h>
|
||||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* All possible statitic on the neighborhood fitness
|
||||
* to combine with other specific statistic to print them
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moNeighborhoodStat : public moStat<typename Neighbor::EOT, bool>
|
||||
{
|
||||
public :
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
typedef typename EOT::Fitness Fitness ;
|
||||
|
||||
using moStat< EOT, bool >::value;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhood a neighborhood
|
||||
* @param _eval an evaluation function
|
||||
* @param _neighborComparator a neighbor Comparator
|
||||
* @param _solNeighborComparator a comparator between a solution and a neighbor
|
||||
*/
|
||||
moNeighborhoodStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator):
|
||||
moStat<EOT, bool>(true, "neighborhood"),
|
||||
neighborhood(_neighborhood), eval(_eval),
|
||||
neighborComparator(_neighborComparator),
|
||||
solNeighborComparator(_solNeighborComparator)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
* where the comparators are basic, there only compare the fitness values
|
||||
*
|
||||
* @param _neighborhood a neighborhood
|
||||
* @param _eval an evaluation function
|
||||
*/
|
||||
moNeighborhoodStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval):
|
||||
moStat<EOT, bool>(true, "neighborhood"),
|
||||
neighborhood(_neighborhood), eval(_eval),
|
||||
neighborComparator(defaultNeighborComp),
|
||||
solNeighborComparator(defaultSolNeighborComp)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Compute classical statistics of the first solution's neighborhood
|
||||
* @param _solution the first solution
|
||||
*/
|
||||
virtual void init(EOT & _solution) {
|
||||
operator()(_solution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute classical statistics of a solution's neighborhood
|
||||
* @param _solution the corresponding solution
|
||||
*/
|
||||
virtual void operator()(EOT & _solution) {
|
||||
Neighbor current ;
|
||||
Neighbor best ;
|
||||
Neighbor lowest ;
|
||||
|
||||
if (neighborhood.hasNeighbor(_solution)) {
|
||||
//init the first neighbor
|
||||
neighborhood.init(_solution, current);
|
||||
|
||||
//eval the _solution moved with the neighbor and stock the result in the neighbor
|
||||
eval(_solution, current);
|
||||
|
||||
// init the statistics
|
||||
value() = true;
|
||||
|
||||
mean = current.fitness();
|
||||
sd = mean * mean;
|
||||
nb = 1;
|
||||
nbInf = 0;
|
||||
nbEqual = 0;
|
||||
nbSup = 0;
|
||||
|
||||
if (solNeighborComparator.equals(_solution, current))
|
||||
nbEqual++;
|
||||
else if (solNeighborComparator(_solution, current))
|
||||
nbSup++;
|
||||
else
|
||||
nbInf++;
|
||||
|
||||
//initialize the best neighbor
|
||||
best = current;
|
||||
lowest = current;
|
||||
|
||||
//test all others neighbors
|
||||
while (neighborhood.cont(_solution)) {
|
||||
//next neighbor
|
||||
neighborhood.next(_solution, current);
|
||||
//eval
|
||||
eval(_solution, current);
|
||||
|
||||
mean += current.fitness();
|
||||
sd += current.fitness() * current.fitness();
|
||||
nb++;
|
||||
|
||||
if (solNeighborComparator.equals(_solution, current))
|
||||
nbEqual++;
|
||||
else if (solNeighborComparator(_solution, current))
|
||||
nbSup++;
|
||||
else
|
||||
nbInf++;
|
||||
|
||||
//if we found a better neighbor, update the best
|
||||
if (neighborComparator(best, current))
|
||||
best = current;
|
||||
|
||||
if (neighborComparator(current, lowest))
|
||||
lowest = current;
|
||||
}
|
||||
|
||||
max = best.fitness();
|
||||
min = lowest.fitness();
|
||||
|
||||
mean /= nb;
|
||||
if (nb > 1)
|
||||
sd = sqrt( (sd - nb * mean * mean) / (nb - 1.0) );
|
||||
else
|
||||
sd = 0.0;
|
||||
}
|
||||
else {
|
||||
//if _solution hasn't neighbor,
|
||||
value() = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the worst fitness value found in the neighborhood
|
||||
*/
|
||||
Fitness getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the best fitness value found in the neighborhood
|
||||
*/
|
||||
Fitness getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mean fitness value of the neighborhood
|
||||
*/
|
||||
double getMean() {
|
||||
return mean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the standard deviation value of the neighborhood
|
||||
*/
|
||||
double getSD() {
|
||||
return sd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size of the neighborhood
|
||||
*/
|
||||
unsigned getSize() {
|
||||
return nb;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of neighbors having a better fitness than the current solution
|
||||
*/
|
||||
unsigned getNbSup() {
|
||||
return nbSup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of neighbors having the same fitness than the current solution
|
||||
*/
|
||||
unsigned getNbEqual() {
|
||||
return nbEqual;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of neighbors having a worst fitness than the current solution
|
||||
*/
|
||||
unsigned getNbInf() {
|
||||
return nbInf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the class name
|
||||
*/
|
||||
virtual std::string className(void) const {
|
||||
return "moNeighborhoodStat";
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//the neighborhood
|
||||
Neighborhood& neighborhood ;
|
||||
moEval<Neighbor>& eval;
|
||||
|
||||
// comparator betwenn solution and neighbor or between neighbors
|
||||
moNeighborComparator<Neighbor>& neighborComparator;
|
||||
moSolNeighborComparator<Neighbor>& solNeighborComparator;
|
||||
|
||||
// default comparators
|
||||
// compare the fitness values of neighbors
|
||||
moNeighborComparator<Neighbor> defaultNeighborComp;
|
||||
// compare the fitness values of the solution and the neighbor
|
||||
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
|
||||
|
||||
// the stastics of the fitness
|
||||
Fitness max, min;
|
||||
//mean and standard deviation
|
||||
double mean, sd ;
|
||||
|
||||
// number of neighbors in the neighborhood;
|
||||
unsigned int nb;
|
||||
|
||||
// number of neighbors with lower, equal and higher fitness
|
||||
unsigned int nbInf, nbEqual, nbSup ;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
<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) {
|
||||
external = false;
|
||||
start = time(NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Synchronize the whole time with an external starting time
|
||||
* @param _externalStart external starting time
|
||||
*/
|
||||
virtual void setStartingTime(time_t _externalStart) {
|
||||
external = true;
|
||||
start = _externalStart;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To get the starting time
|
||||
* @return starting time
|
||||
*/
|
||||
virtual time_t getStartingTime() {
|
||||
return start;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To set the maximum running time
|
||||
*
|
||||
* @param _maxTime maximum running time
|
||||
*/
|
||||
virtual void maxTime(time_t _maxTime) {
|
||||
max = _maxTime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns false when the running time is reached.
|
||||
* @param _sol the current solution
|
||||
*/
|
||||
virtual bool operator() (EOT& _sol)
|
||||
{
|
||||
bool res;
|
||||
time_t elapsed = (time_t) difftime(time(NULL), start);
|
||||
res = (elapsed < max);
|
||||
if (!res && verbose)
|
||||
std::cout << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* reset the start time
|
||||
* @param _solution a solution
|
||||
*/
|
||||
virtual void init(EOT & _solution) {
|
||||
if (!external)
|
||||
start = time(NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class name
|
||||
*/
|
||||
virtual std::string className(void) const
|
||||
{
|
||||
return "moTimeContinuator";
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** maximum running time */
|
||||
time_t max;
|
||||
/** starting time */
|
||||
time_t start;
|
||||
/** external start flag */
|
||||
bool external;
|
||||
/** verbose mode */
|
||||
bool verbose;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
<moUnsignedStat.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moUnsignedStat_h
|
||||
#define moUnsignedStat_h
|
||||
|
||||
#include <continuator/moStat.h>
|
||||
|
||||
/**
|
||||
* The statistic gives from a boolean variable
|
||||
*/
|
||||
template <class EOT>
|
||||
class moUnsignedStat : public moStat<EOT, unsigned int>
|
||||
{
|
||||
public :
|
||||
using moStat< EOT, unsigned int>::value;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
moUnsignedStat(unsigned int * _b): moStat<EOT, unsigned int>(*_b, "unsigned"), b(_b) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the number of iteration
|
||||
* @param _sol a solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = *b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of iteration
|
||||
* @param _sol a solution
|
||||
*/
|
||||
virtual void operator()(EOT & _sol) {
|
||||
value() = *b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of the class
|
||||
*/
|
||||
virtual std::string className(void) const {
|
||||
return "moUnsignedStat";
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int * b;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
<moUpdater.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moUpdater_h
|
||||
#define moUpdater_h
|
||||
|
||||
#include <eoFunctor.h>
|
||||
#include <utils/eoParam.h>
|
||||
|
||||
/**
|
||||
* Base class for to update what ever you want
|
||||
* similar to eoUpdater
|
||||
* But there is an init method !
|
||||
*/
|
||||
class moUpdater : public eoF<void>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* first call of the updater
|
||||
*/
|
||||
virtual void init() {}
|
||||
|
||||
/**
|
||||
* last call of the updater
|
||||
*/
|
||||
virtual void lastCall() {}
|
||||
|
||||
/**
|
||||
* class name
|
||||
*/
|
||||
virtual std::string className(void) const
|
||||
{ return "moUpdater"; }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
<moValueStat.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moValueStat_h
|
||||
#define moValueStat_h
|
||||
|
||||
#include <continuator/moStat.h>
|
||||
#include <utils/eoParam.h>
|
||||
|
||||
/**
|
||||
* The statistic gives the number of iteration
|
||||
*/
|
||||
template <class EOT, class ValueType>
|
||||
class moValueStat : public moStat<EOT, double>
|
||||
{
|
||||
public :
|
||||
using moStat< EOT, double>::value;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
moValueStat(eoValueParam<ValueType> & _valueParam): moStat<EOT, double>(0, "value"), valueParam(_valueParam) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the number of iteration
|
||||
* @param _sol a solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
value() = (double) valueParam.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of iteration
|
||||
* @param _sol a solution
|
||||
*/
|
||||
virtual void operator()(EOT & _sol) {
|
||||
value() = (double) valueParam.value() ;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of the class
|
||||
*/
|
||||
virtual std::string className(void) const {
|
||||
return "moValueStat";
|
||||
}
|
||||
|
||||
private:
|
||||
eoValueParam<ValueType> & valueParam;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,241 +0,0 @@
|
|||
/*
|
||||
<moVectorMonitor.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moVectorMonitor_h
|
||||
#define moVectorMonitor_h
|
||||
|
||||
#include <fstream>
|
||||
#include <utils/eoMonitor.h>
|
||||
#include <utils/eoParam.h>
|
||||
|
||||
/**
|
||||
* To save the values of the same type (double, unsigned int, or EOT) in a vector
|
||||
* It is similar to eoFileMonitor
|
||||
*
|
||||
*/
|
||||
template <class EOT>
|
||||
class moVectorMonitor : public eoMonitor
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _param the parameter of type double to save in the vector
|
||||
*/
|
||||
moVectorMonitor(eoValueParam<double> & _param) : doubleParam(&_param), intParam(NULL), eotParam(NULL)
|
||||
{
|
||||
// precision of the output by default
|
||||
precisionOutput = std::cout.precision();
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
* @param _param the parameter of type unsigned int to save in the vector
|
||||
*/
|
||||
moVectorMonitor(eoValueParam<unsigned int> & _param) : doubleParam(NULL), intParam(&_param), eotParam(NULL)
|
||||
{
|
||||
// precision of the output by default
|
||||
precisionOutput = std::cout.precision();
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
* @param _param the parameter of type EOT to save in the vector
|
||||
*/
|
||||
moVectorMonitor(eoValueParam<EOT> & _param) : doubleParam(NULL), intParam(NULL), eotParam(&_param)
|
||||
{
|
||||
// precision of the output by default
|
||||
precisionOutput = std::cout.precision();
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
* @param _param the parameter of type eoScalarFitness to save in the vector
|
||||
*/
|
||||
template <class ScalarType, class Compare>
|
||||
moVectorMonitor(eoValueParam<eoScalarFitness<ScalarType, Compare> > & _param) : doubleParam( & (eoValueParam<double>&)_param), intParam(NULL), eotParam(NULL)
|
||||
{
|
||||
// precision of the output by default
|
||||
precisionOutput = std::cout.precision();
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
* @param _param unvalid Parameter
|
||||
*/
|
||||
template <class T>
|
||||
moVectorMonitor(eoValueParam<T> & _param) : doubleParam(NULL), intParam(NULL), eotParam(NULL)
|
||||
{
|
||||
std::cerr << "Sorry the type can not be in a vector of moVectorMonitor" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* To test if the value are basic type (double or unsigned int), or EOT type
|
||||
*
|
||||
* @return true if the type is a EOT type
|
||||
*/
|
||||
bool solutionType() {
|
||||
return eotParam != NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* To "print" the value of the parameter in the vector
|
||||
*
|
||||
* @return this monitor (sorry I don't why, but it is like this in EO)
|
||||
*/
|
||||
eoMonitor& operator()(void) {
|
||||
if (doubleParam != NULL)
|
||||
valueVec.push_back(doubleParam->value());
|
||||
else
|
||||
if (intParam != NULL)
|
||||
valueVec.push_back((double) intParam->value());
|
||||
else
|
||||
eotVec.push_back(eotParam->value());
|
||||
return *this ;
|
||||
}
|
||||
|
||||
/**
|
||||
* To have all the values
|
||||
*
|
||||
* @return the vector of values
|
||||
*/
|
||||
const std::vector<double>& getValues() const {
|
||||
return valueVec;
|
||||
}
|
||||
|
||||
/**
|
||||
* To have all the solutions
|
||||
*
|
||||
* @return the vector of solutions
|
||||
*/
|
||||
const std::vector<EOT>& getSolutions() const {
|
||||
return eotVec;
|
||||
}
|
||||
|
||||
/**
|
||||
* to get the value out.
|
||||
* @return the string of the value
|
||||
*/
|
||||
std::string getValue(unsigned int i) const {
|
||||
std::ostringstream os;
|
||||
|
||||
// set the precision of the output
|
||||
os.precision(precisionOutput);
|
||||
|
||||
if (eotParam == NULL)
|
||||
os << (valueVec[i]) ;
|
||||
else
|
||||
os << (eotVec[i]) ;
|
||||
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/**
|
||||
* clear the vector
|
||||
*/
|
||||
void clear() {
|
||||
valueVec.clear();
|
||||
eotVec.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* number of value
|
||||
* @return size of the vector
|
||||
*/
|
||||
unsigned int size() {
|
||||
if (eotParam == NULL)
|
||||
return valueVec.size();
|
||||
else
|
||||
return eotVec.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* to set the precision of the output file
|
||||
* @param _precision precision of the output (number of digit)
|
||||
*/
|
||||
void precision(unsigned int _precision) {
|
||||
precisionOutput = _precision;
|
||||
}
|
||||
|
||||
/**
|
||||
* to export the vector of values into one file
|
||||
* @param _filename file name
|
||||
* @param _openFile to specify if it writes at the following of the file
|
||||
*/
|
||||
void fileExport(std::string _filename, bool _openFile=false) {
|
||||
// create file
|
||||
std::ofstream os;
|
||||
|
||||
if(! _openFile)
|
||||
os.open(_filename.c_str());
|
||||
|
||||
else
|
||||
os.open(_filename.c_str(),std::ios::app);
|
||||
|
||||
|
||||
if (!os) {
|
||||
std::string str = "moVectorMonitor: Could not open " + _filename;
|
||||
throw std::runtime_error(str);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < size(); i++) {
|
||||
os << getValue(i);
|
||||
|
||||
os << std::endl ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of the class
|
||||
*/
|
||||
virtual std::string className(void) const {
|
||||
return "moVectorMonitor";
|
||||
}
|
||||
|
||||
protected:
|
||||
eoValueParam<double> * doubleParam ;
|
||||
eoValueParam<unsigned int> * intParam ;
|
||||
eoValueParam<EOT> * eotParam ;
|
||||
|
||||
std::vector<double> valueVec;
|
||||
std::vector<EOT> eotVec;
|
||||
|
||||
// precision of the output
|
||||
unsigned int precisionOutput;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
<moDoubleIncrEvaluation.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moDoubleIncrEvaluation_H
|
||||
#define moDoubleIncrEvaluation_H
|
||||
|
||||
#include <eval/moNeighborhoodEvaluation.h>
|
||||
#include <continuator/moUpdater.h>
|
||||
|
||||
/**
|
||||
* Base class for the double incremental evaluation of the neighborhood
|
||||
*
|
||||
* The sizes of the neighborhoods are equal
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moDoubleIncrEvaluation : public moNeighborhoodEvaluation<Neighbor>, public moUpdater
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
*/
|
||||
moDoubleIncrEvaluation(unsigned int _neighborhoodSize) : moNeighborhoodEvaluation<Neighbor>(), moUpdater(), neighborhoodSize(_neighborhoodSize), firstEval(true) {
|
||||
deltaFitness = new Fitness[neighborhoodSize];
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moDoubleIncrEvaluation() {
|
||||
if (deltaFitness != NULL)
|
||||
delete [] deltaFitness;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisation of the evaluation process
|
||||
* The first evaluation will be a simple incremental evaluation
|
||||
*
|
||||
*/
|
||||
virtual void init() {
|
||||
firstEval = true;
|
||||
}
|
||||
|
||||
virtual void operator()() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluation of the neighborhood
|
||||
* Here nothing to do
|
||||
*
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void operator()(EOT & _solution) {
|
||||
}
|
||||
|
||||
/** the delta of fitness for each neighbors
|
||||
* The fitness of the neighbor i is given by : fitness(solution) + deltaFitness[i]
|
||||
*/
|
||||
Fitness * deltaFitness;
|
||||
|
||||
protected:
|
||||
/** the neighborhood size */
|
||||
unsigned int neighborhoodSize;
|
||||
|
||||
/** flag : true when it is the first evaluation */
|
||||
bool firstEval;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
<moDoubleIncrNeighborhoodEval.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moDoubleIncrNeighborhoodEval_H
|
||||
#define moDoubleIncrNeighborhoodEval_H
|
||||
|
||||
#include <eval/moEval.h>
|
||||
#include <eval/moDoubleIncrEvaluation.h>
|
||||
|
||||
/**
|
||||
* Evaluation of a neighbor from the full evaluation f the neighborhood
|
||||
*
|
||||
*
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moDoubleIncrNeighborhoodEval : public moEval<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename moEval<Neighbor>::EOT EOT;
|
||||
|
||||
/**
|
||||
* Ctor
|
||||
* @param _evaluation the double incremental evaluation of the neighborhood
|
||||
*/
|
||||
moDoubleIncrNeighborhoodEval(moDoubleIncrEvaluation<Neighbor>& _evaluation) : evaluation(_evaluation) {}
|
||||
|
||||
/**
|
||||
* evaluation of a neighbor with the double incremental evaluation
|
||||
*
|
||||
* @param _sol current solution
|
||||
* @param _neighbor the neighbor to be evaluated
|
||||
*/
|
||||
void operator()(EOT & _sol, Neighbor & _neighbor)
|
||||
{
|
||||
_neighbor.fitness(_sol.fitness() + evaluation.deltaFitness[_neighbor.index()]);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
/** the evaluation of the neighborhood */
|
||||
moDoubleIncrEvaluation<Neighbor> & evaluation;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
<moEval.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moEval_H
|
||||
#define moEval_H
|
||||
|
||||
#include <eoFunctor.h>
|
||||
|
||||
/**
|
||||
* Abstract class for the evaluation
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moEval : public eoBF<typename Neighbor::EOT &, Neighbor&, void>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
<moNeighborhoodEvaluation.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
|
||||
|
||||
This software is governed by the CeCILL license under French law and
|
||||
abiding by the rules of distribution of free software. You can use,
|
||||
modify and/ or redistribute the software under the terms of the CeCILL
|
||||
license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
"http://www.cecill.info".
|
||||
|
||||
As a counterpart to the access to the source code and rights to copy,
|
||||
modify and redistribute granted by the license, users are provided only
|
||||
with a limited warranty and the software's author, the holder of the
|
||||
economic rights, and the successive licensors have only limited liability.
|
||||
|
||||
In this respect, the user's attention is drawn to the risks associated
|
||||
with loading, using, modifying and/or developing or reproducing the
|
||||
software by the user in light of its specific status of free software,
|
||||
that may mean that it is complicated to manipulate, and that also
|
||||
therefore means that it is reserved for developers and experienced
|
||||
professionals having in-depth computer knowledge. Users are therefore
|
||||
encouraged to load and test the software's suitability as regards their
|
||||
requirements in conditions enabling the security of their systems and/or
|
||||
data to be ensured and, more generally, to use and operate it in the
|
||||
same conditions as regards security.
|
||||
The fact that you are presently reading this means that you have had
|
||||
knowledge of the CeCILL license and that you accept its terms.
|
||||
|
||||
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*/
|
||||
|
||||
#ifndef moNeighborhoodEvaluation_H
|
||||
#define moNeighborhoodEvaluation_H
|
||||
|
||||
#include <eoFunctor.h>
|
||||
|
||||
/**
|
||||
* Abstract class for the evaluation
|
||||
* of all the neighborhood
|
||||
* in one step
|
||||
*
|
||||
* It is usefull for example in a double incremental evaluation (QAP, UBQP problems)
|
||||
* This class is used in combinaison with the class moEvaluatedNeighborhood
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moNeighborhoodEvaluation : public eoUF<typename Neighbor::EOT &, void>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
<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
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
<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;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
//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
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
<moIntensification.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 _moIntensification_h
|
||||
#define _moIntensification_h
|
||||
|
||||
#include <memory/moMemory.h>
|
||||
#include <eoFunctor.h>
|
||||
|
||||
/**
|
||||
* Abstract class for intensification strategy
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moIntensification : virtual public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool> {};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
#ifndef _moMemory_h
|
||||
#define _moMemory_h
|
||||
|
||||
/**
|
||||
* Abstract class for different memory
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moMemory //: public eoObject
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Init the memory
|
||||
* @param _sol the current solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) = 0;
|
||||
|
||||
/**
|
||||
* Add data to the memory
|
||||
* @param _sol the current solution
|
||||
* @param _neighbor the current neighbor
|
||||
*/
|
||||
virtual void add(EOT & _sol, Neighbor & _neighbor) = 0;
|
||||
|
||||
/**
|
||||
* update the memory
|
||||
* @param _sol the current solution
|
||||
* @param _neighbor the current neighbor
|
||||
*/
|
||||
virtual void update(EOT & _sol, Neighbor & _neighbor) = 0;
|
||||
|
||||
/**
|
||||
* clear the memory
|
||||
*/
|
||||
virtual void clearMemory() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
<moMonOpDiversification.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 _moMonOpDiversification_h
|
||||
#define _moMonOpDiversification_h
|
||||
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoOp.h>
|
||||
#include <memory/moDiversification.h>
|
||||
#include <memory/moDummyMemory.h>
|
||||
|
||||
/**
|
||||
* Diversification strategy applies a "monOp" operator
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moMonOpDiversification : public moDiversification<Neighbor>, public moDummyMemory<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _monOp an eoMonOp (diversification operator)
|
||||
* @param _fullEval a full evaluation function
|
||||
*/
|
||||
moMonOpDiversification(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval) {}
|
||||
|
||||
/**
|
||||
* Apply monOp on the solution
|
||||
* @param _solution to diversify
|
||||
* @return value of monOp
|
||||
*/
|
||||
bool operator()(EOT& _solution) {
|
||||
bool res = monOp(_solution);
|
||||
fullEval(_solution);
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
/** monOp */
|
||||
eoMonOp<EOT>& monOp;
|
||||
eoEvalFunc<EOT>& fullEval;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
/*
|
||||
<moNeighborVectorTabuList.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 _moNeighborVectorTabuList_h
|
||||
#define _moNeighborVectorTabuList_h
|
||||
|
||||
#include <memory/moTabuList.h>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* Tabu List of neighbors stocked in a vector
|
||||
*/
|
||||
template<class Neighbor >
|
||||
class moNeighborVectorTabuList : 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 (0 -> no limits)
|
||||
*/
|
||||
moNeighborVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong), index(0) {
|
||||
tabuList.reserve(_maxSize);
|
||||
tabuList.resize(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 (tabuList.size() < maxSize) {
|
||||
std::pair<Neighbor, unsigned int> tmp;
|
||||
tmp.first=_neighbor;
|
||||
tmp.second=howlong;
|
||||
tabuList.push_back(tmp);
|
||||
}
|
||||
else {
|
||||
tabuList[index%maxSize].first = _neighbor;
|
||||
tabuList[index%maxSize].second = howlong;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update the tabulist
|
||||
* @param _sol unused solution
|
||||
* @param _neighbor unused neighbor
|
||||
*/
|
||||
virtual void update(EOT & _sol, Neighbor & _neighbor) {
|
||||
if (howlong > 0)
|
||||
for (unsigned int i=0; i<tabuList.size(); i++)
|
||||
if (tabuList[i].second > 0)
|
||||
tabuList[i].second--;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
for (unsigned int i=0; i<tabuList.size(); i++) {
|
||||
if ((howlong > 0 && tabuList[i].second > 0 && tabuList[i].first.equals(_neighbor)) || (howlong==0 && tabuList[i].first.equals(_neighbor)))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* clearMemory: remove all solution of the tabuList
|
||||
*/
|
||||
virtual void clearMemory() {
|
||||
tabuList.resize(0);
|
||||
index = 0;
|
||||
}
|
||||
|
||||
void print(){
|
||||
std::cout << "TAbulist:" << std::endl;
|
||||
for(int i=0; i<tabuList.size(); i++)
|
||||
std::cout << i << ": " << tabuList[i].first.index() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
//tabu list
|
||||
std::vector< std::pair<Neighbor, unsigned int> > tabuList;
|
||||
//maximum size of the tabu list
|
||||
unsigned int maxSize;
|
||||
//how many iteration a move is tabu
|
||||
unsigned int howlong;
|
||||
//index on the tabulist
|
||||
unsigned long index;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
<moRndIndexedVectorTabuList.h>
|
||||
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
|
||||
|
||||
Sebastien Verel
|
||||
|
||||
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 _moRndIndexedVectorTabuList_h
|
||||
#define _moRndIndexedVectorTabuList_h
|
||||
|
||||
#include <memory/moIndexedVectorTabuList.h>
|
||||
#include <utils/eoRndGenerators.h>
|
||||
|
||||
|
||||
/**
|
||||
* Tabu List of indexed neighbors save in a vector
|
||||
* each neighbor can not used during howlong + rnd(howlongRnd) iterations
|
||||
* see paper:
|
||||
* Zhipeng Lu, Fred Glover, Jin-Kao Hao. "A Hybrid Metaheuristic Approach to Solving the UBQP Problem". European Journal of Operational Research, 2010.
|
||||
*/
|
||||
template<class Neighbor >
|
||||
class moRndIndexedVectorTabuList : public moIndexedVectorTabuList<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
//tabu list
|
||||
using moIndexedVectorTabuList<Neighbor>::tabuList;
|
||||
//maximum size of the tabu list
|
||||
using moIndexedVectorTabuList<Neighbor>::maxSize;
|
||||
//how many iteration a move is tabu
|
||||
using moIndexedVectorTabuList<Neighbor>::howlong;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _maxSize maximum size of the tabu list
|
||||
* @param _howlong how many minimal iteration a move is tabu
|
||||
* @param _howlongRnd how many additional iterations a move is tabu (random between [0 , _howlongRnd [ )
|
||||
*/
|
||||
moRndIndexedVectorTabuList(unsigned int _maxSize, unsigned int _howlong, unsigned int _howlongRnd) : moIndexedVectorTabuList<Neighbor>(_maxSize, _howlong), howlongRnd(_howlongRnd) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 + rng.uniform(howlongRnd) ;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
// the random part of the forbidden time
|
||||
unsigned int howlongRnd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
<moSolVectorTabuList.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 _moSolVectorTabuList_h
|
||||
#define _moSolVectorTabuList_h
|
||||
|
||||
#include <memory/moTabuList.h>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* Tabu List of solution stocked in a vector
|
||||
*/
|
||||
template<class Neighbor >
|
||||
class moSolVectorTabuList : public moTabuList<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _maxSize maximum size of the tabu list
|
||||
* @param _howlong how many iteration a solution is tabu
|
||||
*/
|
||||
moSolVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong) {
|
||||
tabuList.reserve(_maxSize);
|
||||
tabuList.resize(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* init the tabuList by clearing the memory
|
||||
* @param _sol the current solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
clearMemory();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* add a new solution in the tabuList
|
||||
* @param _sol the current solution
|
||||
* @param _neighbor unused neighbor
|
||||
*/
|
||||
virtual void add(EOT & _sol, Neighbor & _neighbor) {
|
||||
|
||||
if (tabuList.size() < maxSize) {
|
||||
std::pair<EOT, unsigned int> tmp;
|
||||
tmp.first=_sol;
|
||||
tmp.second=howlong;
|
||||
tabuList.push_back(tmp);
|
||||
}
|
||||
else {
|
||||
tabuList[index%maxSize].first = _sol;
|
||||
tabuList[index%maxSize].second = howlong;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* update the tabulist: NOTHING TO DO
|
||||
* @param _sol the current solution
|
||||
* @param _neighbor the current neighbor (unused)
|
||||
*/
|
||||
virtual void update(EOT & _sol, Neighbor & _neighbor) {
|
||||
if (howlong > 0)
|
||||
for (unsigned int i=0; i<tabuList.size(); i++)
|
||||
if (tabuList[i].second > 0)
|
||||
tabuList[i].second--;
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the solution is tabu
|
||||
* @param _sol the current solution
|
||||
* @param _neighbor the current neighbor (unused)
|
||||
* @return true if tabuList contains _sol
|
||||
*/
|
||||
virtual bool check(EOT & _sol, Neighbor & _neighbor) {
|
||||
EOT tmp=_sol;
|
||||
_neighbor.move(tmp);
|
||||
for (unsigned int i=0; i<tabuList.size(); i++) {
|
||||
if ((howlong > 0 && tabuList[i].second > 0 && tabuList[i].first == tmp) || (howlong==0 && tabuList[i].first==tmp))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* clearMemory: remove all solution of the tabuList
|
||||
*/
|
||||
virtual void clearMemory() {
|
||||
tabuList.resize(0);
|
||||
index = 0;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
//tabu list
|
||||
std::vector< std::pair<EOT, unsigned int> > tabuList;
|
||||
//maximum size of the tabu list
|
||||
unsigned int maxSize;
|
||||
//how many iteration a move is tabu
|
||||
unsigned int howlong;
|
||||
//index on the tabulist
|
||||
unsigned long index;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
<moTabuList.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 _moTabuList_h
|
||||
#define _moTabuList_h
|
||||
|
||||
#include <memory/moMemory.h>
|
||||
|
||||
/**
|
||||
* Abstract class for the Tabu List
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moTabuList : public moMemory<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Check if a neighbor is tabu or not
|
||||
* @param _sol the current solution
|
||||
* @param _neighbor the neighbor
|
||||
* @return true if the neighbor is tabu
|
||||
*/
|
||||
virtual bool check(EOT & _sol, Neighbor & _neighbor) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
<moBackableNeighbor.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 _BackableNeighbor_h
|
||||
#define _BackableNeighbor_h
|
||||
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
|
||||
/**
|
||||
* Neighbor with a move back function to use in a moFullEvalByModif
|
||||
*/
|
||||
template< class EOT, class Fitness=typename EOT::Fitness >
|
||||
class moBackableNeighbor : virtual public moNeighbor<EOT, Fitness>
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* the function to move back a solution
|
||||
* @param _solution the solution to moveBack
|
||||
*/
|
||||
virtual void moveBack(EOT & _solution)=0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
<moBackwardVectorVNSelection.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 _moBackwardVectorVNSelection_h
|
||||
#define _moBackwardVectorVNSelection_h
|
||||
|
||||
#include <neighborhood/moVectorVNSelection.h>
|
||||
|
||||
/**
|
||||
* This class is used for the Variable Neighborhood Search explorer inherits from moVectorVNSelection
|
||||
* The search heuristics are saved in vectors
|
||||
* They are given in backward order from the last ones to the first ones
|
||||
*
|
||||
*/
|
||||
template< class EOT >
|
||||
class moBackwardVectorVNSelection: public moVectorVNSelection<EOT>{
|
||||
|
||||
using moVectorVNSelection<EOT>::LSvector;
|
||||
using moVectorVNSelection<EOT>::current;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default constructor with first search heuristics
|
||||
*
|
||||
* @param _firstLS first local search
|
||||
* @param _firstShake first heuristic which perturbs the solution
|
||||
* @param _cycle when true, the first heuristics follows the last ones. Otherwise the search stop.
|
||||
*/
|
||||
moBackwardVectorVNSelection(eoMonOp<EOT>& _firstLS, eoMonOp<EOT>& _firstShake, bool _cycle = true) : moVectorVNSelection<EOT>(_firstLS, _firstShake), cycle(_cycle){}
|
||||
|
||||
/**
|
||||
* Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moBackwardVectorVNSelection";
|
||||
}
|
||||
|
||||
/**
|
||||
* test if there is still some heuristics
|
||||
*
|
||||
* @param _solution the current solution
|
||||
* @return true if there is some heuristics
|
||||
*/
|
||||
virtual bool cont(EOT& _solution){
|
||||
return (cycle || (current > 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* put the current heuristics on the first ones
|
||||
*
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void init(EOT& _solution){
|
||||
current = LSvector.size() - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* put the current heuristics on the next ones
|
||||
*
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void next(EOT& _solution){
|
||||
current = (current + LSvector.size() -1) % LSvector.size();
|
||||
}
|
||||
|
||||
private:
|
||||
// boolean to indicate the last heuristics follow the first ones
|
||||
bool cycle;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
<moDummyNeighbor.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 _moDummyNeighbor_h
|
||||
#define _moDummyNeighbor_h
|
||||
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
|
||||
/**
|
||||
* Dummy Neighborhood
|
||||
*/
|
||||
template< class EOT, class Fitness=typename EOT::Fitness >
|
||||
class moDummyNeighbor : public moNeighbor< EOT, Fitness > {
|
||||
public:
|
||||
|
||||
/**
|
||||
* NOTHING TO DO
|
||||
* @param _solution the related solution
|
||||
*/
|
||||
virtual void move(EOT& _solution) {}
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
<moDummyNeighborhood.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 _moDummyNeighborhood_h
|
||||
#define _moDummyNeighborhood_h
|
||||
|
||||
#include <neighborhood/moDummyNeighbor.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* Dummy Neighborhood
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moDummyNeighborhood : public moNeighborhood<Neighbor> {
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* NOTHING TO DO
|
||||
* @param _solution unused solution
|
||||
* @return always false
|
||||
*/
|
||||
virtual bool hasNeighbor(EOT & _solution) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTHING TO DO
|
||||
* @param _solution unused solution
|
||||
* @param _current unused neighbor
|
||||
*/
|
||||
virtual void init(EOT & _solution, Neighbor & _current) {}
|
||||
|
||||
/**
|
||||
* NOTHING TO DO
|
||||
* @param _solution unused solution
|
||||
* @param _current unused neighbor
|
||||
*/
|
||||
virtual void next(EOT & _solution, Neighbor & _current) {}
|
||||
|
||||
/**
|
||||
* NOTHING TO DO
|
||||
* @param _solution unused solution
|
||||
* @return always false
|
||||
*/
|
||||
virtual bool cont(EOT & _solution) {
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
<moEvaluatedNeighborhood.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 _moEvaluatedNeighborhood_h
|
||||
#define _moEvaluatedNeighborhood_h
|
||||
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eval/moNeighborhoodEvaluation.h>
|
||||
|
||||
/**
|
||||
* A Neighborhood for the evaluation of all neighbors
|
||||
* in one step
|
||||
*
|
||||
* It is usefull for example in a double incremental evaluation (QAP, UBQP problems)
|
||||
* This class is used in combinaison with the class moNeighborhoodEvaluation
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moEvaluatedNeighborhood: public moNeighborhood<Neighbor> {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _originalNeighborhood the original neighborhood to apply
|
||||
* @param _nhEval the evaluation function of the neighborhood
|
||||
*/
|
||||
moEvaluatedNeighborhood(moNeighborhood<Neighbor> & _originalNeighborhood, moNeighborhoodEvaluation<Neighbor> & _nhEval) :
|
||||
moNeighborhood<Neighbor>(), originalNeighborhood(_originalNeighborhood), nhEval(_nhEval) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the neighborhood is random (default false)
|
||||
*/
|
||||
virtual bool isRandom() {
|
||||
return originalNeighborhood.isRandom();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a neighbor exists
|
||||
* @param _solution the solution to explore
|
||||
* @return true if the neighborhood was not empty
|
||||
*/
|
||||
virtual bool hasNeighbor(EOT& _solution) {
|
||||
return originalNeighborhood.hasNeighbor(_solution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood with the full evaluation
|
||||
*
|
||||
* @param _solution the solution to explore
|
||||
* @param _neighbor the first neighbor
|
||||
*/
|
||||
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||
// full evaluation of the neighborhood
|
||||
nhEval(_solution);
|
||||
// initialisation of the original neighborhood
|
||||
originalNeighborhood.init(_solution, _neighbor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Give the next neighbor with the original neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _neighbor the next neighbor
|
||||
*/
|
||||
virtual void next(EOT & _solution, Neighbor & _neighbor) {
|
||||
originalNeighborhood.next(_solution, _neighbor);
|
||||
}
|
||||
|
||||
/**
|
||||
* give the continuation with the original neighborhood
|
||||
*
|
||||
* @param _solution the solution to explore
|
||||
* @return true if there is again a neighbor to explore
|
||||
*/
|
||||
virtual bool cont(EOT & _solution) {
|
||||
return originalNeighborhood.cont(_solution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moEvaluatedNeighborhood";
|
||||
}
|
||||
|
||||
protected:
|
||||
moNeighborhood<Neighbor> & originalNeighborhood;
|
||||
moNeighborhoodEvaluation<Neighbor> & nhEval ;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
<moForwardVectorVNSelection.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 _moForwardVectorVNSelection_h
|
||||
#define _moForwardVectorVNSelection_h
|
||||
|
||||
#include <neighborhood/moVectorVNSelection.h>
|
||||
|
||||
/**
|
||||
* This class is used for the Variable Neighborhood Search explorer inherits from moVectorVNSelection
|
||||
* The search heuristics are saved in vectors
|
||||
* They are given in forward order from the first ones to the last ones
|
||||
*
|
||||
*/
|
||||
template< class EOT >
|
||||
class moForwardVectorVNSelection: public moVectorVNSelection<EOT>{
|
||||
|
||||
using moVectorVNSelection<EOT>::LSvector;
|
||||
using moVectorVNSelection<EOT>::current;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default constructor with first search heuristics
|
||||
*
|
||||
* @param _firstLS first local search
|
||||
* @param _firstShake first heuristic which perturbs the solution
|
||||
* @param _cycle when true, the first heuristics follows the last ones. Otherwise the search stop.
|
||||
*/
|
||||
moForwardVectorVNSelection(eoMonOp<EOT>& _firstLS, eoMonOp<EOT>& _firstShake, bool _cycle = true) : moVectorVNSelection<EOT>(_firstLS, _firstShake), cycle(_cycle){}
|
||||
|
||||
/**
|
||||
* Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moForwardVectorVNSelection";
|
||||
}
|
||||
|
||||
/**
|
||||
* test if there is still some heuristics
|
||||
*
|
||||
* @param _solution the current solution
|
||||
* @return true if there is some heuristics
|
||||
*/
|
||||
virtual bool cont(EOT& _solution){
|
||||
return (cycle || (current <= (LSvector.size() - 2)));
|
||||
}
|
||||
|
||||
/**
|
||||
* put the current heuristics on the first ones
|
||||
*
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void init(EOT& _solution){
|
||||
current = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* put the current heuristics on the next ones
|
||||
*
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void next(EOT& _solution){
|
||||
current = (current + 1) % LSvector.size();
|
||||
}
|
||||
|
||||
private:
|
||||
// boolean to indicate the first heuristics follow the last ones
|
||||
bool cycle;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
<moIndexNeighbor.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 _IndexNeighbor_h
|
||||
#define _IndexNeighbor_h
|
||||
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
|
||||
/**
|
||||
* Index Neighbor
|
||||
*/
|
||||
template<class EOT, class Fitness = typename EOT::Fitness>
|
||||
class moIndexNeighbor: virtual public moNeighbor<EOT, Fitness> {
|
||||
public:
|
||||
|
||||
using moNeighbor<EOT, Fitness>::fitness;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
moIndexNeighbor() :
|
||||
moNeighbor<EOT, Fitness> (), key(0) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy Constructor
|
||||
* @param _n the neighbor to copy
|
||||
*/
|
||||
moIndexNeighbor(const moIndexNeighbor& _n) :
|
||||
moNeighbor<EOT, Fitness> (_n) {
|
||||
this->key = _n.key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assignment operator
|
||||
* @param _source the source neighbor
|
||||
*/
|
||||
|
||||
moIndexNeighbor<EOT, Fitness> & operator=(const moIndexNeighbor<EOT,
|
||||
Fitness> & _source) {
|
||||
moNeighbor<EOT, Fitness>::operator=(_source);
|
||||
this->key = _source.key;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moIndexNeighbor";
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter
|
||||
* @return index of the IndexNeighbor
|
||||
*/
|
||||
unsigned int index() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter
|
||||
* @param _key index of the IndexNeighbor
|
||||
*/
|
||||
void index(unsigned int _key) {
|
||||
key = _key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param _neighbor a neighbor
|
||||
* @return if _neighbor and this one are equals
|
||||
*/
|
||||
virtual bool equals(moIndexNeighbor<EOT>& _neighbor) {
|
||||
return (key == _neighbor.index());
|
||||
}
|
||||
|
||||
protected:
|
||||
// key allowing to describe the neighbor
|
||||
unsigned int key;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
<moIndexNeighborhood.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 _moIndexNeighborhood_h
|
||||
#define _moIndexNeighborhood_h
|
||||
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* A Indexed Neighborhood
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moIndexNeighborhood: virtual public moNeighborhood<Neighbor> {
|
||||
public:
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
*/
|
||||
moIndexNeighborhood(unsigned int _neighborhoodSize) :
|
||||
neighborhoodSize(_neighborhoodSize) {
|
||||
}
|
||||
|
||||
/**
|
||||
* getter to get the value of neighborhoodSize
|
||||
* @return the neighborhoodSize
|
||||
*/
|
||||
unsigned int getNeighborhoodSize() const {
|
||||
return neighborhoodSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter to fixe the neighoodSize
|
||||
* @param _neighborhoodSize the value to set
|
||||
*/
|
||||
|
||||
void setNeighborhoodSize(unsigned int _neighborhoodSize) {
|
||||
neighborhoodSize = _neighborhoodSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moIndexNeighborhood";
|
||||
}
|
||||
|
||||
protected:
|
||||
// size of the neighborhood
|
||||
unsigned int neighborhoodSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
<moNeighbor.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 _moNeighbor_h
|
||||
#define _moNeighbor_h
|
||||
|
||||
//EO inclusion
|
||||
#include <EO.h>
|
||||
#include <eoObject.h>
|
||||
#include <eoPersistent.h>
|
||||
|
||||
/**
|
||||
* Container of the neighbor informations
|
||||
*/
|
||||
template<class EOType, class Fitness = typename EOType::Fitness>
|
||||
class moNeighbor: public EO<Fitness> {
|
||||
public:
|
||||
typedef EOType EOT;
|
||||
using EO<Fitness>::fitness;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
moNeighbor() :
|
||||
EO<Fitness> () {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy Constructor
|
||||
* @param _neighbor to copy
|
||||
*/
|
||||
moNeighbor(const moNeighbor<EOT, Fitness>& _neighbor) {
|
||||
if (!(_neighbor.invalid()))
|
||||
fitness(_neighbor.fitness());
|
||||
else
|
||||
(*this).invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assignment operator
|
||||
* @param _neighbor the neighbor to assign
|
||||
* @return a neighbor equal to the other
|
||||
*/
|
||||
virtual moNeighbor<EOT, Fitness>& operator=(
|
||||
const moNeighbor<EOT, Fitness>& _neighbor) {
|
||||
if (!(_neighbor.invalid()))
|
||||
fitness(_neighbor.fitness());
|
||||
else
|
||||
(*this).invalidate();
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a solution
|
||||
* @param _solution the related solution
|
||||
*/
|
||||
virtual void move(EOT & _solution) = 0;
|
||||
|
||||
/**
|
||||
* Test equality between two neighbors
|
||||
* @param _neighbor a neighbor
|
||||
* @return if _neighbor and this one are equals
|
||||
*/
|
||||
virtual bool equals(moNeighbor<EOT, Fitness> & _neighbor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moNeighbor";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
<moNeighborhood.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 _moNeighborhood_h
|
||||
#define _moNeighborhood_h
|
||||
|
||||
#include <eoObject.h>
|
||||
|
||||
/**
|
||||
* A Neighborhood
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moNeighborhood : public eoObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
moNeighborhood() {}
|
||||
|
||||
/**
|
||||
* @return true if the neighborhood is random (default false)
|
||||
*/
|
||||
virtual bool isRandom() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a solution has (again) a Neighbor
|
||||
* @param _solution the related solution
|
||||
* @return true if _solution has a Neighbor
|
||||
*/
|
||||
virtual bool hasNeighbor(EOT & _solution) = 0 ;
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the first neighbor
|
||||
*/
|
||||
virtual void init(EOT & _solution, Neighbor & _current) = 0 ;
|
||||
|
||||
/**
|
||||
* Give the next neighbor
|
||||
* @param _solution the solution to explore
|
||||
* @param _current the next neighbor
|
||||
*/
|
||||
virtual void next(EOT & _solution, Neighbor & _current) = 0 ;
|
||||
|
||||
/**
|
||||
* Test if there is again a neighbor
|
||||
* @param _solution the solution to explore
|
||||
* @return true if there is again a neighbor not explored
|
||||
*/
|
||||
virtual bool cont(EOT & _solution) = 0 ;
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moNeighborhood";
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
<moOrderNeighborhood.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 _moOrderNeighborhood_h
|
||||
#define _moOrderNeighborhood_h
|
||||
|
||||
#include <neighborhood/moIndexNeighborhood.h>
|
||||
|
||||
/**
|
||||
* An ordered Neighborhood
|
||||
*/
|
||||
template<class Neighbor>
|
||||
class moOrderNeighborhood: public moIndexNeighborhood<Neighbor> {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moIndexNeighborhood<Neighbor>::neighborhoodSize;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
*/
|
||||
moOrderNeighborhood(unsigned int _neighborhoodSize) :
|
||||
moIndexNeighborhood<Neighbor> (_neighborhoodSize), currentIndex(0) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if a neighbor exists
|
||||
* @param _solution the solution to explore
|
||||
* @return true if the neighborhood was not empty
|
||||
*/
|
||||
virtual bool hasNeighbor(EOT& _solution) {
|
||||
return neighborhoodSize > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _neighbor the first neighbor
|
||||
*/
|
||||
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||
currentIndex = 0;
|
||||
_neighbor.index(currentIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Give the next neighbor
|
||||
* @param _solution the solution to explore
|
||||
* @param _neighbor the next neighbor
|
||||
*/
|
||||
virtual void next(EOT & _solution, Neighbor & _neighbor) {
|
||||
currentIndex++;
|
||||
_neighbor.index(currentIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* test if all neighbors are explore or not,if false, there is no neighbor left to explore
|
||||
* currentIndex is the index which have been used before, it is not the next neighbor which can be possibly evaluated
|
||||
*
|
||||
* @param _solution the solution to explore
|
||||
* @return true if there is again a neighbor to explore
|
||||
*/
|
||||
virtual bool cont(EOT & _solution) {
|
||||
return (currentIndex < neighborhoodSize - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter
|
||||
* @return the position in the Neighborhood
|
||||
*/
|
||||
unsigned int position() {
|
||||
return currentIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter the position in the Neighborhood
|
||||
*/
|
||||
void setPosition(unsigned int _currentIndex) {
|
||||
currentIndex=_currentIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moOrderNeighborhood";
|
||||
}
|
||||
|
||||
protected:
|
||||
unsigned int currentIndex;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
<moRndNeighborhood.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 _moRndNeighborhood_h
|
||||
#define _moRndNeighborhood_h
|
||||
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* Class used to specify a neighborhood is random
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moRndNeighborhood : virtual public moNeighborhood<Neighbor> {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @return true
|
||||
*/
|
||||
bool isRandom() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
<moRndVectorVNSelection.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 _moRndVectorVNSelection_h
|
||||
#define _moRndVectorVNSelection_h
|
||||
|
||||
#include <utils/eoRndGenerators.h>
|
||||
#include <utils/rnd_generators.h>
|
||||
|
||||
#include <neighborhood/moVectorVNSelection.h>
|
||||
|
||||
/**
|
||||
* This class is used for the Variable Neighborhood Search explorer inherits from moVectorVNSelection
|
||||
* The search heuristics are saved in vectors
|
||||
* They are given in random order (at each initialization the order is changed)
|
||||
*
|
||||
*/
|
||||
template< class EOT >
|
||||
class moRndVectorVNSelection: public moVectorVNSelection<EOT>
|
||||
{
|
||||
using moVectorVNSelection<EOT>::LSvector;
|
||||
using moVectorVNSelection<EOT>::current;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default constructor with first search heuristics
|
||||
*
|
||||
* @param _firstLS first local search
|
||||
* @param _firstShake first heuristic which perturbs the solution
|
||||
* @param _cycle when true, the first heuristics follows the last ones. Otherwise the search stop.
|
||||
*/
|
||||
moRndVectorVNSelection(eoMonOp<EOT>& _firstLS, eoMonOp<EOT>& _firstShake, bool _cycle = true) : moVectorVNSelection<EOT>(_firstLS, _firstShake), cycle(_cycle){}
|
||||
|
||||
/**
|
||||
* Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moRndVectorVNSelection";
|
||||
}
|
||||
|
||||
/**
|
||||
* test if there is still some heuristics
|
||||
*
|
||||
* @param _solution the current solution
|
||||
* @return true if there is some heuristics
|
||||
*/
|
||||
virtual bool cont(EOT& _solution){
|
||||
return ( cycle || (currentOrder <= (order.size() - 2)) );
|
||||
}
|
||||
|
||||
/**
|
||||
* put the current heuristics on the first ones
|
||||
*
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void init(EOT& _solution) {
|
||||
if(order.size() == 0)
|
||||
for(unsigned int i = 0; i < LSvector.size(); i++)
|
||||
order.push_back(i);
|
||||
|
||||
std::random_shuffle(order.begin(), order.end(), gen);
|
||||
|
||||
currentOrder = 0;
|
||||
current = order[currentOrder];
|
||||
}
|
||||
|
||||
/**
|
||||
* put the current heuristics on the next ones
|
||||
*
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void next(EOT& _solution){
|
||||
currentOrder = (currentOrder + 1) % order.size();
|
||||
|
||||
current = order[currentOrder];
|
||||
}
|
||||
|
||||
private:
|
||||
// boolean to indicate the first heuristics follow the last ones
|
||||
bool cycle;
|
||||
// index in order vector
|
||||
unsigned int currentOrder;
|
||||
// the index of heuristics in random order
|
||||
std::vector<unsigned int> order;
|
||||
// random generator
|
||||
UF_random_generator<unsigned int> gen;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
<moRndWithReplNeighborhood.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 _moRndWithReplNeighborhood_h
|
||||
#define _moRndWithReplNeighborhood_h
|
||||
|
||||
#include <neighborhood/moIndexNeighborhood.h>
|
||||
#include <neighborhood/moRndNeighborhood.h>
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
/**
|
||||
* A Random With replacement Neighborhood
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moRndWithReplNeighborhood : public moIndexNeighborhood<Neighbor>, public moRndNeighborhood<Neighbor>
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
using moIndexNeighborhood<Neighbor>::neighborhoodSize;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
*/
|
||||
moRndWithReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize) {}
|
||||
|
||||
/**
|
||||
* Test if it exist a neighbor
|
||||
* @param _solution the solution to explore
|
||||
* @return true if the neighborhood was not empty
|
||||
*/
|
||||
virtual bool hasNeighbor(EOT& _solution) {
|
||||
return neighborhoodSize > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _neighbor the first neighbor
|
||||
*/
|
||||
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||
_neighbor.index(rng.random(neighborhoodSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* Give the next neighbor
|
||||
* @param _solution the solution to explore
|
||||
* @param _neighbor the next neighbor
|
||||
*/
|
||||
virtual void next(EOT & _solution, Neighbor & _neighbor) {
|
||||
_neighbor.index(rng.random(neighborhoodSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* test if all neighbors are explore or not,if false, there is no neighbor left to explore
|
||||
* @param _solution the solution to explore
|
||||
* @return true if there is again a neighbor to explore
|
||||
*/
|
||||
virtual bool cont(EOT & _solution) {
|
||||
return neighborhoodSize > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moRndWithReplNeighborhood";
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
/*
|
||||
<moRndWithoutReplNeighborhood.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 _moRndWithoutReplNeighborhood_h
|
||||
#define _moRndWithoutReplNeighborhood_h
|
||||
|
||||
#include <neighborhood/moIndexNeighborhood.h>
|
||||
#include <neighborhood/moRndNeighborhood.h>
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
/**
|
||||
* A Random without replacement Neighborhood
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moRndWithoutReplNeighborhood : public moIndexNeighborhood<Neighbor>, public moRndNeighborhood<Neighbor>
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Define type of a solution corresponding to Neighbor
|
||||
*/
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
|
||||
using moIndexNeighborhood<Neighbor>::neighborhoodSize;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
*/
|
||||
moRndWithoutReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize), maxIndex(0) {
|
||||
for (unsigned int i=0; i < neighborhoodSize; i++)
|
||||
indexVector.push_back(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if it exist a neighbor
|
||||
* @param _solution the solution to explore
|
||||
* @return true if the neighborhood was not empty
|
||||
*/
|
||||
virtual bool hasNeighbor(EOT& _solution) {
|
||||
return neighborhoodSize > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialization of the neighborhood
|
||||
* @param _solution the solution to explore
|
||||
* @param _neighbor the first neighbor
|
||||
*/
|
||||
virtual void init(EOT & _solution, Neighbor & _neighbor) {
|
||||
unsigned int i, tmp;
|
||||
maxIndex = neighborhoodSize ;
|
||||
i = rng.random(maxIndex);
|
||||
_neighbor.index(indexVector[i]);
|
||||
tmp=indexVector[i];
|
||||
indexVector[i]=indexVector[maxIndex-1];
|
||||
indexVector[maxIndex-1]=tmp;
|
||||
maxIndex--;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give the next neighbor
|
||||
* @param _solution the solution to explore
|
||||
* @param _neighbor the next neighbor
|
||||
*/
|
||||
virtual void next(EOT & _solution, Neighbor & _neighbor) {
|
||||
unsigned int i, tmp;
|
||||
i = rng.random(maxIndex);
|
||||
_neighbor.index(indexVector[i]);
|
||||
tmp=indexVector[i];
|
||||
indexVector[i]=indexVector[maxIndex-1];
|
||||
indexVector[maxIndex-1]=tmp;
|
||||
maxIndex--;
|
||||
}
|
||||
|
||||
/**
|
||||
* test if all neighbors are explore or not,if false, there is no neighbor left to explore
|
||||
* maxIndex is number of neighbors
|
||||
* @param _solution the solution to explore
|
||||
* @return true if there is again a neighbor to explore
|
||||
*/
|
||||
virtual bool cont(EOT & _solution) {
|
||||
return (maxIndex > 0) ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter
|
||||
* @return the position in the Neighborhood
|
||||
*/
|
||||
unsigned int position() {
|
||||
return indexVector[maxIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class Name
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moRndWithoutReplNeighborhood";
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned int maxIndex;
|
||||
std::vector<unsigned int> indexVector;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
<moVariableNeighborhoodSelection.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 _moVariableNeighborhoodSelection_h
|
||||
#define _moVariableNeighborhoodSelection_h
|
||||
|
||||
#include <eoOp.h>
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* This class is used for the Variable Neighborhood Search explorer
|
||||
* It gives the sequence of search heuristics based on the different "neighborhoods"
|
||||
* The class is built such as the moNeighborhood" with init, next, cont
|
||||
* and two methods to get the heuristics which shake the solution, and which give the local search
|
||||
*
|
||||
*/
|
||||
template< class EOT >
|
||||
class moVariableNeighborhoodSelection
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moVariableNeighborhoodSelection";
|
||||
}
|
||||
|
||||
/**
|
||||
* test if there is still some search heuristics to use
|
||||
* @return true if there is some neighborhood to explore
|
||||
*/
|
||||
virtual bool cont(EOT& _solution) = 0;
|
||||
|
||||
/**
|
||||
* put on the first search heuristics
|
||||
*/
|
||||
virtual void init(EOT& _solution) = 0;
|
||||
|
||||
/**
|
||||
* put the next search heuristics
|
||||
*/
|
||||
virtual void next(EOT& _solution) = 0;
|
||||
|
||||
/**
|
||||
* Get the current "shake" operator based on the current neighborhood
|
||||
*
|
||||
* @return current shake operator
|
||||
*/
|
||||
virtual eoMonOp<EOT> & getShake() = 0;
|
||||
|
||||
/**
|
||||
* Get the current local search based on the current neighborhood
|
||||
*
|
||||
* @return current local search
|
||||
*/
|
||||
virtual eoMonOp<EOT> & getLocalSearch() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/*
|
||||
<moVectorVNSelection.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 _moVectorVNSelection_h
|
||||
#define _moVectorVNSelection_h
|
||||
|
||||
#include <neighborhood/moVariableNeighborhoodSelection.h>
|
||||
#include <eoOp.h>
|
||||
|
||||
/**
|
||||
* This class is used for the Variable Neighborhood Search explorer inherits from moVariableNeighborhoodSelection
|
||||
* The search heuristics are saved in vectors
|
||||
* The way to croos the vector is not defined here
|
||||
*
|
||||
*/
|
||||
template< class EOT >
|
||||
class moVectorVNSelection: public moVariableNeighborhoodSelection<EOT>{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default constructor with first search heuristics
|
||||
*
|
||||
* @param _firstLS first local search
|
||||
* @param _firstShake first heuristic which perturbs the solution
|
||||
*/
|
||||
moVectorVNSelection(eoMonOp<EOT>& _firstLS, eoMonOp<EOT>& _firstShake){
|
||||
LSvector.push_back(&_firstLS);
|
||||
shakeVector.push_back(&_firstShake);
|
||||
|
||||
current = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add some search heuristics
|
||||
*
|
||||
* @param _otherLS the added local search
|
||||
* @param _otherShake the added heuristic which perturbs the solution
|
||||
*/
|
||||
void add(eoMonOp<EOT>& _otherLS, eoMonOp<EOT>& _otherShake){
|
||||
LSvector.push_back(&_otherLS);
|
||||
shakeVector.push_back(&_otherShake);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moVectorVNSelection";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current "shake" operator based on the current neighborhood
|
||||
*
|
||||
* @return current shake operator
|
||||
*/
|
||||
virtual eoMonOp<EOT> & getShake() {
|
||||
return *(shakeVector[current]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current local search based on the current neighborhood
|
||||
*
|
||||
* @return current local search
|
||||
*/
|
||||
virtual eoMonOp<EOT> & getLocalSearch() {
|
||||
return *(LSvector[current]);
|
||||
}
|
||||
|
||||
protected:
|
||||
// vector of local searches
|
||||
std::vector<eoMonOp<EOT>* > LSvector;
|
||||
// vector of "shake" heiristics which perturbs the current solution
|
||||
std::vector<eoMonOp<EOT>* > shakeVector;
|
||||
// index of the current search heuristics which is applied
|
||||
unsigned int current;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
<moLocalSearchInit.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 _moLocalSearchInit_h
|
||||
#define _moLocalSearchInit_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <algo/moLocalSearch.h>
|
||||
|
||||
/**
|
||||
* Initialization of the solution with a local search
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moLocalSearchInit : public eoInit<typename Neighbor::EOT> {
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialization of the solution before the local search
|
||||
* @param _ls the local search to apply to the solution
|
||||
*/
|
||||
moLocalSearchInit(eoInit<EOT>& _init, moLocalSearch<Neighbor>& _ls) : init(_init), ls(_ls) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the local search on the solution
|
||||
* @param _solution to perturb
|
||||
*/
|
||||
void operator()(EOT& _solution) {
|
||||
init(_solution);
|
||||
ls(_solution);
|
||||
}
|
||||
|
||||
private:
|
||||
eoInit<EOT>& init;
|
||||
moLocalSearch<Neighbor> & ls;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
<moMonOpPerturb.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 _moMonOpPerturb_h
|
||||
#define _moMonOpPerturb_h
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoOp.h>
|
||||
#include <perturb/moPerturbation.h>
|
||||
#include <memory/moDummyMemory.h>
|
||||
|
||||
/**
|
||||
* Perturbation operator using only a eoMonOp
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moMonOpPerturb : public moPerturbation<Neighbor>, public moDummyMemory<Neighbor> {
|
||||
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _monOp an eoMonOp (pertubation operator)
|
||||
* @param _fullEval a full evaluation function
|
||||
*/
|
||||
moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval) {}
|
||||
|
||||
/**
|
||||
* Apply monOp on the solution
|
||||
* @param _solution to perturb
|
||||
* @return value of monOp
|
||||
*/
|
||||
bool operator()(EOT& _solution) {
|
||||
bool res = monOp(_solution);
|
||||
_solution.invalidate();
|
||||
fullEval(_solution);
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
/** monOp */
|
||||
eoMonOp<EOT>& monOp;
|
||||
eoEvalFunc<EOT>& fullEval;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
<moNeighborhoodPerturb.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 _moNeighborhoodPerturb_h
|
||||
#define _moNeighborhoodPerturb_h
|
||||
|
||||
#include <eval/moEval.h>
|
||||
#include <perturb/moPerturbation.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* Neighborhood Perturbation: explore the neighborhood to perturb the solution (the neighborhood could be different as the one used in the Local Search)
|
||||
*/
|
||||
template< class Neighbor, class OtherNeighbor >
|
||||
class moNeighborhoodPerturb : public moPerturbation<Neighbor> {
|
||||
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
typedef moNeighborhood<OtherNeighbor> OtherNH;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _otherNeighborhood a neighborhood
|
||||
* @param _eval an Evaluation Function
|
||||
*/
|
||||
moNeighborhoodPerturb(OtherNH& _otherNeighborhood, moEval<OtherNeighbor>& _eval): otherNeighborhood(_otherNeighborhood), eval(_eval) {}
|
||||
|
||||
/**
|
||||
* Apply move on the solution
|
||||
* @param _solution the current solution
|
||||
* @return true
|
||||
*/
|
||||
virtual bool operator()(EOT& _solution) {
|
||||
if (otherNeighborhood.hasNeighbor(_solution)) {
|
||||
eval(_solution, current);
|
||||
current.move(_solution);
|
||||
_solution.fitness(current.fitness());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init the neighborhood
|
||||
* @param _sol the current solution
|
||||
*/
|
||||
virtual void init(EOT & _sol) {
|
||||
if (otherNeighborhood.hasNeighbor(_sol))
|
||||
otherNeighborhood.init(_sol, current);
|
||||
}
|
||||
|
||||
/**
|
||||
* ReInit the neighborhood because a move was done
|
||||
* @param _sol the current solution
|
||||
* @param _neighbor unused neighbor (always empty)
|
||||
*/
|
||||
virtual void add(EOT & _sol, Neighbor & _neighbor) {
|
||||
(*this).init(_sol);
|
||||
}
|
||||
|
||||
/**
|
||||
* Explore another neighbor because no move was done
|
||||
* @param _sol the current solution
|
||||
* @param _neighbor unused neighbor (always empty)
|
||||
*/
|
||||
virtual void update(EOT & _sol, Neighbor & _neighbor) {
|
||||
if (otherNeighborhood.cont(_sol))
|
||||
otherNeighborhood.next(_sol, current);
|
||||
else
|
||||
(*this).init(_sol);
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTHING TO DO
|
||||
*/
|
||||
virtual void clearMemory() {}
|
||||
|
||||
private:
|
||||
OtherNH& otherNeighborhood;
|
||||
moEval<OtherNeighbor>& eval;
|
||||
OtherNeighbor current;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
<moPertubation.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 _moPertubation_h
|
||||
#define _moPertubation_h
|
||||
|
||||
#include <eoOp.h>
|
||||
#include <memory/moMemory.h>
|
||||
|
||||
/**
|
||||
* Abstract class for Perturbation operator
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moPerturbation : public eoMonOp<typename Neighbor::EOT>, virtual public moMemory<Neighbor> {};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
<moRestartPerturb.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 _moRestartPerturb_h
|
||||
#define _moRestartPerturb_h
|
||||
|
||||
|
||||
#include <eoEvalFunc.h>
|
||||
#include <eoInit.h>
|
||||
#include <perturb/moPerturbation.h>
|
||||
#include <memory/moCountMoveMemory.h>
|
||||
|
||||
/**
|
||||
* Restart Perturbation : restart when maximum number of iteration with no improvement is reached
|
||||
*/
|
||||
template< class Neighbor >
|
||||
class moRestartPerturb : public moPerturbation<Neighbor>, public moCountMoveMemory<Neighbor> {
|
||||
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _initializer an initializer of solution
|
||||
* @param _fullEval a full evaluation function
|
||||
* @param _threshold maximum number of iteration with no improvement
|
||||
*/
|
||||
moRestartPerturb(eoInit<EOT>& _initializer, eoEvalFunc<EOT>& _fullEval, unsigned int _threshold):initializer(_initializer), fullEval(_fullEval), threshold(_threshold) {}
|
||||
|
||||
/**
|
||||
* Apply restart when necessary
|
||||
* @param _solution to restart
|
||||
* @return true
|
||||
*/
|
||||
bool operator()(EOT& _solution) {
|
||||
if ((*this).getCounter()>= threshold) {
|
||||
initializer(_solution);
|
||||
fullEval(_solution);
|
||||
(*this).initCounter();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
eoInit<EOT>& initializer;
|
||||
eoEvalFunc<EOT>& fullEval;
|
||||
unsigned int threshold;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
<moSolInit.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 _moSolInit_h
|
||||
#define _moSolInit_h
|
||||
|
||||
#include <eoInit.h>
|
||||
|
||||
/**
|
||||
* Initialization of the solution with the external solution
|
||||
*/
|
||||
template< class EOT >
|
||||
class moSolInit : public eoInit<EOT> {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _extSol external solution of the initialization
|
||||
*/
|
||||
moSolInit(EOT & _extSol) : extSol(_extSol) {}
|
||||
|
||||
/**
|
||||
* Initialization on the external solution
|
||||
* @param _solution to initialize
|
||||
*/
|
||||
void operator()(EOT& _solution) {
|
||||
_solution = extSol;
|
||||
}
|
||||
|
||||
private:
|
||||
EOT& extSol;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
<moAdaptiveWalkSampling.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 moAdaptiveWalkSampling_h
|
||||
#define moAdaptiveWalkSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <continuator/moCheckpoint.h>
|
||||
#include <perturb/moLocalSearchInit.h>
|
||||
#include <algo/moRandomSearch.h>
|
||||
#include <algo/moFirstImprHC.h>
|
||||
#include <continuator/moSolutionStat.h>
|
||||
#include <continuator/moMinusOneCounterStat.h>
|
||||
#include <continuator/moStatFromStat.h>
|
||||
#include <sampling/moSampling.h>
|
||||
|
||||
/**
|
||||
* To compute the length and final solution of an adaptive walk:
|
||||
* Perform a first improvement Hill-climber based on the neighborhood (adaptive walk),
|
||||
* The lengths of HC are collected and the final solution which are local optima
|
||||
* The adaptive walk is repeated several times
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moAdaptiveWalkSampling : public moSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood giving neighbor in random order
|
||||
* @param _fullEval a full evaluation function
|
||||
* @param _eval an incremental evaluation of neighbors
|
||||
* @param _nbAdaptWalk Number of adaptive walks
|
||||
*/
|
||||
moAdaptiveWalkSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
unsigned int _nbAdaptWalk) :
|
||||
moSampling<Neighbor>(initHC, * new moRandomSearch<Neighbor>(initHC, _fullEval, _nbAdaptWalk), copyStat),
|
||||
copyStat(lengthStat),
|
||||
checkpoint(trueCont),
|
||||
hc(_neighborhood, _fullEval, _eval, checkpoint),
|
||||
initHC(_init, hc)
|
||||
{
|
||||
// to count the number of step in the HC
|
||||
checkpoint.add(lengthStat);
|
||||
|
||||
// add the solution into statistics
|
||||
add(solStat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moAdaptiveWalkSampling() {
|
||||
// delete the pointer on the local search which has been constructed in the constructor
|
||||
delete localSearch;
|
||||
}
|
||||
|
||||
protected:
|
||||
moSolutionStat<EOT> solStat;
|
||||
moMinusOneCounterStat<EOT> lengthStat;
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
moStatFromStat<EOT, unsigned int> copyStat;
|
||||
moCheckpoint<Neighbor> checkpoint;
|
||||
moFirstImprHC<Neighbor> hc;
|
||||
moLocalSearchInit<Neighbor> initHC;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
/*
|
||||
<moAutocorrelationSampling.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 moAutocorrelationSampling_h
|
||||
#define moAutocorrelationSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moRandomWalk.h>
|
||||
#include <continuator/moFitnessStat.h>
|
||||
#include <sampling/moSampling.h>
|
||||
|
||||
/**
|
||||
* To compute the autocorrelation function:
|
||||
* Perform a random walk based on the neighborhood,
|
||||
* The fitness values of solutions are collected during the random walk
|
||||
* The autocorrelation can be computed from the serie of fitness values
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moAutocorrelationSampling : public moSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood giving neighbor in random order
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _eval neighbor evaluation, incremental evaluation function
|
||||
* @param _nbStep Number of steps of the random walk
|
||||
*/
|
||||
moAutocorrelationSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
unsigned int _nbStep) :
|
||||
moSampling<Neighbor>(_init, * new moRandomWalk<Neighbor>(_neighborhood, _fullEval, _eval, _nbStep), fitnessStat) {}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moAutocorrelationSampling() {
|
||||
// delete the pointer on the local search which has been constructed in the constructor
|
||||
delete localSearch;
|
||||
}
|
||||
|
||||
protected:
|
||||
moFitnessStat<EOT> fitnessStat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
<moDensityOfStatesSampling.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 moDensityOfStatesSampling_h
|
||||
#define moDensityOfStatesSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moRandomSearch.h>
|
||||
#include <continuator/moFitnessStat.h>
|
||||
#include <sampling/moSampling.h>
|
||||
|
||||
/**
|
||||
* To compute the density of states:
|
||||
* Sample the fitness of random solution in the search space
|
||||
* The fitness values of solutions are collected during the random search
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moDensityOfStatesSampling : public moSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _nbSol Number of solutions in the sample
|
||||
*/
|
||||
moDensityOfStatesSampling(eoInit<EOT> & _init,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
unsigned int _nbSol) :
|
||||
moSampling<Neighbor>(_init, * new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol), fitnessStat) {}
|
||||
|
||||
/**
|
||||
* default destructor
|
||||
*/
|
||||
~moDensityOfStatesSampling() {
|
||||
// delete the pointer on the local search which has been constructed in the constructor
|
||||
delete localSearch;
|
||||
}
|
||||
|
||||
protected:
|
||||
moFitnessStat<EOT> fitnessStat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
<moFDCsampling.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 moFDCsampling_h
|
||||
#define moFDCsampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moRandomSearch.h>
|
||||
#include <continuator/moFitnessStat.h>
|
||||
#include <utils/eoDistance.h>
|
||||
#include <continuator/moDistanceStat.h>
|
||||
#include <sampling/moSampling.h>
|
||||
|
||||
/**
|
||||
* To compute the fitness distance correlation:
|
||||
* Sample the fitness and the distance from a particular solution of random solution in the search space
|
||||
* The fitness values and distances of solutions are collected during the random search
|
||||
* Then the correlation between the fitness and the distance can be computed
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moFDCsampling : public moSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _fullEval a full evaluation function
|
||||
* @param _dist the distance function between solution
|
||||
* @param _refSol the reference solution to compute the distance (think of global optimum when possible)
|
||||
* @param _nbSol Number of solutions of the sample
|
||||
*/
|
||||
moFDCsampling(eoInit<EOT> & _init,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
eoDistance<EOT>& _dist,
|
||||
EOT& _refSol,
|
||||
unsigned int _nbSol) :
|
||||
moSampling<Neighbor>(_init, * new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol), fitnessStat),
|
||||
distStat(_dist, _refSol)
|
||||
{
|
||||
add(distStat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moFDCsampling() {
|
||||
// delete the pointer on the local search which has been constructed in the constructor
|
||||
delete localSearch;
|
||||
}
|
||||
|
||||
protected:
|
||||
moFitnessStat<EOT> fitnessStat;
|
||||
moDistanceStat<EOT> distStat;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
<moFitnessCloudSampling.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 moFitnessCloudSampling_h
|
||||
#define moFitnessCloudSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moDummyLS.h>
|
||||
#include <continuator/moFitnessStat.h>
|
||||
#include <continuator/moNeighborFitnessStat.h>
|
||||
#include <sampling/moSampling.h>
|
||||
|
||||
/**
|
||||
* To compute an estimation of the fitness cloud,
|
||||
* i.e. the scatter plot of solution fitness versus neighbor fitness:
|
||||
*
|
||||
* This class do nothing. See others mo(...)FitnessCloudSampling classes
|
||||
* with different fitness sampling methods
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moFitnessCloudSampling : public moSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood to get a neighbor
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _eval neighbor evaluation, incremental evaluation function
|
||||
* @param _nbSol Number of solutions in the sample
|
||||
*/
|
||||
moFitnessCloudSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
unsigned int _nbSol) :
|
||||
moSampling<Neighbor>(_init, * new moDummyLS<Neighbor>(_fullEval), fitnessStat),
|
||||
neighborhood(_neighborhood),
|
||||
fullEval(_fullEval),
|
||||
eval(_eval),
|
||||
nbSol(_nbSol)
|
||||
{}
|
||||
|
||||
/**
|
||||
* default destructor
|
||||
*/
|
||||
~moFitnessCloudSampling() {
|
||||
// delete the pointer on the local search which has been constructed in the constructor
|
||||
delete localSearch;
|
||||
}
|
||||
|
||||
protected:
|
||||
moNeighborhood<Neighbor> & neighborhood;
|
||||
eoEvalFunc<EOT>& fullEval;
|
||||
moEval<Neighbor>& eval;
|
||||
unsigned int nbSol;
|
||||
moFitnessStat<EOT> fitnessStat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
<moHillClimberSampling.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 moHillClimberSampling_h
|
||||
#define moHillClimberSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <continuator/moCheckpoint.h>
|
||||
#include <perturb/moLocalSearchInit.h>
|
||||
#include <algo/moRandomSearch.h>
|
||||
#include <algo/moSimpleHC.h>
|
||||
#include <continuator/moSolutionStat.h>
|
||||
#include <continuator/moMinusOneCounterStat.h>
|
||||
#include <continuator/moStatFromStat.h>
|
||||
#include <sampling/moSampling.h>
|
||||
|
||||
/**
|
||||
* To compute the length and final solution of an adaptive walk:
|
||||
* Perform a simple Hill-climber based on the neighborhood (gradiant walk, the whole neighborhood is visited),
|
||||
* The lengths of HC are collected and the final solution which are local optima
|
||||
* The adaptive walk is repeated several times
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moHillClimberSampling : public moSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood giving neighbor in random order
|
||||
* @param _fullEval a full evaluation function
|
||||
* @param _eval an incremental evaluation of neighbors
|
||||
* @param _nbAdaptWalk Number of adaptive walks
|
||||
*/
|
||||
moHillClimberSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
unsigned int _nbAdaptWalk) :
|
||||
moSampling<Neighbor>(initHC, * new moRandomSearch<Neighbor>(initHC, _fullEval, _nbAdaptWalk), copyStat),
|
||||
copyStat(lengthStat),
|
||||
checkpoint(trueCont),
|
||||
hc(_neighborhood, _fullEval, _eval, checkpoint),
|
||||
initHC(_init, hc)
|
||||
{
|
||||
// to count the number of step in the HC
|
||||
checkpoint.add(lengthStat);
|
||||
|
||||
// add the solution into statistics
|
||||
add(solStat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moHillClimberSampling() {
|
||||
// delete the pointer on the local search which has been constructed in the constructor
|
||||
delete localSearch;
|
||||
}
|
||||
|
||||
protected:
|
||||
moSolutionStat<EOT> solStat;
|
||||
moMinusOneCounterStat<EOT> lengthStat;
|
||||
moTrueContinuator<Neighbor> trueCont;
|
||||
moStatFromStat<EOT, unsigned int> copyStat;
|
||||
moCheckpoint<Neighbor> checkpoint;
|
||||
moSimpleHC<Neighbor> hc;
|
||||
moLocalSearchInit<Neighbor> initHC;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
<moMHBestFitnessCloudSampling.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 moMHBestFitnessCloudSampling_h
|
||||
#define moMHBestFitnessCloudSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moMetropolisHasting.h>
|
||||
#include <continuator/moNeighborBestStat.h>
|
||||
#include <sampling/moFitnessCloudSampling.h>
|
||||
|
||||
/**
|
||||
* To compute an estimation of the fitness cloud,
|
||||
* i.e. the scatter plot of solution fitness versus neighbor fitness:
|
||||
*
|
||||
* Here solution are sampled with Metropolis-Hasting method
|
||||
*
|
||||
* Sample the fitness of solutions from Metropolis-Hasting sampling
|
||||
* and the best fitness of k random neighbor
|
||||
*
|
||||
* The values are collected during the Metropolis-Hasting walk
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moMHBestFitnessCloudSampling : public moFitnessCloudSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
using moSampling<Neighbor>::checkpoint;
|
||||
using moSampling<Neighbor>::monitorVec;
|
||||
using moSampling<Neighbor>::continuator;
|
||||
using moFitnessCloudSampling<Neighbor>::fitnessStat;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood to get one random neighbor (supposed to be random neighborhood)
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _eval neighbor evaluation, incremental evaluation function
|
||||
* @param _nbStep Number of step of the MH sampling
|
||||
*/
|
||||
moMHBestFitnessCloudSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
unsigned int _nbStep) :
|
||||
moFitnessCloudSampling<Neighbor>(_init, _neighborhood, _fullEval, _eval, _nbStep),
|
||||
neighborBestStat(_neighborhood, _eval)
|
||||
{
|
||||
// delete the dummy local search
|
||||
delete localSearch;
|
||||
|
||||
// Metropolis-Hasting sampling
|
||||
localSearch = new moMetropolisHasting<Neighbor>(_neighborhood, _fullEval, _eval, _nbStep);
|
||||
|
||||
// delete the checkpoint with the wrong continuator
|
||||
delete checkpoint;
|
||||
|
||||
// set the continuator
|
||||
continuator = localSearch->getContinuator();
|
||||
|
||||
// re-construction of the checkpoint
|
||||
checkpoint = new moCheckpoint<Neighbor>(*continuator);
|
||||
checkpoint->add(fitnessStat);
|
||||
checkpoint->add(*monitorVec[0]);
|
||||
|
||||
// one random neighbor
|
||||
add(neighborBestStat);
|
||||
}
|
||||
|
||||
protected:
|
||||
moNeighborBestStat< Neighbor > neighborBestStat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
<moMHRndFitnessCloudSampling.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 moMHRndFitnessCloudSampling_h
|
||||
#define moMHRndFitnessCloudSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moMetropolisHasting.h>
|
||||
#include <continuator/moNeighborFitnessStat.h>
|
||||
#include <sampling/moFitnessCloudSampling.h>
|
||||
|
||||
/**
|
||||
* To compute an estimation of the fitness cloud,
|
||||
* i.e. the scatter plot of solution fitness versus neighbor fitness:
|
||||
*
|
||||
* Here solution are sampled with Metropolis-Hasting method
|
||||
*
|
||||
* Sample the fitness of solutions from Metropolis-Hasting sampling
|
||||
* and the fitness of one random neighbor
|
||||
*
|
||||
* The values are collected during the Metropolis-Hasting walk
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moMHRndFitnessCloudSampling : public moFitnessCloudSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
using moSampling<Neighbor>::checkpoint;
|
||||
using moSampling<Neighbor>::monitorVec;
|
||||
using moSampling<Neighbor>::continuator;
|
||||
using moFitnessCloudSampling<Neighbor>::fitnessStat;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood to get one random neighbor (supposed to be random neighborhood)
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _eval neighbor evaluation, incremental evaluation function
|
||||
* @param _nbStep Number of step of the MH sampling
|
||||
*/
|
||||
moMHRndFitnessCloudSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
unsigned int _nbStep) :
|
||||
moFitnessCloudSampling<Neighbor>(_init, _neighborhood, _fullEval, _eval, _nbStep),
|
||||
neighborFitnessStat(_neighborhood, _eval)
|
||||
{
|
||||
// delete the dummy local search
|
||||
delete localSearch;
|
||||
|
||||
// Metropolis-Hasting sampling
|
||||
localSearch = new moMetropolisHasting<Neighbor>(_neighborhood, _fullEval, _eval, _nbStep);
|
||||
|
||||
// delete the checkpoint with the wrong continuator
|
||||
delete checkpoint;
|
||||
|
||||
// set the continuator
|
||||
continuator = localSearch->getContinuator();
|
||||
|
||||
// re-construction of the checkpoint
|
||||
checkpoint = new moCheckpoint<Neighbor>(*continuator);
|
||||
checkpoint->add(fitnessStat);
|
||||
checkpoint->add(*monitorVec[0]);
|
||||
|
||||
// one random neighbor
|
||||
add(neighborFitnessStat);
|
||||
}
|
||||
|
||||
protected:
|
||||
moNeighborFitnessStat< Neighbor > neighborFitnessStat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
/*
|
||||
<moNeutralDegreeSampling.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 moNeutralDegreeSampling_h
|
||||
#define moNeutralDegreeSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moRandomSearch.h>
|
||||
#include <continuator/moFitnessStat.h>
|
||||
#include <continuator/moNeighborhoodStat.h>
|
||||
#include <continuator/moNeutralDegreeNeighborStat.h>
|
||||
#include <sampling/moSampling.h>
|
||||
|
||||
/**
|
||||
* To compute the neutral degree:
|
||||
* Sample the fitness of random solution in the search space (1er information)
|
||||
* and sample the neutral degree (2nd information), i.e. the number of neighbor solutions with the same fitness value
|
||||
* The values are collected during the random search
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moNeutralDegreeSampling : public moSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood to compute the neutral degree
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _eval neighbor evaluation, incremental evaluation function
|
||||
* @param _nbSol Number of solutions in the sample
|
||||
*/
|
||||
moNeutralDegreeSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
unsigned int _nbSol) :
|
||||
moSampling<Neighbor>(_init, * new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol), fitnessStat),
|
||||
neighborhoodStat(_neighborhood, _eval),
|
||||
ndStat(neighborhoodStat)
|
||||
{
|
||||
add(neighborhoodStat, false);
|
||||
add(ndStat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with comparators
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood to compute the neutral degree
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _eval neighbor evaluation, incremental evaluation function
|
||||
* @param _neighborComparator a neighbor Comparator
|
||||
* @param _solNeighborComparator a comparator between a solution and a neighbor
|
||||
* @param _nbSol Number of solutions in the sample
|
||||
*/
|
||||
moNeutralDegreeSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
moNeighborComparator<Neighbor>& _neighborComparator,
|
||||
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
|
||||
unsigned int _nbSol) :
|
||||
moSampling<Neighbor>(_init, * new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol), fitnessStat),
|
||||
neighborhoodStat(_neighborhood, _eval, _neighborComparator, _solNeighborComparator),
|
||||
ndStat(neighborhoodStat)
|
||||
{
|
||||
add(neighborhoodStat, false);
|
||||
add(ndStat);
|
||||
}
|
||||
|
||||
/**
|
||||
* default destructor
|
||||
*/
|
||||
~moNeutralDegreeSampling() {
|
||||
// delete the pointer on the local search which has been constructed in the constructor
|
||||
delete localSearch;
|
||||
}
|
||||
|
||||
protected:
|
||||
moFitnessStat<EOT> fitnessStat;
|
||||
moNeighborhoodStat< Neighbor > neighborhoodStat;
|
||||
moNeutralDegreeNeighborStat< Neighbor > ndStat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
/*
|
||||
<moNeutralWalkSampling.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 moNeutralWalkSampling_h
|
||||
#define moNeutralWalkSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moRandomNeutralWalk.h>
|
||||
#include <sampling/moSampling.h>
|
||||
#include <perturb/moSolInit.h>
|
||||
#include <continuator/moSolutionStat.h>
|
||||
#include <utils/eoDistance.h>
|
||||
#include <continuator/moDistanceStat.h>
|
||||
#include <continuator/moNeighborhoodStat.h>
|
||||
#include <continuator/moMaxNeighborStat.h>
|
||||
#include <continuator/moMinNeighborStat.h>
|
||||
#include <continuator/moAverageFitnessNeighborStat.h>
|
||||
#include <continuator/moStdFitnessNeighborStat.h>
|
||||
#include <continuator/moSizeNeighborStat.h>
|
||||
#include <continuator/moNbInfNeighborStat.h>
|
||||
#include <continuator/moNbSupNeighborStat.h>
|
||||
#include <continuator/moNeutralDegreeNeighborStat.h>
|
||||
|
||||
/**
|
||||
* To explore the evolvability of solutions in a neutral networks:
|
||||
* Perform a random neutral walk based on the neighborhood,
|
||||
* The measures of evolvability of solutions are collected during the random neutral walk
|
||||
* The distribution and autocorrelation can be computed from the serie of values
|
||||
*
|
||||
* Informations collected:
|
||||
* - the current solution of the walk
|
||||
* - the distance from the starting solution
|
||||
* - the minimal fitness in the neighborhood
|
||||
* - the average fitness
|
||||
* - the standard deviation of the fitness
|
||||
* - the maximal fitness
|
||||
* - the size of the neighborhood
|
||||
* - the number of neighbors with lower fitness
|
||||
* - the number of neighbors with equal fitness (neutral degree)
|
||||
* - the number of neighbors with higher fitness
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moNeutralWalkSampling : public moSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _initSol the first solution of the walk
|
||||
* @param _neighborhood neighborhood giving neighbor in random order
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _eval neighbor evaluation, incremental evaluation function
|
||||
* @param _distance component to measure the distance from the initial solution
|
||||
* @param _nbStep Number of steps of the random walk
|
||||
*/
|
||||
moNeutralWalkSampling(EOT & _initSol,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
eoDistance<EOT> & _distance,
|
||||
unsigned int _nbStep) :
|
||||
moSampling<Neighbor>(init, * new moRandomNeutralWalk<Neighbor>(_neighborhood, _fullEval, _eval, _nbStep), solutionStat),
|
||||
init(_initSol),
|
||||
distStat(_distance, _initSol),
|
||||
neighborhoodStat(_neighborhood, _eval),
|
||||
minStat(neighborhoodStat),
|
||||
averageStat(neighborhoodStat),
|
||||
stdStat(neighborhoodStat),
|
||||
maxStat(neighborhoodStat),
|
||||
nbSupStat(neighborhoodStat),
|
||||
nbInfStat(neighborhoodStat),
|
||||
sizeStat(neighborhoodStat),
|
||||
ndStat(neighborhoodStat)
|
||||
{
|
||||
add(neighborhoodStat, false);
|
||||
add(distStat);
|
||||
add(minStat);
|
||||
add(averageStat);
|
||||
add(stdStat);
|
||||
add(maxStat);
|
||||
add(sizeStat);
|
||||
add(nbInfStat);
|
||||
add(ndStat);
|
||||
add(nbSupStat);
|
||||
}
|
||||
|
||||
/**
|
||||
* default destructor
|
||||
*/
|
||||
~moNeutralWalkSampling() {
|
||||
// delete the pointer on the local search which has been constructed in the constructor
|
||||
delete localSearch;
|
||||
}
|
||||
|
||||
protected:
|
||||
moSolInit<EOT> init;
|
||||
moSolutionStat<EOT> solutionStat;
|
||||
moDistanceStat<EOT> distStat;
|
||||
moNeighborhoodStat< Neighbor > neighborhoodStat;
|
||||
moMinNeighborStat< Neighbor > minStat;
|
||||
moAverageFitnessNeighborStat< Neighbor > averageStat;
|
||||
moStdFitnessNeighborStat< Neighbor > stdStat;
|
||||
moMaxNeighborStat< Neighbor > maxStat;
|
||||
moNbSupNeighborStat< Neighbor > nbSupStat;
|
||||
moNbInfNeighborStat< Neighbor > nbInfStat;
|
||||
moSizeNeighborStat< Neighbor > sizeStat;
|
||||
moNeutralDegreeNeighborStat< Neighbor > ndStat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
<moRndBestFitnessCloudSampling.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 moRndBestFitnessCloudSampling_h
|
||||
#define moRndBestFitnessCloudSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moRandomSearch.h>
|
||||
#include <continuator/moNeighborBestStat.h>
|
||||
#include <sampling/moFitnessCloudSampling.h>
|
||||
|
||||
/**
|
||||
* To compute an estimation of the fitness cloud,
|
||||
* i.e. the scatter plot of solution fitness versus neighbor fitness:
|
||||
*
|
||||
* Sample the fitness of random solution in the search space
|
||||
* and the best fitness of k random neighbor
|
||||
*
|
||||
* The values are collected during the random search
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moRndBestFitnessCloudSampling : public moFitnessCloudSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
using moSampling<Neighbor>::checkpoint;
|
||||
using moSampling<Neighbor>::monitorVec;
|
||||
using moSampling<Neighbor>::continuator;
|
||||
using moFitnessCloudSampling<Neighbor>::fitnessStat;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood to get one random neighbor (supposed to be random neighborhood)
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _eval neighbor evaluation, incremental evaluation function
|
||||
* @param _nbSol Number of solutions in the sample
|
||||
*/
|
||||
moRndBestFitnessCloudSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
unsigned int _nbSol) :
|
||||
moFitnessCloudSampling<Neighbor>(_init, _neighborhood, _fullEval, _eval, _nbSol),
|
||||
neighborBestStat(_neighborhood, _eval)
|
||||
{
|
||||
// delete the dummy local search
|
||||
delete localSearch;
|
||||
|
||||
// random sampling
|
||||
localSearch = new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol);
|
||||
|
||||
// delete the checkpoint with the wrong continuator
|
||||
delete checkpoint;
|
||||
|
||||
// set the continuator
|
||||
continuator = localSearch->getContinuator();
|
||||
|
||||
// re-construction of the checkpoint
|
||||
checkpoint = new moCheckpoint<Neighbor>(*continuator);
|
||||
checkpoint->add(fitnessStat);
|
||||
checkpoint->add(*monitorVec[0]);
|
||||
|
||||
// one random neighbor
|
||||
add(neighborBestStat);
|
||||
}
|
||||
|
||||
protected:
|
||||
moNeighborBestStat< Neighbor > neighborBestStat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
<moRndRndFitnessCloudSampling.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 moRndRndFitnessCloudSampling_h
|
||||
#define moRndRndFitnessCloudSampling_h
|
||||
|
||||
#include <eoInit.h>
|
||||
#include <neighborhood/moNeighborhood.h>
|
||||
#include <eval/moEval.h>
|
||||
#include <eoEvalFunc.h>
|
||||
#include <algo/moRandomSearch.h>
|
||||
#include <continuator/moNeighborFitnessStat.h>
|
||||
#include <sampling/moFitnessCloudSampling.h>
|
||||
|
||||
/**
|
||||
* To compute an estimation of the fitness cloud,
|
||||
* i.e. the scatter plot of solution fitness versus neighbor fitness:
|
||||
*
|
||||
* Sample the fitness of random solution in the search space
|
||||
* and the fitness of one random neighbor
|
||||
*
|
||||
* The values are collected during the random search
|
||||
*
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moRndRndFitnessCloudSampling : public moFitnessCloudSampling<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
using moSampling<Neighbor>::localSearch;
|
||||
using moSampling<Neighbor>::checkpoint;
|
||||
using moSampling<Neighbor>::monitorVec;
|
||||
using moSampling<Neighbor>::continuator;
|
||||
using moFitnessCloudSampling<Neighbor>::fitnessStat;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _neighborhood neighborhood to get one random neighbor (supposed to be random neighborhood)
|
||||
* @param _fullEval Fitness function, full evaluation function
|
||||
* @param _eval neighbor evaluation, incremental evaluation function
|
||||
* @param _nbSol Number of solutions in the sample
|
||||
*/
|
||||
moRndRndFitnessCloudSampling(eoInit<EOT> & _init,
|
||||
moNeighborhood<Neighbor> & _neighborhood,
|
||||
eoEvalFunc<EOT>& _fullEval,
|
||||
moEval<Neighbor>& _eval,
|
||||
unsigned int _nbSol) :
|
||||
moFitnessCloudSampling<Neighbor>(_init, _neighborhood, _fullEval, _eval, _nbSol),
|
||||
neighborFitnessStat(_neighborhood, _eval)
|
||||
{
|
||||
// delete the dummy local search
|
||||
delete localSearch;
|
||||
|
||||
// random sampling
|
||||
localSearch = new moRandomSearch<Neighbor>(_init, _fullEval, _nbSol);
|
||||
|
||||
// delete the checkpoint with the wrong continuator
|
||||
delete checkpoint;
|
||||
|
||||
// set the continuator
|
||||
continuator = localSearch->getContinuator();
|
||||
|
||||
// re-construction of the checkpoint
|
||||
checkpoint = new moCheckpoint<Neighbor>(*continuator);
|
||||
checkpoint->add(fitnessStat);
|
||||
checkpoint->add(*monitorVec[0]);
|
||||
|
||||
// one random neighbor
|
||||
add(neighborFitnessStat);
|
||||
}
|
||||
|
||||
protected:
|
||||
moNeighborFitnessStat< Neighbor > neighborFitnessStat;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,239 +0,0 @@
|
|||
/*
|
||||
<moSampling.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 moSampling_h
|
||||
#define moSampling_h
|
||||
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstdlib>
|
||||
#include <eoFunctor.h>
|
||||
#include <utils/eoMonitor.h>
|
||||
#include <continuator/moStat.h>
|
||||
#include <continuator/moCheckpoint.h>
|
||||
#include <continuator/moVectorMonitor.h>
|
||||
#include <algo/moLocalSearch.h>
|
||||
#include <eoInit.h>
|
||||
|
||||
|
||||
/**
|
||||
* To sample the search space:
|
||||
* A local search is used to sample the search space
|
||||
* Some statistics are computed at each step of the local search
|
||||
*
|
||||
* Can be used to study the fitness landscape
|
||||
*/
|
||||
template <class Neighbor>
|
||||
class moSampling : public eoF<void>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init initialisation method of the solution
|
||||
* @param _localSearch local search to sample the search space
|
||||
* @param _stat statistic to compute during the search
|
||||
* @param _monitoring the statistic is saved into the monitor if true
|
||||
*/
|
||||
template <class ValueType>
|
||||
moSampling(eoInit<EOT> & _init, moLocalSearch<Neighbor> & _localSearch, moStat<EOT,ValueType> & _stat, bool _monitoring = true) : init(_init), localSearch(&_localSearch), continuator(_localSearch.getContinuator())
|
||||
{
|
||||
checkpoint = new moCheckpoint<Neighbor>(*continuator);
|
||||
add(_stat, _monitoring);
|
||||
// precision of the output by default
|
||||
precisionOutput = std::cout.precision();
|
||||
}
|
||||
|
||||
/**
|
||||
* default destructor
|
||||
*/
|
||||
~moSampling() {
|
||||
// delete all monitors
|
||||
for (unsigned i = 0; i < monitorVec.size(); i++)
|
||||
delete monitorVec[i];
|
||||
|
||||
// delete the checkpoint
|
||||
delete checkpoint ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a statistic
|
||||
* @param _stat another statistic to compute during the search
|
||||
* @param _monitoring the statistic is saved into the monitor if true
|
||||
*/
|
||||
template< class ValueType >
|
||||
void add(moStat<EOT, ValueType> & _stat, bool _monitoring = true) {
|
||||
checkpoint->add(_stat);
|
||||
|
||||
if (_monitoring) {
|
||||
moVectorMonitor<EOT> * monitor = new moVectorMonitor<EOT>(_stat);
|
||||
monitorVec.push_back(monitor);
|
||||
checkpoint->add(*monitor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To sample the search and get the statistics which are stored in the moVectorMonitor vector
|
||||
*/
|
||||
void operator()(void) {
|
||||
// clear all statistic vectors
|
||||
for (unsigned i = 0; i < monitorVec.size(); i++)
|
||||
monitorVec[i]->clear();
|
||||
|
||||
// change the checkpoint to compute the statistics
|
||||
localSearch->setContinuator(*checkpoint);
|
||||
|
||||
// the initial solution
|
||||
EOT solution;
|
||||
|
||||
// initialisation of the solution
|
||||
init(solution);
|
||||
|
||||
// compute the sampling
|
||||
(*localSearch)(solution);
|
||||
|
||||
// set back to initial continuator
|
||||
localSearch->setContinuator(*continuator);
|
||||
}
|
||||
|
||||
/**
|
||||
* to set the precision of the output file
|
||||
* @param _precision precision of the output (number of digit)
|
||||
*/
|
||||
void precision(unsigned int _precision) {
|
||||
precisionOutput = _precision;
|
||||
}
|
||||
|
||||
/**
|
||||
* to export the vectors of values into one file
|
||||
* @param _filename file name
|
||||
* @param _delim delimiter between statistics
|
||||
* @param _openFile to specify if it writes at the following of the file
|
||||
*/
|
||||
void fileExport(std::string _filename, std::string _delim = " ", bool _openFile=false) {
|
||||
// create file
|
||||
std::ofstream os;
|
||||
|
||||
if(! _openFile)
|
||||
os.open(_filename.c_str());
|
||||
|
||||
else
|
||||
os.open(_filename.c_str(),std::ios::app);
|
||||
|
||||
if (!os) {
|
||||
std::string str = "moSampling: Could not open " + _filename;
|
||||
throw std::runtime_error(str);
|
||||
}
|
||||
|
||||
// set the precision of the output
|
||||
os.precision(precisionOutput);
|
||||
for (unsigned int j = 0; j < monitorVec.size(); j++)
|
||||
monitorVec[j]->precision(precisionOutput);
|
||||
|
||||
// all vector have the same size
|
||||
unsigned vecSize = monitorVec[0]->size();
|
||||
|
||||
for (unsigned int i = 0; i < vecSize; i++) {
|
||||
os << monitorVec[0]->getValue(i);
|
||||
|
||||
for (unsigned int j = 1; j < monitorVec.size(); j++) {
|
||||
os << _delim.c_str() << monitorVec[j]->getValue(i);
|
||||
}
|
||||
|
||||
os << std::endl ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* to export one vector of values into a file
|
||||
* @param _col number of vector to print into file
|
||||
* @param _filename file name
|
||||
* @param _openFile to specify if it writes at the following of the file
|
||||
*/
|
||||
void fileExport(unsigned int _col, std::string _filename, bool _openFile=false) {
|
||||
if (_col >= monitorVec.size()) {
|
||||
std::string str = "moSampling: Could not export into file the vector. The index does not exists (too large)";
|
||||
throw std::runtime_error(str);
|
||||
}
|
||||
|
||||
monitorVec[_col]->precision(precisionOutput);
|
||||
monitorVec[_col]->fileExport(_filename, _openFile);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* to get one vector of values
|
||||
* @param _numStat number of statistics to get (in the order of creation)
|
||||
* @return the vector of value (all values are converted in double)
|
||||
*/
|
||||
const std::vector<double> & getValues(unsigned int _numStat) {
|
||||
return monitorVec[_numStat]->getValues();
|
||||
}
|
||||
|
||||
/**
|
||||
* to get one vector of solutions values
|
||||
* @param _numStat number of statistics to get (in the order of creation)
|
||||
* @return the vector of value (all values are converted in double)
|
||||
*/
|
||||
const std::vector<EOT> & getSolutions(unsigned int _numStat) {
|
||||
return monitorVec[_numStat]->getSolutions();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return name of the class
|
||||
*/
|
||||
virtual std::string className(void) const {
|
||||
return "moSampling";
|
||||
}
|
||||
|
||||
protected:
|
||||
eoInit<EOT> & init;
|
||||
moLocalSearch<Neighbor> * localSearch;
|
||||
|
||||
moContinuator<Neighbor> * continuator;
|
||||
moCheckpoint<Neighbor> * checkpoint;
|
||||
|
||||
std::vector< moVectorMonitor<EOT> *> monitorVec;
|
||||
|
||||
// precision of the output
|
||||
unsigned int precisionOutput;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue