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
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue