A neighborhood generator. More...
#include <model.hh>
Public Types | |
typedef std::deque< move * > ::iterator | iterator |
Iterator type to iterate over moves of the neighborhood. | |
typedef std::deque< move * > ::size_type | size_type |
Size type. | |
Public Member Functions | |
iterator | begin () |
Begin iterator of available moves queue. | |
iterator | end () |
End iterator of available moves queue. | |
move_manager () | |
Initialize the move manager with an empty list of moves. | |
virtual void | refresh (mets::feasible_solution &s)=0 |
Selects a different set of moves at each iteration. | |
size_type | size () const |
Size of the neighborhood. | |
virtual | ~move_manager () |
Virtual destructor. | |
Protected Member Functions | |
move_manager (const move_manager &) | |
Protected Attributes | |
std::deque< move * > | moves_m |
The moves queue. |
A neighborhood generator.
This is a sample implementation of the neighborhood exploration concept. You can still derive from this class and implement the refresh method, but, since version 0.5.x you don't need to.
To implement your own move manager you should simply adhere to the following concept:
provide an iterator, and size_type types, a begin() and end() method returning iterators to a move collection. The switch to a template based move_manager was made so that you can use any iterator type that you want. This allows, between other things, to implement intelligent iterators that dynamically return moves.
The move manager can represent both Variable and Constant Neighborhoods.
To make a constant neighborhood put moves in the moves_m queue in the constructor and implement an empty void refresh(feasible_solution&)
method.
typedef std::deque<move*>::iterator mets::move_manager::iterator |
typedef std::deque<move*>::size_type mets::move_manager::size_type |
mets::move_manager::move_manager | ( | ) | [inline] |
virtual mets::move_manager::~move_manager | ( | ) | [inline, virtual] |
mets::move_manager::move_manager | ( | const move_manager & | ) | [protected] |
iterator mets::move_manager::begin | ( | ) | [inline] |
iterator mets::move_manager::end | ( | ) | [inline] |
virtual void mets::move_manager::refresh | ( | mets::feasible_solution & | s | ) | [pure virtual] |
Selects a different set of moves at each iteration.
Implemented in mets::invert_full_neighborhood, mets::swap_full_neighborhood, and mets::swap_neighborhood< random_generator >.
size_type mets::move_manager::size | ( | ) | const [inline] |
std::deque<move*> mets::move_manager::moves_m [protected] |