Migration from SVN

This commit is contained in:
quemy 2012-08-30 11:30:11 +02:00
commit 8cd56f37db
29069 changed files with 0 additions and 4096888 deletions

View file

@ -0,0 +1,88 @@
/*
<moAverageFitnessNeighborStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moAverageFitnessNeighborStat_h
#define moAverageFitnessNeighborStat_h
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
/**
* From moNeighborhoodStat, to compute the average of fitness in the neighborhood
*/
template< class Neighbor >
class moAverageFitnessNeighborStat : public moStat<typename Neighbor::EOT, double >
{
public :
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, double >::value;
/**
* Constructor
* @param _nhStat a neighborhoodStat
*/
moAverageFitnessNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, double >(0.0, "average"), nhStat(_nhStat) {}
/**
* Set the average of fitness in the neighborhood
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = nhStat.getMean();
}
/**
* Set the average of fitness in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value() = nhStat.getMean();
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moAverageFitnessNeighborStat";
}
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -0,0 +1,95 @@
/*
<moBestFitnessStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moBestFitnessStat_h
#define moBestFitnessStat_h
#include <continuator/moStat.h>
/**
* The statistic which save the best solution found during the search
*/
template <class EOT>
class moBestFitnessStat : public moStat<EOT, typename EOT::Fitness>
{
public :
typedef typename EOT::Fitness Fitness;
using moStat< EOT , typename EOT::Fitness >::value;
/**
* Default Constructor
* @param _reInitSol when true the best so far is reinitialized
*/
moBestFitnessStat(bool _reInitSol = true): moStat<EOT, typename EOT::Fitness>(Fitness(), "best"), reInitSol(_reInitSol), firstTime(true) {
}
/**
* Initialization of the best solution on the first one
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
if (reInitSol)
value() = _sol.fitness();
else if (firstTime)
{
value() = _sol.fitness();
firstTime = false;
}
}
/**
* Update the best solution
* @param _sol the current solution
*/
virtual void operator()(EOT & _sol) {
if (value() < _sol.fitness())
{
value() = _sol.fitness();
}
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moBestFitnessStat";
}
protected:
bool reInitSol;
bool firstTime;
};
#endif

View file

@ -0,0 +1,118 @@
/*
<moBestNoImproveContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moBestNoImproveContinuator_h
#define _moBestNoImproveContinuator_h
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
#include <comparator/moSolComparator.h>
/**
* Stop when the best solution cannot be improved
* within a given number of iterations
*/
template< class Neighbor >
class moBestNoImproveContinuator : public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
/**
* Constructor
*
* @param _bestSol the best solution
* @param _maxNoImprove number maximum of iterations
* @param _solComparator a comparator between solutions
* @param _verbose true/false : verbose mode on/off
*/
moBestNoImproveContinuator(const EOT & _bestSol,
unsigned int _maxNoImprove,
moSolComparator<EOT>& _solComparator,
bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(_solComparator), verbose(_verbose) {}
/**
* Constructor where the comparator of solutions is the default comparator
*
* @param _bestSol the best solution
* @param _maxNoImprove number maximum of iterations
* @param _verbose true/false : verbose mode on/off
*/
moBestNoImproveContinuator(const EOT & _bestSol,
unsigned int _maxNoImprove,
bool _verbose = true): bestSol(_bestSol), maxNoImprove(_maxNoImprove), solComparator(defaultSolComp), verbose(_verbose) {}
/**
* Count and test the number of non improvement of the best solution
* improvement: if the current solution is STRICTLY better than the current best solution
*
*@param _solution a solution
*@return true if counter < maxNoImprove
*/
virtual bool operator()(EOT & _solution) {
if (solComparator(_solution, bestSol) || solComparator.equals(_solution, bestSol))
cpt++;
else
cpt = 0;
bool res = (cpt < maxNoImprove);
if (!res && verbose)
std::cout << "STOP in moBestNoImproveContinuator: Reached maximum number of iterations without improvement [" << cpt << "/" << maxNoImprove << "]" << std::endl;
return res;
}
/**
* reset the counter of iteration
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
cpt = 0;
}
/**
* the current number of iteration without improvement
* @return the number of iteration
*/
unsigned int value() {
return cpt ;
}
private:
const EOT & bestSol;
unsigned int maxNoImprove;
unsigned int cpt;
// comparator between solutions
moSolComparator<EOT>& solComparator;
bool verbose;
moSolComparator<EOT> defaultSolComp;
};
#endif

View file

@ -0,0 +1,94 @@
/*
<moBestSoFarStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moBestSoFarStat_h
#define moBestSoFarStat_h
#include <continuator/moStat.h>
/**
* The statistic which save the best solution found during the search
*/
template <class EOT>
class moBestSoFarStat : public moStat<EOT, EOT>
{
public :
using moStat< EOT , EOT >::value;
/**
* Default Constructor
* @param _reInitSol when true the best so far is reinitialized
*/
moBestSoFarStat(bool _reInitSol = true): moStat<EOT, EOT>(EOT(), "best"), reInitSol(_reInitSol), firstTime(true) {
}
/**
* Initialization of the best solution on the first one
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
if (reInitSol)
value() = _sol;
else if (firstTime)
{
value() = _sol;
firstTime = false;
}
}
/**
* Update the best solution
* @param _sol the current solution
*/
virtual void operator()(EOT & _sol) {
if (value().fitness() < _sol.fitness())
{
value() = _sol;
}
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moBestSoFarStat";
}
protected:
bool reInitSol;
bool firstTime;
};
#endif

View file

@ -0,0 +1,82 @@
/*
<moBooleanStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moBooleanStat_h
#define moBooleanStat_h
#include <continuator/moStat.h>
/**
* The statistic gives from a boolean variable
*/
template <class EOT>
class moBooleanStat : public moStat<EOT, bool>
{
public :
using moStat< EOT, bool>::value;
/**
* Default Constructor
*/
moBooleanStat(bool * _b): moStat<EOT, bool>(*_b, "boolean"), b(_b) {
}
/**
* Init the number of iteration
* @param _sol a solution
*/
virtual void init(EOT & _sol) {
value() = *b;
}
/**
* Set the number of iteration
* @param _sol a solution
*/
virtual void operator()(EOT & _sol) {
value() = *b;
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moBooleanStat";
}
private:
bool * b;
};
#endif

View file

@ -0,0 +1,197 @@
/*
<moCheckpoint.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moCheckpoint_h
#define moCheckpoint_h
#include <continuator/moContinuator.h>
#include <utils/eoMonitor.h>
#include <continuator/moStatBase.h>
#include <utils/eoUpdater.h>
#include <continuator/moUpdater.h>
#include <neighborhood/moNeighborhood.h>
/**
* Continuator allowing to add others (continuators, stats, monitors or updaters)
*/
template <class Neighbor>
class moCheckpoint : public moContinuator<Neighbor> {
public :
typedef typename Neighbor::EOT EOT ;
/**
* Constructor (moCheckpoint must have at least one continuator)
* @param _cont a continuator
* @param _interval frequency to compute statistical operators
*/
moCheckpoint(moContinuator<Neighbor>& _cont, unsigned int _interval=1):interval(_interval), counter(0) {
continuators.push_back(&_cont);
}
/**
* add a continuator to the checkpoint
* @param _cont a continuator
*/
void add(moContinuator<Neighbor>& _cont) {
continuators.push_back(&_cont);
}
/**
* add a statistic operator to the checkpoint
* @param _stat a statistic operator
*/
void add(moStatBase<EOT>& _stat) {
stats.push_back(&_stat);
}
/**
* add a monitor to the checkpoint
* @param _mon a monitor
*/
void add(eoMonitor& _mon) {
monitors.push_back(&_mon);
}
/**
* add a updater to the checkpoint
* @param _upd an updater
*/
void add(eoUpdater& _upd) {
updaters.push_back(&_upd);
}
/**
* add a MO updater to the checkpoint
* @param _moupd an mo updater
*/
void add(moUpdater& _moupd) {
moupdaters.push_back(&_moupd);
}
/**
* init all continuators containing in the checkpoint regarding a solution
* @param _sol the corresponding solution
*/
virtual void init(EOT& _sol) {
for (unsigned i = 0; i < stats.size(); ++i)
stats[i]->init(_sol);
counter=1;
for (unsigned i = 0; i < moupdaters.size(); ++i)
moupdaters[i]->init();
for (unsigned int i = 0; i < monitors.size(); ++i)
(*monitors[i])();
for (unsigned i = 0; i < continuators.size(); ++i)
continuators[i]->init(_sol);
}
/**
* @return class name
*/
virtual std::string className(void) const {
return "moCheckpoint";
}
/**
* apply operator of checkpoint's containers
* @param _sol reference of the solution
* @return true if all continuator return true
*/
bool operator()(EOT & _sol) {
unsigned i;
bool bContinue = true;
for (i = 0; i < stats.size(); ++i) {
if (counter % interval == 0)
(*stats[i])(_sol);
counter++;
}
for (i = 0; i < updaters.size(); ++i)
(*updaters[i])();
for (i = 0; i < moupdaters.size(); ++i)
(*moupdaters[i])();
for (i = 0; i < monitors.size(); ++i)
(*monitors[i])();
for (i = 0; i < continuators.size(); ++i)
if ( !(*continuators[i])(_sol) )
bContinue = false;
return bContinue;
}
/**
* last call of statistic operators, monitors and updaters
* @param _sol reference of the solution
*/
void lastCall(EOT& _sol) {
unsigned int i;
for (i = 0; i < stats.size(); ++i)
stats[i]->lastCall(_sol);
for (i = 0; i < updaters.size(); ++i)
updaters[i]->lastCall();
for (i = 0; i < moupdaters.size(); ++i)
moupdaters[i]->lastCall();
for (i = 0; i < monitors.size(); ++i)
monitors[i]->lastCall();
}
private :
/** continuators vector */
std::vector<moContinuator<Neighbor>*> continuators;
/** statistic operators vector */
std::vector<moStatBase<EOT>*> stats;
/** monitors vector */
std::vector<eoMonitor*> monitors;
/** updaters vector */
std::vector<eoUpdater*> updaters;
/** MO updaters vector */
std::vector<moUpdater*> moupdaters;
unsigned int interval;
unsigned int counter;
};
#endif

View file

@ -0,0 +1,93 @@
/*
<moCombinedContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moCombinedContinuator_h
#define _moCombinedContinuator_h
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
#include <vector>
/**
* Combined several continuators.
* Continue until one of the continuators returns false
*/
template< class Neighbor >
class moCombinedContinuator : public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
/**
* Constructor (moCheckpoint must have at least one continuator)
* @param _cont a continuator
*/
moCombinedContinuator(moContinuator<Neighbor>& _cont) {
continuators.push_back(&_cont);
}
/**
* add a continuator to the combined continuator
* @param _cont a continuator
*/
void add(moContinuator<Neighbor>& _cont) {
continuators.push_back(&_cont);
}
/**
* init all continuators
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
for (unsigned int i = 0; i < continuators.size(); ++i)
continuators[i]->init(_solution);
}
/**
*@param _solution a solution
*@return true all the continuators are true
*/
virtual bool operator()(EOT & _solution) {
bool bContinue = true;
// some data may be update in each continuator.
// So, all continuators are tested
for (unsigned int i = 0; i < continuators.size(); ++i)
if ( !(*continuators[i])(_solution) )
bContinue = false;
return bContinue;
}
private:
/** continuators vector */
std::vector< moContinuator<Neighbor>* > continuators;
};
#endif

