Download - Ch 9 Network
1 1© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Slides Prepared bySlides Prepared by
JOHN S. LOUCKSJOHN S. LOUCKS
St. Edward’s UniversitySt. Edward’s University
2 2© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Chapter 9 Chapter 9 Network ModelsNetwork Models
Shortest-Route ProblemShortest-Route Problem Minimal Spanning Tree ProblemMinimal Spanning Tree Problem Maximal Flow ProblemMaximal Flow Problem
3 3© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Computer CodesComputer Codes
Computer codesComputer codes for specific network problems for specific network problems (e.g. shortest route, minimal spanning tree, and (e.g. shortest route, minimal spanning tree, and maximal flow) are extremely efficient and can maximal flow) are extremely efficient and can solve even large problems relatively quickly. solve even large problems relatively quickly.
The Management Scientist The Management Scientist contains computer contains computer codes for each of these problems.codes for each of these problems.
4 4© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Shortest-Route ProblemShortest-Route Problem
The The shortest-route problemshortest-route problem is concerned with is concerned with finding the shortest path in a network from one finding the shortest path in a network from one node (or set of nodes) to another node (or set of node (or set of nodes) to another node (or set of nodes).nodes).
If all arcs in the network have nonnegative values If all arcs in the network have nonnegative values then a labeling algorithm can be used to find the then a labeling algorithm can be used to find the shortest paths from a particular node to all other shortest paths from a particular node to all other nodes in the network.nodes in the network.
The criterion to be minimized in the shortest-route The criterion to be minimized in the shortest-route problem is not limited to distance even though the problem is not limited to distance even though the term "shortest" is used in describing the term "shortest" is used in describing the procedure. Other criteria include time and cost. procedure. Other criteria include time and cost. (Neither time nor cost are necessarily linearly (Neither time nor cost are necessarily linearly related to distance.)related to distance.)
5 5© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Shortest-Route AlgorithmShortest-Route Algorithm
Note:Note: We use the notation [ ] to represent a We use the notation [ ] to represent a permanent permanent label and ( ) to represent a tentative label and ( ) to represent a tentative label.label.
Step 1:Step 1: Assign node 1 the permanent label [0,Assign node 1 the permanent label [0,SS]. ]. The first number is the distance from node 1; the The first number is the distance from node 1; the
second number is the preceding node. second number is the preceding node. Since node 1 has no preceding node, it is labeled Since node 1 has no preceding node, it is labeled SS for the starting node. for the starting node.
Step 2:Step 2: Compute tentative labels, (Compute tentative labels, (dd,,nn), for the ), for the nodes that can be reached directly from node 1. nodes that can be reached directly from node 1. dd = the = the direct distance from node 1 to the direct distance from node 1 to the node in question -- this is called the distance node in question -- this is called the distance value. value. nn indicates the preceding node on the indicates the preceding node on the route from node 1 -- this is called the preceding route from node 1 -- this is called the preceding node value. node value.
6 6© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Shortest-Route AlgorithmShortest-Route Algorithm
Step 3:Step 3: Identify the tentatively labeled node Identify the tentatively labeled node with the smallest distance value. Suppose it is with the smallest distance value. Suppose it is node node kk. Node . Node kk is now permanently labeled is now permanently labeled (using [ , ] brackets). If all nodes are (using [ , ] brackets). If all nodes are permanently labeled, GO TO STEP 5.permanently labeled, GO TO STEP 5.
Step 4:Step 4: Consider all nodes without permanent Consider all nodes without permanent labels that can be reached directly from the labels that can be reached directly from the node node kk identified in Step 3. For each, calculate identified in Step 3. For each, calculate the quantity the quantity t, t, wherewhere
tt = (arc distance from node = (arc distance from node kk to node to node ii) )
+ (distance value at node + (distance value at node kk).).
7 7© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Shortest-Route AlgorithmShortest-Route Algorithm
Step 4: (continued)Step 4: (continued)
• If the non-permanently labeled node has a If the non-permanently labeled node has a tentative label, compare tentative label, compare tt with the current with the current distance value at the tentatively labeled node distance value at the tentatively labeled node in question.in question.
If If tt < distance value of the tentatively < distance value of the tentatively labeled labeled node, replace the tentative node, replace the tentative label with (label with (tt,,kk). ).
If If tt >> distance value of the tentatively distance value of the tentatively labeled node, keep the current tentative labeled node, keep the current tentative label.label.
• If the non-permanently labeled node does not If the non-permanently labeled node does not have a tentative label, create a tentative label have a tentative label, create a tentative label of (of (tt,,kk) for the node in question.) for the node in question.
In either case, now GO TO STEP 3.In either case, now GO TO STEP 3.
8 8© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Shortest-Route AlgorithmShortest-Route Algorithm
Step 5:Step 5: The permanent labels identify the The permanent labels identify the shortest distance from node 1 to each node as shortest distance from node 1 to each node as well as the preceding node on the shortest well as the preceding node on the shortest route. The shortest route to a given node can route. The shortest route to a given node can be found by working backwards by starting at be found by working backwards by starting at the given node and moving to its preceding the given node and moving to its preceding node. Continuing this procedure from the node. Continuing this procedure from the preceding node will provide the shortest route preceding node will provide the shortest route from node 1 to the node in question.from node 1 to the node in question.
9 9© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Find the Shortest Route From Node 1 to All Find the Shortest Route From Node 1 to All Other Nodes in the Network:Other Nodes in the Network:
66664444
44
77
33
55 11
88
66
22
55
33
66
22
33331111
2222 5555
7777
10 10© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 1Iteration 1
•Step 1:Step 1: Assign Node 1 the permanent label Assign Node 1 the permanent label [0,S].[0,S].
•Step 2:Step 2: Since Nodes 2, 3, and 4 are directly Since Nodes 2, 3, and 4 are directly connected to Node 1, assign the tentative connected to Node 1, assign the tentative labels of (4,1) to Node 2; (7,1) to Node 3; labels of (4,1) to Node 2; (7,1) to Node 3; and (5,1) to Node 4. and (5,1) to Node 4.
11 11© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Tentative Labels ShownTentative Labels Shown
66664444
44
77
33
55 11
88
66
22
55
33
66
22
(4,1)(4,1)
[0,S][0,S]
(5,1)(5,1)
(7,1)(7,1)33331111
2222 5555
7777
12 12© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 1Iteration 1
•Step 3:Step 3: Node 2 is the tentatively labeled node Node 2 is the tentatively labeled node with the smallest distance (4) , and hence with the smallest distance (4) , and hence becomes the new permanently labeled node.becomes the new permanently labeled node.
13 13© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Permanent Label ShownPermanent Label Shown
66664444
44
77
33
55 11
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
(5,1)(5,1)
(7,1)(7,1)33331111
2222 5555
7777
14 14© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 1Iteration 1
•Step 4:Step 4: For each node with a tentative label For each node with a tentative label which is connected to Node 2 by just one arc, which is connected to Node 2 by just one arc, compute the sum of its arc length plus the compute the sum of its arc length plus the distance value of Node 2 (which is 4). distance value of Node 2 (which is 4).
Node 3: 3 + 4 = 7 (not smaller Node 3: 3 + 4 = 7 (not smaller than current label; do not change.)than current label; do not change.)
Node 5: 5 + 4 = 9 (assign Node 5: 5 + 4 = 9 (assign tentative label to Node 5 of (9,2) since node 5 tentative label to Node 5 of (9,2) since node 5 had no label.)had no label.)
15 15© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 1, Step 4 ResultsIteration 1, Step 4 Results
66664444
44
77
33
5511
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
(5,1)(5,1)
(7,1)(7,1)
(9,2)(9,2)
33331111
2222 5555
7777
16 16© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 2Iteration 2
•Step 3:Step 3: Node 4 has the smallest tentative Node 4 has the smallest tentative label distance (5). It now becomes the new label distance (5). It now becomes the new permanently labeled node.permanently labeled node.
17 17© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 2, Step 3 ResultsIteration 2, Step 3 Results
66664444
44
7733
5511
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
[5,1][5,1]
(6,4)(6,4)
(9,2)(9,2)
33331111
2222 5555
7777
18 18© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 2Iteration 2
•Step 4:Step 4: For each node with a tentative label For each node with a tentative label which is connected to node 4 by just one arc, which is connected to node 4 by just one arc, compute the sum of its arc length plus the compute the sum of its arc length plus the distance value of node 4 (which is 5).distance value of node 4 (which is 5).
Node 3: 1 + 5 = 6 (replace the Node 3: 1 + 5 = 6 (replace the tentative label of node 3 by (6,4) since 6 < 7, tentative label of node 3 by (6,4) since 6 < 7, the current distance.)the current distance.)
Node 6: 8 + 5 = 13 (assign Node 6: 8 + 5 = 13 (assign tentative label to node 6 of (13,4) since node tentative label to node 6 of (13,4) since node 6 had no label.)6 had no label.)
19 19© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 2, Step 4 ResultsIteration 2, Step 4 Results
66664444
44
77
33
5511
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
[5,1][5,1]
(6,4)(6,4)
(9,2)(9,2)
(13,4)(13,4)
33331111
2222 5555
7777
20 20© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 3Iteration 3
•Step 3:Step 3: Node 3 has the smallest tentative Node 3 has the smallest tentative distance label (6). It now becomes the new distance label (6). It now becomes the new permanently labeled node.permanently labeled node.
21 21© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 3, Step 3 ResultsIteration 3, Step 3 Results
66664444
44
7733
5511
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
[5,1][5,1]
[6,4][6,4]
(9,2)(9,2)
(13,4)(13,4)
33331111
2222 5555
7777
22 22© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 3Iteration 3
•Step 4:Step 4: For each node with a tentative label For each node with a tentative label which is connected to node 3 by just one arc, which is connected to node 3 by just one arc, compute the sum of its arc length plus the compute the sum of its arc length plus the distance to node 3 (which is 6).distance to node 3 (which is 6).
Node 5: 2 + 6 = 8 (replace the Node 5: 2 + 6 = 8 (replace the tentative label of node 5 with (8,3) since 8 < tentative label of node 5 with (8,3) since 8 < 9, the current distance)9, the current distance)
Node 6: 6 + 6 = 12 (replace the Node 6: 6 + 6 = 12 (replace the tentative label of node 6 with (12,3) since 12 tentative label of node 6 with (12,3) since 12 < 13, the current distance)< 13, the current distance)
23 23© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 3, Step 4 ResultsIteration 3, Step 4 Results
66664444
44
77
33
5511
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
[5,1][5,1]
[6,4][6,4]
(8,3)(8,3)
(12,3)(12,3)
33331111
2222 5555
7777
24 24© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 4Iteration 4
•Step 3:Step 3: Node 5 has the smallest tentative Node 5 has the smallest tentative label distance (8). It now becomes the new label distance (8). It now becomes the new permanently labeled node.permanently labeled node.
25 25© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 4, Step 3 ResultsIteration 4, Step 3 Results
66664444
44
77
33
55 11
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
[5,1][5,1]
[6,4][6,4]
[8,3][8,3]
(12,3)(12,3)
33331111
2222 5555
7777
26 26© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 4Iteration 4
•Step 4:Step 4: For each node with a tentative label For each node with a tentative label which is connected to node 5 by just one arc, which is connected to node 5 by just one arc, compute the sum of its arc length plus the compute the sum of its arc length plus the distance value of node 5 (which is 8).distance value of node 5 (which is 8).
Node 6: 3 + 8 = 11 (Replace the Node 6: 3 + 8 = 11 (Replace the tentative label with (11,5) since 11 < 12, the tentative label with (11,5) since 11 < 12, the current distance.)current distance.)
Node 7: 6 + 8 = 14 (AssignNode 7: 6 + 8 = 14 (Assign
27 27© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 4, Step 4 ResultsIteration 4, Step 4 Results
66664444
44
77
33
55 11
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
[5,1][5,1]
[6,4][6,4]
[8,3][8,3]
(11,5)(11,5)
(14,5)(14,5)33331111
2222 5555
7777
28 28© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 5Iteration 5
•Step 3:Step 3: Node 6 has the smallest tentative Node 6 has the smallest tentative label distance (11). It now becomes the new label distance (11). It now becomes the new permanently labeled node.permanently labeled node.
29 29© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 5, Step 3 ResultsIteration 5, Step 3 Results
66664444
44
77
33
55 11
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
[5,1][5,1]
[6,4][6,4]
[8,3][8,3]
[11,5][11,5]
(14,5)(14,5)33331111
2222 5555
7777
30 30© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 5Iteration 5
•Step 4:Step 4: For each node with a tentative label For each node with a tentative label which is connected to Node 6 by just one arc, which is connected to Node 6 by just one arc, compute the sum of its arc length plus the compute the sum of its arc length plus the distance value of Node 6 (which is 11).distance value of Node 6 (which is 11).
Node 7: 2 + 11 = 13 (replace the Node 7: 2 + 11 = 13 (replace the tentative label with (13,6) since 13 < 14, the tentative label with (13,6) since 13 < 14, the current distance.)current distance.)
31 31© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 5, Step 4 ResultsIteration 5, Step 4 Results
66664444
44
77
33
55 11
88
66
22
55
33
66
22
[4,1][4,1]
[0,S][0,S]
[5,1][5,1]
[6,4][6,4]
[8,3][8,3]
[11,5][11,5]
(13,6)(13,6)33331111
2222 5555
7777
32 32© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Iteration 6Iteration 6
•Step 3:Step 3: Node 7 becomes permanently Node 7 becomes permanently labeled, and hence all nodes are now labeled, and hence all nodes are now permanently labeled. Thus proceed to permanently labeled. Thus proceed to summarize in Step 5.summarize in Step 5.
•Step 5:Step 5: Summarize by tracing the shortest Summarize by tracing the shortest routes backwards through the permanent routes backwards through the permanent labels.labels.
33 33© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Shortest RouteExample: Shortest Route
Solution SummarySolution Summary
NodeNode Minimum DistanceMinimum Distance Shortest Shortest RouteRoute
2 2 4 4 1-2 1-2
3 3 6 6 1-4-3 1-4-3
4 4 5 5 1-4 1-4
5 5 8 8 1-4-3- 1-4-3-55
6 6 11 11 1-4-3-5-6 1-4-3-5-6
7 7 13 13 1-4-3-5-6-7 1-4-3-5-6-7
34 34© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Minimal Spanning Tree ProblemMinimal Spanning Tree Problem
A A treetree is a set of connected arcs that does not is a set of connected arcs that does not form a cycle.form a cycle.
A A spanning treespanning tree is a tree that connects all nodes is a tree that connects all nodes of a network.of a network.
The The minimal spanning tree problemminimal spanning tree problem seeks to seeks to determine the minimum sum of arc lengths determine the minimum sum of arc lengths necessary to connect all nodes in a network. necessary to connect all nodes in a network.
The criterion to be minimized in the minimal The criterion to be minimized in the minimal spanning tree problem is not limited to distance spanning tree problem is not limited to distance even though the term "closest" is used in even though the term "closest" is used in describing the procedure. Other criteria include describing the procedure. Other criteria include time and cost. (Neither time nor cost are time and cost. (Neither time nor cost are necessarily linearly related to distance.)necessarily linearly related to distance.)
35 35© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Minimal Spanning Tree AlgorithmMinimal Spanning Tree Algorithm
Step 1:Step 1: Arbitrarily begin at any node and Arbitrarily begin at any node and connect it to the closest node. The two nodes connect it to the closest node. The two nodes are referred to as connected nodes, and the are referred to as connected nodes, and the remaining nodes are referred to as unconnected remaining nodes are referred to as unconnected nodes.nodes.
Step 2:Step 2: Identify the unconnected node that is Identify the unconnected node that is closest to one of the connected nodes (break ties closest to one of the connected nodes (break ties arbitrarily). Add this new node to the set of arbitrarily). Add this new node to the set of connected nodes. Repeat this step until all connected nodes. Repeat this step until all nodes have been connected.nodes have been connected.
Note:Note: A problem with A problem with nn nodes to be connected nodes to be connected will require will require nn - 1 iterations of the above steps. - 1 iterations of the above steps.
36 36© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Minimal Spanning TreeExample: Minimal Spanning Tree
Find the Minimal Spanning Tree:Find the Minimal Spanning Tree:
22
4444
1010
3030
45456060
4040
255050
50504545
2020 3030
252515
2020
35
353530
406666
5555
3333
1111
9999
8888
7777
37 37© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Minimal Spanning TreeExample: Minimal Spanning Tree
Iteration 1:Iteration 1: Arbitrarily selecting node 1, we see Arbitrarily selecting node 1, we see that its closest node is node 2 (distance = 30). that its closest node is node 2 (distance = 30). Therefore, initially we have: Therefore, initially we have:
Connected nodes: 1,2 Connected nodes: 1,2 Unconnected nodes: 3,4,5,6,7,8,9,10Unconnected nodes: 3,4,5,6,7,8,9,10Chosen arcs: 1-2Chosen arcs: 1-2
Iteration 2:Iteration 2: The closest unconnected node to a The closest unconnected node to a connected node is node 5 (distance = 25 to node connected node is node 5 (distance = 25 to node 2). Node 5 becomes a connected node. 2). Node 5 becomes a connected node.
Connected nodes: 1,2,5 Connected nodes: 1,2,5 Unconnected nodes: 3,4,6,7,8,9,10Unconnected nodes: 3,4,6,7,8,9,10
Chosen arcs: 1-2, 2-5Chosen arcs: 1-2, 2-5
38 38© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Minimal Spanning TreeExample: Minimal Spanning Tree
Iteration 3:Iteration 3: The closest unconnected node to a The closest unconnected node to a connected node is node 7 (distance = 15 to node connected node is node 7 (distance = 15 to node 5). Node 7 becomes a connected node. 5). Node 7 becomes a connected node.
Connected nodes: 1,2,5,7 Connected nodes: 1,2,5,7 Unconnected nodes: 3,4,6,8,9,10Unconnected nodes: 3,4,6,8,9,10Chosen arcs: 1-2, 2-5, 5-7Chosen arcs: 1-2, 2-5, 5-7
Iteration 4:Iteration 4: The closest unconnected node to a The closest unconnected node to a connected node is node 10 (distance = 20 to connected node is node 10 (distance = 20 to node 7). Node 10 becomes a connected node. node 7). Node 10 becomes a connected node.
Connected nodes: 1,2,5,7,10 Connected nodes: 1,2,5,7,10 Unconnected nodes: 3,4,6,8,9Unconnected nodes: 3,4,6,8,9
Chosen arcs: 1-2, 2-5, 5-7, 7-10Chosen arcs: 1-2, 2-5, 5-7, 7-10
39 39© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Minimal Spanning TreeExample: Minimal Spanning Tree
Iteration 5:Iteration 5: The closest unconnected node to a The closest unconnected node to a connected node is node 8 (distance = 25 to node connected node is node 8 (distance = 25 to node 10). Node 8 becomes a connected node. 10). Node 8 becomes a connected node.
Connected nodes: 1,2,5,7,10,8 Connected nodes: 1,2,5,7,10,8 Unconnected nodes: 3,4,6,9Unconnected nodes: 3,4,6,9
Chosen arcs: 1-2, 2-5, 5-7, 7-10, 10-8Chosen arcs: 1-2, 2-5, 5-7, 7-10, 10-8
Iteration 6:Iteration 6: The closest unconnected node to a The closest unconnected node to a connected node is node 6 (distance = 35 to node connected node is node 6 (distance = 35 to node 10). Node 6 becomes a connected node. 10). Node 6 becomes a connected node.
Connected nodes: 1,2,5,7,10,8,6 Connected nodes: 1,2,5,7,10,8,6 Unconnected nodes: 3,4,9Unconnected nodes: 3,4,9
Chosen arcs: 1-2, 2-5, 5-7, 7-10, 10-8, 10-Chosen arcs: 1-2, 2-5, 5-7, 7-10, 10-8, 10-66
40 40© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Minimal Spanning TreeExample: Minimal Spanning Tree
Iteration 7:Iteration 7: The closest unconnected node to a The closest unconnected node to a connected node is node 3 (distance = 20 to node 6). connected node is node 3 (distance = 20 to node 6). Node 3 becomes a connected node. Node 3 becomes a connected node.
Connected nodes: 1,2,5,7,10,8,6,3 Connected nodes: 1,2,5,7,10,8,6,3 Unconnected nodes: 4,9Unconnected nodes: 4,9
Chosen arcs: 1-2, 2-5, 5-7, 7-10, 10-8, 10-6, Chosen arcs: 1-2, 2-5, 5-7, 7-10, 10-8, 10-6, 6-36-3
Iteration 8:Iteration 8: The closest unconnected node to a The closest unconnected node to a connected node is node 9 (distance = 30 to node 6). connected node is node 9 (distance = 30 to node 6). Node 9 becomes a connected node. Node 9 becomes a connected node.
Connected nodes: 1,2,5,7,10,8,6,3,9 Connected nodes: 1,2,5,7,10,8,6,3,9 Unconnected nodes: 4Unconnected nodes: 4
Chosen arcs: 1-2, 2-5, 5-7, 7-10, 10-8, Chosen arcs: 1-2, 2-5, 5-7, 7-10, 10-8, 10-6, 6-3, 6-910-6, 6-3, 6-9
41 41© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Minimal Spanning TreeExample: Minimal Spanning Tree
Iteration 9:Iteration 9: The only remaining unconnected The only remaining unconnected node is node 4. It is closest to connected node 6 node is node 4. It is closest to connected node 6 (distance = 45). (distance = 45).
Thus, the minimal spanning tree (displayed on Thus, the minimal spanning tree (displayed on the next slide) consists of: the next slide) consists of:
Arcs: 1-2, 2-5, 5-7, 7-10, 10-8, 10-6, 6-3, Arcs: 1-2, 2-5, 5-7, 7-10, 10-8, 10-6, 6-3, 6-9, 6-46-9, 6-4
Values: 30 + 25 + 15 + 20 + 25 + 35 + 20 Values: 30 + 25 + 15 + 20 + 25 + 35 + 20 + 30 + 45+ 30 + 45
= 245= 245
42 42© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Minimal Spanning TreeExample: Minimal Spanning Tree
Optimal Spanning TreeOptimal Spanning Tree
4444
3030
45456060
4040
25255050
50504545
2020 3030
25251515
2020
3535
35353030
4040
1111
5555
8888
10101010
6666
33339999
22227777
43 43© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Maximal Flow ProblemMaximal Flow Problem
The The maximal flow problemmaximal flow problem is concerned with is concerned with determining the maximal volume of flow from determining the maximal volume of flow from one node (called the source) to another node one node (called the source) to another node (called the sink). (called the sink).
In the maximal flow problem, each arc has a In the maximal flow problem, each arc has a maximum maximum arc flow capacityarc flow capacity which limits the flow which limits the flow through the arc.through the arc.
44 44© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Maximal FlowExample: Maximal Flow
Network ModelNetwork Model
2222 5555
1111 4444 7777
3333 6666
44
44
33
33
2233
442
3333
33
11
55 555511
66
33
SinkSinkSourceSource
45 45© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Maximal FlowExample: Maximal Flow
A A capacitated transshipment modelcapacitated transshipment model (Chapter 7) (Chapter 7) can be developed for the maximal flow problem.can be developed for the maximal flow problem.
We will add an arc from node 7 back to node 1 to We will add an arc from node 7 back to node 1 to represent the total flow through the network.represent the total flow through the network.
There is no capacity on the newly added 7-1 arc.There is no capacity on the newly added 7-1 arc. We want to maximize the flow over the 7-1 arc.We want to maximize the flow over the 7-1 arc.
46 46© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Maximal FlowExample: Maximal Flow
Modified Network ModelModified Network Model
2222 5555
1111 4444 7777
3333 6666
44
44
33
33
2233
442
3333
33
11
55 555511
66
33
SinkSinkSourceSource
47 47© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Maximal Flow ProblemMaximal Flow Problem
LP FormulationLP Formulation
(as Capacitated Transshipment Problem)(as Capacitated Transshipment Problem)
•There is a There is a variablevariable for every arc. for every arc.
•There is a There is a constraintconstraint for every node; the flow for every node; the flow out must equal the flow in.out must equal the flow in.
•There is a There is a constraintconstraint for every arc (except the for every arc (except the added sink-to-source arc); arc capacity cannot added sink-to-source arc); arc capacity cannot be exceeded.be exceeded.
•The The objectiveobjective is to is to maximize the flow over the maximize the flow over the added, sink-to-source arc.added, sink-to-source arc.
48 48© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Maximal Flow ProblemMaximal Flow Problem
LP FormulationLP Formulation
(as Capacitated Transshipment Problem)(as Capacitated Transshipment Problem)
Max Max xxkk11 ( (kk is sink node, 1 is source node) is sink node, 1 is source node)
s.t. s.t. xxijij - - xxjiji = 0 (conservation of = 0 (conservation of flow) flow) ii jj
xxijij << ccijij ( (ccijij is capacity of is capacity of ijij arc)arc)
xxijij >> 0, for all 0, for all ii and and jj (non-negativity) (non-negativity)
(x(xijij represents the flow from node represents the flow from node ii to node to node j)j)
49 49© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Maximal FlowExample: Maximal Flow
LP FormulationLP Formulation
•18 variables (for 17 original arcs and 1 added 18 variables (for 17 original arcs and 1 added arc)arc)
•24 constraints24 constraints 7 node flow-conservation constraints7 node flow-conservation constraints 17 arc capacity constraints (for original arcs)17 arc capacity constraints (for original arcs)
50 50© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Maximal FlowExample: Maximal Flow
LP FormulationLP Formulation
•Objective FunctionObjective Function
Max Max xx7171
•Node Flow-Conservation ConstraintsNode Flow-Conservation Constraints
xx7171 - - xx1212 - - xx1313 - - xx1414 = 0 (flow in & out of node 1) = 0 (flow in & out of node 1)
xx1212 + + xx4242 + + xx5252 – – xx2424 - - xx2525 = 0 (node 2) = 0 (node 2)
xx1313 + + xx4343 – – xx3434 – – xx3636 = 0 (etc.) = 0 (etc.)
xx1414 + + xx2424 + + xx3434 + + xx5454 + + xx6464 – – xx4242 - - xx4343 - - xx4545 - - xx4646 - - xx4747 = 0 = 0
xx2525 + + xx4545 – – xx5252 – – xx5454 - - xx5757 = 0 = 0
xx3636 + + xx4646 - - xx6464 - - xx6767 = 0 = 0
xx4747 + + xx5757 + + xx6767 - - xx7171 = 0 = 0
51 51© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Maximal FlowExample: Maximal Flow
LP Formulation (continued)LP Formulation (continued)
•Arc Capacity ConstraintsArc Capacity Constraints
xx1212 << 4 4 xx1313 << 3 3 xx1414 << 4 4
xx2424 << 2 2 xx2525 << 3 3
xx3434 << 3 3 xx3636 << 6 6
xx4242 << 3 3 xx4343 << 5 5 xx4545 << 3 3 xx4646 << 1 1 xx4747 << 3 3
xx5252 << 5 5 xx5454 << 5 5 xx5757 << 5 5
xx6464 << 5 5 xx6767 << 5 5
52 52© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
Example: Maximal FlowExample: Maximal Flow
Optimal SolutionOptimal Solution
2222 5555
1111 4444 7777
3333 6666
33
44
33
22
11 2
33
11
11 5555
44
SinkSinkSourceSource
1010
53 53© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
HomeworkHomework
Solve the following Problems:Solve the following Problems:
9- 89- 8 9- 99- 9 9- 149- 14 9- 179- 17 9- 189- 18
54 54© 2003 Thomson© 2003 Thomson/South-Western/South-Western Slide Slide
End of Chapter 9End of Chapter 9