State Space Search, UCS & A* Heuristic Admissibility
“f(n) = g(n) + h(n), proving A* optimality on trees vs graphs, and dominance of heuristics.”
1.The A* Search Algorithm & The f(n) Evaluation Function
§ 1.1.Uninformed search algorithms suffer from exponential state expansion because they blindly explore all directions. Informed (heuristic) search guides exploration using domain-specific knowledge.
The A Algorithm: A selects for expansion the frontier node that minimizes the estimated total solution cost:
$f(n) = g(n) + h(n)$
Where:
• g(n) is the exact path cost incurred from the start state s_0 to node n.
• h(n) is the heuristic estimate of the remaining path cost from node n to the nearest goal state.
• f(n) represents the estimated total cost of the cheapest solution path passing through node n.
2.Mathematical Proof of A* Tree Search Optimality under Admissibility
§ 1.2.Definition (Admissibility): A heuristic function h(n) is admissible if it never overestimates the true cost to reach the goal: 0 ≤ h(n) ≤ h^*(n) for all nodes n, and h(G) = 0 for any goal state G.
Theorem: A* Tree Search is guaranteed to return an optimal solution if h(n) is admissible.
Proof by Contradiction:
1. Let G_2 be a sub-optimal goal state generated during search, with path cost g(G_2) > C^, where C^ is the optimal path cost.
2. Since G_2 is a goal, h(G_2) = 0, so f(G_2) = g(G_2) + h(G_2) = g(G_2) > C^*.
3. Now consider an optimal goal path. At any point before finding G_2, there must exist at least one unexpanded node n on the frontier that lies on this optimal path.
4. For this node n on the optimal path:
$f(n) = g(n) + h(n) ≤ g(n) + h^(n) = C^$
(Since h(n) ≤ h^(n) by admissibility, and g(n) + h^(n) = C^* by definition of an optimal path).
5. Therefore, f(n) ≤ C^* < f(G_2).
6. Since A* always selects the node with the lowest f-value, node n will always be selected for expansion before G_2 could ever be selected for expansion.
7. This holds for every node along the optimal path, culminating in the optimal goal G^* being selected before G_2. Contradiction! Hence, sub-optimal goal G_2 can never be selected.
3.Consistency (Monotonicity) for A* Graph Search
§ 1.3.In Graph Search, an explored set (closed list) prevents re-visiting already expanded states. If a heuristic is admissible but inconsistent, the first path found to a state n might NOT be the cheapest. If n is discarded on subsequent encounters, A* can return a sub-optimal solution.
Definition (Consistency / Monotonicity):
A heuristic h(n) is consistent if, for every node n and every successor n' generated by action a:
$h(n) ≤ c(n, a, n') + h(n')$
This is the form of the classical Triangle Inequality: the estimated cost from n to goal cannot exceed the step cost to n' plus the estimated cost from n' to goal.
Consequences of Consistency:
1. Non-decreasing f-costs: f(n') = g(n') + h(n') = g(n) + c(n, a, n') + h(n') ≥ g(n) + h(n) = f(n).
2. First Expansion Optimality: Whenever A* selects a state for expansion in graph search, the path to that state is guaranteed to be optimal. No closed-list state ever needs to be re-opened!
3. Consistency strictly implies Admissibility (by induction along the path to goal, where h(G) = 0).
Consider S -> A (cost 1), A -> G (cost 3), S -> G (cost 5). Let h(S) = 4, h(A) = 1, h(G) = 0. • Admissibility: h(S)=4 <= 4 (optimal is S->A->G cost 4); h(A)=1 <= 3. Admissible! • Consistency check on edge S->A: h(S) <= c(S, A) + h(A) => 4 <= 1 + 1 = 2 (FALSE!). Inconsistent! Triangle inequality is violated.
4. GATE DA Worked Example: A* Node Expansion Trace
Nodes are selected for expansion strictly based on lowest f(n) = g(n) + h(n), not purely h(n) or g(n) alone!
Problem: Trace A* Graph Search from Start S to Goal G. Given transitions with step costs and heuristics h:
Heuristic values: h(S) = 5, h(A) = 3, h(B) = 4, h(C) = 2, h(G) = 0.
Directed Edges with costs:
S -> A (cost 2), S -> B (cost 3)
A -> C (cost 2), B -> C (cost 1)
C -> G (cost 3).
Step 1: Initialize at Start S:
g(S) = 0, h(S) = 5 => f(S) = 0 + 5 = 5.
Frontier: [ S(f=5, g=0) ]. Closed: { }.
Pop S for expansion.
Step 2: Generate successors of S:
Node A: g(A) = 0 + 2 = 2; f(A) = 2 + h(A) = 2 + 3 = 5.
Node B: g(B) = 0 + 3 = 3; f(B) = 3 + h(B) = 3 + 4 = 7.
Frontier: [ A(f=5, g=2), B(f=7, g=3) ]. Closed: { S }.
Lowest f is A(f=5) => Pop A for expansion.
Step 3: Generate successors of A:
Node C: g(C) = g(A) + 2 = 2 + 2 = 4; f(C) = 4 + h(C) = 4 + 2 = 6.
Frontier: [ C(f=6, g=4), B(f=7, g=3) ]. Closed: { S, A }.
Lowest f is C(f=6) => Pop C for expansion.
Step 4: Generate successors of C:
Node G: g(G) = g(C) + 3 = 4 + 3 = 7; f(G) = 7 + h(G) = 7 + 0 = 7.
Frontier: [ G(f=7, g=7), B(f=7, g=3) ]. Closed: { S, A, C }.
Lowest f is tie between G(f=7) and B(f=7).
If tie broken in favor of goal G: Pop G. Goal test succeeds!
If tie broken in favor of B: Pop B. B generates C with g(C) = 3 + 1 = 4 (same cost, C already closed). Then pop G.
Conclusion: Optimal Path is S -> A -> C -> G with total optimal cost C* = 7.
Primary Academic References & Exam Sources
Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.