Passage du code dans un pretty printer

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1813 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jhumeau 2010-05-17 14:56:42 +00:00
commit 3d8057ac4d
88 changed files with 2726 additions and 2720 deletions

View file

@ -39,28 +39,28 @@ Contact: paradiseo-help@lists.gforge.inria.fr
template< class Neighbor >
class moLocalSearchInit : public eoInit<typename Neighbor::EOT> {
public:
typedef typename Neighbor::EOT EOT;
/**
* Default Constructor
* @param _init initialization of the solution before the local search
* @param _ls the local search to apply to the solution
*/
moLocalSearchInit(eoInit<EOT>& _init, moLocalSearch<Neighbor>& _ls) : init(_init), ls(_ls) {
}
/**
* Apply the local search on the solution
* @param _solution to perturb
*/
void operator()(EOT& _solution){
init(_solution);
ls(_solution);
}
typedef typename Neighbor::EOT EOT;
/**
* Default Constructor
* @param _init initialization of the solution before the local search
* @param _ls the local search to apply to the solution
*/
moLocalSearchInit(eoInit<EOT>& _init, moLocalSearch<Neighbor>& _ls) : init(_init), ls(_ls) {
}
/**
* Apply the local search on the solution
* @param _solution to perturb
*/
void operator()(EOT& _solution) {
init(_solution);
ls(_solution);
}
private:
eoInit<EOT>& init;
moLocalSearch<Neighbor> & ls;
eoInit<EOT>& init;
moLocalSearch<Neighbor> & ls;
};
#endif

View file

@ -42,30 +42,30 @@ template< class Neighbor >
class moMonOpPerturb : public moPerturbation<Neighbor>, public moDummyMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
typedef typename Neighbor::EOT EOT;
/**
* Default Constructor
* @param _monOp an eoMonOp (pertubation operator)
* @param _fullEval a full evaluation function
*/
moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval){}
/**
* Default Constructor
* @param _monOp an eoMonOp (pertubation operator)
* @param _fullEval a full evaluation function
*/
moMonOpPerturb(eoMonOp<EOT>& _monOp, eoEvalFunc<EOT>& _fullEval):monOp(_monOp), fullEval(_fullEval) {}
/**
* Apply monOp on the solution
* @param _solution to perturb
* @return value of monOp
*/
bool operator()(EOT& _solution){
bool res = monOp(_solution);
fullEval(_solution);
return res;
}
/**
* Apply monOp on the solution
* @param _solution to perturb
* @return value of monOp
*/
bool operator()(EOT& _solution) {
bool res = monOp(_solution);
fullEval(_solution);
return res;
}
private:
/** monOp */
eoMonOp<EOT>& monOp;
eoEvalFunc<EOT>& fullEval;
/** monOp */
eoMonOp<EOT>& monOp;
eoEvalFunc<EOT>& fullEval;
};
#endif

View file

