Network Flow Problems –Shortest Path Problem
Consider the following flow network:
1
2
3
4 5
d12
The objective is to find the shortest path from node 1 to node n. The distance from node i to j, dij does not have to equal the distance from node j to i, dji.
6
d14
d23
d26
d36
d35
d45
d56
d34
d13
Network Flow Problems –Shortest Path Problem
Dijkstra’s labeling algorithm:
1
2
3
4 5
3
Summary: Nodes are permanently labeled or temporarily labeled. All nodes that can be immediately reached from permanently labeled nodes are temporarily labeled. The label is the minimum of the sum of the distance from node 1 to the permanent node plus the distance to the temporary node. Start with node 1 as the only permanently labeled node. Find the temporarily labeled node with minimum distance. Make this node permanent. Repeat this process until all nodes are permanently labeled.
6
4
2
9
6
3
3
3
1
7
Network Flow Problems –Shortest Path Problem
Dijkstra’s labeling algorithm:
1[0]
2(3,1)
3(7,1)
4(4,1)
5
3
[ ] – permanent label(d,f) – temporary label; d – distance, f - from node
L(0) = [0, 3, 7, 4, inf., inf.] – choose node 2 *
6
4
2
9
6
3
3
3
1
7
)(
)(
Network Flow Problems –Shortest Path Problem
Dijkstra’s labeling algorithm:
1[0]
2[3,1]
3(5,2)
4(4,1)
5
3
L(1) = [0, 3, 5, 4, inf., 12] – choose node 4 * *
6(12,2)
4
2
9
6
3
3
3
1
7
)(
Network Flow Problems –Shortest Path Problem
Dijkstra’s labeling algorithm:
1[0]
2[3,1]
3(5,2)
4[4,1]
5(7,4)
3
L(2) = [0, 3, 5, 4, 7, 12] – choose node 3 * * *
6(12,2)
4
2
9
6
3
3
3
1
7
Network Flow Problems –Shortest Path Problem
Dijkstra’s labeling algorithm:
1[0]
2[3,1]
3[5,2]
4[4,1]
5(7,4)
3
L(3) = [0, 3, 5, 4, 7, 11] – choose node 5 * * * *
6(11,3)
4
2
9
6
3
3
3
1
7
Network Flow Problems –Shortest Path Problem
Dijkstra’s labeling algorithm:
1[0]
2[3,1]
3[5,2]
4[4,1]
5[7,4]
3
L(4) = [0, 3, 5, 4, 7, 10] – choose node 6 * * * * *
6(10,5)
4
2
9
6
3
3
3
1
7
Network Flow Problems –Shortest Path Problem
Dijkstra’s labeling algorithm:
1[0]
2[3,1]
3[5,2]
4[4,1]
5[7,4]
3
L(5) = [0, 3, 5, 4, 7, 10] – done * * * * * *
Shortest Path: 1-4-5-6
6[10,5]
4
2
9
6
3
3
3
1
7
Shortest Path Problem – Excel Solution
Shortest Path Problem – Cost Example
where Ki is purchase price in year i , Si is salvage value after i years in service, and ct is maintenance cost after t years of service.
1 5d12
d14
d35
d45
d13
2 3 4
Equipment Replacement Problem:
d15
d23 d34
ij
ttijiij cSKd
1
Minimal Spanning Tree
1
2
3
4 5
36
4
2
9
6
3
3
3
1
7
Objective: Find the minimum distance such that allnodes are visited once (i.e. no cycles).
Minimal Spanning Tree
1
2
3
4 5
36
4
9
3
7
One possible spanning tree, Z = 26 (note, no cycles).
Minimal Spanning Tree
Possible applications:• Phone lines between cities.• Rail lines between cities.• Road networks.• Air conditioning ducts.• etc..
1
2
3
4 5
36
4
9
3
7
Minimal Spanning Tree
Algorithm:
Step 1 – Select an arbitrary node initially. Identify a node that is closest and include the arc connecting these two nodes in the spanning tree.
Step 2 – Out of the remaining nodes, determine the one that is closest to a node already selected in the spanning tree. Include the arc connecting these two nodes in the spanningtree. Whenever there is a tie for the closest node, it is broken arbitrarily.
Minimal Spanning Tree
1
2
3
4 5
36
4
2
9
6
3
3
3
1
7
Start with node 1. Node 2 is closest.
Minimal Spanning Tree
1
2
3
4 5
36
4
2
9
6
3
3
3
1
Node 3 is closest to partial spanning tree {(1,2)}. Remove any cycles.
Minimal Spanning Tree
1
2
3
4 5
36
2
9
6
3
3
3
1
Node 4 is closest to partial spanning tree {(1,2), (2,3)}. Remove any cycles.
Minimal Spanning Tree
1
2
3
4 5
36
2
9
6
3
3
1
Node 5 is closest to partial spanning tree {(1,2), (2,3),(3,4)}. Remove any cycles. Note, arbitrarily select (3,5) or (4,5).
Minimal Spanning Tree
1
2
3
4 5
36
2
3
3
1
Node 6 is closest to partial spanning tree {(1,2), (2,3),(3,4),(4,5)}. Remove any cycles. Stop, no more nodes.
Minimal spanning tree is {(1,2), (2,3),(3,4),(4,5),(5,6)}. Z = 12.