Assignment Search Framework
|
Public Member Functions | |
Heuristic () | |
virtual | ~Heuristic () |
virtual void | prepareToCompute () |
double | getHValue (const state_t &state) |
double | getLastHValue () const |
bool | isHValueStored () const |
Protected Member Functions | |
virtual double | computeHValue (const state_t &state) const =0 |
Abstract class for defining a heuristic function.
Descendents should overwrite calculateH. Negative heuristic values should be interpreted as indicating that the problem is unsolvable from the current state. The intended way to calculate a heuristic will then be call prepareToCompute, and then computeHeuristic.
Constructor for the abstract heuristic class. Abstract constructor only initializes the last heuristic value to be 0.0.
Destructor for the abstract heuristic class. Abstract destructor is empty.
|
protectedpure virtual |
Calculates the heuristic value of the given state. Does not store the heuristic value.
If the heuristic value is negative, the heuristic function is indicating unsolvability.
This is the main function to be overloaded.
state | The state whose heuristic value is to be calculated. |
Implemented in MapOctileDistance, NonGoalHeuristic< state_t >, MapManhattanDistance, and TileManhattanDistance.
double Heuristic< state_t >::getHValue | ( | const state_t & | state | ) |
Gets and returns the heuristic value of the given state.
To get the heuristic value, calls computeHValue. If the heuristic value is negative, the heuristic function is indicating unsolvability.
state | The state whose heuristic value is to be calculated. |
|
inline |
Returns the last heuristic value computed.
If the heuristic value is negative, the heuristic function is indicating unsolvability.
|
inline |
Returns if a heuristic value is currently stored for this heuristic function.
|
virtual |
Prepares the heuristic function for computing the next heuristic value.
This function is intended to allow for having multiple heuristics computed simultaneously using the same process.