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,59 @@
/*
<moAspiration.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moAspiration_h
#define _moAspiration_h
#include <eoFunctor.h>
/**
* Abstract class for Aspiration Criteria
*/
template< class Neighbor >
class moAspiration : public eoBF<typename Neighbor::EOT &, Neighbor &, bool>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Virtual Init
* @param _sol the current solution
*/
virtual void init(EOT & _sol) = 0;
/**
* Virtual update
* @param _sol the current solution
* @param _neighbor the current neighbor
*/
virtual void update(EOT & _sol, Neighbor & _neighbor) = 0;
};
#endif

View file

@ -0,0 +1,87 @@
/*
<moBestImprAspiration.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moBestImprAspiration_h
#define _moBestImprAspiration_h
#include <memory/moAspiration.h>
/**
* Aspiration criteria accepts a solution better than the best so far
*/
template< class Neighbor >
class moBestImprAspiration : public moAspiration<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* init the best solution
* @param _sol the best solution found
*/
void init(EOT & _sol) {
bestFoundSoFar = _sol;
}
/**
* update the "bestFoundSoFar" if a best solution is found
* @param _sol a solution
* @param _neighbor a neighbor
*/
void update(EOT & _sol, Neighbor & _neighbor) {
if (bestFoundSoFar.fitness() < _sol.fitness())
bestFoundSoFar = _sol;
}
/**
* Test the tabu feature of the neighbor:
* test if the neighbor's fitness is better than the "bestFoundSoFar" fitness
* @param _sol a solution
* @param _neighbor a neighbor
* @return true if _neighbor fitness is better than the "bestFoundSoFar"
*/
bool operator()(EOT & _sol, Neighbor & _neighbor) {
return (bestFoundSoFar.fitness() < _neighbor.fitness());
}
/**
* Getter
* @return a reference on the best found so far solution
*/
EOT& getBest() {
return bestFoundSoFar;
}
private:
EOT bestFoundSoFar;
};
#endif

View file

@ -0,0 +1,119 @@
/*
<moCountMoveMemory.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moCountMoveMemory_h
#define _moCountMoveMemory_h
#include <memory/moMemory.h>
/**
* Count the number of move, no move and the successive stagnation since the last Move
*/
template< class Neighbor >
class moCountMoveMemory : virtual public moMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
/**
* Init all the counters
* @param _sol unused solution
*/
void init(EOT & _sol) {
nbMove=0;
nbNoMove=0;
counter=0;
}
/**
* @param _sol unused solution
* @param _neighbor unused neighbor
*/
void add(EOT & _sol, Neighbor & _neighbor) {
nbMove++;
counter=0;
}
/**
* @param _sol unused solution
* @param _neighbor unused neighbor
*/
void update(EOT & _sol, Neighbor & _neighbor) {
nbNoMove++;
counter++;
}
/**
* ClearMemory : Reinit all the counters
*/
void clearMemory() {
nbMove=0;
nbNoMove=0;
counter=0;
}
/**
* Getter of the number of move
* @return the counter
*/
unsigned int getNbMove() {
return nbMove;
}
/**
* Getter of the number of no move
* @return the counter
*/
unsigned int getNbNoMove() {
return nbNoMove;
}
/**
* Getter of the number of successive stagnation since the last Move
* @return the counter
*/
unsigned int getCounter() {
return counter;
}
/**
* Init counter
*/
void initCounter() {
counter=0;
}
private:
unsigned int nbMove;
unsigned int nbNoMove;
unsigned int counter;
};
#endif

View file

@ -0,0 +1,42 @@
/*
<moDiversification.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moDiversification_h
#define _moDiversification_h
#include <memory/moMemory.h>
#include <eoFunctor.h>
/**
* Abstract class for diversification strategy
*/
template< class Neighbor >
class moDiversification : virtual public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool> {};
#endif

View file

@ -0,0 +1,53 @@
/*
<moDummyDiversification.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moDummyDiversification_h
#define _moDummyDiversification_h
#include <memory/moDiversification.h>
#include <memory/moDummyMemory.h>
/**
* Dummy diversification strategy
*/
template< class Neighbor >
class moDummyDiversification : public moDiversification<Neighbor>, public moDummyMemory<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* @return always false
*/
bool operator()(EOT &) {
return false;
}
};
#endif

View file

