Public Types | Public Member Functions | Protected Attributes

mets::abstract_search< move_manager_type > Class Template Reference
[Common components]

An abstract search. More...

#include <abstract-search.hh>

Inheritance diagram for mets::abstract_search< move_manager_type >:
Inheritance graph
[legend]
Collaboration diagram for mets::abstract_search< move_manager_type >:
Collaboration graph
[legend]

List of all members.

Public Types

enum  {
  MOVE_MADE = 0, IMPROVEMENT_MADE, ITERATION_BEGIN, ITERATION_END,
  LAST
}

Public Member Functions

 abstract_search (feasible_solution &working, solution_recorder &recorder, move_manager_type &moveman)
 Set some common values needed for neighborhood based metaheuristics.
 abstract_search (const abstract_search< move_manager_type > &)
 purposely not implemented (see Effective C++)
abstract_searchoperator== (const abstract_search< move_manager_type > &)
 purposely not implemented (see Effective C++)
virtual ~abstract_search ()
 Virtual destructor.
virtual void search ()=0 throw (no_moves_error)
 This method starts the search.
const solution_recorderrecorder () const
 The solution recorder instance.
const feasible_solutionworking () const
 The current working solution.
feasible_solutionworking ()
const movecurrent_move () const
 The last move made.
movecurrent_move ()
 The last move made.
const move_manager_type & move_manager () const
 The move manager used by this search.
move_manager_type & move_manager ()
 The move manager used by this search.
int step () const
 The current step of the algorithm (to be used by the observers).

Protected Attributes

solution_recordersolution_recorder_m
feasible_solutionworking_solution_m
move_manager_type & moves_m
move_manager_type::iterator current_move_m
int step_m

Detailed Description

template<typename move_manager_type>
class mets::abstract_search< move_manager_type >

An abstract search.

See also:
mets::tabu_search, mets::simulated_annealing, mets::local_search

Member Enumeration Documentation

template<typename move_manager_type >
anonymous enum
Enumerator:
MOVE_MADE 

We just made a move.

IMPROVEMENT_MADE 

Our solution_recorder_chain object reported an improvement.

ITERATION_BEGIN 

We are about to start a new iteration.

ITERATION_END 

We have done the iteration.

LAST 

Placeholer for next values.


Constructor & Destructor Documentation

template<typename move_manager_type >
mets::abstract_search< move_manager_type >::abstract_search ( feasible_solution working,
solution_recorder recorder,
move_manager_type &  moveman 
) [inline]

Set some common values needed for neighborhood based metaheuristics.

Parameters:
working The starting point solution (this will be modified during search as the working solution)
recorder A solution recorder instance used to record the best solution found
moveman A problem specific implementation of the move_manager_type used to generate the neighborhood.

Member Function Documentation

template<typename move_manager_type >
virtual void mets::abstract_search< move_manager_type >::search (  )  throw (no_moves_error) [pure virtual]

This method starts the search.

Remember that this is a minimization.

An exception mets::no_moves_error can be risen when no move is possible.

Implemented in mets::local_search< move_manager_type >, mets::simulated_annealing< move_manager_type >, and mets::tabu_search< move_manager_type >.

template<typename move_manager_type >
int mets::abstract_search< move_manager_type >::step (  )  const [inline]

The current step of the algorithm (to be used by the observers).

When you implement a new type of search you should set step_m protected variable to the status of the algorithm (0 = "MOVE_MADE", 1 = "IMPROVEMENT_MADE", etc.).


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

Return to METSlib home page