EasyLocal++ Documentation


 
Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

easylocal::MoveRunner Class Template Reference

#include <EasyLocal.h>

Inheritance diagram for easylocal::MoveRunner

Inheritance graph
[legend]
Collaboration diagram for easylocal::MoveRunner:

Collaboration graph
[legend]
List of all members.

Public Methods

Protected Methods

Protected Attributes


Detailed Description

template<class Input, class State, class Move> class easylocal::MoveRunner

A Move Runner is an instance of the Runner interface which it compel with a particular definition of @Move (given as template instantiation). It is at the root of the inheritance hierarchy of actual runners.

Definition at line 564 of file EasyLocal.h.


Constructor & Destructor Documentation

template<class Input, class State, class Move>
easylocal::MoveRunner<Input, State, Move>::~MoveRunner<Input, State, Move> ( ) [inline, virtual]
 

Virtual destructor.

Definition at line 568 of file EasyLocal.h.

template<class Input, class State, class Move>
easylocal::MoveRunner< Input, State, Move >::MoveRunner<Input, State, Move> ( StateManager< Input, State > * sm,
NeighborhoodExplorer< Input, State, Move > * ne,
Input * in = NULL,
std::string name = "Runner name",
std::string type = "Move Runner" ) [protected]
 

Creates a move runner and links it to a given state manager, neighborhood explorer and input objects. In addition, it sets its name and type to the given values.

Parameters:
sm   a pointer to a compatible state manager
ne   a pointer to a compatible neighborhood explorer
in   a pointer to the input object
name   the name of the runner
type   the type of the runner

Definition at line 779 of file EasyLocalTemplates.cpp.


Member Function Documentation

template<class Input, class State, class Move>
bool easylocal::MoveRunner< Input, State, Move >::AcceptableMove ( ) [protected, virtual]
 

Checks whether the selected move can be performed. Its tentative definition simply returns true

Reimplemented in easylocal::SteepestDescent, easylocal::HillClimbing, easylocal::TabuSearch, and easylocal::SimulatedAnnealing.

Definition at line 1054 of file EasyLocalTemplates.cpp.

Referenced by Go(), and Step().

template<class Input, class State, class Move>
fvalue easylocal::MoveRunner< Input, State, Move >::BestStateCost ( ) [virtual]
 

Returns the cost of the best state found so far by the runner.

Returns:
the cost of the best state found

Reimplemented from easylocal::Runner.

Definition at line 880 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::Check ( ) [virtual]
 

Checks wether the object state is consistent with all the related objects.

Reimplemented from easylocal::Runner.

Definition at line 826 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::ComputeCost ( ) [virtual]
 

Computes explicitely the cost of the current state (used at the beginning of a run for consistency purpose).

Reimplemented from easylocal::Runner.

Definition at line 888 of file EasyLocalTemplates.cpp.

Referenced by InitializeRun().

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::ComputeMoveCost ( ) [protected, virtual]
 

Computes the cost of the selected move; it delegates this task to the neighborhood explorer.

Definition at line 1028 of file EasyLocalTemplates.cpp.

Referenced by easylocal::SimulatedAnnealing::SelectMove(), and easylocal::HillClimbing::SelectMove().

template<class Input, class State, class Move>
fvalue easylocal::MoveRunner< Input, State, Move >::CurrentStateCost ( ) [virtual]
 

Returns the cost of the internal state.

Returns:
the cost of the current state

Reimplemented from easylocal::Runner.

Definition at line 862 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
State easylocal::MoveRunner< Input, State, Move >::GetBestState ( ) [virtual]
 

Returns the best state found so far by the runner.

Returns:
the best state found

Reimplemented from easylocal::Runner.

Definition at line 871 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
State easylocal::MoveRunner< Input, State, Move >::GetCurrentState ( ) [virtual]
 

Retrieves the internal state of the runner.

Returns:
the current state of the runner

Reimplemented from easylocal::Runner.

Definition at line 853 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
Input * easylocal::MoveRunner< Input, State, Move >::GetInput ( ) [virtual]
 

Returns the input pointer which the object is attached to.

Returns:
the pointer to the input.

Reimplemented from easylocal::Runner.

Definition at line 809 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::Go ( ) [virtual]
 

Performs a full run of a local search method.

Reimplemented from easylocal::Runner.

Definition at line 942 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::InitializeRun ( ) [protected, virtual]
 

Initializes all the runner variable for starting a new run.

