CSE-41XX
CS-4101 AI

Lecture 03.3: Advanced Uninformed Search

Exploring Uniform Cost Search, Depth-Limited Search, Iterative Deepening, and Bidirectional Search.

Breadth-First Search (BFS) and Depth-First Search (DFS) are foundational, but they have major flaws. BFS uses too much memory, and DFS can get stuck in infinite loops and isn't optimal. To solve these issues, we look to advanced uninformed search strategies.

1. Uniform Cost Search (UCS)

A breadth-first search finds the shallowest goal state. This is only guaranteed to be the cheapest solution if the path cost is a function of the depth (i.e., every step costs the same). If step costs vary, BFS fails to find the optimal path.

Uniform Cost Search (UCS) remedies this by expanding the lowest-cost node on the fringe, rather than the shallowest node.

Why UCS matters: A Shortest Path Example

Consider finding the shortest route from Start (SS) to Goal (GG):

  • BFS approach: BFS might expand AA first (cost 1). Seeing GG as a successor of AA, it finds the path SAGS \rightarrow A \rightarrow G with a total cost of 1111. It stops, assuming it found the best path because it reached GG in 2 steps.
  • UCS approach: UCS expands the lowest cost node currently available.
    1. Starts at SS. Queue: A(1),B(5),C(15)A(1), B(5), C(15).
    2. Expands AA. Finds GG with cost 1111. Queue: B(5),G(11),C(15)B(5), G(11), C(15).
    3. Crucially, UCS does not stop yet! B(5)B(5) is cheaper than G(11)G(11).
    4. Expands BB. Finds GG through BB with cost 5+5=105 + 5 = 10. Queue: G(10),G(11),C(15)G(10), G(11), C(15).
    5. Expands G(10)G(10) and returns the optimal path SBGS \rightarrow B \rightarrow G.

2. Depth-Limited Search (DLS)

The biggest problem with DFS is its unbounded nature; it can traverse down an infinite path forever.

Depth-Limited Search (DLS) resolves this by supplying DFS with a pre-determined depth limit ll. Nodes at depth ll are treated as if they have no successors.

  • Completeness: Solves the infinite-path problem, but introduces incompleteness if l<dl < d (where dd is the depth of the shallowest goal).
  • Optimality: Non-optimal if l>dl > d.
  • Time Complexity: O(bl)O(b^l)
  • Space Complexity: O(bl)O(bl)

(Note: Standard DFS is simply a special case of DLS where l=l = \infty).


3. Iterative Deepening Search (IDS)

The problem with DLS is deciding on a suitable depth parameter ll. Iterative Deepening Search (IDS) avoids this by gradually increasing the depth limit—first 0, then 1, then 2, and so on—until a goal is found.

This guarantees finding the goal when the depth limit finally reaches dd.

How IDS Works

  • Iteration 0: Limit=0. Expand AA. No goal.
  • Iteration 1: Limit=1. Expand AA, BB, CC. No goal.
  • Iteration 2: Limit=2. Expand AA, BB, DD, EE, CC, FF, GG. Goal found!

Is IDS Wasteful?

Generating states multiple times seems wasteful. However, in a search tree with a consistent branching factor, the vast majority of nodes are in the bottom level.

  • The nodes on the bottom level are generated once.
  • The nodes on the next-to-bottom level are generated twice.
  • Only the children of the root are generated dd times.

Properties of IDS:

  • Complete? Yes.
  • Optimal? Yes (if step cost = 1).
  • Time: (d+1)b0+db1+(d1)b2+...+bd=O(bd)(d+1)b^0 + d b^1 + (d-1)b^2 + ... + b^d = O(b^d)
  • Space: O(bd)O(bd) (linear space, just like DFS!).

IDS combines the benefits of DFS (low memory) and BFS (complete and optimal).


Bidirectional search operates by simultaneously searching forward from the initial state and backward from the goal state. The searches expand until they meet in the middle.

  • Advantage: Can be significantly faster. It reduces the search space because bdb^d becomes 2×bd/22 \times b^{d/2}.
    • Example: If b=10b=10 and d=10d=10, bidirectional search can be up to 50,000 times faster.
  • Challenges: The goal state must be known a priori. Memory consumption can be high, as it maintains two search trees.

Summary of Search Algorithms

CriterionBFSUniform-Cost (UCS)DFSDepth-Limited (DLS)Iterative Deepening (IDS)
Complete?YesYesNoNoYes
Optimal?YesYesNoNoYes
TimeO(bd)O(b^d)O(b1+C/ϵ)O(b^{1 + \lfloor C^*/\epsilon \rfloor})O(bm)O(b^m)O(bl)O(b^l)O(bd)O(b^d)
SpaceO(bd)O(b^d)O(b1+C/ϵ)O(b^{1 + \lfloor C^*/\epsilon \rfloor})O(bm)O(bm)O(bl)O(bl)O(bd)O(bd)

Legend: bb = branching factor, dd = depth of shallowest solution, mm = max depth of the search tree, ll = depth limit, CC^* = cost of optimal solution, ϵ\epsilon = minimum step cost.

On this page