Download presentation
Presentation is loading. Please wait.
Published byJemimah Cook Modified over 9 years ago
1
Basic Search Procedure 1. Start with the start node (root of the search tree) and place in on the queue 2. Remove the front node in the queue and If the node is a goal node, then we are done; stop. If the node is a goal node, then we are done; stop. Otherwise expand the node generate its children using the successor function (other states that can be reached with one move) Otherwise expand the node generate its children using the successor function (other states that can be reached with one move) 3. Place the children on the queue according to the search strategy 4. Go back to step 2.
2
Search Strategies Search strategies differ based on the order in which new successor nodes are added to the queue Breadth-first add nodes to the end of the queue Depth-first add nodes to the front Uniform cost sort the nodes on the queue based on the cost of reaching the node from start node
3
Breadth-First Search add nodes to the end of the queue
4
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: A
5
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: B I E
6
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: I E C D
7
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: E C D M K
8
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: C D M K F H
9
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: D M K F H N
10
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: M K F H N
11
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: K F H N O G
12
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: F H N O G
13
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: H N O G Q
14
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: N O G Q R T
15
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: O G Q R T P S
16
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: G Q R T P S
17
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: Q R T P S DONE!!! Solution: A I M G
18
Depth-First Search add nodes to the front of the queue
19
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: A
20
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: B I E
21
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: C D I E
22
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: N D I E
23
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: P S D I E
24
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: S D I E
25
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: D I E
26
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: I E
27
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: M K E
28
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: O G K E
29
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: G K E
30
Breadth-First Search A IBE CDMK N F H OG Q RT PS goal Queue: K E DONE!!! Solution: A I M G
31
Example: The 8-Puzzle States?integer location of tiles Operators? move blank left, right, up, down Goal Test?= goal state (given) Path Cost?One per move
32
We will assume that we can do repeated state checking (i.e., we will not generate nodes that have been previously expanded) Example: 8-Puzzle – Depth First Search
39
... Example: 8-Puzzle – Depth First Search
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.