Searches in AI
Searches in AI
Goal state
Search
Search
• Initial state Initial
state
• Actions
• Transition model
• Goal state
• Path cost
• Optimal solution
Goal
state
Example: Romania
Example: Romania
• On vacation in Romania; currently in A
• Initial state
• A
• Actions
• Go from one city to another
• Transition model
• If you go from city A to
city B, you end up in city B
• Goal state
• B
• Path cost
• Sum of edge costs
Example: Romania
Example: Romania
Example: 8-Queen Problem
Example: 8-Queen Problem
• Initial state
• No queens on the board
• Actions
• Go from one cell to another
• Transition model
• any arrangement of n<=8 queens
• or arrangements of n<=8 queens in leftmost n columns, 1 per column, such that no queen
attacks any other.
• Goal state
• 8 queens on the board, none attacked
• Path cost
• 1 per move
Searching Techniques
Searching Techniques
• UnInformed
• Breadth First Search
• Depth First Search
• Bidirectional Search
• Uniform Cost Search
• Informed
• Best First Search
• Greedy Best First Search
• A* Search
Searching Techniques
Searching Techniques
S
3 8
1
A B C
3 15
7 20
5
D E G
Example
Example
Expanded node Nodes list
{ S0 }
S0 { A3 B1 C8 }
S
A3 { D6 E10 G18 B1 C8 }
3 1 8 D6 { E10 G18 B1 C8 }
E10 { G18 B1 C8 }
A B C G18 { B1 C8 }
3 15
7 20 5 Solution path found is S A G, cost 18
Number of nodes expanded (including goal
D E G node) = 5
12
T Z
5
3
S O
9 16
L
11
1 R F
M
12 13
14
D
17
15 23
C P B