#ifndef _moMoveNeighborhood_h #define _moMoveNeighborhood_h #include #include #include #include template< class M, class Fitness > class moMoveNeighborhood : public moNeighborhood > { public: typedef moMoveNeighbor Neighbor; typedef typename M::EOType EOT; moMoveNeighborhood(moMoveInit& i, moNextMove& n):_init(i), _next(n), isContinue(true) {} virtual bool hasNeighbor(EOT & solution) { return true; } /* initialisation of the neighborhood */ virtual void init(EOT & solution, Neighbor & current) { _init(*(current._move), solution); isContinue=true; } /* Give the next neighbor */ virtual void next(EOT & solution, Neighbor & current) { isContinue=_next(*(current._move), solution); } /* if false, there is no neighbor left to explore */ virtual bool cont(EOT & solution) { return isContinue; } /** Return the class id. * @return the class name as a std::string */ virtual std::string className() const { return "moMoveNeighborhood"; } private: moMoveInit& _init; moNextMove& _next; bool isContinue; }; #endif