AI Lecture 12
AI Lecture 12
Lecture 12
Problem Solving as Search
& State Space Search
4 5 6 7
8 9 10 11 12 13 14 15
Depth-LimitedStrategy
Depth-first with depth cutoff k (maximal depth below
which nodes are not expanded). You do not exceed
maximum depth.
Iterative-Deepening
Strategy
E.g., Repeat for k = 0 to 4
- Perform depth-first with depth cutoff k
ComparingDepth,Breadth,& IterativeDeepening
SearchAlgorithms
o Breadth-first and iterative deepening guarantee shortest
solution.
o Breadth-first: high space complexity. (Fringe expanded
exponentially)
o Depth-first: low space complexity, but may search below
solution depth.
o Iterative deepening: best performance in terms of orders
of complexity.
BidirectionalSearch
Bidirectional search is a graph search algorithm that finds a
shortest path from an initial start state to a goal state in a
directed graph. It runs two simultaneous searches: one
forward from the initial state, and one backward from the
goal, stopping when the two meet.
BidirectionalSearch
• You begin searching from the start and expand the
children and move in a direction, and in the same time
you move from the goal and try to find the parents and
the parents of these parent till we meet at specific node.
Then the path obtained from the two searches is the
final path to goal.
2 3
4 5 6 7
8 9 10 12 13 14 15
BidirectionalSearch
Complexityof BidirectionalSearch
Consider the following case:
- forward and backward branching both b, uniform ..
d/2 d/2
• The total cost from the initial state to any other state is based
on the summation of the cost of the steps.
• The cost of the path to each fringe node N is
• Start with the start state S is it the goal (NO). Expand and put its children
sorted by cost in the fringe or queue S
A 0
1 10
A B C
S 5 B 5 G
1 5 15
5 Nodes List = (S0)
15 C G G
11 10 Nodes List = (A1, B5, C15)
Nodes List = (B5, G11, C15)
Nodes List = (G10, G11, C15)
Uniform-CostStrategy
• After sorting they are A, B, and C because A has cost 1, then B with cost 5, and
then C with cost 15.
• First you go to the A, then B, and then C. Is A the goal (NO). Expand it and go to
G with cost 10 + 1 = 11.
• Then you go to B, is it the goal (NO) Expand it and you go to G with cost 5 + 5 =
10.
• No need to expand C because 15 is higher than 10 and 11 and the best is S,B,G
A S
0
1 10
S 5 B 5 G A B C
11 55 15
5
15 C
G G Nodes List = (S0)
11 10 Nodes List = (A1, B5, C15)
Nodes List = (B5, G11, C15)
Nodes List = (G10, G11, C15)
THANK YOU