Professional Documents
Culture Documents
Engineering Decisions
Transshipment and Shortest Path Problems
George Gross
Department of Electrical and Computer Engineering
University of Illinois at Urbana-Champaign
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
TRANSSHIPMENT PROBLEMS
1
FLOW NETWORK EXAMPLE
1
4
s 3 t
2 5
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
TRANSSHIPMENT PROBLEMS
2
MAX FLOW PROBLEM
on each arc (i , j)
The mathematical statement of the problem is
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
max Z = f
s.t .
0 ≤ f ij ≤ kij ∀ arc ( i , j ) that connects
nodes i and j
f = ∑fi
si at source s conservation
of flow
∑i f it = f at sink t relations
⎫⎪
∑i f ij = ∑k f jk ⎬ at each transshipment node j
⎪⎭
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
3
MAX FLOW PROBLEM
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
NETWORK DEFINITIONS
4
NETWORK DEFINITION
we denote a path by
P = { ( i, k ), ( k, l ), …, ( m, j ) }
( 1, 2 ), ( 2, 5 ), ( 5, 4 ) is a path from 1 to 4
P = { ( i, k ), ( k, l ), …, ( m, i ) }
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
NETWORK DEFINITION
the definition is
N = { s , 1, 2, 3, 4, 5, t }
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
5
NETWORK CUT
NETWORK CUT
6
NETWORK CUT
Κ (S ,T ) = k4, t + k4, 5 + k3, 5 + k2, 5
Note : arc (5, 4) is directed from a node in T to a
node in S and is not included in the summation
max flow ≤ Κ (S , T ) ∀ S , T
and consequently
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
7
MAX FLOW MIN CUT THEOREM
MAX FLOW
8
LABELING PROCEDURE
9
EXAMPLE APPLICATION
7 1 9
s 3 t
9 8
2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
EXAMPLE APPLICATION
(1,7) 1 (0, 9)
s (1, 3) t
(0, 9) (1,8)
2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
10
EXAMPLE APPLICATION
6 1
s 2 t
7
2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
EXAMPLE APPLICATION
(3,7) 1 (0, 9)
s (3, 3) t
(0, 9) (3, 8)
2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
11
EXAMPLE APPLICATION
f = min { 5, 9 } = 5
s t
9 5
2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
EXAMPLE APPLICATION
(3,7) 1 (0, 9)
s t
(3, 3)
(5, 9) (8, 8)
2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
12
EXAMPLE APPLICATION
f = min { 4, 9 } = 4
4 1 9
s t
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
EXAMPLE APPLICATION
(7,7) 1 (4, 9)
s t
(3, 3)
(5, 9) (8, 8)
2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
13
EXAMPLE APPLICATION
f = min { 4, 3, 5 } = 3
1 5
s t
3
4
2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
EXAMPLE APPLICATION
s (0, 3)
t
(8, 9) (8, 8)
2
14
UNDIRECTED NETWORKS
A network with undirected arcs is called an
undirected network: the flows on each arc ( i, j )
with the limit kij cannot violate the capacity
constraints in either direction
Mathematically, we require
f ij ≤ kij ⎫ interpretation of
⎪
f ji ≤ k ji ⎪⎬ unidirectional flow below
⎪
f ij f ji = 0 ⎪⎭ capacity limit
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
EXAMPLES OF AN UNDIRECTED
NETWORK WITH ARCS
Consider the network with the three unrestricted
arcs
30
1 3
40 50
s 15 20 25 t
30 30
2 4
50
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
15
EXAMPLE OF A NETWORK WITH
UNDIRECTED ARCS
To make the problems realistic, we assume that
the numbers represent traffic flow capacities:
the directed arcs correspond to unidirectional
streets and the problem is to place one-way
signs on each street ( i, j ) not already directed
so as to maximize traffic flow from s to t
1 30 3
40 50
s 15 15 20
25 25 t
20
30 30
2 4
50
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
16
EXAMPLE OF A NETWORK WITH
UNDIRECTED ARCS
We apply the max flow scheme to the directed
network and give the following interpretations to
the flows on the max flow bidirectional arcs that
are the initially undirected arcs ( i, j ) : if
fij > 0 , fji > 0 and fij > fji
set up the flow from i to j with value fij – fji
and remove the arc ( j, i )
The computation of the max flow f for this
example is left as a homework exercise
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
(30 ,30)
30
1 3 (30
(40 ,50)
50
(40
(30 ,40)
40
20
s 15 15 25 (10 ,25)
25 t
20
(10 ,20)
30
(30 ,30) (30 ,30)
30
2 4
50
(30 ,50)
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
17
EXAMPLE OF A NETWORK WITH
UNDIRECTED ARCS
flow: s 1 3 n = 30
flow: s 2 4 n = 30
flow: s 1 4 3 t = 10
18
NETWORKS WITH MULTIPLE
SOURCES AND MULTIPLE SINKS
s1 t1
n
e
t
ŝ s2 w t2 t̂
o
. . .
. . .
r
sm k
tn
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
1 3 5 6 10 8
20
5 5
sources 10 10
with
supply 20 4 5 7
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
19
MULTIPLE SOURCE / MULTIPLE SINK
NETWORK EXAMPLE
2 15 5
super sink
node t̂
10 15
5 t̂
10 5
20 20
ŝ 1 3 5 6 10 8
20
20 5
5 10 10
super source
node ŝ 5
4 7
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
f = ∑
sinks
demands
20
MULTIPLE SOURCE / MULTIPLE SINK
NETWORK EXAMPLE
2 15 5 f
15
10 t̂
5
10 5
20
1 3 5 6 10 8
20
20 5 5
10 10
ŝ
20 4 5 7
f
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
15 + 5 + 5 + 5 = 30
21
APPLICATION TO MANPOWER
SCHEDULING
Consider the case of a company that must comp-
lete 4 projects in 6 months
manpower
earliest start latest finish
project requirements
month month
( person/month )
A 1 4 6
B 1 6 8
C 2 5 3
D 1 6 4
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
APPLICATION TO MANPOWER
SCHEDULING
There are the following additional constraints:
22
APPLICATION TO MANPOWER
SCHEDULING
The solution approach is to setup the problem
as a transshipment network
the sources are the 6 months
the sinks are the 4 projects
arcs ( i, j ) are introduced whenever a
feasible assignment of the engineers in
month i can be made to project j ; each arc
has capacity
kij = 2 i = 1, 2, …, 6 , j = A, B, C, D
there is no arc ( 1, C ) since project C cannot
start before month 2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
APPLICATION TO MANPOWER
SCHEDULING
4 1
A 6
4 2
8
man / months
B
man / months
demands
4 3
supply
4 4 C 3
4 5
D 4
4 6 each arc has capacity 2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
23
APPLICATION TO MANPOWER
SCHEDULING
APPLICATION TO MANPOWER
SCHEDULING
1 (2, 2)
(4, 4) (2, 2) (2, 2) A (6, 6)
(4, 4)
2 (2, 2)
(2, 2)
(4, 4)
(2, 2) B (8, 8)
3
ŝ (2, 2) t̂
(4, 4) 4 (2, 2) (1, 2) C (3, 3)
(3, 4)
5 (2, 2)
(2, 4)
D (4, 4)
6 (2, 2)
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
24
APPLICATION TO MANPOWER
SCHEDULING
(2, 2)
1 (6, 6)
(4, 4) (2, 2) (2, 2) A
21
(4, 4)
2 (2, 2)
(2, 2) (8, 8)
(4, 4)
(2, 2) B
3
ŝ (2, 2) t̂
(3, 3)
(4, 4) 4 (2, 2) C
(1, 2) 21
(3, 4)
5 (2, 2)
(4, 4)
(2, 4)
D
6 (2, 2)
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
25
SHORTEST ROUTE PROBLEM
dij = ∞
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
DIJKSTRA’S ALGORITHM
The solution is very efficiently performed using
Dijkstra’s algorithm
dij ≥ 0
26
DIJKSTRA’S ALGORITHM
node i
DIJKSTRA’S ALGORITHM
Step 0 : assign the permanent label 0 to node 1
Step 1 : assign the temporary labels to all the other
nodes
d1j if node j is directly connected to
node 1
∞ if node j is not directly connected
to node 1
and select the minimum of the temporary
labels and declare it permanent ; in case
of ties, the choice is arbitrary
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
27
DIJKSTRA’S ALGORITHM
Step 2 : let A be the node most recently assigned
a permanent label and consider each node
j with a temporary label; recompute the
label to be
⎪⎧ temporary label permanent label ⎪⎫
min ⎨ , + d Aj ⎬
⎪⎩ of node j of node A ⎪⎭
DIJKSTRA’S ALGORITHM
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
28
EXAMPLE : SHORTEST PATH
1 7 3 3
1 3
4
4 5
3
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
The problem is to
29
EXAMPLE : SHORTEST PATH
0
3,7,4,∞ ,∞ ⎤⎦
Steps 0 and 1 : L (0 ) = ⎡⎣0 ,,3,7,4,
1
L (4) = ⎡0,3,5,4,7,10 ⎤
⎣ ⎦
6
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
30
EXAMPLE : SHORTEST PATH
9
2 6 5
3 1 6
2
1 7 3 3 3
0
1 3
4 2
4 5 4
3
The shortest distance is 10 and we get the path
{ ( 1, 4 ) , ( 4, 5 ) , ( 5, 6 ) }
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
PATH RETRACING
We retrace the path from n back to 0 using the
scheme:
31
SHORTEST PATH BETWEEN ANY TWO
NODES
network
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
4 8 10
0 1 2 3 4
3 3 2 3
4 4 8
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
32
EXAMPLE : SHORTEST PATH
L (0 ) = 3,4,8,10,∞ ⎤⎦
⎡0 ,,3,4,8,10,
⎣
0
L (1) = ⎡0 ,,3,4,7,10
⎣
3, 4,7,10 ⎤⎦
1
L (2) = ⎡0 ,3,4,6,8
⎣
, 3, 4, 6,8⎤⎦
2
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
L (3) = ⎡0 ,,3,4,6,8
⎣
3, 4, 6, 8 ⎤⎦
3
Retracing the path we get
8 = 4
O + d 24
node 2 4
33
EXAMPLE : PATH RETRACING
1 4 8 3 10
2
0 1 2 3 4 4
3 3 2 3
4 4 8
0
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
APPPLICATION : EQUIPMENT
REPLACEMENT PROBLEM
We consider the problem of replacing old
equipment or continuing its maintenance
34
APPPLICATION : EQUIPMENT
REPLACEMENT PROBLEM
in order to minimize
fixed variable
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
EQUIPMENT REPLACEMENT
PROBLEM
Equipment replacement is planned during the
next 5 years
The cost elements are
pj = purchase costs in year j
sj = salvage value of original
equipment after j years of use
cj = O&M costs in year j of operation
of equipment with the property that
… cj < cj+1 < cj+2 < …
We formulate the equipment replacement
problem as a shortest route problem on a
directed network
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
35
EQUIPMENT REPLACEMENT PROBLEM
end of
planning
d16
d15 period
d14 d36
d13 d35
1 d12
2 d23
3 4 5 6
d34 d45 d56
d24 d46
d25
beginning of d26
planning period
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
APPPLICATION : EQUIPMENT
REPLACEMENT PROBLEM
36
APPPLICATION : EQUIPMENT
REPLACEMENT PROBLEM
For example, if the purchase is made in year 1
5
d16 = p1 − s5 + ∑c
τ =1
τ
37
COMPACT BOOK STORAGE IN A
LIBRARY
Any book of height Hi may be shelved on a
shelf of height ≥ Hi
38
COMPACT BOOK STORAGE IN A
LIBRARY
For example, if we consider the problem with 2
height classes Hm and Hn with Hm < Hn
all books of height ≤ Hm are shelved in shelf
with height Hm
all other books are shelved on the shelf with
height Hn
The corresponding total costs are
⎡ m ⎤ ⎡ n ⎤
⎢ sm + c m H m
⎢⎣
∑ L j ⎥ + ⎢ sn + c n H n
⎥⎦ ⎢⎣
∑ Lj ⎥
⎥
j =1 j = m +1 ⎦
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
set of n + 1 nodes
N = { 1, 2, . . . , n }
corresponding to the n + 1 book heights with
39
COMPACT BOOK STORAGE IN A
LIBRARY
a total of n ( n + 1) arcs
2
⎧ j
⎪ s + cj H j
d ij = ⎨ j ∑
k = i +1
Lk if j > i
⎪ ∞ otherwise
⎩
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
{ ( 0, 7 ) , ( 7, 9 ) , ( 9, 15 ) , (1 5, 17 ) }
the interpretation of this solution is :
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
40
COMPACT BOOK STORAGE IN A
LIBRARY
store all the books of height ≤ H7 on the
shelf of height H7
store all the books of height ≤ H9 but > H7
on the shelf of height H9
store all the books of height ≤ H15 but > H9
on the shelf of height H15
store all the books of height ≤ H17 but >
H15 on the shelf of height H17
ECE 307© 2006 George Gross, University of Illinois at Urbana-Champaign, All Rights Reserved.
41