@ -0,0 +1,53 @@
/*
<moDummyIntensification.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moDummyIntensification_h
#define _moDummyIntensification_h
#include <memory/moIntensification.h>
#include <memory/moDummyMemory.h>
/**
* Dummy intensification strategy
*/
template< class Neighbor >
class moDummyIntensification : public moIntensification<Neighbor>, public moDummyMemory<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* @return always false
*/
bool operator()(EOT &) {
return false;
}
};
#endif

View file

@ -0,0 +1,67 @@
/*
<moDummyMemory.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moDummyMemory_h
#define _moDummyMemory_h
#include <memory/moMemory.h>
/**
* Dummy memory to make an empty memory
*/
template< class Neighbor >
class moDummyMemory : virtual public moMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
/**
* Init : NOTHIING TO DO
*/
void init(EOT & _sol) {}
/**
* Add : NOTHIING TO DO
*/
void add(EOT & _sol, Neighbor & _neighbor) {}
/**
* Update : NOTHIING TO DO
*/
void update(EOT & _sol, Neighbor & _neighbor) {}
/**
* ClearMemory : NOTHIING TO DO
*/
void clearMemory() {}
};
#endif

View file

@ -0,0 +1,121 @@
/*
<moIndexedVectorTabuList.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moIndexedVectorTabuList_h
#define _moIndexedVectorTabuList_h
#include <memory/moTabuList.h>
#include <vector>
#include <iostream>
/**
* Tabu List of indexed neighbors save in a vector
* each neighbor can not used during howlong iterations
*/
template<class Neighbor >
class moIndexedVectorTabuList : public moTabuList<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Constructor
* @param _maxSize maximum size of the tabu list
* @param _howlong how many iteration a move is tabu
*/
moIndexedVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong) {
tabuList.resize(_maxSize);
}
/**
* init the tabuList by clearing the memory
* @param _sol the current solution
*/
virtual void init(EOT & _sol) {
clearMemory();
}
/**
* add a new neighbor in the tabuList
* @param _sol unused solution
* @param _neighbor the current neighbor
*/
virtual void add(EOT & _sol, Neighbor & _neighbor) {
if (_neighbor.index() < maxSize)
tabuList[_neighbor.index()] = howlong;
}
/**
* update the tabulist by decreasing the number of tabu iteration
* @param _sol unused solution
* @param _neighbor unused neighbor
*/
virtual void update(EOT & _sol, Neighbor & _neighbor) {
for (unsigned int i = 0; i < maxSize; i++)
if (tabuList[i] > 0)
tabuList[i]--;
}
/**
* check if the move is tabu
* @param _sol unused solution
* @param _neighbor the current neighbor
* @return true if tabuList contains _sol
*/
virtual bool check(EOT & _sol, Neighbor & _neighbor) {
return (tabuList[_neighbor.index()] > 0);
}
/**
* clearMemory: remove all solution of the tabuList
*/
virtual void clearMemory() {
for (unsigned int i = 0; i < maxSize; i++)
tabuList[i] = 0;
}
void print(){
std::cout << "Tabulist:" << std::endl;
for(int i=0; i<tabuList.size(); i++)
std::cout << i << ": " << tabuList[i] << std::endl;
}
protected:
//tabu list
std::vector< unsigned int > tabuList;
//maximum size of the tabu list
unsigned int maxSize;
//how many iteration a move is tabu
unsigned int howlong;
};
#endif

View file

@ -0,0 +1,42 @@
/*
<moIntensification.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moIntensification_h
#define _moIntensification_h
#include <memory/moMemory.h>
#include <eoFunctor.h>
/**
* Abstract class for intensification strategy
*/
template< class Neighbor >
class moIntensification : virtual public moMemory<Neighbor>, public eoUF<typename Neighbor::EOT &,bool> {};
#endif

40
mo/src/memory/moMemory.h Normal file
View file

@ -0,0 +1,40 @@
#ifndef _moMemory_h
#define _moMemory_h
/**
* Abstract class for different memory
*/
template< class Neighbor >
class moMemory //: public eoObject
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Init the memory
* @param _sol the current solution
*/
virtual void init(EOT & _sol) = 0;
/**
* Add data to the memory
* @param _sol the current solution
* @param _neighbor the current neighbor
*/
virtual void add(EOT & _sol, Neighbor & _neighbor) = 0;
/**
* update the memory
* @param _sol the current solution
* @param _neighbor the current neighbor
*/
virtual void update(EOT & _sol, Neighbor & _neighbor) = 0;
/**
* clear the memory
*/
virtual void clearMemory() = 0;
};
#endif

View file

@ -0,0 +1,72 @@
/*
<moMonOpDiversification.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moMonOpDiversification_h
#define _moMonOpDiversification_h
#include <eoEvalFunc.h>
#include <eoOp.h>
#include <memory/moDiversification.h>
#include <memory/moDummyMemory.h>
/**
* Diversification strategy applies a "monOp" operator
*/
template< class Neighbor >
class moMonOpDiversification : public moDiversification<Neighbor>, public moDummyMemory<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Constructor
* @param _monOp an eoMonOp (diversification operator)
* @param _fullEval a full evaluation function
*/
moMonOpDiversification(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval) {}
/**
* Apply monOp on the solution
* @param _solution to diversify
* @return value of monOp
*/
bool operator()(EOT& _solution) {
bool res = monOp(_solution);
fullEval(_solution);
return res;
}
private:
/** monOp */
eoMonOp<EOT>& monOp;
eoEvalFunc<EOT>& fullEval;
};
#endif

View file

@ -0,0 +1,138 @@
/*
<moNeighborVectorTabuList.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moNeighborVectorTabuList_h
#define _moNeighborVectorTabuList_h
#include <memory/moTabuList.h>
#include <vector>
#include <iostream>
/**
* Tabu List of neighbors stocked in a vector
*/
template<class Neighbor >
class moNeighborVectorTabuList : public moTabuList<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Constructor
* @param _maxSize maximum size of the tabu list
* @param _howlong how many iteration a move is tabu (0 -> no limits)
*/
moNeighborVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong), index(0) {
tabuList.reserve(_maxSize);
tabuList.resize(0);
}
/**
* init the tabuList by clearing the memory
* @param _sol the current solution
*/
virtual void init(EOT & _sol) {
clearMemory();
}
/**
* add a new neighbor in the tabuList
* @param _sol unused solution
* @param _neighbor the current neighbor
*/
virtual void add(EOT & _sol, Neighbor & _neighbor) {
if (tabuList.size() < maxSize) {
std::pair<Neighbor, unsigned int> tmp;
tmp.first=_neighbor;
tmp.second=howlong;
tabuList.push_back(tmp);
}
else {
tabuList[index%maxSize].first = _neighbor;
tabuList[index%maxSize].second = howlong;
index++;
}
}
/**
* update the tabulist
* @param _sol unused solution
* @param _neighbor unused neighbor
*/
virtual void update(EOT & _sol, Neighbor & _neighbor) {
if (howlong > 0)
for (unsigned int i=0; i<tabuList.size(); i++)
if (tabuList[i].second > 0)
tabuList[i].second--;
}
/**
* check if the move is tabu
* @param _sol unused solution
* @param _neighbor the current neighbor
* @return true if tabuList contains _sol
*/
virtual bool check(EOT & _sol, Neighbor & _neighbor) {
for (unsigned int i=0; i<tabuList.size(); i++) {
if ((howlong > 0 && tabuList[i].second > 0 && tabuList[i].first.equals(_neighbor)) || (howlong==0 && tabuList[i].first.equals(_neighbor)))
return true;
}
return false;
}
/**
* clearMemory: remove all solution of the tabuList
*/
virtual void clearMemory() {
tabuList.resize(0);
index = 0;
}
void print(){
std::cout << "TAbulist:" << std::endl;
for(int i=0; i<tabuList.size(); i++)
std::cout << i << ": " << tabuList[i].first.index() << std::endl;
}
private:
//tabu list
std::vector< std::pair<Neighbor, unsigned int> > tabuList;
//maximum size of the tabu list
unsigned int maxSize;
//how many iteration a move is tabu
unsigned int howlong;
//index on the tabulist
unsigned long index;
};
#endif

View file

