METSlib  0.6
Public Types | Public Member Functions | Protected Attributes | List of all members
mets::simulated_annealing< move_manager_type > Class Template Reference

Search by Simulated Annealing. More...

#include <simulated-annealing.hh>

Inheritance diagram for mets::simulated_annealing< move_manager_type >:
Inheritance graph
Collaboration diagram for mets::simulated_annealing< move_manager_type >:
Collaboration graph

Public Types

typedef simulated_annealing
< move_manager_type > 
search_type
 
- Public Types inherited from mets::abstract_search< move_manager_type >
enum  {
  MOVE_MADE = 0, IMPROVEMENT_MADE, ITERATION_BEGIN, ITERATION_END,
  LAST
}
 

Public Member Functions

 simulated_annealing (evaluable_solution &starting_point, solution_recorder &recorder, move_manager_type &moveman, termination_criteria_chain &tc, abstract_cooling_schedule &cs, double starting_temp, double stop_temp=1e-7, double K=1.0)
 Creates a search by simulated annealing instance. More...
 
 simulated_annealing (const simulated_annealing &)
 purposely not implemented (see Effective C++)
 
simulated_annealingoperator= (const simulated_annealing &)
 
virtual void throw (no_moves_error)
 This method starts the simulated annealing search process. More...
 
double current_temp () const
 The current annealing temperature. More...
 
const abstract_cooling_schedulecooling_schedule () const
 The annealing schedule instance. More...
 
- Public Member Functions inherited from mets::abstract_search< move_manager_type >
 abstract_search (feasible_solution &working, solution_recorder &recorder, move_manager_type &moveman)
 Set some common values needed for neighborhood based metaheuristics. More...
 
 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.
 
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). More...
 
- Public Member Functions inherited from mets::subject< abstract_search< move_manager_type > >
virtual void attach (observer< abstract_search< move_manager_type > > &o)
 Attach a new observer to this subject. More...
 
virtual void detach (observer< abstract_search< move_manager_type > > &o)
 Detach a new observer to this subject. More...
 
virtual void notify ()
 Notify all attached observers. More...
 

Protected Attributes

termination_criteria_chaintermination_criteria_m
 
abstract_cooling_schedulecooling_schedule_m
 
double starting_temp_m
 
double stop_temp_m
 
double current_temp_m
 
double K_m
 
std::tr1::uniform_real< double > ureal
 
std::tr1::mt19937 rng
 
std::tr1::variate_generator
< std::tr1::mt19937,
std::tr1::uniform_real< double > > 
gen
 
- Protected Attributes inherited from mets::abstract_search< move_manager_type >
solution_recordersolution_recorder_m
 
feasible_solutionworking_solution_m
 
move_manager_type & moves_m
 
move_manager_type::iterator current_move_m
 
int step_m
 
- Protected Attributes inherited from mets::subject< abstract_search< move_manager_type > >
std::set< observer
< abstract_search
< move_manager_type > > * > 
observers_m
 

Detailed Description

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

Search by Simulated Annealing.

Constructor & Destructor Documentation

template<typename move_manager_type >
mets::simulated_annealing< move_manager_type >::simulated_annealing ( evaluable_solution starting_point,
solution_recorder recorder,
move_manager_type &  moveman,
termination_criteria_chain tc,
abstract_cooling_schedule cs,
double  starting_temp,
double  stop_temp = 1e-7,
double  K = 1.0 
)

Creates a search by simulated annealing instance.

Parameters
workingThe working solution (this will be modified during search).
recorderA solution recorder (possibly holding a different solution instance) used to record the best solution found.
movemanA problem specific implementation of the move_manager_type used to generate the neighborhood (the choice of the neighbourhood and its exploration greatly influences the algorithm quality and speed).
tcThe termination criteria used to terminate the search process, this is an extension to the standard Simulated Annealing: the algorithm terminates either when the termination criterion is met or when the temperature is <= 0.
csThe annealing schedule that will be used by the algorithm to regulate the temperature at each iteration (many have been proposed in literature and influence the quality and speed of the algorithm).
starting_tempThe starting SA temperature (this is an important parameter that depends on the problem and will influence the search quality and duration).
KThe "Boltzmann" constant that we want ot use (default is 1).

Member Function Documentation

template<typename move_manager_type >
const abstract_cooling_schedule& mets::simulated_annealing< move_manager_type >::cooling_schedule ( ) const
inline

The annealing schedule instance.

Returns
The cooling schedule used by this search process.
template<typename move_manager_type >
double mets::simulated_annealing< move_manager_type >::current_temp ( ) const
inline

The current annealing temperature.

Returns
The current temperature of the algorithm.
template<typename move_manager_type >
virtual void mets::simulated_annealing< move_manager_type >::throw ( no_moves_error  )
virtual

This method starts the simulated annealing search process.

Remember that this is a minimization process.

Implements mets::abstract_search< move_manager_type >.


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

Return to METSlib home page