breadth first search uniform cost search · breadth first search uniform cost search robert platt...
TRANSCRIPT
![Page 1: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/1.jpg)
Breadth first searchUniform cost search
Robert PlattNortheastern University
Some images and slides are used from:1. CS188 UC Berkeley2. RN, AIMA
![Page 2: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/2.jpg)
What is graph search?
Start state
Goal state
![Page 3: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/3.jpg)
What is a graph?
Graph:
Edges:
Vertices:
Directed graph
![Page 4: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/4.jpg)
What is a graph?
Graph:
Edges:
Vertices:
Undirected graph
![Page 5: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/5.jpg)
Graph search
Given: a graph, G
Problem: find a path from A to B
– A: start state
– B: goal state
![Page 6: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/6.jpg)
Graph search
Given: a graph, G
Problem: find a path from A to B
– A: start state
– B: goal state
How?
![Page 7: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/7.jpg)
A search tree
Start at A
![Page 8: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/8.jpg)
A search tree
Successors of A
![Page 9: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/9.jpg)
A search tree
Successors of A
parent children
![Page 10: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/10.jpg)
A search tree
Let's expand S next
![Page 11: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/11.jpg)
A search tree
Successors of S
![Page 12: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/12.jpg)
A search tree
A was already visited!
![Page 13: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/13.jpg)
A search tree
A was already visited!So, prune it!
![Page 14: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/14.jpg)
A search tree
In what order should we expand states?
– here, we expanded S, but we could also have expanded Z or T
– different search algorithms expand in different orders
![Page 15: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/15.jpg)
Breadth first search (BFS)
Slide: Adapted from Berkeley CS188 course notes (downloaded Summer 2015)
![Page 16: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/16.jpg)
Breadth first search (BFS)
![Page 17: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/17.jpg)
Breadth first search (BFS)
Start node
![Page 18: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/18.jpg)
Breadth first search (BFS)
![Page 19: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/19.jpg)
Breadth first search (BFS)
![Page 20: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/20.jpg)
Breadth first search (BFS)
![Page 21: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/21.jpg)
Breadth first search (BFS)
We're going to maintain a queue called the fringe
– initialize the fringe as an empty queue
Fringe
![Page 22: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/22.jpg)
Breadth first search (BFS)
– add A to the fringe
fringeFringeA
![Page 23: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/23.jpg)
Breadth first search (BFS)
-- remove A from the fringe
-- add successors of A to the fringe
fringe
FringeBC
![Page 24: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/24.jpg)
Breadth first search (BFS)
-- remove B from the fringe
-- add successors of B to the fringe
fringe
FringeCDE
![Page 25: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/25.jpg)
Breadth first search (BFS)
fringe
FringeDEFG
-- remove C from the fringe
-- add successors of C to the fringe
![Page 26: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/26.jpg)
Breadth first search (BFS)
fringe
FringeDEFG
Which state gets removed next from the fringe?
![Page 27: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/27.jpg)
Breadth first search (BFS)
fringe
FringeDEFG
Which state gets removed next from the fringe?
What kind of a queue is this?
![Page 28: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/28.jpg)
Breadth first search (BFS)
fringe
FringeDEFG
Which state gets removed next from the fringe?
What kind of a queue is this?
FIFO Queue!(first in first out)
![Page 29: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/29.jpg)
Breadth first search (BFS)
![Page 30: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/30.jpg)
Breadth first search (BFS)
What is the purpose of the explored set?
![Page 31: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/31.jpg)
BFS Properties
Is BFS complete?– is it guaranteed to find a solution if one exists?
![Page 32: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/32.jpg)
BFS Properties
Is BFS complete?– is it guaranteed to find a solution if one exists?
What is the time complexity of BFS?– how many states are expanded before finding a sol'n?
– b: branching factor– d: depth of shallowest solution– complexity = ???
![Page 33: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/33.jpg)
BFS Properties
Is BFS complete?– is it guaranteed to find a solution if one exists?
What is the time complexity of BFS?– how many states are expanded before finding a sol'n?
– b: branching factor– d: depth of shallowest solution– complexity =
![Page 34: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/34.jpg)
BFS Properties
Is BFS complete?– is it guaranteed to find a solution if one exists?
What is the time complexity of BFS?– how many states are expanded before finding a sol'n?
– b: branching factor– d: depth of shallowest solution– complexity =
What is the space complexity of BFS?– how much memory is required?
– complexity = ???
![Page 35: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/35.jpg)
BFS Properties
Is BFS complete?– is it guaranteed to find a solution if one exists?
What is the time complexity of BFS?– how many states are expanded before finding a sol'n?
– b: branching factor– d: depth of shallowest solution– complexity =
What is the space complexity of BFS?– how much memory is required?
– complexity =
![Page 36: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/36.jpg)
BFS Properties
Is BFS complete?– is it guaranteed to find a solution if one exists?
What is the time complexity of BFS?– how many states are expanded before finding a sol'n?
– b: branching factor– d: depth of shallowest solution– complexity =
What is the space complexity of BFS?– how much memory is required?
– complexity =
Is BFS optimal?– is it guaranteed to find the best solution (shortest path)?
![Page 37: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/37.jpg)
Another BFS example...
![Page 38: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/38.jpg)
Uniform Cost Search (UCS)
Slide: Adapted from Berkeley CS188 course notes (downloaded Summer 2015)
![Page 39: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/39.jpg)
Uniform Cost Search (UCS)
Notice the distances between cities
![Page 40: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/40.jpg)
Uniform Cost Search (UCS)
Notice the distances between cities– does BFS take these distances into account?
![Page 41: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/41.jpg)
Uniform Cost Search (UCS)
Notice the distances between cities– does BFS take these distances into account?– does BFS find the path w/ shortest milage?
![Page 42: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/42.jpg)
Uniform Cost Search (UCS)
Notice the distances between cities– does BFS take these distances into account?– does BFS find the path w/ shortest milage?– compare S-F-B with S-R-P-B. Which costs less?
![Page 43: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/43.jpg)
Uniform Cost Search (UCS)
Notice the distances between cities– does BFS take these distances into account?– does BFS find the path w/ shortest milage?– compare S-F-B with S-R-P-B. Which costs less?
How do we fix this?
![Page 44: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/44.jpg)
Uniform Cost Search (UCS)
Notice the distances between cities– does BFS take these distances into account?– does BFS find the path w/ shortest milage?– compare S-F-B with S-R-P-B. Which costs less?
How do we fix this?UCS!
![Page 45: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/45.jpg)
Uniform Cost Search (UCS)
Same as BFS except: expand node w/ smallest path cost
Length of path
![Page 46: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/46.jpg)
Uniform Cost Search (UCS)
Same as BFS except: expand node w/ smallest path cost
Length of path
Cost of going from state A to B:
Minimum cost of path going from start state to B:
![Page 47: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/47.jpg)
Uniform Cost Search (UCS)
Same as BFS except: expand node w/ smallest path cost
Length of path
Cost of going from state A to B:
Minimum cost of path going from start state to B:
BFS: expands states in order of hops from start
UCS: expands states in order of
![Page 48: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/48.jpg)
Uniform Cost Search (UCS)
Same as BFS except: expand node w/ smallest path cost
Length of path
Cost of going from state A to B:
Minimum cost of path going from start state to B:
BFS: expands states in order of hops from start
UCS: expands states in order of How?
![Page 49: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/49.jpg)
Uniform Cost Search (UCS)
Simple answer: change the FIFO to a priority queue– the priority of each element in the queue is its path cost.
![Page 50: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/50.jpg)
Uniform Cost Search (UCS)
![Page 51: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/51.jpg)
UCS
FringeA
Path Cost0
Explored set:
![Page 52: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/52.jpg)
UCS
140 11875
Explored set: A
FringeASTZ
Path Cost014011875
![Page 53: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/53.jpg)
UCS
140 11875
146
Explored set: A, Z
FringeASTZT
Path Cost014011875146
![Page 54: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/54.jpg)
UCS
140 11875
146229
Explored set: A, Z, T
FringeASTZTL
Path Cost014011875146229
![Page 55: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/55.jpg)
UCS
140 11875
239 220 146229
Explored set: A, Z, T, S
FringeASTZTLFR
Path Cost014011875146229239220
![Page 56: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/56.jpg)
UCS
140 11875
239 220 146229
Explored set: A, Z, T, S
FringeASTZTLFR
Path Cost014011875146229239220
![Page 57: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/57.jpg)
UCS
140 11875
239 220
336 317
146229
Explored set: A, Z, T, S, R
FringeASTZTLFRCP
Path Cost014011875146229239220336317
![Page 58: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/58.jpg)
UCS
140 11875
239 220
336 317
146229
299
Explored set: A, Z, T, S, R, L
FringeASTZTLFRCPM
Path Cost014011875146229239220336317299
![Page 59: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/59.jpg)
UCS
140 11875
239 220
336 317
146229
299
Explored set: A, Z, T, S, R, L
FringeASTZTLFRCPM
Path Cost014011875146229239220336317299
When does this end?
![Page 60: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/60.jpg)
UCS
140 11875
239 220
336 317
146229
299
Explored set: A, Z, T, S, R, L
FringeASTZTLFRCPM
Path Cost014011875146229239220336317299
When does this end?– when the goal state is removed from the queue
![Page 61: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/61.jpg)
UCS
140 11875
239 220
336 317
146229
299
Explored set: A, Z, T, S, R, L
FringeASTZTLFRCPM
Path Cost014011875146229239220336317299
When does this end?– when the goal state is removed from the queue– NOT when the goal state is expanded
![Page 62: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/62.jpg)
UCS
![Page 63: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/63.jpg)
UCS Properties
Is UCS complete?– is it guaranteed to find a solution if one exists?
What is the time complexity of UCS?– how many states are expanded before finding a sol'n?
– b: branching factor– C*: cost of optimal sol'n– e: min one-step cost– complexity =
What is the space complexity of BFS?– how much memory is required?
– complexity =
Is BFS optimal?– is it guaranteed to find the best solution (shortest path)?
![Page 64: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/64.jpg)
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
Strategy: expand a cheapest node first:
Fringe is a priority queue (priority: cumulative cost) S
G
d
b
p q
c
e
h
a
f
r
3 9 1
16411
5
713
8
1011
17 11
0
6
39
1
1
2
8
8 2
15
1
2
Cost contours
2
UCS vs BFS
Slide: Adapted from Berkeley CS188 course notes (downloaded Summer 2015)
![Page 65: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/65.jpg)
UCS vs BFS
S
a
b
d p
a
c
e
p
h
f
r
q
q c G
a
qe
p
h
f
r
q
q c G
a
S
G
d
b
p q
c
e
h
a
f
r
Search
Tiers
Strategy: expand a shallowest node first
Implementation: Fringe is a FIFO queue
Slide: Adapted from Berkeley CS188 course notes (downloaded Summer 2015)
![Page 66: Breadth first search Uniform cost search · Breadth first search Uniform cost search Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley](https://reader034.vdocuments.us/reader034/viewer/2022051900/5fee662bcc72d3349052e03b/html5/thumbnails/66.jpg)
UCS vs BFS
Start Goal
…
c 3
c 2c 1 Remember: UCS explores
increasing cost contours
The good: UCS is complete and optimal!
The bad: Explores options in every
“direction” No information about goal
location
We’ll fix that soon!
Slide: Adapted from Berkeley CS188 course notes (downloaded Summer 2015)