IA-c03-NoAnim
IA-c03-NoAnim
(some slides adapted from A. Dragan, N. Kitaev, N. Lambert, S. Levine, S. Rao, S. Russell)
Outline
Uninformed Search
Breadth-First Search
Uniform Cost Search
Depth-First Search
Informed Search
Search problems
Partial search trees for Arad → Bucharest
Search problems
BFS on a tree
I employs FIFO
I early goal test: check if the node is goal when generated
BFS
Evaluation
I COMPLETENESS: yes
I COST OPTIMALITY: yes, if all actions have the same cost
I TIME COMPLEXITY: 1 + b + b2 + · · · + bd = O(bd )
(b=# of successors of a node, d=depth of a solution)
I SPACE COMPLEXITY: O(bd ) (all nodes kept in memory)
Uniform Cost Search, aka Dijkstra’s
UCS algorithm
When to stop?
Evaluation
I COMPLETENESS: yes it is systematic
I COST OPTIMALITY: yes first solution has a cost at least
as low as any other node in the frontier
∗
I TIME COMPLEXITY: O(b1+C / )
(C ∗ =cost of optimal solution, =lower bound of the cost of
each action)
I SPACE COMPLEXITY: same as for time
Depth First Search
DFS
Evaluation
I COMPLETENESS: yes if finite state space; no for infinte of
cyclic state spaces
I COST OPTIMALITY: no the first solution found is not
always the cheapest
I SPACE COMPLEXITY: O(bm)
(b=branching factor, m=max depth of tree)
Depth-Limited (DLS) and Iterative Deepening Search
(IDS)
DLS
Evaluation
I TIME COMPLEXITY: O(bl )
(b=branching factor, l=depth limit)
I SPACE COMPLEXITY: O(bl)
I COMPLETENESS: No if l not carefully chosen
Evaluation
I SPACE COMPLEXITY: O(bd) if there is a solution, O(bm)
on finite state spaces with no solution
I TIME COMPLEXITY: O(bd ) if there is a solution, O(bm ) on
finite state spaces with no solution
N(IDS) = d ∗ B 1 + (d − 1) ∗ b2 + . . . bd
(in many cases, most of the nodes are in the bottom level)
I COMPLETENESS: yes
Bidirectional Search
Use:
I two tables of reached states
I two frontiers and stop when they collide
Informed Search
Idea
Use domain specific info about how far we are from the goal.
h(n)=estimated cost of the cheapest path from the state at
node n to a goal state
Greedy Best First
Evaluation
I COMPLETENESS: yes for finite state spaces, pause no
pause for infinte ones
I SPACE COMPLEXITY: O(|V |)
I TIME COMPLEXITY: O(|V |)
I COST OPTIMALITY: no
A* Search
Consider both proximity of goal (h) and cost so far (g)
f (n) = g(n) + h(n)
A* Search
Evaluation
I COMPLETENESS: yes
I COST OPTIMALITY: yes, if h is admissible: it never
overestimates the cost to reach goal (it is optimistic)
∀n, h(n) ≤ h∗ (n), h∗ (n) =real cost n → nearest goal
(we assume ∀ i, h(i) ≥ 0 and ∀ g goal(g) ⇒ h(g) = 0)
Comparing heuristics
Two heuristics
h1 =number of misplaced tiles (blank not included),
e.g., h1 = 8
h2 =sum of Manhattan distances of tiles to their goal positions,
e.g, h2 = 3 + 1 + 2 + 2 + 2 + 3 + 3 + 2 = 18
A* Search
Dominance
If ∀n, h2 (n) ≥ h1 (n), we say that h2 dominates h1 .
Comparing heuristics
If h2 dominates h1 , then A* using h2 will not expand more nodes
than A* using h1 (except in the case of breaking ties unluckily).
Inventing heuristics
Relaxing problems
Exact cost of an optimal solution of a relaxed problem is an
admissible heuristic for the original problem.
Take max
If h1 , . . . , hm are heuristics, but none of them dominates any
other, we still can use : h(n) = max(h1 , . . . , hm )
Inventing heuristics
Use landmarks
Choose 10-20 landmark points among vertices and, foreach
landmark L and each other vertex v in the graph, compute and
store the exact cost of the optimal path from v to L, C ∗ (v , L).
Heuristics
Exercises
I Cannibals and missionaries problem: which of the
following heuristic is admissible:
h1 = # of people on the initial bank - 1
h2 = (# of people on the initial bank) / 2
I Knight on an infinite chess board: suggest a heuristic
I Go by car in a city from S to D in mimimum time: suggest a
heuristic
That’s all, folks!