Reimplemented in easylocal::SteepestDescent, easylocal::HillClimbing, easylocal::TabuSearch, and easylocal::SimulatedAnnealing.

Definition at line 1068 of file EasyLocalTemplates.cpp.

Referenced by Go().

template<class Input, class State, class Move>
bool easylocal::MoveRunner< Input, State, Move >::LowerBoundReached ( ) [virtual]
 

Checks whether the lower bound of the cost function has been reached. The tentative definition verifies whether the current state cost is equal to zero.

Reimplemented from easylocal::Runner.

Definition at line 897 of file EasyLocalTemplates.cpp.

Referenced by Go(), and Step().

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::MakeMove ( ) [protected, virtual]
 

Actually performs the move selected by the local search strategy.

Definition at line 967 of file EasyLocalTemplates.cpp.

Referenced by Go(), and Step().

template<class Input, class State, class Move>
unsigned long easylocal::MoveRunner< Input, State, Move >::MaxIteration ( ) const
 

Returns the maximum value of iterations allowed for the runner.

Returns:
the maximum value of iterations allowed

Definition at line 915 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
bool easylocal::MoveRunner< Input, State, Move >::MaxIterationExpired ( ) [protected]
 

Verifies whether the upper bound on the number of iterations allowed for the strategy has been reached.

Returns:
true if the maximum number of iteration has been reached, false otherwise

Definition at line 1046 of file EasyLocalTemplates.cpp.

Referenced by Go().

template<class Input, class State, class Move>
unsigned long easylocal::MoveRunner< Input, State, Move >::NumberOfIterations ( ) const [virtual]
 

Returns the number of iterations elapsed.

Returns:
the number of iterations performed by the runner

Reimplemented from easylocal::Runner.

Definition at line 906 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::Print ( std::ostream & os = std::cout ) const [virtual]
 

Outputs the name of the runner on a given output stream.

Parameters:
os   the output stream

Reimplemented from easylocal::Runner.

Reimplemented in easylocal::SteepestDescent, easylocal::HillClimbing, easylocal::TabuSearch, and easylocal::SimulatedAnnealing.

Definition at line 818 of file EasyLocalTemplates.cpp.

Referenced by Go().

template<class Input, class State, class Move>
void easylocal::MoveRunner<Input, State, Move>::SelectMove ( ) [protected, pure virtual]
 

Encodes the criterion used to select the move at each step.

Reimplemented in easylocal::SteepestDescent, easylocal::HillClimbing, easylocal::TabuSearch, and easylocal::SimulatedAnnealing.

Referenced by Go(), and Step().

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::SetCurrentState ( const State & s ) [virtual]
 

Sets the internal state of the runner to the value passed as parameter.

Parameters:
s   the state to become the current state of the runner

Reimplemented from easylocal::Runner.

Definition at line 840 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::SetInput ( Input * in ) [virtual]
 

Sets the internal input pointer to the new value passed as parameter.

Parameters:
in   the new input.

Reimplemented from easylocal::Runner.

Reimplemented in easylocal::TabuSearch.

Definition at line 795 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::SetMaxIteration ( unsigned long max )
 

Sets a bound on the maximum number of iterations allowed for the runner.

Parameters:
max   the maximum number of iterations allowed

Definition at line 923 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::SetParameters ( const ParameterBox & pb ) [virtual]
 

Sets the runner parameters, passed through a parameter box.

Parameters:
pb   the object containing the parameter setting for the algorithm

Reimplemented from easylocal::Runner.

Reimplemented in easylocal::TabuSearch, and easylocal::SimulatedAnnealing.

Definition at line 932 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::MoveRunner<Input, State, Move>::SetPlotStream ( std::ostream * os = &std::cerr ) [inline]
 

Sets the output stream which is used to write the plot of the cost function during a run.

Parameters:
os   the output stream to use (cerr for default).

Definition at line 589 of file EasyLocal.h.

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::Step ( unsigned int n ) [virtual]
 

Performs a given number of steps of the local search strategy.

Parameters:
n   the number of steps

Reimplemented from easylocal::Runner.

Definition at line 1006 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
bool easylocal::MoveRunner<Input, State, Move>::StopCriterion ( ) [protected, pure virtual]
 

Encodes the criterion used to stop the search.

Reimplemented in easylocal::SteepestDescent, easylocal::HillClimbing, easylocal::TabuSearch, and easylocal::SimulatedAnnealing.

Referenced by Go().

template<class Input, class State, class Move>
void easylocal::MoveRunner<Input, State, Move>::StoreMove ( ) [inline, protected, virtual]
 

