EasyLocal++ Documentation


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

easylocal::NeighborhoodExplorer Class Template Reference

#include <EasyLocal.h>

Collaboration diagram for easylocal::NeighborhoodExplorer:

Collaboration graph
[legend]
List of all members.

Public Methods

Protected Methods

Protected Attributes


Detailed Description

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

The Neighborhood Explorer is responsible for the strategy exploited in the exploration of the neighborhood, and for computing the variations of the cost function due to a specific Move.

Definition at line 332 of file EasyLocal.h.


Constructor & Destructor Documentation

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

Virtual destructor.

Definition at line 336 of file EasyLocal.h.

template<class Input, class State, class Move>
easylocal::NeighborhoodExplorer< Input, State, Move >::NeighborhoodExplorer<Input, State, Move> ( StateManager< Input, State > * sm,
Input * in = NULL ) [protected]
 

Constructs a neighborhood explorer passing a pointer to a state manager and a pointer to the input.

Parameters:
sm   a pointer to a compatible state manager
in   a pointer to an input object

Definition at line 375 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
easylocal::NeighborhoodExplorer< Input, State, Move >::NeighborhoodExplorer<Input, State, Move> ( StateManager< Input, State > * sm,
ProhibitionManager< Move > * pm,
Input * in = NULL ) [protected]
 

Constructs a neighborhood explorer which has a prohibition manager too. It accepts a pointer to a state manager, a pointer to the prohibition manager, and a pointer to the input.

Parameters:
sm   a pointer to a compatible state manager
pm   a pointer to a compatible prohibition manager
in   a pointer to an input object

Definition at line 389 of file EasyLocalTemplates.cpp.


Member Function Documentation

template<class Input, class State, class Move>
fvalue easylocal::NeighborhoodExplorer< Input, State, Move >::BestMove ( const State & st,
Move & mv ) [virtual]
 

Looks for the best move in the exploration of the neighborhood of a given state. (i.e., the one that gives the best improvement in the cost function).

Parameters:
st   the state
mv   the best move in the state st
Returns:
the cost of move mv

Definition at line 427 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
fvalue easylocal::NeighborhoodExplorer< Input, State, Move >::BestNonProhibitedMove ( const State & st,
Move & mv,
fvalue curr,
fvalue best ) [virtual]
 

Looks for the best move in a given state that is non prohibited.

Parameters:
st   the state
mv   the best non prohibited move in st
curr   the cost of the state st
best   the cost of the best state found so far
Returns:
the cost of the move mv

Definition at line 547 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer< Input, State, Move >::Check ( )
 

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

Definition at line 674 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
fvalue easylocal::NeighborhoodExplorer< Input, State, Move >::DeltaCostFunction ( const State & st,
const Move & mv ) [virtual]
 

Evaluates the variation of the cost function obtainted by applying the move to the given state. The tentative definition computes a weighted sum of the variation of the violations function and of the difference in the objective function.

Parameters:
st   the start state
mv   the move
Returns:
the variation in the cost function

Definition at line 404 of file EasyLocalTemplates.cpp.

Referenced by BestMove(), BestNonProhibitedMove(), NeighborhoodStatistics(), PrintMoveInfo(), SampleMove(), and SampleNonProhibitedMove().

template<class Input, class State, class Move>
fvalue easylocal::NeighborhoodExplorer< Input, State, Move >::DeltaObjective ( const State & st,
const Move & mv ) [protected, virtual]
 

Evaluates the variation of the objective function obtained by performing a move in a given state. The tentative definition simply makes the move and invokes the companion StateManager method (Objective) on the initial and on the final state.

Parameters:
st   the state
mv   the move to evaluate
Returns:
the difference in the objective function induced by the move mv

Definition at line 708 of file EasyLocalTemplates.cpp.

Referenced by DeltaCostFunction(), and PrintMoveInfo().

template<class Input, class State, class Move>
fvalue easylocal::NeighborhoodExplorer< Input, State, Move >::DeltaViolations ( const State & st,
const Move & mv ) [protected, virtual]
 

Evaluates the variation of the violations function obtained by performing a move in a given state. The tentative definition simply makes the move and invokes the companion StateManager method (Violations) on the initial and on the final state.

Parameters:
st   the state
mv   the move to evaluate
Returns:
the difference in the violations function induced by the move mv

Definition at line 689 of file EasyLocalTemplates.cpp.

Referenced by DeltaCostFunction(), and PrintMoveInfo().

template<class Input, class State, class Move>
bool easylocal::NeighborhoodExplorer<Input, State, Move>::FeasibleMove ( const State & st,
const Move mv ) [inline, virtual]
 

States whether a move is feasible or not in a given state. For default it acceptsall the moves as feasible ones, but it can be overwritten by the user.

Parameters:
st   the start state
mv   the move to check for feasibility
Returns:
true if the move is feasible in st, false otherwise

Definition at line 371 of file EasyLocal.h.

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer< Input, State, Move >::FirstMove ( const State & st,
Move & mv ) [virtual]
 

Generates the first move in the exploration of the neighborhood of a given state. By default, it invokes the RandomMove function and records mv as start move.

Parameters:
st   the state

Definition at line 498 of file EasyLocalTemplates.cpp.

