Chapter 4: Problem Solving and Search

4.1 What is Problem Solving in AI?

AI agents often face situations where:

In such cases, they search through a space of possible actions and outcomes to reach a solution.

4.2 Components of a Problem

Component Description Example (8-puzzle)
Initial State Starting point Tiles in a scrambled order
Actions Possible moves from each state Slide left, right, up, down
Transition Model Result of an action New arrangement of tiles after a move
Goal Test Checks if current state = goal Are all tiles in order?
Path Cost Cost for the solution (e.g., steps taken) Each move = 1 step

4.3 State Space

The state space is the set of all possible configurations (states) the system can be in.

Example: In 8-puzzle, there are 9! = 362,880 possible states (positions of 9 tiles).

4.4 Search Types: Informed vs. Uninformed

Type Has Heuristic? Examples
Uninformed BFS, DFS, UCS
Informed Greedy, A* Search

4.5 Uninformed (Blind) Search Algorithms

Breadth-First Search (BFS)

Explores the shallowest (closest to root) nodes first.

Time/Space Complexity: O(bd)

Depth-First Search (DFS)

Explores the deepest node first.

Time Complexity: O(bm)

Uniform Cost Search (UCS)

Expands the node with the lowest path cost.

4.6 Informed (Heuristic) Search

Informed search algorithms use problem-specific knowledge to guide the search.

What is a Heuristic?

A heuristic is a function that estimates the cost to reach the goal from a given node n.

Common Heuristics:

4.7 Frequently Asked Exam Questions

  1. Define BFS and explain how it differs from DFS.
  2. Compare the performance of UCS vs. IDS.
  3. Solve a simple state graph using UCS and list node expansions.
  4. Explain iterative deepening search with an example.