Solving problems by searching

Tree and graph search

Runs breadth-first, depth-first, depth-limited, iterative deepening, uniform-cost, greedy best-first, A*, and weighted A* search on a graph, one step at a time, with the state space, the search tree, and the frontier side by side.

  • Lecture reference: Solving Problems by Searching · slides 27–43
  • Lecture reference: Uninformed Search · slides 3–44
  • Lecture reference: Informed Search · slides 7–38

Problem 20 states · 23 edges

Start
Arad
Goal
Bucharest
h(n)
Straight-line distance to Bucharest
Successor order

A* search example. f(n) = g(n) + h(n) under every node, from 366=0+366 at Arad to 418=418+0 at Bucharest.

Lecture reference: Informed Search · slides 17–22
Edit graph

Strategy A* search

Frontier: Priority queue ordered by f(n) = g(n) + h(n)
As in the tree search outline.
Nodes taken off the frontier before the run stops.
Repeated states
Step 1 of 7
Initialize the frontier with Arad.

State space with h(n)

  • On the frontier
  • Goal state
  • h(n) estimate

Search tree

Arad366=0+366
  • On the frontier

Frontier

1 node Priority queue ordered by f(n) = g(n) + h(n)

Expansion order

0 of 6 nodes taken off the frontier

Expansion order: none taken off the frontier yet; 6 in all.

With focus in the tool: ← → previous and next step, Home End first and last step, Space play or pause.

Result

Solution Solution: Arad → Sibiu → Rimnicu Vilcea → Pitesti → Bucharest (cost 418). 6 nodes taken off the frontier, 5 expanded, 16 generated.

Taken off the frontier
6
Expanded
5
Generated
16
Largest frontier
11

Cheapest path This is a cheapest path (cost 418).

Questions from the slides

Properties of depth-first search: complete?

Lecture reference: Uninformed Search · slide 32
Show answer

How can we fix the greedy problem?

Lecture reference: Informed Search · slide 15
Show answer

A* gone wrong?

Lecture reference: Informed Search · slide 27
Show answer