Stores the move and updates the related data.

Reimplemented in easylocal::HillClimbing, and easylocal::TabuSearch.

Definition at line 609 of file EasyLocal.h.

Referenced by Go(), and Step().

template<class Input, class State, class Move>
void easylocal::MoveRunner<Input, State, Move>::TerminateRun ( ) [inline, protected, virtual]
 

Actions to be performed at the end of the run.

Reimplemented in easylocal::SteepestDescent, easylocal::HillClimbing, and easylocal::SimulatedAnnealing.

Definition at line 598 of file EasyLocal.h.

Referenced by Go().

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::UpdateIterationCounter ( ) [protected, virtual]
 

Updates the counter that tracks the number of iterations elapsed.

Reimplemented in easylocal::SimulatedAnnealing.

Definition at line 1035 of file EasyLocalTemplates.cpp.

Referenced by Go(), and Step().

template<class Input, class State, class Move>
void easylocal::MoveRunner< Input, State, Move >::UpdateStateCost ( ) [protected, virtual]
 

Updates the cost of the internal state of the runner.

Definition at line 1061 of file EasyLocalTemplates.cpp.

Referenced by Go(), and Step().


Member Data Documentation

template<class Input, class State, class Move>
State easylocal::MoveRunner<Input, State, Move>::best_state [protected]
 

The best state object.

Definition at line 630 of file EasyLocal.h.

template<class Input, class State, class Move>
fvalue easylocal::MoveRunner<Input, State, Move>::best_state_cost [protected]
 

The cost of the best state.

Definition at line 631 of file EasyLocal.h.

template<class Input, class State, class Move>
Move easylocal::MoveRunner<Input, State, Move>::current_move [protected]
 

The currently selected move.

Definition at line 627 of file EasyLocal.h.

template<class Input, class State, class Move>
fvalue easylocal::MoveRunner<Input, State, Move>::current_move_cost [protected]
 

The cost of the selected move.

Definition at line 628 of file EasyLocal.h.

template<class Input, class State, class Move>
State easylocal::MoveRunner<Input, State, Move>::current_state [protected]
 

The current state object.

Definition at line 623 of file EasyLocal.h.

template<class Input, class State, class Move>
fvalue easylocal::MoveRunner<Input, State, Move>::current_state_cost [protected]
 

The cost of the current state.

Definition at line 624 of file EasyLocal.h.

template<class Input, class State, class Move>
bool easylocal::MoveRunner<Input, State, Move>::current_state_set [protected]
 

A flag that whether the current state is set. It is so until a new input is given.

Definition at line 625 of file EasyLocal.h.

template<class Input, class State, class Move>
unsigned long easylocal::MoveRunner<Input, State, Move>::iteration_of_best [protected]
 

The iteration when the best state has found.

Definition at line 633 of file EasyLocal.h.

template<class Input, class State, class Move>
unsigned long easylocal::MoveRunner<Input, State, Move>::max_idle_iteration [protected]
 

The maximum number of iterations allowed since the best state has been found.

Definition at line 635 of file EasyLocal.h.

template<class Input, class State, class Move>
unsigned long easylocal::MoveRunner<Input, State, Move>::max_iteration [protected]
 

The overall maximum number of iterations allowed.

Definition at line 641 of file EasyLocal.h.

template<class Input, class State, class Move>
unsigned long easylocal::MoveRunner<Input, State, Move>::number_of_iterations [protected]
 

The overall number of iterations performed.

Definition at line 639 of file EasyLocal.h.

template<class Input, class State, class Move>
Input * easylocal::MoveRunner<Input, State, Move>::p_in [protected]
 

A pointer to the input object.

Definition at line 613 of file EasyLocal.h.

template<class Input, class State, class Move>
NeighborhoodExplorer< Input, State, Move > * easylocal::MoveRunner<Input, State, Move>::p_nhe [protected]
 

A pointer to the attached neighborhood explorer.

Definition at line 618 of file EasyLocal.h.

template<class Input, class State, class Move>
StateManager< Input, State > * easylocal::MoveRunner<Input, State, Move>::p_sm [protected]
 

A pointer to the attached state manager.

Definition at line 616 of file EasyLocal.h.

template<class Input, class State, class Move>
std::ostream * easylocal::MoveRunner<Input, State, Move>::pos [protected]
 

The output stream used for plotting.

Definition at line 644 of file EasyLocal.h.


The documentation for this class was generated from the following files:
 
Go to: the Main Page of the documentation.