View file

@ -0,0 +1,64 @@
/*
<moContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moContinuator_h
#define _moContinuator_h
#include <eoFunctor.h>
#include <neighborhood/moNeighborhood.h>
/**
* To make specific continuator from a solution
*/
template< class Neighbor >
class moContinuator : public eoUF<typename Neighbor::EOT &, bool>
{
public:
typedef typename Neighbor::EOT EOT ;
/**
* Init Continuator parameters
* @param _solution the related solution
*/
virtual void init(EOT& _solution) {};
/**
* Last Call to terminate the checkpoint
* @param _solution the related solution
*/
virtual void lastCall(EOT& _solution) {};
};
#endif

View file

@ -0,0 +1,97 @@
/*
<moCounterMonitorSaver.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moCounterMonitorSaver_h
#define moCounterMonitorSaver_h
#include <utils/eoUpdater.h>
#include <utils/eoMonitor.h>
/**
* Class calling monitors with a given frequency
*/
class moCounterMonitorSaver : public eoUpdater {
public :
/**
* Constructor
* @param _interval frequency to call monitors
* @param _mon a monitor
*/
moCounterMonitorSaver(unsigned _interval, eoMonitor& _mon) : interval(_interval), counter(0) {
monitors.push_back(&_mon);
}
/**
* call monitors if interval is reach by a counter
*/
void operator()(void) {
if (counter++ % interval == 0)
for (unsigned i = 0; i < monitors.size(); i++)
(*monitors[i])();
}
/**
* last call of monitors
*/
void lastCall(void) {
for (unsigned i = 0; i < monitors.size(); i++)
monitors[i]->lastCall();
}
/**
* attach another monitor to this class
* @param _mon the monitor to attach
*/
void add(eoMonitor& _mon) {
monitors.push_back(&_mon);
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moCounterMonitorSaver";
}
private :
/** interval and counter value */
unsigned int interval, counter;
/** monitor's vector */
std::vector<eoMonitor*> monitors;
};
#endif

View file

@ -0,0 +1,80 @@
/*
<moCounterStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moCounterStat_h
#define moCounterStat_h
#include <continuator/moStat.h>
/**
* The statistic gives the number of iteration
*/
template <class EOT>
class moCounterStat : public moStat<EOT, unsigned int>
{
public :
using moStat< EOT, unsigned int>::value;
/**
* Default Constructor
*/
moCounterStat(): moStat<EOT, unsigned int>(0, "counter") {
}
/**
* Init the number of iteration
* @param _sol a solution
*/
virtual void init(EOT & _sol) {
value() = 0;
}
/**
* Set the number of iteration
* @param _sol a solution
*/
virtual void operator()(EOT & _sol) {
value() = value() + 1;
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moCounterStat";
}
};
#endif

View file

@ -0,0 +1,93 @@
/*
<moDistanceStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moDistanceStat_h
#define moDistanceStat_h
#include <utils/eoDistance.h>
#include <continuator/moStat.h>
/**
* The statistic gives the distance to a reference solution
* The reference solution could be the global optimum, or the best knowed solution
* It allows to compute the Fitness-Distance correlation (FDC)
*/
template <class EOT, class T = double>
class moDistanceStat : public moStat<EOT, T>
{
public :
using moStat< EOT, T >::value;
/**
* Constructor
* @param _dist a distance
* @param _ref the reference solution
*/
moDistanceStat(eoDistance<EOT> & _dist, EOT & _ref): moStat<EOT, T>(0, "distance"), dist(_dist), refSolution(_ref) {}
/**
* Compute distance between the first solution and the reference solution
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = dist(_sol, refSolution);
}
/**
* Compute distance between a solution and the reference solution
* @param _sol a solution
*/
virtual void operator()(EOT & _sol) {
value() = dist(_sol, refSolution);
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moDistanceStat";
}
private:
/** the distance */
eoDistance<EOT> & dist;
/**
* the reference solution does not change during the run
* it could be the best solution knowed of the problem
*/
EOT refSolution;
};
#endif

View file

@ -0,0 +1,99 @@
/*
<moEvalsContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moEvalsContinuator_h
#define _moEvalsContinuator_h
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
#include <eoEvalFuncCounter.h>
#include <eval/moEvalCounter.h>
/**
* Continue until a maximum fixed number of full evaluation and neighbor evaluation is reached (total number of evaluation = full evaluation + incremental evaluation)
*
*
* Becareful 1: if restartCounter is true, then the number of neighbor evaluations (for example incremental evaluations) is considered during the local search (not before it)
*
* Becareful 2: Can not be used if the evaluation function is used in parallel
*
* Becareful 3: Check if the incremental does not use full evaluation, otherwise the total number of evaluations is not correct
*/
template< class Neighbor >
class moEvalsContinuator : public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
/**
* Constructor
* @param _fullEval full evaluation function to count
* @param _neighborEval neighbor evaluation function to count
* @param _maxEvals number maximum of evaluations (full and incremental evaluations)
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
*/
moEvalsContinuator(eoEvalFuncCounter<EOT> & _fullEval, moEvalCounter<Neighbor> & _neighborEval, unsigned int _maxEvals, bool _restartCounter = true): fullEval(_fullEval), neighborEval(_neighborEval), maxEvals(_maxEvals), restartCounter(_restartCounter) {}
/**
* Test if continue
* @param _solution a solution
* @return true if number of evaluations < maxEvals
*/
virtual bool operator()(EOT & _solution) {
return (fullEval.value() + neighborEval.value() - nbEval_start < maxEvals);
}
/**
* Reset the number of evaluations
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
if (restartCounter)
nbEval_start = fullEval.value() + neighborEval.value();
else
nbEval_start = 0;
}
/**
* the current number of evaluation from the begining
* @return the number of evaluation
*/
unsigned int value() {
return fullEval.value() + neighborEval.value() - nbEval_start ;
}
private:
eoEvalFuncCounter<EOT> & fullEval;
moEvalCounter<Neighbor> & neighborEval;
unsigned int maxEvals;
bool restartCounter;
unsigned int nbEval_start ;
};
#endif

View file

@ -0,0 +1,63 @@
/*
<moFitContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moFitContinuator_h
#define _moFitContinuator_h
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Continue until a maximum fitness is reached
*/
template< class Neighbor >
class moFitContinuator : public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
/**
* @param _maxFit maximum fitness to reach
*/
moFitContinuator(Fitness _maxFit): maxFit(_maxFit) {}
/**
*@param _solution a solution
*@return true if counter < maxFit
*/
virtual bool operator()(EOT & _solution) {
return (_solution.fitness() < maxFit);
}
private:
Fitness maxFit;
};
#endif

View file

@ -0,0 +1,83 @@
/*
<moFitnessStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moFitnessStat_h
#define moFitnessStat_h
#include <continuator/moStat.h>
/**
* Stat given the fitness of the current solution
*/
template <class EOT>
class moFitnessStat : public moStat<EOT, typename EOT::Fitness>
{
public :
typedef typename EOT::Fitness Fitness;
using moStat< EOT, Fitness >::value;
/**
* Constructor
* @param _description a description of the stat
*/
moFitnessStat(std::string _description = "fitness"):
moStat<EOT, Fitness>(Fitness(), _description) {}
/**
* store the initial fitness value
* @param _sol the initial solution
*/
virtual void init(EOT & _sol)
{
value() = _sol.fitness();
}
/**
* store fitness value
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol)
{
value() = _sol.fitness();
}
/**
* @return the name of the class
*/
virtual std::string className(void) const {
return "moFitnessStat";
}
};
#endif

View file

@ -0,0 +1,96 @@
/*
<moFullEvalContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moFullEvalContinuator_h
#define _moFullEvalContinuator_h
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
#include <eoEvalFuncCounter.h>
/**
* Continue until a maximum fixed number of full evaluation is reached
*
*
* Becareful 1: if restartCounter is true, then the number of full evaluations is considered during the local search (not before it)
*
* Becareful 2: Can not be used if the evaluation function is used in parallel
*/
template< class Neighbor >
class moFullEvalContinuator : public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
/**
* Constructor
* @param _eval evaluation function to count
* @param _maxFullEval number maximum of iterations
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
*/
moFullEvalContinuator(eoEvalFuncCounter<EOT> & _eval, unsigned int _maxFullEval, bool _restartCounter = true): eval(_eval), maxFullEval(_maxFullEval), restartCounter(_restartCounter) {
nbEval_start = eval.value();
}
/**
* Test if continue
* @param _solution a solution
* @return true if number of evaluations < maxFullEval
*/
virtual bool operator()(EOT & _solution) {
return (eval.value() - nbEval_start < maxFullEval);
}
/**
* Reset the number of evaluations
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
if (restartCounter)
nbEval_start = eval.value();
else
nbEval_start = 0;
}
/**
* the current number of evaluation from the begining
* @return the number of evaluation
*/
unsigned int value() {
return eval.value() - nbEval_start ;
}
private:
eoEvalFuncCounter<EOT> & eval;
unsigned int nbEval_start ;
bool restartCounter;
unsigned int maxFullEval ;
};
#endif