@ -0,0 +1,81 @@
/*
<moRndIndexedVectorTabuList.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sebastien Verel
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moRndIndexedVectorTabuList_h
#define _moRndIndexedVectorTabuList_h
#include <memory/moIndexedVectorTabuList.h>
#include <utils/eoRndGenerators.h>
/**
* Tabu List of indexed neighbors save in a vector
* each neighbor can not used during howlong + rnd(howlongRnd) iterations
* see paper:
* Zhipeng Lu, Fred Glover, Jin-Kao Hao. "A Hybrid Metaheuristic Approach to Solving the UBQP Problem". European Journal of Operational Research, 2010.
*/
template<class Neighbor >
class moRndIndexedVectorTabuList : public moIndexedVectorTabuList<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
//tabu list
using moIndexedVectorTabuList<Neighbor>::tabuList;
//maximum size of the tabu list
using moIndexedVectorTabuList<Neighbor>::maxSize;
//how many iteration a move is tabu
using moIndexedVectorTabuList<Neighbor>::howlong;
/**
* Constructor
* @param _maxSize maximum size of the tabu list
* @param _howlong how many minimal iteration a move is tabu
* @param _howlongRnd how many additional iterations a move is tabu (random between [0 , _howlongRnd [ )
*/
moRndIndexedVectorTabuList(unsigned int _maxSize, unsigned int _howlong, unsigned int _howlongRnd) : moIndexedVectorTabuList<Neighbor>(_maxSize, _howlong), howlongRnd(_howlongRnd) {
}
/**
* add a new neighbor in the tabuList
* @param _sol unused solution
* @param _neighbor the current neighbor
*/
virtual void add(EOT & _sol, Neighbor & _neighbor) {
if (_neighbor.index() < maxSize)
tabuList[_neighbor.index()] = howlong + rng.uniform(howlongRnd) ;
}
protected:
// the random part of the forbidden time
unsigned int howlongRnd;
};
#endif

View file

@ -0,0 +1,134 @@
/*
<moSolVectorTabuList.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moSolVectorTabuList_h
#define _moSolVectorTabuList_h
#include <memory/moTabuList.h>
#include <vector>
#include <iostream>
/**
* Tabu List of solution stocked in a vector
*/
template<class Neighbor >
class moSolVectorTabuList : public moTabuList<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Constructor
* @param _maxSize maximum size of the tabu list
* @param _howlong how many iteration a solution is tabu
*/
moSolVectorTabuList(unsigned int _maxSize, unsigned int _howlong) : maxSize(_maxSize), howlong(_howlong) {
tabuList.reserve(_maxSize);
tabuList.resize(0);
}
/**
* init the tabuList by clearing the memory
* @param _sol the current solution
*/
virtual void init(EOT & _sol) {
clearMemory();
}
/**
* add a new solution in the tabuList
* @param _sol the current solution
* @param _neighbor unused neighbor
*/
virtual void add(EOT & _sol, Neighbor & _neighbor) {
if (tabuList.size() < maxSize) {
std::pair<EOT, unsigned int> tmp;
tmp.first=_sol;
tmp.second=howlong;
tabuList.push_back(tmp);
}
else {
tabuList[index%maxSize].first = _sol;
tabuList[index%maxSize].second = howlong;
index++;
}
}
/**
* update the tabulist: NOTHING TO DO
* @param _sol the current solution
* @param _neighbor the current neighbor (unused)
*/
virtual void update(EOT & _sol, Neighbor & _neighbor) {
if (howlong > 0)
for (unsigned int i=0; i<tabuList.size(); i++)
if (tabuList[i].second > 0)
tabuList[i].second--;
}
/**
* check if the solution is tabu
* @param _sol the current solution
* @param _neighbor the current neighbor (unused)
* @return true if tabuList contains _sol
*/
virtual bool check(EOT & _sol, Neighbor & _neighbor) {
EOT tmp=_sol;
_neighbor.move(tmp);
for (unsigned int i=0; i<tabuList.size(); i++) {
if ((howlong > 0 && tabuList[i].second > 0 && tabuList[i].first == tmp) || (howlong==0 && tabuList[i].first==tmp))
return true;
}
return false;
}
/**
* clearMemory: remove all solution of the tabuList
*/
virtual void clearMemory() {
tabuList.resize(0);
index = 0;
}
private:
//tabu list
std::vector< std::pair<EOT, unsigned int> > tabuList;
//maximum size of the tabu list
unsigned int maxSize;
//how many iteration a move is tabu
unsigned int howlong;
//index on the tabulist
unsigned long index;
};
#endif

View file

@ -0,0 +1,53 @@
/*
<moTabuList.h>
Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010
Sébastien Verel, Arnaud Liefooghe, Jérémie Humeau
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can ue,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
ParadisEO WebSite : http://paradiseo.gforge.inria.fr
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef _moTabuList_h
#define _moTabuList_h
#include <memory/moMemory.h>
/**
* Abstract class for the Tabu List
*/
template< class Neighbor >
class moTabuList : public moMemory<Neighbor>
{
public:
typedef typename Neighbor::EOT EOT;
/**
* Check if a neighbor is tabu or not
* @param _sol the current solution
* @param _neighbor the neighbor
* @return true if the neighbor is tabu
*/
virtual bool check(EOT & _sol, Neighbor & _neighbor) = 0;
};
#endif