Informed search
A heuristic estimates remaining cost. Its numerical size alone does not establish safety: compare it with the true remaining cost and with every directed edge. A* uses the cost already paid as well as the estimate still to go.
2.1 Priority rules
Past papers · DA 2024–2026 (3 papers): 1 question, 1 mark
Greedy search is generally neither optimal nor complete on infinite spaces; with duplicate suppression it is complete on a finite reachable graph. A small does not mean a cheap complete path. When priorities tie, follow the stated rule; different valid tie rules can give different expansion sequences and counts.
2.2 Admissibility and consistency
Write for path cost, for the heuristic and for A* priority. Let be the true minimum remaining cost to any goal, with if none is reachable. This handbook uses nonnegative admissible heuristics and zero heuristic at every goal. Edge costs are nonnegative.
2.3 Combining and constructing heuristics
Past papers · DA 2024–2026 (3 papers): 1 question, 1 mark
Write for candidate heuristic functions and for true remaining cost. A relaxed problem removes restrictions without increasing action costs. Its optimal remaining cost is a lower bound for the original problem. If each original transition is legal in the relaxed problem at no greater cost, relaxed shortest-path costs also satisfy consistency.
A heuristic dominates when everywhere and both are admissible. It is at least as informative a lower bound. For consistent A* on the same problem, reachable states with optimal-path priority must be expanded before the optimal goal, where is least start-to-state cost and is optimal goal cost; equal-priority ties at need care when comparing counts. A stronger heuristic can cost more to compute.
2.4 Distance and puzzle heuristics
For a unit-cost sliding-tile puzzle, count misplaced numbered tiles, excluding the blank. Each move can put at most one such tile into its goal cell. Summed Manhattan distances of numbered tiles, also excluding the blank, form a stronger consistent lower bound: one move shifts one numbered tile by one cell. Do not add the misplaced count to Manhattan distance without a cost-partition proof.
2.5 A-star tracing and reopening
Past papers · DA 2024–2026 (3 papers): 1 question, 2 marks
Let be stored path cost, the remaining-cost heuristic and the priority. A* repeatedly removes the entry with smallest . Keep a table containing state, best , parent, and . When a cheaper route is found, update its cost and parent, then insert/update its frontier entry. Ignore stale entries with an old larger cost.
| Version | Sufficient condition for optimality |
|---|---|
| Tree A* | Admissible , goal tested on removal |
| Graph A*, never reopen an expanded state | Consistent , correct cost updates before expansion |
| Graph A*, reopen on improved | Admissible , correct improvements and stale-entry handling |
For completeness on an infinite space, additionally assume finite branching, finite nonnegative heuristic values on relevant states, an edge-cost lower bound and a finite-cost solution. The usual finite-graph version terminates with nonnegative costs and strict-improvement updates. A* can still require exponential memory and work; a heuristic is not a polynomial-time guarantee.
best[start] = 0; push(start, priority=h(start), cost=0)
while frontier is nonempty:
n, saved_cost = pop_min()
if saved_cost != best[n]: continue
if n is a goal: return its stored path
for each edge n -> v with cost c:
candidate = best[n] + c
if v is new or candidate < best[v]:
best[v] = candidate; parent[v] = n
push(v, priority=candidate+h(v), cost=candidate)
return failure
There is no permanent closed-set rejection in this version, so an improved expanded state is reopened. Use the question's tie rule in pop_min.
2.6 Memory-limited and local variants
Here is path cost, a remaining-cost heuristic and . Iterative-deepening A* (IDA*) performs depth-first searches with a threshold on , increasing it to the smallest value that exceeded the previous threshold. With admissible , positive edge costs and finite branching it retains optimality while storing a path and pending successors, but can repeat substantial work. Recursive best-first search (RBFS) stores the best alternative bound and backtracks when the current route exceeds it. Memory-bounded A* can discard its worst leaves and retain backed-up bounds; sufficient memory to retain an optimal solution path is needed for its usual optimality guarantee.
Hill climbing keeps a current state and moves to a better neighbour. Local optima, ridges and plateaus can stop progress. Random restarts and limited sideways moves can help but do not give a general finite-run optimum guarantee. Beam search retains only a fixed number of candidate states and can discard the only solution route.
Last-minute recall
- UCS uses , greedy uses , and A* uses .
- Admissibility bounds total remaining cost; consistency bounds every edge.
- Check zero heuristic at every goal.
- A closed set without reopening needs consistency for the standard guarantee.
- Max of admissible heuristics is admissible; a sum needs extra justification.
- Absolute difference is admissible under the nonnegative convention.
- Choose distance heuristics for the actual movement costs.
- Trace improved paths, stale entries and ties explicitly.
- Memory-saving search usually pays with repeated work or weaker guarantees.