View file

@ -0,0 +1,86 @@
/*
<moIterContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moIterContinuator_h
#define _moIterContinuator_h
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Continue until a maximum fixed number of iterations is reached
*/
template< class Neighbor >
class moIterContinuator : public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
/**
* @param _maxIter number maximum of iterations
* @param _verbose true/false : verbose mode on/off
*/
moIterContinuator(unsigned int _maxIter, bool _verbose=true): maxIter(_maxIter), verbose(_verbose) {}
/**
*@param _solution a solution
*@return true if counter < maxIter
*/
virtual bool operator()(EOT & _solution) {
bool res;
cpt++;
res = (cpt < maxIter);
if (!res && verbose)
std::cout << "STOP in moIterContinuator: Reached maximum number of iterations [" << cpt << "/" << maxIter << "]" << std::endl;
return res;
}
/**
* reset the counter of iteration
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
cpt = 0;
}
/**
* the current number of iteration
* @return the number of iteration
*/
unsigned int value() {
return cpt ;
}
private:
unsigned int maxIter;
unsigned int cpt;
bool verbose;
};
#endif

View file

@ -0,0 +1,89 @@
/*
<moMaxNeighborStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moMaxNeighborStat_h
#define moMaxNeighborStat_h
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
#include <neighborhood/moNeighborhood.h>
/**
* From moNeighborhoodStat, to compute the max fitness in the neighborhood
*/
template< class Neighbor >
class moMaxNeighborStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
{
public :
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, Fitness >::value;
/**
* Constructor
* @param _nhStat a neighborhoodStat
*/
moMaxNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
/**
* Set the max fitness in the neighborhood
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = nhStat.getMax();
}
/**
* Set the max fitness in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value() = nhStat.getMax();
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moMaxNeighborStat";
}
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -0,0 +1,89 @@
/*
<moMinNeighborStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moMinNeighborStat_h
#define moMinNeighborStat_h
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
#include <neighborhood/moNeighborhood.h>
/**
* From moNeighborhoodStat, to compute the min fitness in the neighborhood
*/
template< class Neighbor >
class moMinNeighborStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
{
public :
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, Fitness >::value;
/**
* Constructor
* @param _nhStat a neighborhoodStat
*/
moMinNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, Fitness>(Fitness(), "min"), nhStat(_nhStat) {}
/**
* Set the worst fitness in the neighborhood
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = nhStat.getMin();
}
/**
* Set the worst fitness in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value() = nhStat.getMin();
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moMinNeighborStat";
}
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -0,0 +1,90 @@
/*
<moMinusOneCounterStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moMinusOneCounterStat_h
#define moMinusOneCounterStat_h
#include <continuator/moStat.h>
/**
* The statistic gives the number of iteration minus 1
* then the last iteration is not counted (for example for length of adaptive walk)
*/
template <class EOT>
class moMinusOneCounterStat : public moStat<EOT, unsigned int>
{
public :
using moStat< EOT, unsigned int>::value;
/**
* Default Constructor
*/
moMinusOneCounterStat(): moStat<EOT, unsigned int>(0, "counter") {
counter = 0;
}
/**
* Init the number of iteration
* @param _sol a solution
*/
virtual void init(EOT & _sol) {
counter = 0;
value() = 0;
}
/**
* Set the number of iteration
* @param _sol a solution
*/
virtual void operator()(EOT & _sol) {
counter++;
if (counter > 0)
value() = counter - 1;
else
value() = 0;
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moMinusOneCounterStat";
}
private:
unsigned int counter;
};
#endif

View file

@ -0,0 +1,90 @@
/*
<moNbInfNeighborStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moNbInfNeighborStat_h
#define moNbInfNeighborStat_h
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
#include <neighborhood/moNeighborhood.h>
/**
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
* with (strictly) lower fitness than the current solution
*/
template< class Neighbor >
class moNbInfNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
{
public :
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, unsigned >::value;
/**
* Constructor
* @param _nhStat a neighborhoodStat
*/
moNbInfNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, unsigned>(0, "nb inf"), nhStat(_nhStat) {}
/**
* Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = nhStat.getNbInf();
}
/**
* Set the number of solutions in the neighborhood with (strictly) lower fitness than the current solution
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value() = nhStat.getNbInf();
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moNbInfNeighborStat";
}
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -0,0 +1,90 @@
/*
<moNbSupNeighborStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moNbSupNeighborStat_h
#define moNbSupNeighborStat_h
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
#include <neighborhood/moNeighborhood.h>
/**
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
* with higher fitness than the current solution
*/
template< class Neighbor >
class moNbSupNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
{
public :
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, unsigned >::value;
/**
* Constructor
* @param _nhStat a neighborhoodStat
*/
moNbSupNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, unsigned>(0, "nb sup"), nhStat(_nhStat) {}
/**
* Set the number of solutions in the neighborhood with better fitness than the current solution
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = nhStat.getNbSup();
}
/**
* Set the number of solutions in the neighborhood with better fitness than the current solution
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value() = nhStat.getNbSup();
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moNbSupNeighborStat";
}
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -0,0 +1,167 @@
/*
<moNeighborBestStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moNeighborBestStat_h
#define moNeighborBestStat_h
#include <continuator/moStat.h>
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* Compute the fitness of the best solution among k neighbor or all neighbors
*/
template< class Neighbor >
class moNeighborBestStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
{
public :
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, Fitness >::value;
/**
* Constructor
* @param _neighborhood a neighborhood
* @param _eval an evaluation function
* @param _neighborComparator a neighbor Comparator
* @param _solNeighborComparator a comparator between a solution and a neighbor
* @param _k number of neighbors visited
*/
moNeighborBestStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator, unsigned int _k = 0):
moStat<EOT, Fitness>(true, "neighborhood"),
neighborhood(_neighborhood), eval(_eval),
neighborComparator(_neighborComparator),
solNeighborComparator(_solNeighborComparator),
kmax(_k)
{}
/**
* Default Constructor
* where the comparators are basic, there only compare the fitness values
*
* @param _neighborhood a neighborhood
* @param _eval an evaluation function
* @param _k number of neighbors visited (default all)
*/
moNeighborBestStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, unsigned _k = 0):
moStat<EOT, Fitness>(Fitness(), "best"),
neighborhood(_neighborhood), eval(_eval),
neighborComparator(defaultNeighborComp),
solNeighborComparator(defaultSolNeighborComp),
kmax(_k)
{}
/**
* Compute classical statistics of the first solution's neighborhood
* @param _solution the first solution
*/
virtual void init(EOT & _solution) {
operator()(_solution);
}
/**
* Compute the best fitness amoung all neighbors or k neighbors
* @param _solution the corresponding solution
*/
virtual void operator()(EOT & _solution) {
Neighbor current ;
Neighbor best ;
if (neighborhood.hasNeighbor(_solution)) {
//init the first neighbor
neighborhood.init(_solution, current);
//eval the _solution moved with the neighbor and stock the result in the neighbor
eval(_solution, current);
//initialize the best neighbor
best = current;
// number of visited neighbors
unsigned int k = 1;
//test all others neighbors
while ( ( (kmax == 0) || (k < kmax) ) && neighborhood.cont(_solution)) {
//next neighbor
neighborhood.next(_solution, current);
//eval
eval(_solution, current);
//if we found a better neighbor, update the best
if (neighborComparator(best, current))
best = current;
k++;
}
value() = best.fitness();
}
else {
//if _solution hasn't neighbor,
value() = Fitness();
}
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moNeighborBestStat";
}
private:
// to explore the neighborhood
Neighborhood& neighborhood ;
moEval<Neighbor>& eval;
// comparator betwenn solution and neighbor or between neighbors
moNeighborComparator<Neighbor>& neighborComparator;
moSolNeighborComparator<Neighbor>& solNeighborComparator;
// default comparators
// compare the fitness values of neighbors
moNeighborComparator<Neighbor> defaultNeighborComp;
// compare the fitness values of the solution and the neighbor
moSolNeighborComparator<Neighbor> defaultSolNeighborComp;
// number of neighbor to explore
unsigned int kmax;
};
#endif

View file

@ -0,0 +1,94 @@
/*
<moNeighborEvalContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moNeighborEvalContinuator_h
#define _moNeighborEvalContinuator_h
#include <continuator/moContinuator.h>
#include <neighborhood/moNeighborhood.h>
#include <eval/moEvalCounter.h>
/**
* Continue until a maximum fixed number of neighbor evaluation is reached
*
*
* Becareful 1: if restartCounter is true, then the number of neighbor evaluations (for example incremental evaluations) is considered during the local search (not before it)
*
* Becareful 2: Can not be used if the evaluation function is used in parallel
*/
template< class Neighbor >
class moNeighborEvalContinuator : public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
/**
* Constructor
* @param _eval neighbor evaluation function to count
* @param _maxNeighborEval number maximum of iterations
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
*/
moNeighborEvalContinuator(moEvalCounter<Neighbor> & _eval, unsigned int _maxNeighborEval, bool _restartCounter = true): eval(_eval), maxNeighborEval(_maxNeighborEval), restartCounter(_restartCounter) {}
/**
* Test if continue
* @param _solution a solution
* @return true if number of evaluations < maxNeighborEval
*/
virtual bool operator()(EOT & _solution) {
return (eval.value() - nbEval_start < maxNeighborEval);
}
/**
* Reset the number of evaluations
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
if (restartCounter)
nbEval_start = eval.value();
else
nbEval_start = 0;
}
/**
* the current number of evaluation from the begining
* @return the number of evaluation
*/
unsigned int value() {
return eval.value() - nbEval_start ;
}
private:
moEvalCounter<Neighbor> & eval;
unsigned int maxNeighborEval;
bool restartCounter;
unsigned int nbEval_start ;
};
#endif

View file

@ -0,0 +1,113 @@
/*
<moNeighborFitnessStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moNeighborFitnessStat_h
#define moNeighborFitnessStat_h
#include <continuator/moStat.h>
#include <neighborhood/moNeighborhood.h>
#include <eval/moEval.h>
/**
* Compute the fitness of one random neighbor
*/
template< class Neighbor >
class moNeighborFitnessStat : public moStat<typename Neighbor::EOT, typename Neighbor::EOT::Fitness>
{
public :
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, Fitness >::value;
/**
* Constructor
* @param _neighborhood a neighborhood
* @param _eval an evaluation function
*/
moNeighborFitnessStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval):
moStat<EOT, Fitness>(Fitness(), "neighborhood"),
neighborhood(_neighborhood), eval(_eval)
{
if (!neighborhood.isRandom()) {
std::cout << "moNeighborFitnessStat::Warning -> the neighborhood used is not random, the neighbor will not be random" << std::endl;
}
}
/**
* Compute the fitness of one random neighbor
* @param _solution the first solution
*/
virtual void init(EOT & _solution) {
operator()(_solution);
}
/**
* Compute the fitness of one random neighbor
* @param _solution the corresponding solution
*/
virtual void operator()(EOT & _solution) {
if (neighborhood.hasNeighbor(_solution)) {
Neighbor current ;
//init the first neighbor which is supposed to be random
neighborhood.init(_solution, current);
//eval the _solution moved with the neighbor and stock the result in the neighbor
eval(_solution, current);
// the fitness value is collected
value() = current.fitness();
} else {
//if _solution hasn't neighbor,
value() = Fitness();
}
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moNeighborFitnessStat";
}
private:
// the neighborhood
Neighborhood& neighborhood ;
moEval<Neighbor>& eval;
};
#endif

