mets::complex_mana_move Class Reference
[Model]

#include <mets.h>

Inheritance diagram for mets::complex_mana_move:

Inheritance graph
[legend]
Collaboration diagram for mets::complex_mana_move:

Collaboration graph
[legend]
List of all members.

Detailed Description

A complex move.

A complex move is made of 2 or more moves of some type. Moves are applyed in order and unapplied in reverse order.

Tip: construct the defaut instance, than add the moves you wish with the add method.


Public Member Functions

 complex_mana_move (int n=0)
 Construct a complex move (preallocate space for moves).
 complex_mana_move (const complex_mana_move &o)
 Copy ctor, clones all the included moves.
 ~complex_mana_move ()
 Dtor.
void push_back (mana_move *m)
 Append a new move to the list.
size_t size () const
 Returns the number of attached moves.
mana_move *& operator[] (unsigned int ii)
 Returns the pointer to the ii-th move.
const mana_moveoperator[] (unsigned int ii) const
 Returns a const pointer to the ii-th move.
void apply (mets::feasible_solution &s)
 Applies all the moves at once.
void unapply (mets::feasible_solution &s)
 Unapplies all the moves at once (in reverse order).
mana_moveclone () const
 Clone this complex move (cloning all the included moves).
size_t hash () const
 Create an hash number xoring the hashes of the included moves.
bool operator== (const mana_move &o) const
 Compare two mets::complex_mana_moves for equality.

Protected Types

typedef std::vector< mets::mana_move * > move_list_t

Protected Attributes

move_list_t moves_m


Constructor & Destructor Documentation

mets::complex_mana_move::complex_mana_move ( int  n = 0  )  [inline, explicit]

Construct a complex move (preallocate space for moves).

Parameters:
n Number of preallocated moves

mets::complex_mana_move::complex_mana_move ( const complex_mana_move o  )  [inline]

Copy ctor, clones all the included moves.

NB: before copying a complex_mana_move be sure to have assigned valid moves to each slot.


Member Function Documentation

void mets::complex_mana_move::apply ( mets::feasible_solution s  )  [inline, virtual]

Applies all the moves at once.

If there is one not assigned move (you give 3 to the constructor, but assign only two moves, or you give != 0 to the costructor and then add moves only with the push_back) a segfault will alert you. No check is made for performance reason, be sure to have all valid moves.

Implements mets::move.

mana_move*& mets::complex_mana_move::operator[] ( unsigned int  ii  )  [inline]

Returns the pointer to the ii-th move.

The pointer is returned by reference so that one can assign a new instance to it. Be sure to delete the previous pointer, if it's not null.

void mets::complex_mana_move::push_back ( mana_move m  )  [inline]

Append a new move to the list.

Enlarges the move list and assigns a copy of the given move to the last position.

Parameters:
m A pointer to the mets::mana_move to be added

void mets::complex_mana_move::unapply ( mets::feasible_solution s  )  [inline, virtual]

Unapplies all the moves at once (in reverse order).

If there is one not assigned move (you give 3 to the constructor, but assign only two moves, or you give != 0 to the costructor and then add moves only with the push_back) a segfault will alert you. No check is made for performance reason, be sure to have all valid moves.

Implements mets::move.


The documentation for this class was generated from the following file:

Return to METSlib home page