git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1746 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
jhumeau 2010-04-23 15:53:21 +00:00
commit 7e08ca9892
5 changed files with 175 additions and 8 deletions

View file

@ -32,23 +32,24 @@ Contact: paradiseo-help@lists.gforge.inria.fr
#include <eval/moEval.h>
#include <perturb/moPerturbation.h>
#include <neighborhood/moNeighborhood.h>
/**
* Neighborhood Perturbation: explore the neighborhood to perturb the solution (the neighborhood could be different as the one used in the Local Search)
*/
template< class Neighbor, class OtherNH >
template< class Neighbor, class OtherNeighbor >
class moNeighborhoodPerturb : public moPerturbation<Neighbor>{
public:
typedef typename Neighbor::EOT EOT;
typedef typename OtherNH::Neighbor OtherN;
typedef moNeighborhood<OtherNeighbor> OtherNH;
/**
* Default Constructor
* @param _otherNeighborhood a neighborhood
* @param _eval an Evaluation Function
*/
moNeighborhoodPerturb(OtherNH& _otherNeighborhood, moEval<OtherN>& _eval): otherNeighborhood(_otherNeighborhood), eval(_eval){}
moNeighborhoodPerturb(OtherNH& _otherNeighborhood, moEval<OtherNeighbor>& _eval): otherNeighborhood(_otherNeighborhood), eval(_eval){}
/**
* Apply move on the solution
@ -101,8 +102,8 @@ public:
private:
OtherNH& otherNeighborhood;
moEval<OtherN>& eval;
OtherN current;
moEval<OtherNeighbor>& eval;
OtherNeighbor current;
};
#endif

View file

@ -51,7 +51,7 @@ public:
* @param _fullEval a full evaluation function
* @param _threshold maximum number of iteration with no improvement
*/
moRestartPerturb(eoInit<EOT>& _init, eoEvalFunc<EOT>& _fullEval, unsigned int _threshold):init(_init), fullEval(_fullEval), threshold(_threshold) {}
moRestartPerturb(eoInit<EOT>& _initializer, eoEvalFunc<EOT>& _fullEval, unsigned int _threshold):initializer(_initializer), fullEval(_fullEval), threshold(_threshold) {}
/**
* Apply restart when necessary
@ -60,7 +60,7 @@ public:
*/
bool operator()(EOT& _solution){
if((*this).getCounter()>= threshold){
init(_solution);
initializer(_solution);
fullEval(_solution);
(*this).initCounter();
}
@ -68,7 +68,7 @@ public:
}
private:
eoInit<EOT>& init;
eoInit<EOT>& initializer;
eoEvalFunc<EOT>& fullEval;
unsigned int threshold;
};