View file

@ -0,0 +1,264 @@
/*
<moNeighborhoodStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moNeighborhoodStat_h
#define moNeighborhoodStat_h
#include <continuator/moStat.h>
#include <explorer/moNeighborhoodExplorer.h>
#include <comparator/moNeighborComparator.h>
#include <comparator/moSolNeighborComparator.h>
#include <neighborhood/moNeighborhood.h>
/**
* All possible statitic on the neighborhood fitness
* to combine with other specific statistic to print them
*/
template< class Neighbor >
class moNeighborhoodStat : public moStat<typename Neighbor::EOT, bool>
{
public :
typedef typename Neighbor::EOT EOT ;
typedef moNeighborhood<Neighbor> Neighborhood ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, bool >::value;
/**
* Constructor
* @param _neighborhood a neighborhood
* @param _eval an evaluation function
* @param _neighborComparator a neighbor Comparator
* @param _solNeighborComparator a comparator between a solution and a neighbor
*/
moNeighborhoodStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator):
moStat<EOT, bool>(true, "neighborhood"),
neighborhood(_neighborhood), eval(_eval),
neighborComparator(_neighborComparator),
solNeighborComparator(_solNeighborComparator)
{}
/**
* Default Constructor
* where the comparators are basic, there only compare the fitness values
*
* @param _neighborhood a neighborhood
* @param _eval an evaluation function
*/
moNeighborhoodStat(Neighborhood& _neighborhood, moEval<Neighbor>& _eval):
moStat<EOT, bool>(true, "neighborhood"),
neighborhood(_neighborhood), eval(_eval),
neighborComparator(defaultNeighborComp),
solNeighborComparator(defaultSolNeighborComp)
{}
/**
* Compute classical statistics of the first solution's neighborhood
* @param _solution the first solution
*/
virtual void init(EOT & _solution) {
operator()(_solution);
}
/**
* Compute classical statistics of a solution's neighborhood
* @param _solution the corresponding solution
*/
virtual void operator()(EOT & _solution) {
Neighbor current ;
Neighbor best ;
Neighbor lowest ;
if (neighborhood.hasNeighbor(_solution)) {
//init the first neighbor
neighborhood.init(_solution, current);
//eval the _solution moved with the neighbor and stock the result in the neighbor
eval(_solution, current);
// init the statistics
value() = true;
mean = current.fitness();
sd = mean * mean;
nb = 1;
nbInf = 0;
nbEqual = 0;
nbSup = 0;
if (solNeighborComparator.equals(_solution, current))
nbEqual++;
else if (solNeighborComparator(_solution, current))
nbSup++;
else
nbInf++;
//initialize the best neighbor
best = current;
lowest = current;
//test all others neighbors
while (neighborhood.cont(_solution)) {
//next neighbor
neighborhood.next(_solution, current);
//eval
eval(_solution, current);
mean += current.fitness();
sd += current.fitness() * current.fitness();
nb++;
if (solNeighborComparator.equals(_solution, current))
nbEqual++;
else if (solNeighborComparator(_solution, current))
nbSup++;
else
nbInf++;
//if we found a better neighbor, update the best
if (neighborComparator(best, current))
best = current;
if (neighborComparator(current, lowest))
lowest = current;
}
max = best.fitness();
min = lowest.fitness();
mean /= nb;
if (nb > 1)
sd = sqrt( (sd - nb * mean * mean) / (nb - 1.0) );
else
sd = 0.0;
}
else {
//if _solution hasn't neighbor,
value() = false;
}
}
/**
* @return the worst fitness value found in the neighborhood
*/
Fitness getMin() {
return min;
}
/**
* @return the best fitness value found in the neighborhood
*/
Fitness getMax() {
return max;
}
/**
* @return the mean fitness value of the neighborhood
*/
double getMean() {
return mean;
}
/**
* @return the standard deviation value of the neighborhood
*/
double getSD() {
return sd;
}
/**
* @return the size of the neighborhood
*/
unsigned getSize() {
return nb;
}
/**
* @return the number of neighbors having a better fitness than the current solution
*/
unsigned getNbSup() {
return nbSup;
}
/**
* @return the number of neighbors having the same fitness than the current solution
*/
unsigned getNbEqual() {
return nbEqual;
}
/**
* @return the number of neighbors having a worst fitness than the current solution
*/
unsigned getNbInf() {
return nbInf;
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moNeighborhoodStat";
}
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

View file

@ -0,0 +1,90 @@
/*
<moNeutralDegreeNeighborStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moNeutralDegreeNeighborStat_h
#define moNeutralDegreeNeighborStat_h
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
/**
* From moNeighborhoodStat, to compute the neutral degree of the solution
* which is the number of solutions in the neighborhood
* with equals fitness
*/
template< class Neighbor >
class moNeutralDegreeNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
{
public :
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, unsigned >::value;
/**
* Constructor
* @param _nhStat a neighborhoodStat
*/
moNeutralDegreeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, unsigned>(0, "neutral degree"), nhStat(_nhStat) {}
/**
* Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = nhStat.getNbEqual();
}
/**
* Set the neutral degree of the solution which is the number of solutions in the neighborhood with equals fitness
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value() = nhStat.getNbEqual();
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moNeutralDegreeNeighborStat";
}
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -0,0 +1,90 @@
/*
<moSecondMomentNeighborStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moSecondMomentNeighborStat_h
#define moSecondMomentNeighborStat_h
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
/**
* From moNeighborhoodStat, to compute the average and the standard deviation of fitness in the neighborhood
*/
template< class Neighbor >
class moSecondMomentNeighborStat : public moStat<typename Neighbor::EOT, std::pair<double, double> >
{
public :
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, std::pair<double, double> >::value;
/**
* Constructor
* @param _nhStat a neighborhoodStat
*/
moSecondMomentNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, std::pair<double, double> >(std::make_pair(0.0,0.0), "average and stdev"), nhStat(_nhStat) {}
/**
* Set the average and the standard deviation of fitness in the neighborhood
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value().first = nhStat.getMean();
value().second = nhStat.getSD();
}
/**
* Set the average and the standard deviation of fitness in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value().first = nhStat.getMean();
value().second = nhStat.getSD();
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moSecondMomentNeighborStat";
}
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -0,0 +1,89 @@
/*
<moSizeNeighborStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moSizeNeighborStat_h
#define moSizeNeighborStat_h
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
/**
* From moNeighborhoodStat, to compute the number of solutions in the neighborhood
*
*/
template< class Neighbor >
class moSizeNeighborStat : public moStat<typename Neighbor::EOT, unsigned>
{
public :
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, unsigned >::value;
/**
* Constructor
* @param _nhStat a neighborhoodStat
*/
moSizeNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, unsigned>(0, "size"), nhStat(_nhStat) {}
/**
* Set the number of solutions in the neighborhood
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = nhStat.getSize();
}
/**
* Set the number of solutions in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value() = nhStat.getSize();
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moSizeNeighborStat";
}
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -0,0 +1,82 @@
/*
<moSolutionStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moSolutionStat_h
#define moSolutionStat_h
#include <continuator/moStat.h>
/**
* The statistic which only give the current solution.
* Be careful, the solution is given by copy
*
*/
template <class EOT>
class moSolutionStat : public moStat<EOT, EOT>
{
public :
using moStat< EOT, EOT >::value;
/**
* Constructor
* @param _description a description of the parameter
*/
moSolutionStat(std::string _description = "solution"):
moStat<EOT, EOT>(EOT(), _description) { }
/**
* Initialization the solution by copy
* @param _sol the intial solution
*/
virtual void init(EOT & _sol) {
value() = _sol;
}
/**
* Set the solution by copy
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value() = _sol;
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moSolutionStat";
}
};
#endif

View file

@ -0,0 +1,61 @@
/*
<moStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moStat_h
#define moStat_h
#include <continuator/moStatBase.h>
/**
* The actual class that will be used as base for all statistics
* that need to be calculated over the solution
* It is a moStatBase AND an eoValueParam so it can be used in Monitors.
*/
template <class EOT, class T>
class moStat : public eoValueParam<T>, public moStatBase<EOT>
{
public:
/**
* Constructor
* @param _value a default parameter's value
* @param _description a description of the parameter
*/
moStat(T _value, std::string _description):
eoValueParam<T>(_value, _description) {}
};
#endif

View file

@ -0,0 +1,61 @@
/*
<moStatBase.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moStatBase_h
#define moStatBase_h
#include <eoFunctor.h>
#include <utils/eoParam.h>
/**
* Base class for all statistics that need to be calculated
* over the solution
*/
template <class EOT>
class moStatBase : public eoUF<EOT &, void>
{
public:
/**
* last call of a statistical operator
*/
virtual void lastCall(EOT &) {}
/**
* first call of a statistical operator
*/
virtual void init(EOT &) {}
};
#endif

View file

@ -0,0 +1,83 @@
/*
<moStatFromStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moStatFromStat_h
#define moStatFromStat_h
#include <continuator/moStat.h>
/**
* The statistic which copy another statistic
*/
template <class EOT, class T>
class moStatFromStat : public moStat<EOT, T>
{
public :
using moStat< EOT , T >::value;
/**
* Constructor
* @param _stat a stat
*/
moStatFromStat(moStat<EOT,T> & _stat): moStat<EOT, T>(0, _stat.description()), stat(_stat) {
}
/**
* The value of this stat is a copy of the value of the initial stat
* @param _sol a solution
*/
virtual void init(EOT & _sol) {
value() = stat.value();
}
/**
* The value of this stat is a copy of the value of the initial stat
* @param _sol a solution
*/
virtual void operator()(EOT & _sol) {
value() = stat.value();
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moStatFromStat";
}
private:
moStat<EOT, T> & stat;
};
#endif

View file

@ -0,0 +1,88 @@
/*
<moStdFitnessNeighborStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moStdFitnessNeighborStat_h
#define moStdFitnessNeighborStat_h
#include <continuator/moStat.h>
#include <continuator/moNeighborhoodStat.h>
/**
* From moNeighborhoodStat, to compute the average and the standard deviation of fitness in the neighborhood
*/
template< class Neighbor >
class moStdFitnessNeighborStat : public moStat<typename Neighbor::EOT, double >
{
public :
typedef typename Neighbor::EOT EOT ;
typedef typename EOT::Fitness Fitness ;
using moStat< EOT, double >::value;
/**
* Constructor
* @param _nhStat a neighborhoodStat
*/
moStdFitnessNeighborStat(moNeighborhoodStat<Neighbor> & _nhStat):
moStat<EOT, double >(0.0, "stdev"), nhStat(_nhStat) {}
/**
* Set the average and the standard deviation of fitness in the neighborhood
* @param _sol the first solution
*/
virtual void init(EOT & _sol) {
value() = nhStat.getSD();
}
/**
* Set the average and the standard deviation of fitness in the neighborhood
* @param _sol the corresponding solution
*/
virtual void operator()(EOT & _sol) {
value() = nhStat.getSD();
}
/**
* @return the class name
*/
virtual std::string className(void) const {
return "moStdFitnessNeighborStat";
}
private:
/** moNeighborhoodStat */
moNeighborhoodStat<Neighbor> & nhStat;
};
#endif

View file

@ -0,0 +1,133 @@
/*
<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 <ctime>
#include <continuator/moContinuator.h>
/**
* Termination condition until a running time is reached.
*/
template < class Neighbor >
class moTimeContinuator: public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Constructor
* @param _max maximum running time (in second)
* @param _verbose verbose mode true/false -> on/off
*/
moTimeContinuator(time_t _max, bool _verbose = true): max(_max), verbose(_verbose) {
external = false;
start = time(NULL);
}
/**
* Synchronize the whole time with an external starting time
* @param _externalStart external starting time
*/
virtual void setStartingTime(time_t _externalStart) {
external = true;
start = _externalStart;
}
/**
* To get the starting time
* @return starting time
*/
virtual time_t getStartingTime() {
return start;
}
/**
* To set the maximum running time
*
* @param _maxTime maximum running time
*/
virtual void maxTime(time_t _maxTime) {
max = _maxTime;
}
/**
* Returns false when the running time is reached.
* @param _sol the current solution
*/
virtual bool operator() (EOT& _sol)
{
bool res;
time_t elapsed = (time_t) difftime(time(NULL), start);
res = (elapsed < max);
if (!res && verbose)
std::cout << "STOP in moTimeContinuator: Reached maximum time [" << elapsed << "/" << max << "]" << std::endl;
return res;
}
/**
* reset the start time
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
if (!external)
start = time(NULL);
}
/**
* Class name
*/
virtual std::string className(void) const
{
return "moTimeContinuator";
}
private:
/** maximum running time */
time_t max;
/** starting time */
time_t start;
/** external start flag */
bool external;
/** verbose mode */
bool verbose;
};
#endif

View file

@ -0,0 +1,68 @@
/*
<moTrueContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moTrueContinuator_h
#define _moTrueContinuator_h
#include <continuator/moContinuator.h>
/**
* Continuator always return True
*/
template< class Neighbor >
class moTrueContinuator : public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
// empty constructor
moTrueContinuator() {} ;
/**
* @param _solution a solution
* @return always true
*/
virtual bool operator()(EOT & _solution) {
return true;
}
/**
* NOTHING TO DO
* @param _solution a solution
*/
virtual void init(EOT & _solution) {}
};
#endif

View file

@ -0,0 +1,82 @@
/*
<moUnsignedStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moUnsignedStat_h
#define moUnsignedStat_h
#include <continuator/moStat.h>
/**
* The statistic gives from a boolean variable
*/
template <class EOT>
class moUnsignedStat : public moStat<EOT, unsigned int>
{
public :
using moStat< EOT, unsigned int>::value;
/**
* Default Constructor
*/
moUnsignedStat(unsigned int * _b): moStat<EOT, unsigned int>(*_b, "unsigned"), b(_b) {
}
/**
* Init the number of iteration
* @param _sol a solution
*/
virtual void init(EOT & _sol) {
value() = *b;
}
/**
* Set the number of iteration
* @param _sol a solution
*/
virtual void operator()(EOT & _sol) {
value() = *b;
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moUnsignedStat";
}
private:
unsigned int * b;
};
#endif

View file

@ -0,0 +1,67 @@
/*
<moUpdater.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moUpdater_h
#define moUpdater_h
#include <eoFunctor.h>
#include <utils/eoParam.h>
/**
* Base class for to update what ever you want
* similar to eoUpdater
* But there is an init method !
*/
class moUpdater : public eoF<void>
{
public:
/**
* first call of the updater
*/
virtual void init() {}
/**
* last call of the updater
*/
virtual void lastCall() {}
/**
* class name
*/
virtual std::string className(void) const
{ return "moUpdater"; }
};
#endif

View file

@ -0,0 +1,96 @@
/*
<moValueParamContinuator.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel, Arnaud Liefooghe, Jeremie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moValueParamContinuator_h
#define _moValueParamContinuator_h
#include <continuator/moContinuator.h>
//#include <neighborhood/moNeighborhood.h>
#include <utils/eoParam.h>
/**
* Continue until a maximum fixed number of full evaluation is reached
*
*
* Becareful 1: if restartCounter is true, then the number of full evaluations is considered during the local search (not before it)
*
* Becareful 2: Can not be used if the evaluation function is used in parallel
*/
template< class Neighbor, class ValueType >
class moValueParamContinuator : public moContinuator<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT ;
/**
* Constructor
* @param _eval evaluation function to count
* @param _maxValue bound of the value
* @param _restartCounter if true the counter of number of evaluations restarts to "zero" at initialization, if false, the number is cumulative
*/
moValueParamContinuator(eoValueParam<ValueType> & _valueParam, unsigned int _maxValue, bool _restartCounter = true): valueParam(_valueParam), maxValue(_maxValue), restartCounter(_restartCounter) {
value_start = valueParam.value();
}
/**
* Test if continue
* @param _solution a solution
* @return true if number of evaluations < maxValue
*/
virtual bool operator()(EOT & _solution) {
return (valueParam.value() - value_start < maxValue);
}
/**
* Reset the number of evaluations
* @param _solution a solution
*/
virtual void init(EOT & _solution) {
if (restartCounter)
value_start = valueParam.value();
else
value_start = 0;
}
/**
* the current number of evaluation from the begining
* @return the number of evaluation
*/
unsigned int value() {
return valueParam.value() - value_start ;
}
private:
eoValueParam<ValueType> & valueParam;
ValueType value_start ;
bool restartCounter;
unsigned int maxValue ;
};
#endif

View file

@ -0,0 +1,84 @@
/*
<moValueStat.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moValueStat_h
#define moValueStat_h
#include <continuator/moStat.h>
#include <utils/eoParam.h>
/**
* The statistic gives the number of iteration
*/
template <class EOT, class ValueType>
class moValueStat : public moStat<EOT, double>
{
public :
using moStat< EOT, double>::value;
/**
* Default Constructor
*/
moValueStat(eoValueParam<ValueType> & _valueParam): moStat<EOT, double>(0, "value"), valueParam(_valueParam) {
}
/**
* Init the number of iteration
* @param _sol a solution
*/
virtual void init(EOT & _sol) {
value() = (double) valueParam.value();
}
/**
* Set the number of iteration
* @param _sol a solution
*/
virtual void operator()(EOT & _sol) {
value() = (double) valueParam.value() ;
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moValueStat";
}
private:
eoValueParam<ValueType> & valueParam;
};
#endif

View file

@ -0,0 +1,241 @@
/*
<moVectorMonitor.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef moVectorMonitor_h
#define moVectorMonitor_h
#include <fstream>
#include <utils/eoMonitor.h>
#include <utils/eoParam.h>
/**
* To save the values of the same type (double, unsigned int, or EOT) in a vector
* It is similar to eoFileMonitor
*
*/
template <class EOT>
class moVectorMonitor : public eoMonitor
{
public:
/**
* Constructor
* @param _param the parameter of type double to save in the vector
*/
moVectorMonitor(eoValueParam<double> & _param) : doubleParam(&_param), intParam(NULL), eotParam(NULL)
{
// precision of the output by default
precisionOutput = std::cout.precision();
}
/**
* Default Constructor
* @param _param the parameter of type unsigned int to save in the vector
*/
moVectorMonitor(eoValueParam<unsigned int> & _param) : doubleParam(NULL), intParam(&_param), eotParam(NULL)
{
// precision of the output by default
precisionOutput = std::cout.precision();
}
/**
* Default Constructor
* @param _param the parameter of type EOT to save in the vector
*/
moVectorMonitor(eoValueParam<EOT> & _param) : doubleParam(NULL), intParam(NULL), eotParam(&_param)
{
// precision of the output by default
precisionOutput = std::cout.precision();
}
/**
* Default Constructor
* @param _param the parameter of type eoScalarFitness to save in the vector
*/
template <class ScalarType, class Compare>
moVectorMonitor(eoValueParam<eoScalarFitness<ScalarType, Compare> > & _param) : doubleParam( & (eoValueParam<double>&)_param), intParam(NULL), eotParam(NULL)
{
// precision of the output by default
precisionOutput = std::cout.precision();
}
/**
* Default Constructor
* @param _param unvalid Parameter
*/
template <class T>
moVectorMonitor(eoValueParam<T> & _param) : doubleParam(NULL), intParam(NULL), eotParam(NULL)
{
std::cerr << "Sorry the type can not be in a vector of moVectorMonitor" << std::endl;
}
/**
* To test if the value are basic type (double or unsigned int), or EOT type
*
* @return true if the type is a EOT type
*/
bool solutionType() {
return eotParam != NULL;
}
/**
* To "print" the value of the parameter in the vector
*
* @return this monitor (sorry I don't why, but it is like this in EO)
*/
eoMonitor& operator()(void) {
if (doubleParam != NULL)
valueVec.push_back(doubleParam->value());
else
if (intParam != NULL)
valueVec.push_back((double) intParam->value());
else
eotVec.push_back(eotParam->value());
return *this ;
}
/**
* To have all the values
*
* @return the vector of values
*/
const std::vector<double>& getValues() const {
return valueVec;
}
/**
* To have all the solutions
*
* @return the vector of solutions
*/
const std::vector<EOT>& getSolutions() const {
return eotVec;
}
/**
* to get the value out.
* @return the string of the value
*/
std::string getValue(unsigned int i) const {
std::ostringstream os;
// set the precision of the output
os.precision(precisionOutput);
if (eotParam == NULL)
os << (valueVec[i]) ;
else
os << (eotVec[i]) ;
return os.str();
}
/**
* clear the vector
*/
void clear() {
valueVec.clear();
eotVec.clear();
}
/**
* number of value
* @return size of the vector
*/
unsigned int size() {
if (eotParam == NULL)
return valueVec.size();
else
return eotVec.size();
}
/**
* to set the precision of the output file
* @param _precision precision of the output (number of digit)
*/
void precision(unsigned int _precision) {
precisionOutput = _precision;
}
/**
* to export the vector of values into one file
* @param _filename file name
* @param _openFile to specify if it writes at the following of the file
*/
void fileExport(std::string _filename, bool _openFile=false) {
// create file
std::ofstream os;
if(! _openFile)
os.open(_filename.c_str());
else
os.open(_filename.c_str(),std::ios::app);
if (!os) {
std::string str = "moVectorMonitor: Could not open " + _filename;
throw std::runtime_error(str);
}
for (unsigned int i = 0; i < size(); i++) {
os << getValue(i);
os << std::endl ;
}
}
/**
* @return name of the class
*/
virtual std::string className(void) const {
return "moVectorMonitor";
}
protected:
eoValueParam<double> * doubleParam ;
eoValueParam<unsigned int> * intParam ;
eoValueParam<EOT> * eotParam ;
std::vector<double> valueVec;
std::vector<EOT> eotVec;
// precision of the output
unsigned int precisionOutput;
};
#endif