CSC266 ยท 2079 ยท 10 marks
Define admissible heuristic with an example. Explain the working mechanism and limitations of hill climbing search.
Define admissible heuristic with an example. Explain the working mechanism and limitations of hill climbing search.[10]
Quick answer
An admissible heuristic is a heuristic function h(n) that never overestimates the true cost of reaching the goal from node n. In other words, for every node n: h(n) = 0 for all nodes n; h(goal) = 0; h(n) <= h(n) for all nodes n.
Admissible Heuristic and Hill Climbing Search
Part 1: Admissible Heuristic (3 marks)
Definition
An admissible heuristic is a heuristic function h(n) that never overestimates the true cost of reaching the goal from node n. In other words, for every node n:
h(n) <= h(n)*
where h*(n) is the actual (true) cost from node n to the goal.
An admissible heuristic is always optimistic - it either correctly estimates or underestimates the remaining cost. This property is crucial because it guarantees that search algorithms like A* will find the optimal (least-cost) solution.
Formal Condition
For a heuristic h(n) to be admissible:
- h(n) >= 0 for all nodes n
- h(goal) = 0
- h(n) <= h*(n) for all nodes n
Example
Consider finding the shortest path on a map (Romania problem):
- h(n) = straight-line distance (Euclidean distance) from node n to the goal city.
Since the straight-line distance between two points is always less than or equal to the actual road distance, this heuristic never overestimates the true cost. Therefore, it is admissible.
| Node | h(n) = Straight-line dist | h*(n) = Actual road dist |
|---|---|---|
| A | 366 | 418 |
| B | 0 | 0 |
Here h(A) = 366 <= 418 = h*(A), so the condition holds.
Another simple example: In the 8-puzzle problem, the number of misplaced tiles is an admissible heuristic because each misplaced tile requires at least one move to reach its goal position, so it never overestimates.
Part 2: Hill Climbing Search (7 marks)
Definition
Hill Climbing is a heuristically informed local search technique that continuously moves in the direction of increasing value (or decreasing cost) to find the best solution. It belongs to the category of heuristically informed search methods that use domain-dependent information to search more efficiently.
The algorithm works like climbing a hill - at each step, you move to the neighbor that is "higher" (better) than the current position, until no higher neighbor exists.
Working Mechanism
The algorithm uses an evaluation function h(n) (heuristic) to measure the quality of each state. The state with the lowest heuristic value (closest to goal) is selected next.
Algorithm Steps:
1. Start with an initial state (current node).
2. Evaluate the current state using heuristic h(n).
3. Generate all successors (neighbors) of the current state.
4. Evaluate each successor using h(n).
5. Select the successor with the best (lowest h(n)) value.
6. If the best successor is better than the current state:
- Move to that successor (current = best successor)
- Go to Step 3.
7. If no successor is better than the current state:
- STOP. Current state is the local maximum/minimum.
Illustrated Example:
Consider nodes with heuristic values (h = estimated distance to goal):
Start: S (h=12)
|
---------
| |
B(h=4) D(h=5)
|
E(h=7) G1(h=0) <-- Goal
Step 1: At S, h(S) = 12. Successors: B(h=4), D(h=5).
- Best successor = B (h=4 < h=5). Move to B.
Step 2: At B, h(B) = 4. Successors: E(h=7), G1(h=0).
- Best successor = G1 (h=0). Move to G1.
Step 3: G1 is the goal. Search complete.
Path: S --> B --> G1
Types of Hill Climbing
| Type | Description |
|---|---|
| Simple Hill Climbing | Moves to the first neighbor that is better than current state |
| Steepest Ascent Hill Climbing | Evaluates all neighbors and moves to the best one |
| Stochastic Hill Climbing | Randomly selects among uphill moves |
Limitations of Hill Climbing
Hill climbing suffers from three major problems:
1. Local Maxima (Local Optima)
- The algorithm may reach a state that is better than all its neighbors but is not the global optimum.
- Once at a local maximum, the algorithm stops even though a better solution exists elsewhere.
Global Max
/\
/ \
/ LM \ <-- Algorithm gets stuck at Local Max (LM)
/ /\ \
/ / \ \
Start
2. Plateaus (Flat Local Maxima)
- A plateau is a flat area in the search space where all neighboring states have the same evaluation value.
- The algorithm cannot determine which direction to move, so it may wander randomly or stop.
- This makes progress very slow or impossible.
h(n) = 5 --- 5 --- 5 --- 5 <-- Plateau (no uphill direction)
3. Ridges
- A ridge is a sequence of local maxima that is difficult for the algorithm to navigate.
- The path to the global optimum may require moving sideways or downhill temporarily, but hill climbing never does this.
- The algorithm gets stuck because no single step leads uphill toward the true goal.
Ridge
/ \
/ Goal \
---/-----/----\---
/ / \
Summary Table of Limitations
| Limitation | Cause | Effect |
|---|---|---|
| Local Maxima | Better neighbors exist globally but not locally | Algorithm terminates prematurely |
| Plateaus | All neighbors have equal value | No progress, search wanders or stalls |
| Ridges | Uphill progress needs a combination of moves rather than any single move | Search oscillates on the slope and cannot climb the ridge |
Overcoming the Limitations
| Problem | Remedy |
|---|---|
| Local maxima | Backtrack to an earlier node and try a different direction, or restart the search from a randomly chosen state (random restart hill climbing) |
| Plateau | Make a large jump so that the search lands outside the flat region before evaluating again |
| Ridge | Apply two or more operators as one compound move, so the search can travel diagonally along the ridge |
Simulated annealing carries the same idea further by occasionally accepting a worse state, with a probability that falls as the search proceeds, so the search can escape a local maximum early on and still settle on a good solution later.
Conclusion
Hill climbing is attractive because it stores only the current state, needs very little memory and often reaches a good solution quickly. It is, however, neither complete nor optimal: it accepts the best immediate move and never looks beyond its own neighbourhood, so it can terminate at a local maximum, on a plateau or against a ridge. When the optimal solution is required, an admissible heuristic is used with a systematic search such as A*, which the admissibility condition h(n) <= h*(n) guarantees will return the least cost path. Hill climbing is preferred when a reasonably good solution has to be found quickly in a state space too large to search systematically.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.