What is a consistent heuristic?

Stephen M. Walker II · Co-Founder / CEO

Understanding Consistent Heuristics in AI

In heuristic search, a consistent heuristic, also called a monotone heuristic, satisfies the triangle inequality for every edge. For any node n and successor n', the heuristic must obey:

h(n) <= c(n, n') + h(n')

where c(n, n') is the step cost. When h(goal) = 0, this property implies admissibility, meaning the heuristic never overestimates the true cost to the goal.

Consistency is important for A* search because it guarantees that f(n) = g(n) + h(n) is nondecreasing along any path. As a result, graph-search A* does not need to reopen closed nodes and remains optimal when its other assumptions hold.

Common examples include Manhattan distance for grid pathfinding with 4-connected moves and straight-line distance in Euclidean graphs where edge costs are distances. For 8-connected grids with diagonal moves, octile distance is consistent when the diagonal cost is sqrt(2).

More terms

Continue exploring the glossary.

Learn how teams define, measure, and improve LLM systems.

Glossary term

What is a state in AI?

In artificial intelligence (AI), a state represents the current condition or environment of the system, akin to a "snapshot" that the AI uses to inform its decision-making process. The complexity and dynamic nature of the world can pose challenges, as numerous factors influencing the state can change rapidly. To manage this, AI systems may employ state machines, which focus solely on the current state without considering its historical context, thereby simplifying the decision-making process.
Read term

Glossary term

Generative Pre-trained Transformer (GPT)

GPT is a type of Large Language Model (LLM) that is trained to understand the context of language and generate human-like text.
Read term

It's time to build

Collaborate with your team on reliable Generative AI features.
Want expert guidance? Book a 1:1 onboarding session from your dashboard.

Talk to sales