Referenced by BestMove(), BestNonProhibitedMove(), and NeighborhoodStatistics().

template<class Input, class State, class Move>
Input * easylocal::NeighborhoodExplorer< Input, State, Move >::GetInput ( )
 

Returns the input pointer which the object is attached to.

Returns:
the pointer to the input.

Definition at line 666 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer<Input, State, Move>::InputMove ( const State & st,
Move & mv,
std::istream & is = std::cin ) const [inline, virtual]
 

Prompts for reading a move in the neighborhood of a given state from an input stream.

Parameters:
st   the start state
mv   the move read from the input stream
is   the input stream

Definition at line 399 of file EasyLocal.h.

template<class Input, class State, class Move>
bool easylocal::NeighborhoodExplorer< Input, State, Move >::LastMoveDone ( const Move & mv ) [virtual]
 

Checks whether the whole neighborhood has been explored. The tentative definition verifies is the move passed as parameter coincides with the start move.

Parameters:
mv   the move to check
Returns:
true if the whole neighborhood has been explored, false otherwise

Definition at line 724 of file EasyLocalTemplates.cpp.

Referenced by BestMove(), BestNonProhibitedMove(), and NeighborhoodStatistics().

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer<Input, State, Move>::MakeMove ( State & st,
const Move & mv ) [pure virtual]
 

Modifies the state passed as parameter by applying a given move upon it.

Note:
@bf To be implemented in the application.
Parameters:
st   the state to modify
mv   the move to be applied

Referenced by DeltaObjective(), DeltaViolations(), and PrintMoveInfo().

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer< Input, State, Move >::NeighborhoodStatistics ( const State & st ) [virtual]
 

Outputs some statistics about the neighborhood of the given state. In detail it prints out the number of neighbors, the number of improving/non-improving/worsening moves and their percentages.

Parameters:
st   the state to inspect

Definition at line 459 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer<Input, State, Move>::NextMove ( const State & st,
Move & mv ) [pure virtual]
 

Generates the move that follows mv in the exploration of the neighborhood of the state st. It returns the generated move in the same variable mv.

Note:
@bf To be implemented in the application.
Parameters:
st   the start state
mv   the move

Referenced by BestMove(), BestNonProhibitedMove(), and NeighborhoodStatistics().

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer< Input, State, Move >::PrintMoveInfo ( const State & st,
const Move & mv,
std::ostream & os = std::cout )
 

Outputs some informations about a move in a given state on a stream.

Parameters:
st   the state
mv   the move
os   an output stream

Definition at line 631 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer<Input, State, Move>::RandomMove ( const State & st,
Move & mv ) [pure virtual]
 

Generates a random move in the neighborhood of a given state.

Note:
@bf To be implemented in the application.
Parameters:
st   the start state
mv   the generated move

Referenced by FirstMove(), SampleMove(), and SampleNonProhibitedMove().

template<class Input, class State, class Move>
fvalue easylocal::NeighborhoodExplorer< Input, State, Move >::SampleMove ( const State & st,
Move & mv,
int samples ) [virtual]
 

Returns the best move found out of a number of sampled moves from a given state.

Parameters:
st   the state
mv   the best move found
samples   the number of sampled moves
Returns:
the cost of the move mv

Definition at line 514 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
fvalue easylocal::NeighborhoodExplorer< Input, State, Move >::SampleNonProhibitedMove ( const State & st,
Move & mv,
int samples,
fvalue curr,
fvalue best ) [virtual]
 

Returns the best non prohibited move found out of a number of sampled moves from a given state.

Parameters:
st   the state
mv   the best non prohibited move found
samples   the number of sampled moves
curr   the cost of the state st
best   the cost of the best state found so far
Returns:
the cost of the move mv

Definition at line 590 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer< Input, State, Move >::SetInput ( Input * in )
 

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

Parameters:
in   the new input.

Definition at line 657 of file EasyLocalTemplates.cpp.

template<class Input, class State, class Move>
void easylocal::NeighborhoodExplorer< Input, State, Move >::SetProhibitionManager ( ProhibitionManager< Move > * pm ) [virtual]
 

Sets the prohibition manager to the value passed as input.

Parameters:
pm   a pointer to a prohibition manager

Definition at line 413 of file EasyLocalTemplates.cpp.


Member Data Documentation

template<class Input, class State, class Move>
Move easylocal::NeighborhoodExplorer<Input, State, Move>::best_move [protected]
 

The best move found in the exploration of the neighborhood (used from the neighborhood enumerating functions such as BestMove).

Definition at line 415 of file EasyLocal.h.

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

A pointer to the input object.

Definition at line 410 of file EasyLocal.h.

template<class Input, class State, class Move>
ProhibitionManager< Move > * easylocal::NeighborhoodExplorer<Input, State, Move>::p_pm [protected]
 

A pointer to the attached prohibition manager (used in case of memory based strategy.

Definition at line 422 of file EasyLocal.h.

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

A pointer to the attached state manager.

Definition at line 408 of file EasyLocal.h.

template<class Input, class State, class Move>
Move easylocal::NeighborhoodExplorer<Input, State, Move>::start_move [protected]
 

The start move in the exploration of the neighborhood.

Definition at line 419 of file EasyLocal.h.


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