1
15.053
Tuesday, April 2
z
The Shortest Path Problem
z
Dijkstra’s Algorithm for Solving the Shortest
Path Problem
Handouts:
Lecture Notes
2
The Minimum Cost Flow Problem
1
2
3
4
-$3, 6
$8,5
$7,2
$3, 4
$2, 7
3
4
-5
-2
Directed Graph G = (N, A).
Node set N, arc set A;
Capacities u
ij
on arc (i,j)
lower bound 0 on arc (i,j)
Cost c
ij
on arc (i,j)
Supply/demand b
i
for node i.
(Positive indicates supply)
A network with costs,
capacities, supplies, demands
Minimize the cost of sending flow
s.t.
Flow out of
i
- Flow into
i = b
i
0
≤
x
ij
u
ij
3
Formulation
In general the LP formulation is given as
Minimize
subject to
11
1
0
,,
,
nn
ij
ij
ij
ij
ki
i
jk
ij
ij
cx
xx
b
i
n
xu
…
==
−=
∀
=
≤≤
∑∑
4
The Shortest Path Problem
1
2
3
4
5
6
2
4
2
1
3
4
2
3
2
What is the shortest path from a source node (often
denoted as s) to a sink node, (often denoted as t)?
What is the shortest path from node 1 to node 6?
Assumptions for this lecture:
1.
There is a path from the source to all other nodes.
2.
All arc lengths are non-negative
5
Formulation as a linear program
In general the LP formulation for the shortest path
from a source, s, to a sink, t,
is given as
Minimize
subject to
1
0
0
,
,
,
,
ij
ij
ij
ki
is
i
t
i
n
otherwise
xi
j
=
−
=
∀
=
≥∀
…
6
Another Formulation
1
1
0
,{
}
,
ij
ij
ij
ki
ni
s
iN s
j
−∈
−
The LP formulation for the shortest path from a
source, s, to all other nodes is given as
Minimize
subject to