@ -38,40 +38,40 @@ Contact: paradiseo-help@lists.gforge.inria.fr
* 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 OtherNeighbor >
class moNeighborhoodPerturb : public moPerturbation<Neighbor>{
class moNeighborhoodPerturb : public moPerturbation<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<OtherNeighbor> OtherNH;
typedef typename Neighbor::EOT EOT;
typedef moNeighborhood<OtherNeighbor> OtherNH;
/**
* Default Constructor
* @param _otherNeighborhood a neighborhood
* @param _eval an Evaluation Function
*/
moNeighborhoodPerturb(OtherNH& _otherNeighborhood, moEval<OtherNeighbor>& _eval): otherNeighborhood(_otherNeighborhood), eval(_eval){}
/**
* Default Constructor
* @param _otherNeighborhood a neighborhood
* @param _eval an Evaluation Function
*/
moNeighborhoodPerturb(OtherNH& _otherNeighborhood, moEval<OtherNeighbor>& _eval): otherNeighborhood(_otherNeighborhood), eval(_eval) {}
/**
* Apply move on the solution
* @param _solution the current solution
* @return true
*/
virtual bool operator()(EOT& _solution){
if(otherNeighborhood.hasNeighbor(_solution)){
eval(_solution, current);
current.move(_solution);
_solution.fitness(current.fitness());
}
return true;
}
/**
* Apply move on the solution
* @param _solution the current solution
* @return true
*/
virtual bool operator()(EOT& _solution) {
if (otherNeighborhood.hasNeighbor(_solution)) {
eval(_solution, current);
current.move(_solution);
_solution.fitness(current.fitness());
}
return true;
}
/**
* Init the neighborhood
* @param _sol the current solution
*/
virtual void init(EOT & _sol){
if(otherNeighborhood.hasNeighbor(_sol))
otherNeighborhood.init(_sol, current);
virtual void init(EOT & _sol) {
if (otherNeighborhood.hasNeighbor(_sol))
otherNeighborhood.init(_sol, current);
}
/**
@ -79,8 +79,8 @@ public:
* @param _sol the current solution
* @param _neighbor unused neighbor (always empty)
*/
virtual void add(EOT & _sol, Neighbor & _neighbor){
(*this).init(_sol);
virtual void add(EOT & _sol, Neighbor & _neighbor) {
(*this).init(_sol);
}
/**
@ -88,22 +88,22 @@ public:
* @param _sol the current solution
* @param _neighbor unused neighbor (always empty)
*/
virtual void update(EOT & _sol, Neighbor & _neighbor){
if(otherNeighborhood.cont(_sol))
otherNeighborhood.next(_sol, current);
else
(*this).init(_sol);
virtual void update(EOT & _sol, Neighbor & _neighbor) {
if (otherNeighborhood.cont(_sol))
otherNeighborhood.next(_sol, current);
else
(*this).init(_sol);
}
/**
* NOTHING TO DO
*/
virtual void clearMemory(){}
virtual void clearMemory() {}
private:
OtherNH& otherNeighborhood;
moEval<OtherNeighbor>& eval;
OtherNeighbor current;
OtherNH& otherNeighborhood;
moEval<OtherNeighbor>& eval;
OtherNeighbor current;
};
#endif

View file

@ -43,34 +43,34 @@ template< class Neighbor >
class moRestartPerturb : public moPerturbation<Neighbor>, public moCountMoveMemory<Neighbor> {
public:
typedef typename Neighbor::EOT EOT;
typedef typename Neighbor::EOT EOT;
/**
* Default Constructor
* @param _initializer an initializer of solution
* @param _fullEval a full evaluation function
* @param _threshold maximum number of iteration with no improvement
*/
moRestartPerturb(eoInit<EOT>& _initializer, eoEvalFunc<EOT>& _fullEval, unsigned int _threshold):initializer(_initializer), fullEval(_fullEval), threshold(_threshold) {}
/**
* Default Constructor
* @param _initializer an initializer of solution
* @param _fullEval a full evaluation function
* @param _threshold maximum number of iteration with no improvement
*/
moRestartPerturb(eoInit<EOT>& _initializer, eoEvalFunc<EOT>& _fullEval, unsigned int _threshold):initializer(_initializer), fullEval(_fullEval), threshold(_threshold) {}
/**
* Apply restart when necessary
* @param _solution to restart
* @return true
*/
bool operator()(EOT& _solution){
if((*this).getCounter()>= threshold){
initializer(_solution);
fullEval(_solution);
(*this).initCounter();
}
return true;
}
/**
* Apply restart when necessary
* @param _solution to restart
* @return true
*/
bool operator()(EOT& _solution) {
if ((*this).getCounter()>= threshold) {
initializer(_solution);
fullEval(_solution);
(*this).initCounter();
}
return true;
}
private:
eoInit<EOT>& initializer;
eoEvalFunc<EOT>& fullEval;
unsigned int threshold;
eoInit<EOT>& initializer;
eoEvalFunc<EOT>& fullEval;
unsigned int threshold;
};

View file

@ -39,22 +39,22 @@ template< class EOT >
class moSolInit : public eoInit<EOT> {
public:
/**
* Default Constructor
* @param _extSol external solution of the intiialization
*/
moSolInit(EOT & _extSol) : extSol(_extSol) {}
/**
* Initialization on the externatl solution
* @param _solution to initialize
*/
void operator()(EOT& _solution){
_solution = extSol;
}
/**
* Default Constructor
* @param _extSol external solution of the intiialization
*/
moSolInit(EOT & _extSol) : extSol(_extSol) {}
/**
* Initialization on the externatl solution
* @param _solution to initialize
*/
void operator()(EOT& _solution) {
_solution = extSol;
}
private:
EOT& extSol;
EOT& extSol;
};
#endif