V
- vertex typepublic interface AStarAdmissibleHeuristic<V>
Modifier and Type | Method and Description |
---|---|
double |
getCostEstimate(V sourceVertex,
V targetVertex)
An admissible "heuristic estimate" of the distance from $x$, the sourceVertex, to the goal
(usually denoted $h(x)$).
|
default <E> boolean |
isConsistent(Graph<V,E> graph)
Returns true if the heuristic is a consistent or monotone heuristic wrt the
provided
graph . |
double getCostEstimate(V sourceVertex, V targetVertex)
sourceVertex
- the source vertextargetVertex
- the target vertexdefault <E> boolean isConsistent(Graph<V,E> graph)
graph
. A heuristic is monotonic if its estimate is always less than or equal
to the estimated distance from any neighboring vertex to the goal, plus the step cost of
reaching that neighbor. For details, refer to https://en.wikipedia.org/wiki/Consistent_heuristic.
In short, a heuristic is consistent iff h(u)≤ d(u,v)+h(v)
, for every edge
$(u,v)$, where $d(u,v)$ is the weight of edge $(u,v)$ and $h(u)$ is the estimated cost to
reach the target node from vertex u. Most natural admissible heuristics, such as Manhattan or
Euclidean distance, are consistent heuristics.E
- graph edges typegraph
- graph to test heuristic ongraph
, false otherwiseCopyright © 2019. All rights reserved.