git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1825 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
345d81fb9e
commit
633e961b80
3 changed files with 166 additions and 0 deletions
71
trunk/paradiseo-old-mo/src/moMoveNeighbor.h
Normal file
71
trunk/paradiseo-old-mo/src/moMoveNeighbor.h
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#ifndef _moMoveNeighbor_h
|
||||
#define _moMoveNeighbor_h
|
||||
|
||||
#include <eo>
|
||||
|
||||
#include <neighborhood/moNeighbor.h>
|
||||
#include <move/moMoveIncrEval.h>
|
||||
#include <move/moMove.h>
|
||||
|
||||
|
||||
/*
|
||||
contener of the neighbor informations
|
||||
*/
|
||||
template< class M , class Fitness >
|
||||
class moMoveNeighbor : public moNeighbor <typename M::EOType, Fitness>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename M::EOType EOT;
|
||||
|
||||
// empty constructor
|
||||
moMoveNeighbor() {
|
||||
move=new M();
|
||||
};
|
||||
|
||||
~moMoveNeighbor() {
|
||||
delete move;
|
||||
};
|
||||
|
||||
// copy constructeur
|
||||
moMoveNeighbor(const moMoveNeighbor<M, Fitness> & _n) {
|
||||
moNeighbor<EOT, Fitness>::operator=(_n);
|
||||
(*move) = *(_n.getMove());
|
||||
}
|
||||
|
||||
// assignment operator
|
||||
virtual moMoveNeighbor<M, Fitness> & operator=(const moMoveNeighbor<M, Fitness> & _n) {
|
||||
moNeighbor <EOT, Fitness>::operator=(_n);
|
||||
(*move) = *(_n.getMove());
|
||||
return *this ;
|
||||
}
|
||||
|
||||
/*
|
||||
* move the solution
|
||||
*/
|
||||
virtual void move(EOT & _solution) {
|
||||
(*move)(_solution);
|
||||
}
|
||||
|
||||
/** Return the class id.
|
||||
* @return the class name as a std::string
|
||||
*/
|
||||
virtual std::string className() const {
|
||||
return "moMoveNeighbor";
|
||||
}
|
||||
|
||||
void setMove(M* _move) {
|
||||
move=_move;
|
||||
}
|
||||
|
||||
M* getMove() {
|
||||
return move;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
M* move;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue