Lecture 04.1: Informed Search and Heuristics
An introduction to informed search strategies, evaluation functions, and Greedy Best-First Search.
Uninformed search methods blindly explore the state space. They only know if a state is a goal or not. Informed search (or heuristic search) methods add domain-specific information to select the best path along which to continue searching.
Searching to Solve Problems
Before an agent can search for solutions, it operates under environmental assumptions (deterministic, observable, static, and completely known) and formulates a well-defined problem consisting of five parts:
- Initial State: The starting state of the agent (e.g., ).
- Set of Actions: The set of possible actions available to the agent in state , denoted .
- Transition Model: A description of what each action does, denoted .
- Goal Test Function: A test determining whether a given state is a goal state.
- Action Cost Function: A function calculating the step cost of taking action to transition from state to .
The environment of the problem is represented by a state space. A path through the state space from the initial state to a goal state is a solution. The process of removing unnecessary details from a state representation is called abstraction.
The Heuristic Function
To guide the search, we define a heuristic function, , which estimates the "goodness" of a node . Specifically:
The heuristic function is an estimate based on domain-specific information that is computable directly from the current state description.
Example: Manhattan Distance in Robot Navigation
In a grid-based robot navigation problem where movement is restricted to horizontal and vertical steps, the general -dimensional Manhattan distance between two points and is:
For a standard 2-dimensional grid, this simplifies to:
The Obstacle Trap in Greedy Search
When navigating around obstacles (such as U-shaped wall barriers), Greedy Best-First Search relies solely on . As a result, the robot moves to cells with smaller values, drawing it directly toward the barrier wall. Because it ignores the path cost accumulated so far, it gets stuck driving into dead ends against obstacle boundaries before being forced to backtrack around the barrier.
Best-First Search
Best-first search is a general search framework where we evaluate nodes using an evaluation function to estimate node "desirability." The algorithm always expands the most desirable unexpanded node first.
It is implemented using a priority queue that orders nodes in increasing order of (where lower cost means higher desirability).
Two primary special cases of best-first search are:
- Greedy Best-First Search ()
- A Search* ()
Greedy Best-First Search
Greedy best-first search tries to expand the node that appears to be closest to the goal. It evaluates nodes by using solely the heuristic function:
Example: Route Finding in Romania
Imagine finding a route from Arad to Bucharest. We use the Straight-Line Distance (SLD) to Bucharest as our heuristic .

Straight-Line Distances to Bucharest ()
| City | City | ||
|---|---|---|---|
| Arad | 366 | Mehadia | 241 |
| Bucharest | 0 | Neamt | 234 |
| Craiova | 160 | Oradea | 380 |
| Drobeta | 242 | Pitesti | 100 |
| Eforie | 161 | Rimnicu Vilcea | 193 |
| Fagaras | 176 | Sibiu | 253 |
| Giurgiu | 77 | Timisoara | 329 |
| Hirsova | 151 | Urziceni | 80 |
| Iasi | 226 | Vaslui | 199 |
| Lugoj | 244 | Zerind | 374 |
Step-by-Step Search Trace
- Start at Arad: .
- Expand Arad: Successors are Sibiu (), Timisoara (), and Zerind (). Lowest is Sibiu ().
- Expand Sibiu: Successors are Fagaras (), Rimnicu Vilcea (), Arad (), and Oradea (). Lowest is Fagaras ().
- Expand Fagaras: Successors are Bucharest () and Sibiu (). Lowest is Bucharest (). Goal reached!
By greedily following the lowest value, Greedy Best-First Search finds the path:
- Path Cost:
- Optimal Path: with cost .
Because Greedy BFS ignores path costs, it selected Fagaras () over Rimnicu Vilcea (), missing the shorter total route!
Properties of Greedy Best-First Search
- Complete? No in tree search (can get stuck in infinite loops such as ). Yes in graph search if repeated states are tracked and eliminated.
- Optimal? No. As shown in the Romania example, it can yield a path cost of when an optimal path of exists.
- Time Complexity: in worst case, where is maximum depth, but a good heuristic can dramatically reduce search time.
- Space Complexity: , as it retains all generated nodes in memory.