Assignment Search Framework
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
TransitionSystem< state_t, action_t > Class Template Referenceabstract

Public Member Functions

 TransitionSystem ()
 
virtual ~TransitionSystem ()
 
virtual bool isApplicable (const state_t &state, const action_t &action) const
 
virtual bool isChildState (const state_t &parent, const state_t &child) const
 
virtual double getActionCost (const state_t &state, const action_t &action) const =0
 
virtual void applyAction (state_t &state, const action_t &action) const =0
 
virtual void getActions (const state_t &state, std::vector< action_t > &actions) const =0
 
virtual void getSuccessors (const state_t &state, std::vector< state_t > &children) const
 
virtual bool isInvertible (const state_t &state, const action_t &action) const
 
virtual action_t getInverse (const state_t &state, const action_t &action) const
 
virtual action_t getDummyAction () const =0
 
virtual bool isDummyAction (const action_t &action) const =0
 
bool applyActionSequence (state_t &state, const std::vector< action_t > &actions) const
 
bool isApplicableSequence (const state_t &state, const std::vector< action_t > &actions) const
 

Detailed Description

template<class state_t, class action_t>
class TransitionSystem< state_t, action_t >

An abstract class defining the way transition systems are to be applied.

Todo:
Add debug mode?

Constructor & Destructor Documentation

template<class state_t , class action_t >
TransitionSystem< state_t, action_t >::TransitionSystem ( )

Constructor for the abstract transition system class. Abstract constructor is empty.

template<class state_t , class action_t >
TransitionSystem< state_t, action_t >::~TransitionSystem ( )
virtual

Destructor for the abstract transition system class. Abstract destructor is empty.

Member Function Documentation

template<class state_t, class action_t>
virtual void TransitionSystem< state_t, action_t >::applyAction ( state_t &  state,
const action_t &  action 
) const
pure virtual

Applies the given action to the given state.

Assumes the given action is applicable in the given state.

Parameters
stateThe state to update.
actionThe action to apply.

Implemented in TilePuzzleTransitions, and MapPathfindingTransitions.

template<class state_t, class action_t>
bool TransitionSystem< state_t, action_t >::applyActionSequence ( state_t &  state,
const std::vector< action_t > &  actions 
) const

Applies the given sequence of actions to the given state.

Returns false if the sequence is not entirely applicable. The state will be left at the point immediately prior to the sequence no longer being applicable.

Parameters
stateThe state to apply the sequence to.
actionsThe sequence of actions to apply.
Returns
If all actions in the sequence could be applied.
template<class state_t, class action_t>
virtual double TransitionSystem< state_t, action_t >::getActionCost ( const state_t &  state,
const action_t &  action 
) const
pure virtual

Returns the cost of applying the given action in the given state.

Assumes the action is actually applicable in that state.

Parameters
stateThe state to apply the action in.
actionThe action to apply.
Returns
The cost of applying the action in the given state.

Implemented in TilePuzzleTransitions, and MapPathfindingTransitions.

template<class state_t, class action_t>
virtual void TransitionSystem< state_t, action_t >::getActions ( const state_t &  state,
std::vector< action_t > &  actions 
) const
pure virtual

Gets the actions applicable in a given state and appends them to the given list.

Parameters
stateThe state to generate actions in.
actionsThe list of actions to append to.

Implemented in TilePuzzleTransitions, and MapPathfindingTransitions.

template<class state_t, class action_t>
virtual action_t TransitionSystem< state_t, action_t >::getDummyAction ( ) const
pure virtual

Returns the dummy action for this domain.

The dummy action should never actually be applicable and is not invertible.

Returns
The domain's dummy action.

Implemented in TilePuzzleTransitions, and MapPathfindingTransitions.

template<class state_t, class action_t>
action_t TransitionSystem< state_t, action_t >::getInverse ( const state_t &  state,
const action_t &  action 
) const
virtual

Returns the inverse of a given action.

If no inverse exists, returns the dummy action.

Parameters
stateThe state the action is being applied in.
actionThe action to invert.
Returns
The inverse of the given action.

Reimplemented in TilePuzzleTransitions, and MapPathfindingTransitions.

template<class state_t, class action_t >
void TransitionSystem< state_t, action_t >::getSuccessors ( const state_t &  state,
std::vector< state_t > &  children 
) const
virtual

Gets the successors of a given state and appends them to the given list.

By default just generates list of applicable actions and generates the corresponding children.

Parameters
stateThe state to generate successors for.
childrenThe list to append the children to.
template<class state_t, class action_t>
bool TransitionSystem< state_t, action_t >::isApplicable ( const state_t &  state,
const action_t &  action 
) const
virtual

Checks if the action is applicable in the given state.

Parameters
stateThe state in the domain.
actionThe action to test for applicability.
Returns
If the given action is applicable in the given state.

Reimplemented in TilePuzzleTransitions, and MapPathfindingTransitions.

template<class state_t, class action_t>
bool TransitionSystem< state_t, action_t >::isApplicableSequence ( const state_t &  state,
const std::vector< action_t > &  actions 
) const

Checks if the given sequence of actions is applicable to the given state.

Parameters
stateThe state to try the sequence on.
actionsThe sequence of actions to test.
Returns
If the actions can be applied sequentially on the given state.
template<class state_t, class action_t >
bool TransitionSystem< state_t, action_t >::isChildState ( const state_t &  parent,
const state_t &  child 
) const
virtual

Checks if the given states are adjacent.

Parameters
parentThe potential parent state.
childThe potential child state.
Returns
If the given child state is adjacent to the given child state.
template<class state_t, class action_t>
virtual bool TransitionSystem< state_t, action_t >::isDummyAction ( const action_t &  action) const
pure virtual

Checks if the given action is the dummy action for this domain.

Parameters
actionThe action to check.
Returns
If the given action is the dummy action.

Implemented in TilePuzzleTransitions, and MapPathfindingTransitions.

template<class state_t, class action_t>
bool TransitionSystem< state_t, action_t >::isInvertible ( const state_t &  state,
const action_t &  action 
) const
virtual

Checks if the given action is invertible in the given state.

Assumes the action is either the dummy action, or is applicable in the given state.

Parameters
stateThe state the action is being applied in.
actionThe action to check.
Returns
If the action is invertible.

Reimplemented in TilePuzzleTransitions, and MapPathfindingTransitions.


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