Interface AStarAdmissibleHeuristic<V>

  • Type Parameters:
    V - vertex type
    All Known Implementing Classes:
    ALTAdmissibleHeuristic

    public interface AStarAdmissibleHeuristic<V>
    Interface for an admissible heuristic used in A* search.
    Author:
    Joris Kinable, Jon Robison, Thomas Breitbart
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method 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.
    • Method Detail

      • getCostEstimate

        double getCostEstimate​(V sourceVertex,
                               V targetVertex)
        An admissible "heuristic estimate" of the distance from $x$, the sourceVertex, to the goal (usually denoted $h(x)$). This is the good guess function which must never overestimate the distance.
        Parameters:
        sourceVertex - the source vertex
        targetVertex - the target vertex
        Returns:
        an estimate of the distance from the source to the target vertex
      • isConsistent

        default <E> boolean isConsistent​(Graph<V,​E> graph)
        Returns true if the heuristic is a consistent or monotone heuristic wrt the provided 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) \le 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.
        Type Parameters:
        E - graph edges type
        Parameters:
        graph - graph to test heuristic on
        Returns:
        true iff the heuristic is consistent wrt the graph, false otherwise