Assignment Search Framework
|
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... | |
Defines a template for a search algorithm.
SearchEngine< state_t, action_t >::SearchEngine | ( | ) |
Constructor for abstract search engine. Abstract constructor is empty aside from default initializations.
|
virtual |
Destructor for abstract search engine. Abstract constructor is empty.
|
inline |
Returns if an incumbent solution has been found and is stored.
|
inline |
Gets the number of actions generated during the last search.
|
inline |
Gets the number of goal tests performed during the last search.
|
inline |
Returns the number of heuristic computations during the last search.
|
inline |
Returns the last plan found during the last search run.
|
inline |
Returns the cost of the last plan found during the last search run.
Negative values should be interpreted as there being no plan.
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.
init_state | The initial state to find a solution from. |
sol_plan | A solution plan, if one exists. |
|
inline |
Gets the number of states generated during the last search.
|
inline |
Gets the current status of the search engine.
|
inline |
Returns the number of states stored during the last search.
|
inline |
Gets the number of calls to the successor or applicable actions function during the last search.
bool SearchEngine< state_t, action_t >::hitGoalTestLimit | ( | ) |
Returns true if the limit on the number of goal tests has been hit.
bool SearchEngine< state_t, action_t >::hitHCompLimit | ( | ) |
Returns true if the limit on the number of heuristic computations allowed has been set and reached.
bool SearchEngine< state_t, action_t >::hitStorageLimit | ( | ) |
Returns true if the limit on number of states being stored has been set and reached.
bool SearchEngine< state_t, action_t >::hitSuccFuncLimit | ( | ) |
Returns true if the limit on the number of successor function calls has been set and reached.
|
protectedvirtual |
Increases the count of the number of actions generated.
new_gens | The number of new action generations. |
|
protectedvirtual |
Increments the count of the number of goal tests performed.
|
protectedvirtual |
Increments the count of the number of heuristic computations performed.
|
protectedvirtual |
Increments the count of the number of state generations performed.
|
protectedvirtual |
Increments the count of the number of successor function calls performed.
|
virtual |
Checks if the engine has all elements necessary for search.
Reimplemented in BestFirstSearch< state_t, action_t >.
|
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 >.
|
virtual |
Resets the statistics counters.
Reimplemented in BestFirstSearch< state_t, action_t >.
|
protectedpure virtual |
Searches for a plan. Assumes search engine is ready and properly configured.
init_state | The initial state to search from. |
Implemented in BestFirstSearch< state_t, 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.
g | The new goal test function. |
|
inline |
Sets a limit on the number of goal tests.
The default value of 0 means no limit.
limit | The limit on the number of goal tests. |
|
inline |
Sets a limit on the number of heuristic computations that can be performed.
The default value of 0 means no limit.
limit | The limit on the number of heuristic computations performed. |
|
inline |
Sets a limit on the number of states that can be stored at any time.
The default value of 0 means no limit.
limit | The limit on state storage. |
|
inline |
Sets a limit on the number of calls to the successor (or applicable action) function.
The default value of 0 means no limit.
limit | The limit on the number of calls to the successor or applicable action function. |
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.
o | The new transition function. |
|
protected |
The number of state generations during the current search.
|
protected |
The current search status.
|
protected |
The goal test function.
|
protected |
The number of goal tests performed during the current search.
|
protected |
The limit on the number of goal tests. 0 for no limit.
|
protected |
The number of heuristic computations during the current search.
|
protected |
The limit on how many heuristic computations can be performed. 0 for no limit.
|
protected |
If an incumbent solution is stored or not.
|
protected |
The cost of the last solution.
|
protected |
The last solution found.
|
protected |
The transition system.
|
protected |
The number of state generations during the current search.
|
protected |
The number of states currently being stored.
|
protected |
The limit on how many states are stored. 0 for no limit.
|
protected |
The number of heuristic computations made during the current search.
|
protected |
The limit on how many successor function calls can be performed. 0 for no limit.