Documentation updated
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1692 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
11b2b45c12
commit
deaeaeec36
16 changed files with 101 additions and 33 deletions
|
|
@ -39,6 +39,9 @@
|
|||
#include <utils/eoMonitor.h>
|
||||
#include <continuator/moStatBase.h>
|
||||
|
||||
/**
|
||||
* Continuator allowing to add others (continuators, stats, monitors or updaters)
|
||||
*/
|
||||
template <class NH>
|
||||
class moCheckpoint : public moContinuator<NH> {
|
||||
public :
|
||||
|
|
@ -46,22 +49,65 @@ public :
|
|||
typedef NH Neighborhood ;
|
||||
typedef typename Neighborhood::EOT EOT ;
|
||||
|
||||
/**
|
||||
* Default constructor (moCheckpoint must have at least one continuator)
|
||||
* @param _cont a continuator
|
||||
*/
|
||||
moCheckpoint(moContinuator<Neighborhood>& _cont) {
|
||||
continuators.push_back(&_cont);
|
||||
}
|
||||
|
||||
void add(moContinuator<Neighborhood>& _cont) { continuators.push_back(&_cont); }
|
||||
void add(moStatBase<EOT>& _stat) { stats.push_back(&_stat); }
|
||||
void add(eoMonitor& _mon) { monitors.push_back(&_mon); }
|
||||
void add(eoUpdater& _upd) { updaters.push_back(&_upd); }
|
||||
/**
|
||||
* add a continuator to the checkpoint
|
||||
* @param _cont a continuator
|
||||
*/
|
||||
void add(moContinuator<Neighborhood>& _cont) {
|
||||
continuators.push_back(&_cont);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a statistic operator to the checkpoint
|
||||
* @param _stat a statistic operator
|
||||
*/
|
||||
void add(moStatBase<EOT>& _stat) {
|
||||
stats.push_back(&_stat);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a monitor to the checkpoint
|
||||
* @param _mon a monitor
|
||||
*/
|
||||
void add(eoMonitor& _mon) {
|
||||
monitors.push_back(&_mon);
|
||||
}
|
||||
|
||||
/**
|
||||
* add a updater to the checkpoint
|
||||
* @param _upd an updater
|
||||
*/
|
||||
void add(eoUpdater& _upd) {
|
||||
updaters.push_back(&_upd);
|
||||
}
|
||||
|
||||
/**
|
||||
* init all continuators containing in the checkpoint regarding a solution
|
||||
* @param _sol the corresponding solution
|
||||
*/
|
||||
virtual void init(EOT& _sol) {
|
||||
for(unsigned i = 0; i < continuators.size(); ++i)
|
||||
continuators[i]->init(_sol);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the class
|
||||
*/
|
||||
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;
|
||||
|
|
@ -82,6 +128,10 @@ public :
|
|||
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)
|
||||
|
|
@ -95,11 +145,15 @@ public :
|
|||
}
|
||||
|
||||
private :
|
||||
/** continuators vector */
|
||||
std::vector<moContinuator<Neighborhood>*> continuators;
|
||||
/** statistic operators vector */
|
||||
std::vector<moStatBase<EOT>*> stats;
|
||||
/** monitors vector */
|
||||
std::vector<eoMonitor*> monitors;
|
||||
/** updaters vector */
|
||||
std::vector<eoUpdater*> updaters;
|
||||
|
||||
std::vector<moContinuator<Neighborhood>*> continuators;
|
||||
std::vector<moStatBase<EOT>*> stats;
|
||||
std::vector<eoMonitor*> monitors;
|
||||
std::vector<eoUpdater*> updaters;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ public:
|
|||
* Constructor
|
||||
* @param _neighborhood the neighborhood
|
||||
* @param _eval the evaluation function
|
||||
* @param _comparator a neighbor comparator
|
||||
* @param _neighborComparator a neighbor comparator
|
||||
* @param _solNeighborComparator a solution vs neighbor comparator
|
||||
*/
|
||||
moFirstImprExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) {
|
||||
isAccept = false;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ public:
|
|||
* Constructor
|
||||
* @param _neighborhood the neighborhood
|
||||
* @param _eval the evaluation function
|
||||
* @param _comparator a neighbor comparator
|
||||
* @param _neighborComparator a neighbor comparator
|
||||
* @param _solNeighborComparator a solution vs neighbor comparator
|
||||
* @param _nbStep maximum step to do
|
||||
*/
|
||||
moHCneutralExplorer(Neighborhood& _neighborhood,
|
||||
moEval<Neighbor>& _eval,
|
||||
|
|
|
|||
|
|
@ -57,7 +57,9 @@ public:
|
|||
* Constructor
|
||||
* @param _neighborhood the neighborhood
|
||||
* @param _eval the evaluation function
|
||||
* @param _comparator a neighbor comparator
|
||||
* @param _neighborComparator a neighbor comparator
|
||||
* @param _solNeighborComparator a solution vs neighbor comparator
|
||||
* @param _nbStep maximum number of step to do
|
||||
*/
|
||||
moMetropolisHastingExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator, unsigned int _nbStep) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator), nbStep(_nbStep) {
|
||||
isAccept = false;
|
||||
|
|
@ -73,23 +75,26 @@ public:
|
|||
|
||||
/**
|
||||
* initialization of the number of step to be done
|
||||
* @param _solution the solution (unused here)
|
||||
*/
|
||||
virtual void initParam(EOT & solution){
|
||||
virtual void initParam(EOT & _solution){
|
||||
step = 0;
|
||||
isAccept = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* increase the number of step
|
||||
* @param _solution the solution (unused here)
|
||||
*/
|
||||
virtual void updateParam(EOT & solution){
|
||||
virtual void updateParam(EOT & _solution){
|
||||
step++;
|
||||
};
|
||||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
* @param _solution the solution (unused here)
|
||||
*/
|
||||
virtual void terminate(EOT & solution){};
|
||||
virtual void terminate(EOT & _solution){};
|
||||
|
||||
/**
|
||||
* Explore the neighborhood of a solution
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ public:
|
|||
* Constructor with a Neighborhood and evaluation function
|
||||
* @param _neighborhood the neighborhood
|
||||
* @param _eval the evaluation function
|
||||
* @param _comparator a neighbor comparator
|
||||
*/
|
||||
moNeighborhoodExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval):neighborhood(_neighborhood), eval(_eval), isMoved(false) {}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ public:
|
|||
* Constructor
|
||||
* @param _neighborhood the neighborhood
|
||||
* @param _eval the evaluation function
|
||||
* @param _comparator a neighbor comparator
|
||||
* @param _solNeighborComparator a solution vs neighbor comparator
|
||||
* @param _nbStep maximum number of step to do
|
||||
*/
|
||||
moRandomNeutralWalkExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval,
|
||||
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public:
|
|||
* Constructor
|
||||
* @param _neighborhood the neighborhood
|
||||
* @param _eval the evaluation function
|
||||
* @param _comparator a neighbor comparator
|
||||
* @param _nbStep maximum number of step to do
|
||||
*/
|
||||
moRandomWalkExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, unsigned _nbStep) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), nbStep(_nbStep) {
|
||||
isAccept = false;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ public:
|
|||
* Constructor
|
||||
* @param _neighborhood the neighborhood
|
||||
* @param _eval the evaluation function
|
||||
* @param _comparator a neighbor comparator
|
||||
* @param _neighborComparator a neighbor comparator
|
||||
* @param _solNeighborComparator solution vs neighbor comparator
|
||||
*/
|
||||
moSimpleHCexplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moNeighborComparator<Neighbor>& _neighborComparator, moSolNeighborComparator<Neighbor>& _solNeighborComparator) : moNeighborhoodExplorer<Neighborhood>(_neighborhood, _eval), neighborComparator(_neighborComparator), solNeighborComparator(_solNeighborComparator) {
|
||||
isAccept = false;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ public:
|
|||
* Constructor
|
||||
* @param _neighborhood the neighborhood
|
||||
* @param _eval the evaluation function
|
||||
* @param _comparator a neighbor comparator
|
||||
* @param _neighborComparator a neighbor comparator
|
||||
* @param _solNeighborComparator solution vs neighbor comparator
|
||||
*/
|
||||
moSimpleHCneutralExplorer(Neighborhood& _neighborhood,
|
||||
moEval<Neighbor>& _eval,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@
|
|||
#include <comparator/moSolNeighborComparator.h>
|
||||
#include <memory/moAspiration.h>
|
||||
#include <memory/moTabuList.h>
|
||||
#include <memory/moIntensification.h>
|
||||
#include <memory/moDiversification.h>
|
||||
|
||||
|
||||
/**
|
||||
* Explorer for a Tabu Search
|
||||
|
|
@ -135,6 +138,7 @@ public:
|
|||
*/
|
||||
virtual void operator()(EOT & _solution)
|
||||
{
|
||||
bool found=false;
|
||||
intensification(_solution);
|
||||
diversification(_solution);
|
||||
if(neighborhood.hasNeighbor(_solution))
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
/**
|
||||
* Setter
|
||||
* @param index of the IndexNeighbor
|
||||
* @param _key index of the IndexNeighbor
|
||||
*/
|
||||
void index(unsigned int _key){
|
||||
key=_key;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhood the size of the neighborhood
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
*/
|
||||
moIndexNeighborhood(unsigned int _neighborhoodSize):neighborhoodSize(_neighborhoodSize){}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhood the size of the neighborhood
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
*/
|
||||
moOrderNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize), currentIndex(0){}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhood the size of the neighborhood
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
*/
|
||||
moRndWithReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize){}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _neighborhood the size of the neighborhood
|
||||
* @param _neighborhoodSize the size of the neighborhood
|
||||
*/
|
||||
moRndWithoutReplNeighborhood(unsigned int _neighborhoodSize): moIndexNeighborhood<Neighbor>(_neighborhoodSize), maxIndex(0){
|
||||
for(unsigned int i=0; i < neighborhoodSize; i++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue