Informed search algorithms

Informed = use problem-specific knowledge
Allows more efficient solution finding than uninformed (blind) strategies.

  • Blind search: explores all possibilities, expensive, may stop when any or optimal solution is found.
  • Heuristic search: uses domain-specific hints to reduce search space.

Heuristic functions

  • h(n): estimated cost of cheapest path from node n to a goal state.
  • if n is goal → h(n) = 0
  • goal: guide search toward promising states.

Definition

“A rule of thumb, simplification, or educated guess that reduces/limits the search in difficult or poorly understood domains.”

Types of search problems

TypeExample question
Any solution“How do I get to Toronto? Money/time doesn’t matter.”
Optimal“How do I get to Toronto with $15?”
  • Path-based: sequence of steps transforms start → goal (e.g., Rubik’s cube moves).
  • Configuration-based: a single state is the solution (e.g., 8-queens placement).
  • allow evaluation of child nodes to choose most promising.
  • Strong heuristics: more guidance (e.g., don’t lose a piece in chess).
  • Weak heuristics: less guidance (e.g., knights best in center).
  • even minimal heuristics > blind search.
flowchart TD
    Start[Current node] -->|Expand| Children
    Children -->|Heuristic h(n)| Rank[Ranked by promise]
    Rank --> Best[Choose most promising child]

Search algorithms (heuristic-based)

  • Optimal (path search):
    • best-first search
    • a* search
  • Non-optimal (local search):
    • hill climbing
    • beam search
    • simulated annealing
    • tabu search
    • genetic algorithms
  • General approach: expand node with best evaluation f(n)
  • evaluation function measures distance to goal
  • Implementation: queue sorted by desirability

Special cases:

  • greedy best-first search
  • a* search
  • expands node that appears closest to goal (lowest h(n))
  • evaluation: f(n) = h(n)
graph TD
    Arad --> Sibiu
    Sibiu --> Fagaras
    Fagaras --> Bucharest
    Arad --> Zerind
    Sibiu --> Rimnicu
    Rimnicu --> Pitesti
    Pitesti --> Bucharest
  • finds solution quickly, but not optimal
  • example: Arad → Sibiu → Fagaras → Bucharest is longer than via Rimnicu + Pitesti

Properties:

  • Complete? No (can loop)
  • Time: O(b^m), but good heuristics help
  • Space: O(b^m), stores all nodes
  • Optimal? No
  • Evaluation function: f(n) = g(n) + h(n)
    • g(n) = cost so far from start
    • h(n) = estimated cost to goal
    • f(n) = estimated total cost
  • expands node with lowest f(n)
  • most common informed search

Admissible heuristic

  • never overestimates cost to goal
  • ensures A* is optimal
flowchart TD
    Start --> Node1[g(n)+h(n)]
    Node1 --> Node2[g(n)+h(n)]
    Node2 --> Goal

Properties:

  • Complete? Yes (unless infinite nodes with f ≤ f(G))
  • Optimal? Yes
  • Time/Space: Exponential, high memory use

Iterative deepening A* (IDA*)

  • uses depth-first with cutoff on f(n)
  • reduces memory cost
  • always optimal
  • space linear in solution depth
  • in some cases faster than A*

Heuristic quality

  • Admissible: never overestimates (optimistic).
  • Consistent: values get smaller closer to goal.
  • too weak → not useful (extreme: h(n)=0 = uninformed search).

8-puzzle examples

  • h1 = # misplaced tiles
  • h2 = total Manhattan distance
HeuristicExample value
h1(S)8
h2(S)18

Inventing admissible heuristics

  1. Relaxed problems: simplify rules
    • e.g., tile can move anywhere → h1
    • tile can move to adjacent → h2
  2. Sub-problems: use exact solution of smaller problem
    • pattern databases
  3. Learning from experience: use inductive learning from solved states