Chapter 13 Mathematical models of networks give us algorithms so computationally efficient that we can employ them to evaluate problems too big to be solved any other way. Network Models 1 The Structure of Network Problems Networks have features of the following: arcs (e.g., roads), nodes (e.g., cities), and arc values representing distance or flow. 2 Types of Networks and Applications Networks have been used in the following. There are four basic network models. 3 Shortest route problems. Minimal spanning trees. Maximum flow. Minimum-cost maximum flow. The Shortest Route Problem This problem uses the network as prop. We find the shortest route from A to G. 4 The START node is evaluated first (shaded). Then all direct links between evaluated and unevaluated nodes are identified and the distances back to START are computed along connecting arcs. The node with smallest distance, written above it, becomes the next evaluated one and is shaded. An arrow points from there along the connecting arc. The Shortest Route Problem Node C joins the evaluated set. An arrow is added pointing back to A, and the cumulative distance, 3, back to START from C is entered above. The process continues. 5 Node B is next to join the evaluated set, at a distance of 4 back to START. The Shortest Route Problem The process continues. Node D is next to join the evaluated set with a distance of 5 back to START. 6 The Shortest Route Problem The process continues. Node E is next to join the evaluated set with a distance of 7 back to START. 7 The Shortest Route Problem The process continues. Two nodes, F and G, are next to join the evaluated set, each with with a distance of 9 back to START. 8 The Shortest Route Problem All nodes are evaluated. The shortest route is found by tracing back from FINISH following the arrows. The shortest route from A to G is A-B-D-E-G for a distance of C = 9. 9 The Minimal Spanning Tree A tree is a set of arcs connecting nodes in such a way that only one route involving those arcs connects any two nodes. Imagine an ant on a real tree. It has just one way to walk from any leaf to another. A spanning tree connects with all nodes. It is like railroad tracks connecting all cities, but with only one routing between any two. A minimal spanning tree has the smallest sum of its arc distances C (tree size). 10 In connecting all circuit-board solder points with gold wire, it would use the least gold. It would have the least tracks for a railway. Finding the Minimal Spanning Tree As first connected node pick any (here A). Find all arcs directly joining connected to unconnected. Join the shortest arc to tree. 11 Connected nodes are shaded. A-C joins the tree. Finding the Minimal Spanning Tree As new arcs join the tree, more nodes become connected. We consider only arcs directly joining connected to unconnected nodes. Arc A-B joins the tree. 12 Finding the Minimal Spanning Tree The process continues. Arc C-F joins the tree. 13 Finding the Minimal Spanning Tree The process continues. Arcs B-E, D-E, F-J, H-I, and I-J join tree. 14 Finding the Minimal Spanning Tree The process continues. Arc G-H joins the tree. Since all nodes are connected, the tree has been found. The sum of the arc lengths gives its size C. 15 Maximizing Flow Arcs in a maximum flow problem are directed and have upper bounds. Flow moves one way. A node is designated as the SOURCE and another as the SINK. Flow-augmenting paths from SOURCE to SINK are found and flows sent over the arcs. If no path can be found, flow is maximized. A flow-augmenting path ordinarily involves arcs directed away from the SOURCE toward the SINK. But an arc can point in the opposite direction if some of its current flow would be reduced and be redirected to another arc. 16 It doesn’t matter which path is used. The possibilities shrink as more are found. Flow into an interior node must equal the flow out. Maximizing Flow The bottleneck arc on a path has the lowest remaining capacity. Here it is H-J. 17 Maximizing Flow Arc H-J is saturated. Flow over saturated arcs may be decreased only. The next path’s bottleneck arc is E-I. 18 Maximizing Flow The next path has two bottleneck arcs: C-F and K-L. 19 Maximizing Flow The next path has two bottleneck arcs: D-F and I-J. 20 Maximizing Flow This path goes against the direction of J-K flow. Some J-K flow is redirected over J-L. The bottlenecks are B-D and I-K. 21 Maximizing Flow There are no more flow-augmenting paths. The optimal solution has been found with maximum flow (sum into SINK) of C = 14. 22 Minimum-Cost Maximum Flow Transportation problems are special cases of minimum-cost maximum flow problems. The general problem has bounded arcs (routes) and is represented as a network. It may be solved by an elaborate procedure, the out-of-kilter algorithm, involving shortest routes and maximum flows. However, it is best solved on the computer. QuickQuant may be used for this purpose. It can perform the out-of-kilter algorithm. The problem can also be solved as a general linear program (with QuickQuant or Excel). 23 Solving with QuickQuant The following first iteration involves a smaller version of the problem in the text. 24 Solving with QuickQuant The initial solution is infeasible. A series of iterations yields the optimal solution. 25 NetworkTemplates shortest route maximum flow minimum cost maximum flow 26 Shortest Route for Yellow Jacket Freightways (Figure 13-11) This is the upper portion of Figure 13-11. The lower portion is shown next. A 3. If 1000 is not large enough to denote the impossibility of going between two cities, use a larger number. 27 1 2 3 PROBLEM: 4 5 6 7 8 From Node 9 A 10 B 11 C 12 D 13 E 14 F 15 G 16 17 18 19 B C D E F G H I J K SHORTEST ROUTE SOLUTION 1. Enter the problem name in B3. Yellow Jacket Freightways Distances A 1000 4 3 6 1000 1000 1000 B 4 1000 1000 1 4 1000 1000 To Node C D E 3 6 1000 1000 1 4 1000 3 1000 3 1000 2 1000 2 1000 6 4 1000 1000 5 2 Solution C = 9 To Node 17 2. Enter the distances above the diagonal in the table B9:H15. They will automatically be E entered below =SUMPRODUCT(B9:H15,B21:H27) the diagonal. F 1000 1000 6 4 1000 1000 2 G 1000 1000 1000 5 2 2 1000 Total Shortest Route for Yellow Jacket Freightways (Figure 13-11) This is the lower portion of Figure 13-11. The length of the shortest route is in cell E9. Here it is 9. The shortest route is found from the table in cells A20:H27. Here it is A-B-DE-G. 28 A 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 B C D Solution C = From Node A B C D E F G Total Inflow Total Outflow Net Flow Required Flow 28 29 30 31 F 9 G H I J K E 17 =SUMPRODUCT(B9:H15,B21:H27) Total To Node I D E F G Outflow 0 0 0 0 1 21 =SUM(B21:H21) 1 0 0 0 1 22 =SUM(B22:H22) 0 0 0 0 0 23 =SUM(B23:H23) 0 1 0 0 1 24 =SUM(B24:H24) 0 0 0 1 1 25 =SUM(B25:H25) 0 0 0 0 0 26 =SUM(B26:H26) 0 0 0 0 0 27 =SUM(B27:H27) 1 1 0 1 1 1 0 0 0 0 0 -1 0 0 0 -1 C D E =SUM(C21:C27) =SUM(D21:D27) =SUM(E21:E27) =I22 =I23 =I24 =C29-C28 =D29-D28 =E29-E28 0 0 0 F G H =SUM(F21:F27) =SUM(G21:G27) =SUM(H21:H27) =I25 =I26 =I27 =F29-F28 =G29-G28 =H29-H28 0 0 -1 A B 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 B =SUM(B21:B27) =I21 =B29-B28 1 28 29 30 31 E C 0 0 0 0 0 0 0 0 0 0 0 Shortest Route for Yellow Jacket Freightways (Figure 13-11) This is the lower portion of Figure 13-11. 4. Click on Tools and use Solver to find the shortest route. The Solver Parameters dialog box is shown on the next slide. 5. The starting point is assumed to be A and the ending point G. If this is different adjust the required flow in cells B31:H31 accordingly. 29 A 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 B C D Solution C = From Node A B C D E F G Total Inflow Total Outflow Net Flow Required Flow 28 29 30 31 F 9 G H I J K E 17 =SUMPRODUCT(B9:H15,B21:H27) Total To Node I D E F G Outflow 21 =SUM(B21:H21) 0 0 0 0 1 1 0 0 0 1 22 =SUM(B22:H22) 0 0 0 0 0 23 =SUM(B23:H23) 0 1 0 0 1 24 =SUM(B24:H24) 0 0 0 1 1 25 =SUM(B25:H25) 0 0 0 0 0 26 =SUM(B26:H26) 0 0 0 0 0 27 =SUM(B27:H27) 1 1 0 1 6. For problems 1 1 0 0 with more than 7 0 0 0 -1 0 0 0 -1 cities, expand C D E the distance and =SUM(C21:C27) =SUM(D21:D27) =SUM(E21:E27) =I22 =I23 =I24 path tables and =C29-C28 =D29-D28 =E29-E28 check to make 0 0 0 sure that all the F G H =SUM(F21:F27) =SUM(G21:G27) =SUM(H21:H27) formulas have =I25 =I26 =I27 the proper =F29-F28 =G29-G28 =H29-H28 ranges. 0 0 -1 A B 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 B =SUM(B21:B27) =I21 =B29-B28 1 28 29 30 31 E C 0 0 0 0 0 0 0 0 0 0 0 1. Enter the value of the objective function, E17, in the Target Cell line, either with or without the $ signs. Solver Parameters Dialog Box (Figure 13-12) NOTE: Normally all these entries appear in the Solver Parameter dialog box so you only need to click on the Solve button. However, you should always check to make sure the entries are correct for the problem you are solving. 2. The Target Cell is to be minimized so click on Min in the Equal To line. 3. Enter the decision variables in the By Changing Cells line, B21:H27. 4. The constraints are entered in the Subject to Constraints box by using the Add Constraints dialog box shown next (obtained by clicking on the Add button). If a constraint needs to be changed, click on the Change button. The 30 Change and Add Constraint dialog box function in the same manner. The Add Constraint Dialog Box 1. Enter the net flows B30:H30 (or $B$30:$H$30) in the Cell Reference line. Normally, all these entries already appear. You will need to use this dialog box only if you need to add a constraint. 3. Enter the required flow B31:H31 in the Constraint line (or =$B$31:$H$31). 4. Click the OK button. If you need to change a constraint, the Change Constraint dialog box functions just 31 like this one. 2. Enter = as the sign because the net flow must be equal to the required flow, given next in Step 3. Maximum Flow for Lulliput Telephone Company (Figure 13-31) This is the upper portion of Figure 13-31. The lower portion is shown next. A B C D E F G H I J 1 MAXIMUM FLOW 2 3 PROBLEM: Lilliput Telephone Company 4 5 Capacities 6 7 To Node 8 From Node A B C D E F G H I 9 A 5 5 4 6 10 B 4 11 C 5 4 12 D 3 6 13 E 2 3 14 F 5 6 15 G 4 16 H 3 17 I 18 J 19 K 20 L 20 32 K L M N O P SOLUTION 1. Enter the problem name in B3. J K L 2. (a) Enter the capacities in the table B9:M20. 2 3 10 3 7 9 2. (b) A big number is entered for the upper limit on the return flow from L to A. Maximum Flow for Lulliput Telephone Company (Figure 13-31) This is the lower portion of Figure 13-31. A The maximum flow is in cell E22. Here it is 14. The flow along each arc is found from the table in cells A20:H27. For example, cell C26 has a 1 in it. This means one unit of flow goes from A to B. 33 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 B C D Solution C = From Node A B C D E F G H I J K L Total Inflow Total Outflow Net Flow Required Flow 38 39 40 41 A 0 0 0 0 0 0 0 0 0 0 0 14 14 14 0 0 B 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 E 14 C 4 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 D 4 1 0 0 0 0 0 0 0 0 0 0 5 5 0 0 F G H I J K L M N O P E 22 =B37 E 5 0 0 0 0 0 0 0 0 0 0 0 5 5 0 0 To Node F G 0 0 0 0 4 0 3 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 7 3 7 3 0 0 0 0 H 0 0 0 2 0 0 0 0 0 0 0 0 2 2 0 0 I 0 0 0 0 3 6 3 0 0 0 0 0 12 12 0 0 J 0 0 0 0 0 0 0 2 3 0 0 0 5 5 0 0 K 0 0 0 0 0 0 0 0 9 0 0 0 9 9 0 0 L 0 0 0 0 0 0 0 0 0 5 9 0 14 14 0 0 Total Outflow 14 1 4 5 5 7 3 2 12 5 9 14 26 27 28 29 30 31 32 33 34 35 36 37 N =SUM(B26:M26) =SUM(B27:M27) =SUM(B28:M28) =SUM(B29:M29) =SUM(B30:M30) =SUM(B31:M31) =SUM(B32:M32) =SUM(B33:M33) =SUM(B34:M34) =SUM(B35:M35) =SUM(B36:M36) =SUM(B37:M37) B C D E F G H =SUM(B26:B37) =SUM(C26:C37)=SUM(D26:D37)=SUM(E26:E37) =SUM(F26:F37) =SUM(G26:G37)=SUM(H26:H37) =N26 =N27 =N28 =N29 =N30 =N31 =N32 =B38-B39 =C38-C39 =D38-D39 =E38-E39 =F38-F39 =G38-G39 =H38-H39 0 0 0 0 0 0 0 38 39 40 41 I =SUM(I26:I37) =N33 =I38-I39 0 J =SUM(J26:J37) =N34 =J38-J39 0 K L =SUM(K26:K37) =SUM(L26:L37) =N35 =N36 =K38-K39 =L38-L39 0 0 M =SUM(M26:M37) =N37 =M38-M39 0 Maximum Flow for Lulliput Telephone Company (Figure 13-31) This is the lower portion of Figure 13-31. A 3.Click on Tools and use Solver to find the maximum flow. The Solver Parameters dialog box is shown on the next slide. 4. The starting point is the first node and the ending point the last one. 34 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 B C D Solution C = From Node A B C D E F G H I J K L Total Inflow Total Outflow Net Flow Required Flow 38 39 40 41 A 0 0 0 0 0 0 0 0 0 0 0 14 14 14 0 0 B 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 E 14 C 4 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 D 4 1 0 0 0 0 0 0 0 0 0 0 5 5 0 0 F G H I J K L M To Node F G 0 0 0 0 4 0 3 0 0 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 7 3 7 3 0 0 0 0 H 0 0 0 2 0 0 0 0 0 0 0 0 2 2 0 0 I 0 0 0 0 3 6 3 0 0 0 0 0 12 12 0 0 J 0 0 0 0 0 0 0 2 3 0 0 0 5 5 0 0 K 0 0 0 0 0 0 0 0 9 0 0 0 9 9 0 0 L 0 0 0 0 0 0 0 0 0 5 9 0 14 14 0 0 N O P E 22 =B37 E 5 0 0 0 0 0 0 0 0 0 0 0 5 5 0 0 Total Outflow 14 1 4 5 5 7 3 2 12 5 9 14 26 27 28 29 30 31 32 33 34 35 36 37 N =SUM(B26:M26) =SUM(B27:M27) =SUM(B28:M28) =SUM(B29:M29) =SUM(B30:M30) =SUM(B31:M31) =SUM(B32:M32) =SUM(B33:M33) =SUM(B34:M34) =SUM(B35:M35) =SUM(B36:M36) =SUM(B37:M37) B C D E F G H =SUM(B26:B37) =SUM(C26:C37)=SUM(D26:D37)=SUM(E26:E37) =SUM(F26:F37) =SUM(G26:G37)=SUM(H26:H37) =N26 =N27 =N28 =N29 =N30 =N31 =N32 =B38-B39 =C38-C39 =D38-D39 =E38-E39 =F38-F39 =G38-G39 =H38-H39 0 0 0 0 0 0 0 38 39 40 41 I =SUM(I26:I37) =N33 =I38-I39 0 J =SUM(J26:J37) =N34 =J38-J39 0 K L =SUM(K26:K37) =SUM(L26:L37) =N35 =N36 =K38-K39 =L38-L39 0 0 M =SUM(M26:M37) =N37 =M38-M39 0 5. For problems with more than 12 nodes, expand the capacities and flows tables and check to make sure that all the formulas have the proper ranges. 1. Enter the value of the objective function, E22, in the Target Cell line, either with or without the $ signs. Solver Parameters Dialog Box (Figure 13-32) NOTE: Normally all these entries appear in the Solver Parameter dialog box so you only need to click on the Solve button. However, you should always check to make sure the entries are correct for the problem you are solving. 2. The Target Cell is to be maximized so click on Max in the Equal To line. 3. Enter the decision variables in the By Changing Cells line, B26:M37. 4. The constraints are entered in the Subject to Constraints box by using the Add Constraints dialog box (obtained by clicking on the Add button) as was done for the shortest route template. If a constraint needs to be changed, click on the Change 35 button. The Change and Add Constraint dialog box function in the same manner. Minimum Cost Maximum Flow for BigCo (Figure 13-40) This is the upper portion of Figure 13-40. The lower portion is shown next. A 2. Enter the costs and capacities in the table B8:G10 and the corresponding From and To names in cells A8:A9 and B7:F7. 36 1 2 3 PROBLEM: 4 5 6 7 From Node 8 Centralia 9 Gotham 10 Demand 11 12 13 14 From Node 15 Centralia 16 Gotham 17 18 19 20 From Node 21 Centralia 22 Gotham B C D E F G H MINIMUM COST MAXIMUM FLOW SOLUTION BigCo Discount Retail Chain 1. Enter the problem name in B3. Costs, Capacities, and Demands To Node Jay Street 7th Avenue River Cross Downtown Exurbia 10 12 11 13 13 15 12 9 14 9 200 250 350 150 150 Minimum Quantities (Lower Bounds) To Node Jay Street 7th Avenue River Cross Downtown Exurbia 40 60 40 0 60 0 40 80 40 0 Maximum Quantities (Upper Bounds) To Node Jay Street 7th Avenue River Cross Downtown Exurbia 300 200 200 200 100 200 200 200 200 200 Capacity 500 600 3. Enter the minimum quantities in the table B15:F16. 4. Enter the maximum quantities in the table B21:F22. Minimum Cost Maximum Flow for BigCo (Figure 13-40) This is the lower portion of Figure 13-40. The minimum cost is in cell E24. Here it is $12,110. A B C D E F G H 23 E 24 Solution Quantities, C = $ 12,110 24 =SUMPRO DUCT(B8:F9,B27:F28) 25 To Node 26 From Node Jaystreet 7th Avenue River Cross Downtown Exurbia Total Quantity G 27 Centralia 200 60 150 30 60 500 28 Gotham 0 190 200 120 90 600 27 =SUM(B27:F27) 28 =SUM(B28:F28) 29 Total Quantity 200 250 350 150 150 30 B C D E F 31 29 =SUM(B27:B28) =SUM(C27:C28)=SUM(D27:D28)=SUM(E27:E28) =SUM(F27:F28) The optimal shipping schedule is given in the table in cells A28:G29. 37 Minimum Cost Maximum Flow for BigCo (Figure 13-40) This is the lower portion of Figure 13-40. 5.Click on Tools and use Solver to find the optimal solution. The Solver Parameters dialog box is shown on the next slide. A B C D E F G H 23 E 24 =SUMPRO DUCT(B8:F9,B27:F28) 24 Solution Quantities, C = $ 12,110 25 To Node 26 From Node Jaystreet 7th Avenue River Cross Downtown Exurbia Total Quantity G 27 Centralia 200 60 150 30 60 500 28 Gotham 0 190 200 120 90 600 27 =SUM(B27:F27) 28 =SUM(B28:F28) 29 Total Quantity 200 250 350 150 150 30 B C D E F 31 29 =SUM(B27:B28) =SUM(C27:C28)=SUM(D27:D28)=SUM(E27:E28) =SUM(F27:F28) 6. For other problems insert (or delete) the appropriate number of rows or columns and check to make sure that all the formulas have the proper ranges. 38 1. Enter the value of the objective function, E24, in the Target Cell line, either with or without the $ signs. Solver Parameters Dialog Box (Figure 13-41) NOTE: Normally all these entries appear in the Solver Parameter dialog box so you only need to click on the Solve button. However, you should always check to make sure the entries are correct for the problem you are solving. 2. The Target Cell is to be minimized so click on Min in the Equal To line. 3. Enter the decision variables in the By Changing Cells line, B27:F28. 4. The constraints are entered in the Subject to Constraints box by using the Add Constraints dialog box (obtained by clicking on the Add button) as was done for the shortest route template. If a constraint needs to be changed, click on the Change 39 button. The Change and Add Constraint dialog box function in the same manner.