# What is an admissible heuristic?

by Stephen M. Walker II, Co-Founder / CEO

## What is an admissible heuristic?

An admissible heuristic is a concept in computer science, specifically in algorithms related to pathfinding and artificial intelligence. It refers to a heuristic function that never overestimates the cost of reaching the goal. The cost it estimates to reach the goal is not higher than the lowest possible cost from the current state.

Admissible heuristics are used to estimate the cost of reaching the goal state in an informed search. For a heuristic to be admissible, the estimated cost must always be lower than or equal to the actual cost of reaching the goal state.

An admissible heuristic can be derived from a relaxed version of the problem, or by information from pattern databases that store exact solutions to subproblems of the problem, or by using inductive learning methods.

## What are some examples of admissible heuristics?

Admissible heuristics are often used in pathfinding algorithms such as A*. In A* search, the evaluation function is given by `f(n)=g(n)+h(n)`, where `n` is the current node, `g(n)` is the actual cost from the initial node to the current node, and `h(n)` is the estimated cost from the current node to the goal state.

While all consistent heuristics are admissible, not all admissible heuristics are consistent. A heuristic is considered to be consistent if the estimated cost from one node to the successor node added to the estimated cost from the successor node to the goal is less than or equal to the actual cost.

When a non-admissible heuristic is used in an algorithm, it may or may not result in an optimal solution. But, sometimes non-admissible heuristics expand a smaller amount of nodes. As a result, it is possible that the total cost (search cost + path cost) could end up being lower than an optimal solution found by an admissible heuristic.

## How do admissible heuristics work?

Admissible heuristics work by providing an estimate of the cost to reach the goal state from a given state in a search algorithm, without ever overestimating the true cost. This characteristic ensures that the search algorithm, such as A*, can find the shortest or least costly path to the goal.

Here's how they function in the context of A* search:

1. Estimation — The heuristic function, denoted as `h(n)`, provides an estimated cost from the current node `n` to the goal state.

2. Admissibility — For `h(n)` to be admissible, it must always be less than or equal to the true cost to reach the goal from `n`, denoted as `h*(n)`. This means `h(n) <= h*(n)` for all nodes `n`.

3. Evaluation Function — In A*, the evaluation function `f(n)` is used to determine the order in which nodes are expanded. It is defined as `f(n) = g(n) + h(n)`, where `g(n)` is the actual cost from the start node to `n`, and `h(n)` is the heuristic estimate from `n` to the goal.

4. Optimality — Because admissible heuristics do not overestimate the cost to the goal, A* search is guaranteed to find an optimal solution if one exists, assuming `h(n)` is also consistent.

5. Derivation — Admissible heuristics can be derived from a relaxed version of the problem, from pattern databases, or through inductive learning methods.

6. Consistency — While all consistent heuristics (where the estimated cost from a node to a successor plus the estimated cost from the successor to the goal is less than or equal to the actual cost from the node to the goal) are admissible, not all admissible heuristics are consistent.

In practice, admissible heuristics guide the search algorithm by favoring paths that appear to be leading closer to the goal, thereby reducing the number of paths that need to be considered. This makes the search process more efficient while still ensuring that the solution found is optimal in terms of cost.

## What are the benefits of using admissible heuristics?

1. Guaranteed Optimal Path — They ensure that the shortest path to the goal state is found, provided that a path exists.
2. Efficiency — Admissible heuristics can be more efficient than other search strategies like breadth-first search because they only need to explore a part of the search space.
3. Problem Simplification — They simplify complex problems by providing a feasible path to the solution, which is particularly useful in AI, computer games, logistics, and navigation systems.
4. Reduced Search Space — They can prune large portions of the search space, reducing the number of nodes expanded during the search.
5. Resource Management — They help to minimize the system's load by facilitating real-time monitoring of events using fewer resources.

## Are there any drawbacks to using admissible heuristics?

While admissible heuristics offer numerous advantages, they also come with certain limitations. For instance, they may sometimes identify sub-optimal paths due to their focus on the distance to the goal state during node expansion. The process of finding the right admissible heuristic can be a trial-and-error exercise, potentially leading to errors.

There's also a risk of oversimplifying complex problems when designing a heuristic, which could result in underutilization of available information and sub-optimal solutions. Despite being admissible, these heuristics do not always guarantee computational efficiency, as some may still lead to excessive computation or memory usage.

Lastly, designing admissible heuristics can be challenging, but the effort is often justified by their crucial role in ensuring the correctness of search algorithms.

## More terms

### What is Stochastic Gradient Descent (SGD)?

Stochastic Gradient Descent (SGD) is an iterative optimization algorithm widely used in machine learning and deep learning applications to find the model parameters that correspond to the best fit between predicted and actual outputs. It is a variant of the gradient descent algorithm, but instead of performing computations on the entire dataset, SGD calculates the gradient using just a random small part of the observations, or a "mini-batch". This approach can significantly reduce computation time, especially when dealing with large datasets.

### What is Resource Description Framework (RDF)?

The Resource Description Framework (RDF) is a standard developed by the World Wide Web Consortium (W3C) for describing and exchanging data on the web. I's designed to represent information about physical objects and abstract concepts, and to express relationships between entities using a graph data model.