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:
parent
cc31901008
commit
3d8057ac4d
88 changed files with 2726 additions and 2720 deletions
|
|
@ -48,101 +48,101 @@ template< class Neighbor >
|
|||
class moRandomSearchExplorer : public moNeighborhoodExplorer<Neighbor>
|
||||
{
|
||||
public:
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
|
||||
using moNeighborhoodExplorer<Neighbor>::neighborhood;
|
||||
using moNeighborhoodExplorer<Neighbor>::eval;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init the solution initializer, to explore at random the search space
|
||||
* @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) {
|
||||
// number of step done
|
||||
step = 0;
|
||||
}
|
||||
typedef typename Neighbor::EOT EOT ;
|
||||
typedef moNeighborhood<Neighbor> Neighborhood ;
|
||||
|
||||
using moNeighborhoodExplorer<Neighbor>::neighborhood;
|
||||
using moNeighborhoodExplorer<Neighbor>::eval;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param _init the solution initializer, to explore at random the search space
|
||||
* @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) {
|
||||
// number of step done
|
||||
step = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moRandomSearchExplorer() {}
|
||||
|
||||
/**
|
||||
* initialization of the number of step to be done
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void initParam(EOT & _solution) {
|
||||
step = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* increase the number of step
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void updateParam(EOT & _solution) {
|
||||
step++;
|
||||
};
|
||||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
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
|
||||
*/
|
||||
virtual void operator()(EOT & _solution) {
|
||||
//init the first neighbor
|
||||
init(_solution);
|
||||
|
||||
//eval the _solution moved with the neighbor and stock the result in the neighbor
|
||||
fulleval(_solution);
|
||||
};
|
||||
|
||||
/**
|
||||
* continue if it is remainds some steps to do
|
||||
* @param _solution the solution
|
||||
* @return true there is some steps to do
|
||||
*/
|
||||
virtual bool isContinue(EOT & _solution) {
|
||||
return (step < nbStep) ;
|
||||
};
|
||||
|
||||
/**
|
||||
* move the solution with the best neighbor
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
virtual void move(EOT & _solution) {
|
||||
// the solution is already move. So nothing to do !
|
||||
};
|
||||
|
||||
/**
|
||||
* accept test : always accept
|
||||
* @param _solution the solution
|
||||
* @return true if the best neighbor ameliorate the fitness
|
||||
*/
|
||||
virtual bool accept(EOT & _solution) {
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
~moRandomSearchExplorer() {}
|
||||
|
||||
/**
|
||||
* initialization of the number of step to be done
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void initParam(EOT & _solution) {
|
||||
step = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* increase the number of step
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
virtual void updateParam(EOT & _solution) {
|
||||
step++;
|
||||
};
|
||||
|
||||
/**
|
||||
* terminate: NOTHING TO DO
|
||||
* @param _solution a solution (unused)
|
||||
*/
|
||||
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
|
||||
*/
|
||||
virtual void operator()(EOT & _solution) {
|
||||
//init the first neighbor
|
||||
init(_solution);
|
||||
|
||||
//eval the _solution moved with the neighbor and stock the result in the neighbor
|
||||
fulleval(_solution);
|
||||
};
|
||||
|
||||
/**
|
||||
* continue if it is remainds some steps to do
|
||||
* @param _solution the solution
|
||||
* @return true there is some steps to do
|
||||
*/
|
||||
virtual bool isContinue(EOT & _solution) {
|
||||
return (step < nbStep) ;
|
||||
};
|
||||
|
||||
/**
|
||||
* move the solution with the best neighbor
|
||||
* @param _solution the solution to move
|
||||
*/
|
||||
virtual void move(EOT & _solution) {
|
||||
// the solution is already move. So nothing to do !
|
||||
};
|
||||
|
||||
/**
|
||||
* accept test : always accept
|
||||
* @param _solution the solution
|
||||
* @return true if the best neighbor ameliorate the fitness
|
||||
*/
|
||||
virtual bool accept(EOT & _solution) {
|
||||
return true;
|
||||
};
|
||||
|
||||
private:
|
||||
// initialization method to explore at random the search space
|
||||
eoInit<EOT> & init;
|
||||
// initialization method to explore at random the search space
|
||||
eoInit<EOT> & init;
|
||||
|
||||
// the full eval function
|
||||
eoEvalFunc<EOT> & fulleval;
|
||||
// the full eval function
|
||||
eoEvalFunc<EOT> & fulleval;
|
||||
|
||||
// current number of step
|
||||
unsigned int step;
|
||||
|
||||
// maximum number of steps to do
|
||||
unsigned int nbStep;
|
||||
// current number of step
|
||||
unsigned int step;
|
||||
|
||||
// maximum number of steps to do
|
||||
unsigned int nbStep;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue