METSlib  0.6
Public Member Functions | Protected Types | Protected Attributes | List of all members
mets::simple_tabu_list Class Reference

Simplistic implementation of a tabu-list. More...

#include <tabu-search.hh>

Inheritance diagram for mets::simple_tabu_list:
Inheritance graph
Collaboration diagram for mets::simple_tabu_list:
Collaboration graph

Public Member Functions

 simple_tabu_list (unsigned int tenure)
 Ctor. Makes a tabu list of the specified tenure. More...
 
 simple_tabu_list (tabu_list_chain *next, unsigned int tenure)
 Ctor. Makes a tabu list of the specified tenure. More...
 
 ~simple_tabu_list ()
 Destructor.
 
void tabu (const feasible_solution &sol, const move &mov)
 Make move a tabu. More...
 
bool is_tabu (const feasible_solution &sol, const move &mov) const
 True if the move is tabu for the given solution. More...
 
- Public Member Functions inherited from mets::tabu_list_chain
 tabu_list_chain (const tabu_list_chain &)
 purposely not implemented (see Effective C++)
 
tabu_list_chainoperator= (const tabu_list_chain &)
 purposely not implemented (see Effective C++)
 
 tabu_list_chain (unsigned int tenure)
 Create an abstract tabu list with a certain tenure.
 
 tabu_list_chain (tabu_list_chain *next, unsigned int tenure)
 Create an abstract tabu list with a certain tenure and a chained tabu list that decorates this one.
 
virtual ~tabu_list_chain ()
 Virtual destructor.
 
virtual unsigned int tenure () const
 Tenure of this tabu list. More...
 
virtual void tenure (unsigned int tenure)
 Tenure of this tabu list. More...
 

Protected Types

typedef std::deque< const move * > move_list_type
 
typedef
std::tr1::unordered_map< const
mana_move *, int,
mana_move_hash,
dereferenced_equal_to< const
mana_move * > > 
move_map_type
 

Protected Attributes

move_list_type tabu_moves_m
 
move_map_type tabu_hash_m
 
- Protected Attributes inherited from mets::tabu_list_chain
tabu_list_chainnext_m
 
unsigned int tenure_m
 

Detailed Description

Simplistic implementation of a tabu-list.

This class implements one of the simplest and less memory hungry tabu lists. This tabu list memorizes only the moves (not the solutions).

Moves must be of mets::mana_move type.

The comparison between moves is demanded to the move implementation.

A mets::mana_move is tabu if it's in the tabu list by means of its operator== and hash function.

Constructor & Destructor Documentation

mets::simple_tabu_list::simple_tabu_list ( unsigned int  tenure)
inline

Ctor. Makes a tabu list of the specified tenure.

Parameters
tenureTenure (length) of the tabu list
mets::simple_tabu_list::simple_tabu_list ( tabu_list_chain next,
unsigned int  tenure 
)
inline

Ctor. Makes a tabu list of the specified tenure.

Parameters
tenureTenure (length) of the tabu list
nextNext list to invoke when this returns false

Member Function Documentation

bool mets::simple_tabu_list::is_tabu ( const feasible_solution sol,
const move mov 
) const
inlinevirtual

True if the move is tabu for the given solution.

This implementation considers tabu each move already made less then tenure() moves ago.

Parameters
solThe current working solution
movThe move to make tabu
Returns
True if this move was already made during the last tenure iterations

Implements mets::tabu_list_chain.

void mets::simple_tabu_list::tabu ( const feasible_solution sol,
const move mov 
)
inlinevirtual

Make move a tabu.

This implementation simply remembers "tenure" moves.

Parameters
solThe current working solution
movThe move to make tabu

Implements mets::tabu_list_chain.


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

Return to METSlib home page