Assignment Search Framework
|
Public Member Functions | |
OpenClosedList () | |
virtual | ~OpenClosedList () |
void | clear () |
StateLocation | getStateLocation (const state_t &state, StateHash hash_value, NodeID &id) |
BFSNode< state_t, action_t > & | getNode (NodeID id) |
const BFSNode< state_t, action_t > & | getNode (NodeID id) const |
virtual NodeID | addNewNodeToOpen (const state_t &state, const action_t &action, StateHash hash_value, double g, double h, double node_eval, NodeID parent) |
virtual NodeID | addInitialNodeToOpen (const state_t &state, const action_t &action, StateHash hash_value, double h, double node_eval) |
virtual NodeID | getBestNodeAndClose () |
virtual void | openNodeEvalChanged (NodeID id) |
virtual void | reopenNode (NodeID id) |
std::size_t | openListSize () const |
std::size_t | closedListSize () const |
std::size_t | size () const |
bool | isOpenEmpty () const |
Protected Member Functions | |
virtual bool | nodeNoWorse (const BFSNode< state_t, action_t > &node_1, const BFSNode< state_t, action_t > &node_2) const |
virtual bool | nodeNoWorse (BFSOpenLocation loc_1, BFSOpenLocation loc_2) const |
bool | heapifyUp (BFSOpenLocation loc) |
bool | heapifyDown (BFSOpenLocation loc) |
void | swapOpenLocations (BFSOpenLocation loc_1, BFSOpenLocation loc_2) |
void | printOpen () |
Protected Attributes | |
NodeTable< BFSNode< state_t, action_t > > | node_table |
The table of nodes being stored. More... | |
std::vector< NodeID > | open_list_heap |
The heap holding node ids representing the open list. More... | |
A class for an open and closed list to be used by a best-first search.
|
inline |
Constructor for OpenClosedList. Does nothing.
|
inlinevirtual |
Destructor for OpenClosedList. Does nothing.
|
inlinevirtual |
Adds the initial node with the given attributes to the open list.
state | The state being added. |
action | The action that generated this state. |
hash_value | The hash value of this state. |
h | The heuristic value of the node. |
node_eval | The evaluation of the node. |
|
virtual |
Adds a new node with the given attributes to the open list.
state | The state being added. |
action | The action that generated this state. |
hash_value | The hash value of this state. |
g | The g-cost of the node. |
h | The heuristic value of the node. |
node_eval | The evaluation of the node. |
parent | The node id of the parent of this node, or 0 if this is the first node added. |
void OpenClosedList< state_t, action_t >::clear | ( | ) |
Clears the open closed list by emptying the table and heap.
|
inline |
Returns the number of nodes in the closed list.
|
virtual |
Finds the best node in the open list according to the node evaluation, returns its id, and moves it to closed.
|
inline |
Returns the node corresponding to the given id.
id | The id of the node to return. |
|
inline |
Returns a const reference to a node corresponding to the given id.
id | The id of the node to return. |
StateLocation OpenClosedList< state_t, action_t >::getStateLocation | ( | const state_t & | state, |
StateHash | hash_value, | ||
NodeID & | id | ||
) |
Returns whether the state is in the open list, closed list, or is not stored.
state | The state to check for. |
hash_value | The hash value of the state to check for. |
id | The id of the state if it is found to be stored. |
|
protected |
Heapify's down the node at the given open list location if it needs to be moved down.
loc | The location to heapify down from. |
|
protected |
Heapify's up the node at the given open list location if it needs to be moved up.
loc | The location to heapify up from. |
|
inline |
Returns if the open list is empty or not.
|
inlineprotectedvirtual |
Returns true if the evaluation of the first node is less than or equal to the second.
node_1 | The first node being compared. |
node_2 | The second node being compared. |
|
inlineprotectedvirtual |
Returns true if the evaluation of the node in the open list at the first location is less than or equal to the second.
loc_1 | The location in the open list of the first node being compared. |
loc_2 | The location in the open list of the second node being compared. |
|
inline |
Returns the number of nodes in the open list.
|
virtual |
Adjusts the open list as needed because the node evaluation of the node with the given id has changed.
id | The id of the node whose evaluation has changed. |
|
protected |
|
virtual |
Reopens the node with the given id.
id | The id of the node to reopen. |
|
inline |
Returns the total number of nodes being stored.
|
inlineprotected |
Swaps the elements in their locations in the heaps at the given locations, and updates the nodes accordingly.
loc_1 | The first location in the heap. |
loc_2 | The second location in the heap. |
|
protected |
The table of nodes being stored.
|
protected |
The heap holding node ids representing the open list.