Fin du nettoyage
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1812 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
c4b0699f53
commit
cc31901008
46 changed files with 417 additions and 546 deletions
|
|
@ -51,46 +51,46 @@ public:
|
|||
moDummyExplorer(): moNeighborhoodExplorer<Neighbor>() { }
|
||||
|
||||
/**
|
||||
* Init Search parameters
|
||||
* @param _solution the solution to explore
|
||||
* NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
void initParam (EOT& _solution) { } ;
|
||||
|
||||
/**
|
||||
* Update Search parameters
|
||||
* @param _solution the solution to explore
|
||||
* NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
void updateParam (EOT& _solution) { } ;
|
||||
|
||||
/**
|
||||
* Test if the exploration continue or not
|
||||
* @param _solution the solution to explore
|
||||
* @return true if the exploration continue, else return false
|
||||
* NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
* @return always false
|
||||
*/
|
||||
bool isContinue(EOT& _solution) { return false; } ;
|
||||
|
||||
/**
|
||||
* Move a solution
|
||||
* @param _solution the solution to explore
|
||||
* NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
void move(EOT& _solution) { } ;
|
||||
|
||||
/**
|
||||
* Test if a solution is accepted
|
||||
* @param _solution the solution to explore
|
||||
* @return true if the solution is accepted, else return false
|
||||
* NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
* @return always false
|
||||
*/
|
||||
virtual bool accept(EOT& _solution) { return false; } ;
|
||||
|
||||
/**
|
||||
* Terminate the search
|
||||
* @param _solution the solution to explore
|
||||
* NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void terminate(EOT& _solution) { } ;
|
||||
|
||||
/**
|
||||
* Explore the neighborhood of a solution
|
||||
* @param _solution
|
||||
* NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
void operator()(EOT & _solution) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include <neighborhood/moNeighborhood.h>
|
||||
|
||||
/**
|
||||
* Explorer for a first imporvement heuristic
|
||||
* Explorer for a first improvement heuristic
|
||||
*/
|
||||
template< class Neighbor>
|
||||
class moFirstImprHCexplorer : public moNeighborhoodExplorer<Neighbor>
|
||||
|
|
@ -74,21 +74,24 @@ public:
|
|||
|
||||
/**
|
||||
* initParam: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void initParam(EOT & solution) {};
|
||||
virtual void initParam(EOT & _solution) {};
|
||||
|
||||
/**
|
||||
* updateParam: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void updateParam(EOT & solution) {};
|
||||
virtual void updateParam(EOT & _solution) {};
|
||||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void terminate(EOT & solution) {};
|
||||
virtual void terminate(EOT & _solution) {};
|
||||
|
||||
/**
|
||||
* Explore the neighborhood of a solution
|
||||
* Explore the neighborhood of a solution until an ameliorated neighbor is found
|
||||
* @param _solution
|
||||
*/
|
||||
virtual void operator()(EOT & _solution) {
|
||||
|
|
@ -136,7 +139,7 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* accept test if an amelirated neighbor was be found
|
||||
* accept test if an ameliorated neighbor was be found
|
||||
* @param _solution the solution
|
||||
* @return true if the best neighbor ameliorate the fitness
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -98,12 +98,13 @@ public:
|
|||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void terminate(EOT & _solution){};
|
||||
|
||||
/**
|
||||
* Explore the neighborhood of a solution
|
||||
* @param _solution
|
||||
* Perturb and apply local search on a solution
|
||||
* @param _solution the solution
|
||||
*/
|
||||
virtual void operator()(EOT & _solution){
|
||||
//copy the solution to perform new local search
|
||||
|
|
@ -132,8 +133,8 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* move the solution with the best neighbor
|
||||
* @param _solution the solution to move
|
||||
* copy the solution found by the local search
|
||||
* @param _solution the solution
|
||||
*/
|
||||
virtual void move(EOT & _solution) {
|
||||
_solution=current;
|
||||
|
|
|
|||
|
|
@ -119,14 +119,6 @@ public:
|
|||
isMoved=_isMoved;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
// virtual std::string className() const {
|
||||
// return "moNeighborhoodExplorer";
|
||||
// }
|
||||
|
||||
protected:
|
||||
moDummyNeighborhood<Neighbor> dummyNeighborhood;
|
||||
moDummyEval<Neighbor> dummyEval;
|
||||
|
|
|
|||
|
|
@ -70,8 +70,7 @@ public:
|
|||
moNeighborComparator<Neighbor>& _neighborComparator,
|
||||
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
|
||||
unsigned _nbStep) :
|
||||
moRandomBestHCexplorer<Neighbor>(_neighborhood, _eval, _neighborComparator, _solNeighborComparator),
|
||||
nbStep(_nbStep) {
|
||||
moRandomBestHCexplorer<Neighbor>(_neighborhood, _eval, _neighborComparator, _solNeighborComparator),nbStep(_nbStep) {
|
||||
//Some cycle is possible with equals fitness solutions if the neighborhood is not random
|
||||
}
|
||||
|
||||
|
|
@ -83,18 +82,20 @@ public:
|
|||
|
||||
/**
|
||||
* initial number of step
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void initParam(EOT & solution) {
|
||||
moRandomBestHCexplorer<Neighbor>::initParam(solution);
|
||||
virtual void initParam(EOT & _solution) {
|
||||
moRandomBestHCexplorer<Neighbor>::initParam(_solution);
|
||||
|
||||
step = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* one more step
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void updateParam(EOT & solution) {
|
||||
moRandomBestHCexplorer<Neighbor>::updateParam(solution);
|
||||
virtual void updateParam(EOT & _solution) {
|
||||
moRandomBestHCexplorer<Neighbor>::updateParam(_solution);
|
||||
|
||||
step++;
|
||||
};
|
||||
|
|
@ -109,7 +110,7 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* accept test if an ameliorated neighbor was be found
|
||||
* accept test if an ameliorated or an equal neighbor was be found
|
||||
* @param _solution the solution
|
||||
* @return true if the best neighbor ameliorate the fitness or is equals
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -83,28 +83,31 @@ public:
|
|||
|
||||
/**
|
||||
* empty the vector of best solutions
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void initParam(EOT & solution) {
|
||||
virtual void initParam(EOT & _solution) {
|
||||
// delete all the best solutions
|
||||
bestVector.clear();
|
||||
};
|
||||
|
||||
/**
|
||||
* empty the vector of best solutions
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void updateParam(EOT & solution) {
|
||||
virtual void updateParam(EOT & _solution) {
|
||||
// delete all the best solutions
|
||||
bestVector.clear();
|
||||
};
|
||||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void terminate(EOT & solution) {};
|
||||
virtual void terminate(EOT & _solution) {};
|
||||
|
||||
/**
|
||||
* Explore the neighborhood of a solution
|
||||
* @param _solution
|
||||
* @param _solution the current solution
|
||||
*/
|
||||
virtual void operator()(EOT & _solution) {
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,8 @@ public:
|
|||
* @param _solNeighborComparator a solution vs neighbor comparator
|
||||
* @param _nbStep maximum number of step to do
|
||||
*/
|
||||
moRandomNeutralWalkExplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval,
|
||||
moRandomNeutralWalkExplorer(Neighborhood& _neighborhood,
|
||||
moEval<Neighbor>& _eval,
|
||||
moSolNeighborComparator<Neighbor>& _solNeighborComparator,
|
||||
unsigned _nbStep):
|
||||
moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval),
|
||||
|
|
@ -84,23 +85,26 @@ public:
|
|||
|
||||
/**
|
||||
* initialization of the number of step to be done
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void initParam(EOT & solution) {
|
||||
virtual void initParam(EOT & _solution) {
|
||||
step = 0;
|
||||
isAccept = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* increase the number of step
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void updateParam(EOT & solution) {
|
||||
virtual void updateParam(EOT & _solution) {
|
||||
step++;
|
||||
};
|
||||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void terminate(EOT & solution) {};
|
||||
virtual void terminate(EOT & _solution) {};
|
||||
|
||||
/**
|
||||
* Explore the neighborhood of a solution
|
||||
|
|
@ -135,7 +139,7 @@ public:
|
|||
* @return true there is some steps to do
|
||||
*/
|
||||
virtual bool isContinue(EOT & _solution) {
|
||||
return (step < nbStep) && isAccept ;
|
||||
return (step < nbStep) && isAccept ;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -150,7 +154,7 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* accept test if an ameliorated neighbor was be found
|
||||
* accept test if an equals neighbor was be found
|
||||
* @param _solution the solution
|
||||
* @return true if the best neighbor ameliorate the fitness
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
/**
|
||||
* Constructor
|
||||
* @param _init the solution initializer, to explore at random the search space
|
||||
* @param _eval the evaluation function
|
||||
* @param _fulleval the evaluation function
|
||||
* @param _nbStep maximum number of step to do
|
||||
*/
|
||||
moRandomSearchExplorer(eoInit<EOT>& _init, eoEvalFunc<EOT>& _fulleval, unsigned _nbStep) : moNeighborhoodExplorer<Neighbor>(), init(_init), fulleval(_fulleval), nbStep(_nbStep) {
|
||||
|
|
@ -68,27 +68,29 @@ public:
|
|||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moRandomSearchExplorer() {
|
||||
}
|
||||
~moRandomSearchExplorer() {}
|
||||
|
||||
/**
|
||||
* initialization of the number of step to be done
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void initParam(EOT & solution) {
|
||||
virtual void initParam(EOT & _solution) {
|
||||
step = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* increase the number of step
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void updateParam(EOT & solution) {
|
||||
virtual void updateParam(EOT & _solution) {
|
||||
step++;
|
||||
};
|
||||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void terminate(EOT & solution) {};
|
||||
virtual void terminate(EOT & _solution) {};
|
||||
|
||||
/**
|
||||
* Explore the neighborhood with only one random solution
|
||||
|
|
|
|||
|
|
@ -78,28 +78,31 @@ public:
|
|||
|
||||
/**
|
||||
* initialization of the number of step to be done
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void initParam(EOT & solution) {
|
||||
virtual void initParam(EOT & _solution) {
|
||||
step = 0;
|
||||
isAccept = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* increase the number of step
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void updateParam(EOT & solution) {
|
||||
virtual void updateParam(EOT & _solution) {
|
||||
step++;
|
||||
};
|
||||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void terminate(EOT & solution) {};
|
||||
virtual void terminate(EOT & _solution) {};
|
||||
|
||||
/**
|
||||
* Explore the neighborhood with only one random solution
|
||||
* we supposed that the first neighbor is uniformly selected in the neighborhood
|
||||
* @param _solution
|
||||
* @param _solution a solution
|
||||
*/
|
||||
virtual void operator()(EOT & _solution) {
|
||||
|
||||
|
|
|
|||
|
|
@ -64,9 +64,8 @@ public:
|
|||
* Constructor
|
||||
* @param _neighborhood the neighborhood
|
||||
* @param _eval the evaluation function
|
||||
* @param _neighborComparator a neighbor comparator
|
||||
* @param _solNeighborComparator a solution vs neighbor comparator
|
||||
* @param _nbStep maximum number of step to do
|
||||
* @param _coolingSchedule the cooling schedule
|
||||
*/
|
||||
moSAexplorer(Neighborhood& _neighborhood, moEval<Neighbor>& _eval, moSolNeighborComparator<Neighbor>& _solNeighborComparator, moCoolingSchedule<EOT>& _coolingSchedule) : moNeighborhoodExplorer<Neighbor>(_neighborhood, _eval), solNeighborComparator(_solNeighborComparator), coolingSchedule(_coolingSchedule) {
|
||||
isAccept = false;
|
||||
|
|
@ -168,6 +167,10 @@ public:
|
|||
return isAccept;
|
||||
};
|
||||
|
||||
/**
|
||||
* Getter
|
||||
* @return the temperature
|
||||
*/
|
||||
double getTemperature(){
|
||||
return temperature;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue