Dijkstra Variants: A* and Potentials Eric Price UT Austin CS 331, - - PowerPoint PPT Presentation

dijkstra variants a and potentials
SMART_READER_LITE
LIVE PREVIEW

Dijkstra Variants: A* and Potentials Eric Price UT Austin CS 331, - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

Dijkstra Variants: A* and Potentials

Eric Price

UT Austin

CS 331, Spring 2020 Coronavirus Edition

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-2
SLIDE 2

Class Outline

1

Bottleneck Shortest Paths

2

A* search

3

Problems

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-3
SLIDE 3

Logistics

“Raise hand” will hopefully not crash my connection now.

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-4
SLIDE 4

Logistics

“Raise hand” will hopefully not crash my connection now.

◮ So you can try that, as well as chat, for questions. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-5
SLIDE 5

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.

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-6
SLIDE 6

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. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-7
SLIDE 7

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.

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-8
SLIDE 8

Talk Outline

1

Bottleneck Shortest Paths

2

A* search

3

Problems

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-9
SLIDE 9

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?

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-10
SLIDE 10

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 Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-11
SLIDE 11

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 Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-12
SLIDE 12

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:

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-13
SLIDE 13

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

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-14
SLIDE 14

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 ).

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-15
SLIDE 15

Dijkstra’s Algorithm

1: function Dijkstra(s) 2:

pred, dist ← {}, {}

3:

q ← PriorityQueue([(0, s, None)]) ⊲ dist, vertex, pred

4:

while q do

5:

d, u, parent ← q.pop min()

6:

if u ∈ pred then

7:

continue

8:

pred[u] ← parent

9:

dist[u] ← d

10:

for u → v ∈ E do

11:

q.push( (dist[u] + w(u → v), v, u) )

12:

return dist, pred

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-16
SLIDE 16

Dijkstra’s Prim’s Algorithm

1: function Prim(s) 2:

pred, dist ← {}, {}

3:

q ← PriorityQueue([(−∞, s, None)]) ⊲ dist, vertex, pred

4:

while q do

5:

d, u, parent ← q.pop min()

6:

if u ∈ pred then

7:

continue

8:

pred[u] ← parent

9:

dist[u] ← d

10:

for u → v ∈ E do

11:

q.push( (dist[u] + w(u → v), v, u) )

12:

return dist, pred

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-17
SLIDE 17

Dijkstra’s Algorithm

1: function Dijkstra(s) 2:

pred, dist ← {}, {}

3:

q ← PriorityQueue([(0, s, None)]) ⊲ dist, vertex, pred

4:

while q do

5:

d, u, parent ← q.pop min()

6:

if u ∈ pred then

7:

continue

8:

pred[u] ← parent

9:

dist[u] ← d

10:

for u → v ∈ E do

11:

q.push( (dist[u] + w(u → v), v, u) )

12:

return dist, pred

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-18
SLIDE 18

Dijkstra’s Bottleneck shortest path Algorithm

1: function Bottleneck(s) 2:

pred, dist ← {}, {}

3:

q ← PriorityQueue([(0, s, None)]) ⊲ dist, vertex, pred

4:

while q do

5:

d, u, parent ← q.pop max()

6:

if u ∈ pred then

7:

continue

8:

pred[u] ← parent

9:

dist[u] ← d

10:

for u → v ∈ E do

11:

q.push( (min(dist[u], w(u → v)), v, u) )

12:

return dist, pred

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-19
SLIDE 19

Dijkstra’s Bottleneck shortest path Algorithm

1: function Bottleneck(s) 2:

pred, dist ← {}, {}

3:

q ← PriorityQueue([(0, s, None)]) ⊲ dist, vertex, pred

4:

while q do

5:

d, u, parent ← q.pop max()

6:

if u ∈ pred then

7:

continue

8:

pred[u] ← parent

9:

dist[u] ← d

10:

for u → v ∈ E do

11:

q.push( (min(dist[u], w(u → v)), v, u) )

12:

return dist, pred (min, +) → (max, min)

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-20
SLIDE 20

Talk Outline

1

Bottleneck Shortest Paths

2

A* search

3

Problems

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-21
SLIDE 21

Shortest s − t path with Dijkstra

This is the wrong direction. Why waste our timing exploring it?

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-22
SLIDE 22

Shortest s − t path with Dijkstra

This is the wrong direction. Why waste our timing exploring it?

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-23
SLIDE 23

Shortest s − t path with Dijkstra

This is the wrong direction. Why waste our timing exploring it?

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-24
SLIDE 24

A∗ search

Dijkstra explores outward from s.

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-25
SLIDE 25

A∗ search

Dijkstra explores outward from s.

◮ Can stop if it reaches t, but doesn’t bias search toward t. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-26
SLIDE 26

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:

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-27
SLIDE 27

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. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-28
SLIDE 28

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. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-29
SLIDE 29

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.

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-30
SLIDE 30

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 Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-31
SLIDE 31

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 ◮ So it needs to visit NYC, in case it can get from NYC to SF in 20 miles. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-32
SLIDE 32

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 ◮ So it needs to visit NYC, in case it can get from NYC to SF in 20 miles. ◮ ...with a portal or something? Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-33
SLIDE 33

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 ◮ So it needs to visit NYC, in case it can get from NYC to SF in 20 miles. ◮ ...with a portal or something? ◮ Fact: you cannot get from NYC to SF in 20 miles. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-34
SLIDE 34

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 ◮ So it needs to visit NYC, in case it can get from NYC to SF in 20 miles. ◮ ...with a portal or something? ◮ Fact: you cannot get from NYC to SF in 20 miles.

A∗: uses a heuristic h(u), estimating d(u, t).

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-35
SLIDE 35

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 ◮ So it needs to visit NYC, in case it can get from NYC to SF in 20 miles. ◮ ...with a portal or something? ◮ Fact: you cannot get from NYC to SF in 20 miles.

A∗: uses a heuristic h(u), estimating d(u, t).

◮ Dijkstra: visit node of smallest dist[u] Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-36
SLIDE 36

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 ◮ So it needs to visit NYC, in case it can get from NYC to SF in 20 miles. ◮ ...with a portal or something? ◮ Fact: you cannot get from NYC to SF in 20 miles.

A∗: uses a heuristic h(u), estimating d(u, t).

◮ Dijkstra: visit node of smallest dist[u] ◮ A∗: visit node of smallest dist[u] + h(u) Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-37
SLIDE 37

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 ◮ So it needs to visit NYC, in case it can get from NYC to SF in 20 miles. ◮ ...with a portal or something? ◮ Fact: you cannot get from NYC to SF in 20 miles.

A∗: uses a heuristic h(u), estimating d(u, t).

◮ Dijkstra: visit node of smallest dist[u] ◮ A∗: visit node of smallest dist[u] + h(u)

Example: h(NYC) is Euclidean distance from NYC to SF.

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-38
SLIDE 38

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 ◮ So it needs to visit NYC, in case it can get from NYC to SF in 20 miles. ◮ ...with a portal or something? ◮ Fact: you cannot get from NYC to SF in 20 miles.

A∗: uses a heuristic h(u), estimating d(u, t).

◮ Dijkstra: visit node of smallest dist[u] ◮ A∗: visit node of smallest dist[u] + h(u)

Example: h(NYC) is Euclidean distance from NYC to SF.

◮ Any path through NYC will take at least 3700 miles. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-39
SLIDE 39

Dijkstra’s Algorithm

1: function Dijkstra(s) 2:

pred, dist ← {}, {}

3:

q ← PriorityQueue([(0 , s, None)]) ⊲ dist, vertex, pred

4:

while q do

5:

d, u, parent ← q.pop min()

6:

if d ≥ dist[u] then

7:

continue

8:

pred[u] ← parent

9:

dist[u] ← d

10:

for u → v ∈ E do

11:

q.push( (dist[u] + w(u → v), v, u) )

12:

return dist, pred

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-40
SLIDE 40

Dijkstra’s A* Search Algorithm

1: function A*(s) 2:

pred, dist ← {}, {}

3:

q ← PriorityQueue([(0 + h(s), s, None)]) ⊲ dist, vertex, pred

4:

while q do

5:

d, u, parent ← q.pop min()

6:

if d−h(u) ≥ dist[u] then

7:

continue

8:

pred[u] ← parent

9:

dist[u] ← d - h(u)

10:

for u → v ∈ E do

11:

q.push( (dist[u] + w(u → v)+ h(v), v, u) )

12:

return dist, pred

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-41
SLIDE 41

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-42
SLIDE 42

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-43
SLIDE 43

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-44
SLIDE 44

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

◮ Every s t path P on w ′ has length

  • e∈P

w ′(e) = h(t) − h(s) +

  • e∈P

w(e)

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-45
SLIDE 45

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

◮ Every s t path P on w ′ has length

  • e∈P

w ′(e) = h(t) − h(s) +

  • e∈P

w(e)

◮ So which path is shortest is same under w or w ′. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-46
SLIDE 46

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

◮ Every s t path P on w ′ has length

  • e∈P

w ′(e) = h(t) − h(s) +

  • e∈P

w(e)

◮ So which path is shortest is same under w or w ′.

Heuristics:

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-47
SLIDE 47

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

◮ Every s t path P on w ′ has length

  • e∈P

w ′(e) = h(t) − h(s) +

  • e∈P

w(e)

◮ So which path is shortest is same under w or w ′.

Heuristics:

◮ Heuristic “admissible:” h(u) ≤ d(u, t) Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-48
SLIDE 48

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

◮ Every s t path P on w ′ has length

  • e∈P

w ′(e) = h(t) − h(s) +

  • e∈P

w(e)

◮ So which path is shortest is same under w or w ′.

Heuristics:

◮ Heuristic “admissible:” h(u) ≤ d(u, t) ⋆ Admissible =

⇒ first visit to t gives optimal path, so correct.

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-49
SLIDE 49

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

◮ Every s t path P on w ′ has length

  • e∈P

w ′(e) = h(t) − h(s) +

  • e∈P

w(e)

◮ So which path is shortest is same under w or w ′.

Heuristics:

◮ Heuristic “admissible:” h(u) ≤ d(u, t) ⋆ Admissible =

⇒ first visit to t gives optimal path, so correct.

◮ Heuristic “consistent:” h(t) = 0 and h(u) ≤ w(u, v) + h(v). Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-50
SLIDE 50

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

◮ Every s t path P on w ′ has length

  • e∈P

w ′(e) = h(t) − h(s) +

  • e∈P

w(e)

◮ So which path is shortest is same under w or w ′.

Heuristics:

◮ Heuristic “admissible:” h(u) ≤ d(u, t) ⋆ Admissible =

⇒ first visit to t gives optimal path, so correct.

◮ Heuristic “consistent:” h(t) = 0 and h(u) ≤ w(u, v) + h(v). ⋆ Equivalent: h(t) = 0 and w ′(u, v) ≥ 0 for all u, v. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-51
SLIDE 51

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

◮ Every s t path P on w ′ has length

  • e∈P

w ′(e) = h(t) − h(s) +

  • e∈P

w(e)

◮ So which path is shortest is same under w or w ′.

Heuristics:

◮ Heuristic “admissible:” h(u) ≤ d(u, t) ⋆ Admissible =

⇒ first visit to t gives optimal path, so correct.

◮ Heuristic “consistent:” h(t) = 0 and h(u) ≤ w(u, v) + h(v). ⋆ Equivalent: h(t) = 0 and w ′(u, v) ≥ 0 for all u, v. ⋆ w ′ ≥ 0 =

⇒ Dijkstra is fast/correct (depending on implementation).

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-52
SLIDE 52

Heuristics/potential functions

A∗: uses a heuristic h(u), estimating d(u, t).

◮ A∗: visit node of smallest dist[u] + h(u) ◮ Paths equivalent to Dijkstra on a reweighted graph:

w ′(u → v) = w(u → v) − h(u) + h(v). [h(u) is height of a hill: easy to go down, hard to go up.]

◮ Every s t path P on w ′ has length

  • e∈P

w ′(e) = h(t) − h(s) +

  • e∈P

w(e)

◮ So which path is shortest is same under w or w ′.

Heuristics:

◮ Heuristic “admissible:” h(u) ≤ d(u, t) ⋆ Admissible =

⇒ first visit to t gives optimal path, so correct.

◮ Heuristic “consistent:” h(t) = 0 and h(u) ≤ w(u, v) + h(v). ⋆ Equivalent: h(t) = 0 and w ′(u, v) ≥ 0 for all u, v. ⋆ w ′ ≥ 0 =

⇒ Dijkstra is fast/correct (depending on implementation).

⋆ And consistent =

⇒ admissible.

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-53
SLIDE 53

Shortest s − t path with Dijkstra

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-54
SLIDE 54

Shortest s − t path with Dijkstra

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-55
SLIDE 55

Shortest s − t path with Dijkstra

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-56
SLIDE 56

Shortest s − t path with Dijkstra

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-57
SLIDE 57

Summary of Dijkstra variants

Bottleneck shortest paths

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-58
SLIDE 58

Summary of Dijkstra variants

Bottleneck shortest paths

◮ How do they relate to MSTs? Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-59
SLIDE 59

Summary of Dijkstra variants

Bottleneck shortest paths

◮ How do they relate to MSTs?

Dijkstra with potentials: w′(u → v) = w(u → v) − h(u) + h(v).

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-60
SLIDE 60

Summary of Dijkstra variants

Bottleneck shortest paths

◮ How do they relate to MSTs?

Dijkstra with potentials: w′(u → v) = w(u → v) − h(u) + h(v).

◮ Can adjust the graph to have nonnegative weights Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-61
SLIDE 61

Summary of Dijkstra variants

Bottleneck shortest paths

◮ How do they relate to MSTs?

Dijkstra with potentials: w′(u → v) = w(u → v) − h(u) + h(v).

◮ Can adjust the graph to have nonnegative weights ◮ Can adjust the graph to bias toward goal t (A∗ search). Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-62
SLIDE 62

Summary of Dijkstra variants

Bottleneck shortest paths

◮ How do they relate to MSTs?

Dijkstra with potentials: w′(u → v) = w(u → v) − h(u) + h(v).

◮ Can adjust the graph to have nonnegative weights ◮ Can adjust the graph to bias toward goal t (A∗ search). ◮ Admissible =

⇒ correct

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-63
SLIDE 63

Summary of Dijkstra variants

Bottleneck shortest paths

◮ How do they relate to MSTs?

Dijkstra with potentials: w′(u → v) = w(u → v) − h(u) + h(v).

◮ Can adjust the graph to have nonnegative weights ◮ Can adjust the graph to bias toward goal t (A∗ search). ◮ Admissible =

⇒ correct

◮ Consistent =

⇒ correct and O(E + V log V )

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-64
SLIDE 64

Summary of Dijkstra variants

Bottleneck shortest paths

◮ How do they relate to MSTs?

Dijkstra with potentials: w′(u → v) = w(u → v) − h(u) + h(v).

◮ Can adjust the graph to have nonnegative weights ◮ Can adjust the graph to bias toward goal t (A∗ search). ◮ Admissible =

⇒ correct

◮ Consistent =

⇒ correct and O(E + V log V )

◮ Can be faster in many cases. Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-65
SLIDE 65

Talk Outline

1

Bottleneck Shortest Paths

2

A* search

3

Problems

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-66
SLIDE 66

Shortest Path Problems

http://jeffe.cs.illinois.edu/teaching/algorithms/book/ 08-sssp.pdf Problem 2: Dijkstra with k negative edges. Problem 3: vertices, not edges, have weight. Problem 5: edge reinsertion Problem 4: Replacement paths on directed graphs Problem 12: Smallest shortest path Problem 16, 17: Remember reductions? Problem 1 of https://www.cs.utexas.edu/~ecprice/courses/ 331h/psets/331h-ps6.pdf

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-67
SLIDE 67

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16

slide-68
SLIDE 68

Eric Price (UT Austin) Dijkstra Variants: A* and Potentials CS 331, Spring / 16