Assignment Search Framework
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
SearchEngine< state_t, action_t > Class Template Referenceabstract
Inheritance diagram for SearchEngine< state_t, action_t >:

Public Member Functions

 SearchEngine ()
 
virtual ~SearchEngine ()
 
void setGoalTest (const GoalTestFunction< state_t > *g)
 
void setTransitionSystem (const TransitionSystem< state_t, action_t > *o)
 
SearchStatus getStatus () const
 
SearchTermType getPlan (const state_t &init_state, std::vector< action_t > &sol_plan)
 
bool foundSolution () const
 
std::vector< action_t > getLastPlan ()
 
double getLastPlanCost ()
 
void setStorageLimit (uint64_t limit)
 
bool hitStorageLimit ()
 
void setHComputeLimit (uint64_t limit)
 
bool hitHCompLimit ()
 
void setSuccCallLimit (uint64_t limit)
 
bool hitSuccFuncLimit ()
 
void setGoalTestLimit (uint64_t limit)
 
bool hitGoalTestLimit ()
 
uint64_t getStorageCount () const
 
uint64_t getHCompCount () const
 
uint64_t getSuccFuncCount () const
 
uint64_t getStateGenCount () const
 
uint64_t getActionGenCount () const
 
uint64_t getGoalTestCount () const
 
virtual void resetStatistics ()
 
virtual void resetEngine ()
 
virtual bool isConfigured () const
 

Protected Member Functions

virtual SearchTermType searchForPlan (const state_t &init_state)=0
 
virtual void incrementGoalTestCount ()
 
virtual void incrementHCompCount ()
 
virtual void incrementSuccFuccCalls ()
 
virtual void incrementStateGenCount ()
 
virtual void increaseActionGenCount (double new_gens)
 

Protected Attributes

const GoalTestFunction< state_t > * goal_test
 The goal test function. More...
 
const TransitionSystem
< state_t, action_t > * 
op_system
 The transition system. More...
 
SearchStatus alg_status
 The current search status. More...
 
bool have_incumbent
 If an incumbent solution is stored or not. More...
 
std::vector< action_t > incumbent_plan
 The last solution found. More...
 
double incumbent_cost
 The cost of the last solution. More...
 
uint64_t storage_limit
 The limit on how many states are stored. 0 for no limit. More...
 
uint64_t storage_count
 The number of states currently being stored. More...
 
uint64_t h_comp_limit
 The limit on how many heuristic computations can be performed. 0 for no limit. More...
 
uint64_t h_comp_count
 The number of heuristic computations during the current search. More...
 
uint64_t succ_func_limit
 The limit on how many successor function calls can be performed. 0 for no limit. More...
 
uint64_t succ_func_count
 The number of heuristic computations made during the current search. More...
 
uint64_t goal_test_limit
 The limit on the number of goal tests. 0 for no limit. More...
 
uint64_t goal_test_count
 The number of goal tests performed during the current search. More...
 
uint64_t state_gen_count
 The number of state generations during the current search. More...
 
uint64_t action_gen_count
 The number of state generations during the current search. More...
 

Detailed Description

template<class state_t, class action_t>
class SearchEngine< state_t, action_t >

Defines a template for a search algorithm.

Constructor & Destructor Documentation

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

Constructor for abstract search engine. Abstract constructor is empty aside from default initializations.

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

Destructor for abstract search engine. Abstract constructor is empty.

Member Function Documentation

template<class state_t , class action_t >
bool SearchEngine< state_t, action_t >::foundSolution ( ) const
inline

Returns if an incumbent solution has been found and is stored.

Returns
If an incumbent solution is stored.
template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::getActionGenCount ( ) const
inline

Gets the number of actions generated during the last search.

Returns
The number of action generations.
template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::getGoalTestCount ( ) const
inline

Gets the number of goal tests performed during the last search.

Returns
The number of goal tests performed.
template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::getHCompCount ( ) const
inline

Returns the number of heuristic computations during the last search.

Returns
The number of heuristic computations.
template<class state_t , class action_t >
std::vector< action_t > SearchEngine< state_t, action_t >::getLastPlan ( )
inline

Returns the last plan found during the last search run.

Returns
The last plan found.
template<class state_t , class action_t >
double SearchEngine< state_t, action_t >::getLastPlanCost ( )
inline

Returns the cost of the last plan found during the last search run.

Negative values should be interpreted as there being no plan.

Returns
The cost of the last plan found.
template<class state_t , class action_t >
SearchTermType SearchEngine< state_t, action_t >::getPlan ( const state_t &  init_state,
std::vector< action_t > &  sol_plan 
)

Given an initial state, finds a plan if one exists.

If no plan exists or was found before a specified resource limit, the returned plan is set to be empty and the reason for the termination is returned. The function also checks to make sure that the engine is ready to search for a plan prior to search beginning.

Parameters
init_stateThe initial state to find a solution from.
sol_planA solution plan, if one exists.
Returns
The reason for termination.
template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::getStateGenCount ( ) const
inline

Gets the number of states generated during the last search.

Returns
The number of state generations.
template<class state_t , class action_t >
SearchStatus SearchEngine< state_t, action_t >::getStatus ( ) const
inline

Gets the current status of the search engine.

Returns
Status of the engine.
template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::getStorageCount ( ) const
inline

Returns the number of states stored during the last search.

Returns
The number of states stored.
template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::getSuccFuncCount ( ) const
inline

Gets the number of calls to the successor or applicable actions function during the last search.

Returns
The number of calls to the successor or applicable actions function.
template<class state_t , class action_t >
bool SearchEngine< state_t, action_t >::hitGoalTestLimit ( )

Returns true if the limit on the number of goal tests has been hit.

Returns
If the limit on goal tests has been hit.
template<class state_t , class action_t >
bool SearchEngine< state_t, action_t >::hitHCompLimit ( )

Returns true if the limit on the number of heuristic computations allowed has been set and reached.

Returns
If the limit on the heuristic computations has been hit.
template<class state_t , class action_t >
bool SearchEngine< state_t, action_t >::hitStorageLimit ( )

Returns true if the limit on number of states being stored has been set and reached.

Returns
If the limit on state storage has been hit.
template<class state_t , class action_t >
bool SearchEngine< state_t, action_t >::hitSuccFuncLimit ( )

Returns true if the limit on the number of successor function calls has been set and reached.

Returns
If the limit on successor function calls has been hit.
template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::increaseActionGenCount ( double  new_gens)
protectedvirtual

Increases the count of the number of actions generated.

Parameters
new_gensThe number of new action generations.
template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::incrementGoalTestCount ( )
protectedvirtual

Increments the count of the number of goal tests performed.

template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::incrementHCompCount ( )
protectedvirtual

Increments the count of the number of heuristic computations performed.

template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::incrementStateGenCount ( )
protectedvirtual

Increments the count of the number of state generations performed.

template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::incrementSuccFuccCalls ( )
protectedvirtual

Increments the count of the number of successor function calls performed.

template<class state_t , class action_t >
bool SearchEngine< state_t, action_t >::isConfigured ( ) const
virtual

Checks if the engine has all elements necessary for search.

Returns
If the engine has all elements it needs for search.

Reimplemented in BestFirstSearch< state_t, action_t >.

template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::resetEngine ( )
virtual

Resets the search engine by resetting the statistics and checking if the engine is ready for the next search.

Reimplemented in BestFirstSearch< state_t, action_t >.

template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::resetStatistics ( )
virtual

Resets the statistics counters.

Reimplemented in BestFirstSearch< state_t, action_t >.

template<class state_t , class action_t >
virtual SearchTermType SearchEngine< state_t, action_t >::searchForPlan ( const state_t &  init_state)
protectedpure virtual

Searches for a plan. Assumes search engine is ready and properly configured.

Parameters
init_stateThe initial state to search from.
Returns
The reason for the termination of the algorithm.

Implemented in BestFirstSearch< state_t, action_t >.

template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::setGoalTest ( const GoalTestFunction< state_t > *  g)

Sets the goal test function to be used by the engine.

Resets the engine whenever this is called.

Parameters
gThe new goal test function.
template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::setGoalTestLimit ( uint64_t  limit)
inline

Sets a limit on the number of goal tests.

The default value of 0 means no limit.

Parameters
limitThe limit on the number of goal tests.
template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::setHComputeLimit ( uint64_t  limit)
inline

Sets a limit on the number of heuristic computations that can be performed.

The default value of 0 means no limit.

Parameters
limitThe limit on the number of heuristic computations performed.
template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::setStorageLimit ( uint64_t  limit)
inline

Sets a limit on the number of states that can be stored at any time.

The default value of 0 means no limit.

Parameters
limitThe limit on state storage.
template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::setSuccCallLimit ( uint64_t  limit)
inline

Sets a limit on the number of calls to the successor (or applicable action) function.

The default value of 0 means no limit.

Parameters
limitThe limit on the number of calls to the successor or applicable action function.
template<class state_t , class action_t >
void SearchEngine< state_t, action_t >::setTransitionSystem ( const TransitionSystem< state_t, action_t > *  o)

Sets the transition system to be used by the engine.

Resets the engine whenever this is called.

Parameters
oThe new transition function.

Member Data Documentation

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::action_gen_count
protected

The number of state generations during the current search.

template<class state_t , class action_t >
SearchStatus SearchEngine< state_t, action_t >::alg_status
protected

The current search status.

template<class state_t , class action_t >
const GoalTestFunction<state_t>* SearchEngine< state_t, action_t >::goal_test
protected

The goal test function.

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::goal_test_count
protected

The number of goal tests performed during the current search.

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::goal_test_limit
protected

The limit on the number of goal tests. 0 for no limit.

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::h_comp_count
protected

The number of heuristic computations during the current search.

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::h_comp_limit
protected

The limit on how many heuristic computations can be performed. 0 for no limit.

template<class state_t , class action_t >
bool SearchEngine< state_t, action_t >::have_incumbent
protected

If an incumbent solution is stored or not.

template<class state_t , class action_t >
double SearchEngine< state_t, action_t >::incumbent_cost
protected

The cost of the last solution.

template<class state_t , class action_t >
std::vector<action_t> SearchEngine< state_t, action_t >::incumbent_plan
protected

The last solution found.

template<class state_t , class action_t >
const TransitionSystem<state_t, action_t>* SearchEngine< state_t, action_t >::op_system
protected

The transition system.

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::state_gen_count
protected

The number of state generations during the current search.

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::storage_count
protected

The number of states currently being stored.

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::storage_limit
protected

The limit on how many states are stored. 0 for no limit.

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::succ_func_count
protected

The number of heuristic computations made during the current search.

template<class state_t , class action_t >
uint64_t SearchEngine< state_t, action_t >::succ_func_limit
protected

The limit on how many successor function calls can be performed. 0 for no limit.


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