Heuristic Search and Informed Search Strategies
Discover how informed search uses heuristic knowledge to guide AI problem-solving. Learn about heuristic functions, how informed search differs from uninformed search, and the foundations of Greedy Best-First Search and A*.
Heuristic Search and Informed Search Strategies: Using Knowledge to Find Better Solutions
Imagine you are travelling to a city you have never visited before. You have several possible routes, but you do not want to explore every road one by one.
Instead, you look at a map. You estimate which direction takes you closer to your destination and choose a promising route.
You are using information to guide your search.
Artificial Intelligence uses a similar idea. Rather than exploring possible solutions without guidance, an AI system can use additional knowledge to estimate which choices are more promising.
This approach is called Informed Search, and one of its most important ideas is the use of heuristics.
1. What Is Informed Search?
Informed Search is a search strategy that uses additional problem-specific knowledge to guide the search towards a goal.
Unlike uninformed search, which explores the search space without estimating how close a state is to the goal, informed search uses information to decide which paths appear more promising.
For example, consider a navigation system finding a route between two cities.
An uninformed search algorithm might explore routes without considering the remaining distance to the destination.
An informed search algorithm can use estimated distances to guide its decisions.
This does not mean it always chooses the correct path. It means it has additional information that can make the search more efficient.
2. What Is a Heuristic?
A heuristic is a rule, method, or estimate used to guide problem-solving.
In AI search, a heuristic estimates how close a particular state is to the goal or how much work may remain to reach it.
It is commonly represented by:
\[
h(n)
\]
Here:
- \(h\) represents the heuristic function.
- \(n\) represents the current node or state.
- \(h(n)\) represents the estimated cost from node \(n\) to the goal.
For example, suppose a navigation system needs to travel from Srinagar to Jammu.
It can use the straight-line distance between the current location and Jammu as an estimate of the remaining journey.
This estimate does not necessarily represent the actual road distance. Roads may be longer, and traffic or road conditions may change the journey.
However, the estimate provides useful guidance.
3. How Does Heuristic Search Work?
Let’s understand the idea with a simple search tree.
S
/ \
A B
/ \ \
C D G
Suppose G is the goal.
Without additional information, a search algorithm may explore nodes according to its own traversal strategy.
With heuristic information, the algorithm can estimate which node is closer to G and prioritise that node.
For example:
| Node | Estimated remaining cost h(n) |
|---|---|
| A | 6 |
| B | 2 |
| C | 5 |
| D | 4 |
| G | 0 |
Node B has a lower estimated remaining cost than A. An informed search strategy may therefore prioritise B.
The exact way nodes are selected depends on the search algorithm being used.
4. The Heuristic Function
The heuristic function is the central part of informed search.
It provides an estimate that helps the algorithm make decisions.
For example, in a route-finding problem, a heuristic might use:
- Straight-line distance to the destination.
- Estimated travel time.
- Number of remaining moves.
- Distance between two positions on a map.
In a puzzle, it might estimate how many pieces are still in the wrong position.
A good heuristic can reduce unnecessary exploration. However, a poor heuristic may guide the algorithm towards unhelpful paths.
It is important to remember that a heuristic is an estimate, not necessarily the exact cost.
5. Heuristic Search vs Uninformed Search
Both approaches try to find a path or solution, but they use different information.
| Feature | Uninformed Search | Informed Search |
|---|---|---|
| Additional knowledge | Does not use heuristic estimates | Uses heuristic information |
| Guidance | Follows a general search strategy | Uses estimates to guide exploration |
| Node selection | Depends on the algorithm | Often influenced by heuristic values |
| Efficiency | May explore many unnecessary nodes | Can reduce exploration with a useful heuristic |
| Examples | BFS, DFS, UCS | Greedy Best-First Search, A* |
Uniform Cost Search is an important comparison. It uses the cost already travelled to reach a node, but it does not use an estimate of the remaining cost to the goal. Therefore, it is generally classified as an uninformed search strategy.
6. Two Important Informed Search Algorithms
Two major algorithms built around heuristic information are:
Greedy Best-First Search
Greedy Best-First Search selects the node that appears closest to the goal according to the heuristic function.
It mainly considers:
\[
f(n) = h(n)
\]
It focuses on the estimated remaining cost, without considering the full cost already travelled.
This can help it reach a goal quickly, but it does not guarantee the least-cost solution.
A* Search Algorithm
A* combines two types of information:
- The actual cost from the starting node to the current node.
- The estimated cost from the current node to the goal.
Its evaluation function is:
\[
f(n) = g(n) + h(n)
\]
Where:
- \(g(n)\) = actual cost from the start to node \(n\).
- \(h(n)\) = estimated cost from node \(n\) to the goal.
- \(f(n)\) = estimated total cost of a solution path through node \(n\).
A* uses both the journey already completed and the estimated journey remaining.
We will study Greedy Best-First Search and A* in detail in the upcoming articles.
7. What Makes a Good Heuristic?
A heuristic should provide useful guidance without misleading the search unnecessarily.
Two important properties are:
1. Admissibility
An admissible heuristic never overestimates the actual minimum cost from the current node to the goal.
In simple terms, it may underestimate the remaining cost, but it should not claim that the goal is farther away than it actually is.
This property is important for the optimality of A* under the standard search conditions.
2. Consistency
A heuristic is consistent when its estimate obeys the triangle inequality across every transition.
For a node \(n\) and its successor \(n’\):
\[
h(n) \leq c(n,n’) + h(n’)
\]
Here, \(c(n,n’)\) is the cost of moving from \(n\) to \(n’\).
Consistency helps A* behave reliably when exploring paths, particularly in graph search.
We will explore these properties further in the article dedicated to heuristic functions.
8. Applications of Informed Search
Informed search is useful when a problem has a large number of possible states and additional knowledge can help guide the search.
Some applications include:
- Navigation systems: Estimating distances and finding promising routes.
- Robotics: Helping robots plan paths around obstacles.
- Games: Exploring possible moves and positions.
- Puzzle solving: Estimating how far a puzzle is from its solved state.
- Planning: Finding sequences of actions that achieve a goal.
- Network routing: Using available information to guide route selection.
The usefulness of informed search depends on the quality of the information available and the problem being solved.
Conclusion
Uninformed search explores without estimating how close a state is to the goal. Informed search uses additional knowledge to guide its decisions.
The most important idea behind informed search is the heuristic function, which estimates the remaining cost of reaching a goal.
This idea forms the foundation of algorithms such as Greedy Best-First Search and A*, which we will explore next.
In the next article, we will study Greedy Best-First Search, an algorithm that chooses the node that appears closest to the goal.
Quick quiz
5 questionsOriginally published at farhanpaal.com — https://farhanpaal.com/articles/heuristic-search-and-informed-search-strategies/
Keep a copy
Read offline as a printout or PDF.
farhanpaal.com