Dijkstra Variants: A* and Potentials Eric Price UT Austin CS 331, Spring 2020 Coronavirus Edition CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Class Outline Bottleneck Shortest Paths 1 A* search 2 Problems 3 CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Logistics “Raise hand” will hopefully not crash my connection now. CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Logistics “Raise hand” will hopefully not crash my connection now. ◮ So you can try that, as well as chat, for questions. CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Logistics “Raise hand” will hopefully not crash my connection now. ◮ So you can try that, as well as chat, for questions. We’re going to try using Zoom breakout rooms for problems, later today. CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Logistics “Raise hand” will hopefully not crash my connection now. ◮ So you can try that, as well as chat, for questions. We’re going to try using Zoom breakout rooms for problems, later today. ◮ Inside, you can “Ask for help” and it pops up a notification for me. CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Logistics “Raise hand” will hopefully not crash my connection now. ◮ So you can try that, as well as chat, for questions. We’re going to try using Zoom breakout rooms for problems, later today. ◮ Inside, you can “Ask for help” and it pops up a notification for me. ◮ You stop being able to see my screen, so be sure to record the exercises before joining the breakout room. CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Talk Outline Bottleneck Shortest Paths 1 A* search 2 Problems 3 CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Bottleneck Shortest Paths Mentioned before spring break: network of roads, each has bridges of various heights on it. How high of a truck can go from s to t , or anywhere else? CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Bottleneck Shortest Paths Mentioned before spring break: network of roads, each has bridges of various heights on it. How high of a truck can go from s to t , or anywhere else? ◮ Max bandwidth path from s to t CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Bottleneck Shortest Paths Mentioned before spring break: network of roads, each has bridges of various heights on it. How high of a truck can go from s to t , or anywhere else? ◮ Max bandwidth path from s to t ◮ We’ll use it for network flows CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Bottleneck Shortest Paths Mentioned before spring break: network of roads, each has bridges of various heights on it. How high of a truck can go from s to t , or anywhere else? ◮ Max bandwidth path from s to t ◮ We’ll use it for network flows On undirected graph: CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Bottleneck Shortest Paths Mentioned before spring break: network of roads, each has bridges of various heights on it. How high of a truck can go from s to t , or anywhere else? ◮ Max bandwidth path from s to t ◮ We’ll use it for network flows On undirected graph: is maximum spanning tree CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Bottleneck Shortest Paths Mentioned before spring break: network of roads, each has bridges of various heights on it. How high of a truck can go from s to t , or anywhere else? ◮ Max bandwidth path from s to t ◮ We’ll use it for network flows On undirected graph: is maximum spanning tree On directed graph: Dijkstra/Prim variant solves in O ( E + V log V ). CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Dijkstra’s Algorithm 1: function Dijkstra ( s ) pred, dist ← {} , {} 2: q ← PriorityQueue ([(0, s , None)]) ⊲ dist, vertex, pred 3: while q do 4: d, u , parent ← q.pop min() 5: if u ∈ pred then 6: continue 7: pred[ u ] ← parent 8: dist[ u ] ← d 9: for u → v ∈ E do 10: q .push( (dist[u] + w ( u → v ), v , u ) ) 11: return dist, pred 12: CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Dijkstra’s Prim’s Algorithm 1: function Prim ( s ) pred, dist ← {} , {} 2: q ← PriorityQueue ([( −∞ , s , None)]) ⊲ dist, vertex, pred 3: while q do 4: d, u , parent ← q.pop min() 5: if u ∈ pred then 6: continue 7: pred[ u ] ← parent 8: dist[ u ] ← d 9: for u → v ∈ E do 10: q .push( (dist[u] + w ( u → v ), v , u ) ) 11: return dist, pred 12: CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Dijkstra’s Algorithm 1: function Dijkstra ( s ) pred, dist ← {} , {} 2: q ← PriorityQueue ([(0, s , None)]) ⊲ dist, vertex, pred 3: while q do 4: d, u , parent ← q.pop min() 5: if u ∈ pred then 6: continue 7: pred[ u ] ← parent 8: dist[ u ] ← d 9: for u → v ∈ E do 10: q .push( (dist[u] + w ( u → v ), v , u ) ) 11: return dist, pred 12: CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Dijkstra’s Bottleneck shortest path Algorithm 1: function Bottleneck ( s ) pred, dist ← {} , {} 2: q ← PriorityQueue ([(0, s , None)]) ⊲ dist, vertex, pred 3: while q do 4: d, u , parent ← q.pop max() 5: if u ∈ pred then 6: continue 7: pred[ u ] ← parent 8: dist[ u ] ← d 9: for u → v ∈ E do 10: q .push( (min(dist[ u ] , w ( u → v )), v , u ) ) 11: return dist, pred 12: CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Dijkstra’s Bottleneck shortest path Algorithm 1: function Bottleneck ( s ) pred, dist ← {} , {} 2: q ← PriorityQueue ([(0, s , None)]) ⊲ dist, vertex, pred 3: while q do 4: d, u , parent ← q.pop max() 5: if u ∈ pred then 6: continue 7: pred[ u ] ← parent 8: dist[ u ] ← d 9: for u → v ∈ E do 10: q .push( (min(dist[ u ] , w ( u → v )), v , u ) ) 11: return dist, pred 12: (min , +) → (max , min) CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Talk Outline Bottleneck Shortest Paths 1 A* search 2 Problems 3 CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Shortest s − t path with Dijkstra This is the wrong direction. Why waste our timing exploring it? CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Shortest s − t path with Dijkstra This is the wrong direction. Why waste our timing exploring it? CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Shortest s − t path with Dijkstra This is the wrong direction. Why waste our timing exploring it? CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
A ∗ search Dijkstra explores outward from s . CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
A ∗ search Dijkstra explores outward from s . ◮ Can stop if it reaches t , but doesn’t bias search toward t . CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
A ∗ search Dijkstra explores outward from s . ◮ Can stop if it reaches t , but doesn’t bias search toward t . Consider Dijkstra from Austin to San Francisco: CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
A ∗ search Dijkstra explores outward from s . ◮ Can stop if it reaches t , but doesn’t bias search toward t . Consider Dijkstra from Austin to San Francisco: ◮ Austin → New York = 1740 miles. CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
A ∗ search Dijkstra explores outward from s . ◮ Can stop if it reaches t , but doesn’t bias search toward t . Consider Dijkstra from Austin to San Francisco: ◮ Austin → New York = 1740 miles. ◮ Austin → San Francisco = 1760 miles. CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
A ∗ search Dijkstra explores outward from s . ◮ Can stop if it reaches t , but doesn’t bias search toward t . Consider Dijkstra from Austin to San Francisco: ◮ Austin → New York = 1740 miles. ◮ Austin → San Francisco = 1760 miles. Dijkstra will visit NYC before SF. CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
A ∗ search Dijkstra explores outward from s . ◮ Can stop if it reaches t , but doesn’t bias search toward t . Consider Dijkstra from Austin to San Francisco: ◮ Austin → New York = 1740 miles. ◮ Austin → San Francisco = 1760 miles. Dijkstra will visit NYC before SF. ◮ Once it visits SF, it stops searching CS 331, Spring Eric Price (UT Austin) Dijkstra Variants: A* and Potentials / 16
Recommend
More recommend