A consistent heuristic, also known as a monotonic heuristic, is a specific type of heuristic used in artificial intelligence, particularly in search algorithms such as A*. A heuristic is a rule or method that helps in making decisions or solving problems more efficiently than traditional methods.
In the context of search algorithms, a consistent heuristic has the property that the estimated cost of reaching the goal from a given state is always less than or equal to the cost of getting to a neighboring state plus the estimated cost from that neighbor to the goal. In mathematical terms, this is expressed as:
h(n) ≤ c(n, n’) + h(n’)
where h(n) is the heuristic estimate from the current node n to the goal, c(n, n’) is the actual cost to move from node n to a neighbor node n’, and h(n’) is the heuristic estimate from the neighbor to the goal.
One of the main benefits of using a consistent heuristic is that it guarantees the optimality of the search algorithm. This means that if an algorithm like A* uses a consistent heuristic, it will find the shortest path to the goal if one exists. Additionally, consistent heuristics can help reduce the number of nodes that need to be evaluated, leading to more efficient search processes.
Examples of consistent heuristics include the straight-line distance (Euclidean distance) between two points in a spatial search or the Manhattan distance in grid-based pathfinding scenarios. These heuristics provide reliable estimates that adhere to the properties required for consistency.