Network Models Chapters 6 and 7 McGraw-Hill/Irwin 7.1 © The McGraw-Hill Companies, Inc., 2003 Where network flows arise • Transportation – Transportation of goods over transportation networks – Scheduling of fleets of airplanes: time/space networks • Manufacturing – Scheduling of goods for manufacturing – Flow of manufactured items within inventory systems • Communications – Design and expansion of communication systems – Flow of information across networks • Personnel Assignment – Assignment of crews to airline schedules – Assignment of drivers to vehicles McGraw-Hill/Irwin 7.2 © The McGraw-Hill Companies, Inc., 2003 Network Optimization Problem Types Many optimization problems can be represented by a graphical network representation. Examples: – – – – – Distribution problems Routing problems Maximum flow problems Designing computer / phone / road networks Equipment replacement McGraw-Hill/Irwin 7.3 © The McGraw-Hill Companies, Inc., 2003 Network examples • Shortest path • Maximum flow • Transportation problem (Chapter 6) • Assignment problem (Chapter 6) • All are examples of a more general model type: – The Minimum-Cost-Network Flow Model McGraw-Hill/Irwin 7.4 © The McGraw-Hill Companies, Inc., 2003 Advantages of Network Models • They can be solved very quickly with specialized algorithms. • They have naturally integer solutions. – By recognizing that a problem can be formulated as a network program, it is possible to solve special types of integer programs without resorting to the ineffective and time consuming integer programming algorithms. • They are intuitive. – Network models provide a language for talking about problems that is much more intuitive than the “variables, objective, and constraints” language of linear and integer programming. • These advantages come with a drawback (of course): – Network models cannot formulate the wide range of models that linear and integer programs can. – However, they occur often enough that they form an important tool for real decision making. McGraw-Hill/Irwin 7.5 © The McGraw-Hill Companies, Inc., 2003 Table of Contents Chapter 7 (Network Optimization Problems) Minimum-Cost Flow Problems (Section 7.1) A Case Study: The BMZ Maximum Flow Problem (Section 7.2) Maximum Flow Problems (Section 7.3) Shortest Path Problems: Littletown Fire Department (Section 7.4) Shortest Path Problems: General Characteristics (Section 7.4) Shortest Path Problems: Minimizing Sarah’s Total Cost (Section 7.4) Shortest Path Problems: Minimizing Quick’s Total Time (Section 7.4) Minimum Spanning Trees: The Modern Corp. Problem (Section 7.5) McGraw-Hill/Irwin 7.6 © The McGraw-Hill Companies, Inc., 2003 Distribution Unlimited Co. Problem • The Distribution Unlimited Co. has two factories producing a product that needs to be shipped to two warehouses – – – – Factory 1 produces 80 units. Factory 2 produces 70 units. Warehouse 1 needs 60 units. Warehouse 2 needs 90 units. • There are rail links directly from Factory 1 to Warehouse 1 and Factory 2 to Warehouse 2. • Independent truckers are available to ship up to 50 units from each factory to the distribution center, and then 50 units from the distribution center to each warehouse. Question: How many units (truckloads) should be shipped along each shipping lane? McGraw-Hill/Irwin 7.7 © The McGraw-Hill Companies, Inc., 2003 The Distribution Network 80 units produced W1 60 units needed F1 DC 70 units produced McGraw-Hill/Irwin W2 F2 7.8 90 units needed © The McGraw-Hill Companies, Inc., 2003 Data for Distribution Network 80 units produced $700/unit F1 $300/unit [50 unit s max.] $200/unit [50 unit s max.] 60 units W1 needed DC $400/unit [50 unit s max.] 70 units produced F2 $400/unit [50 unit s max.] $900/unit W2 90 units needed Both transportation cost and arc capacity are considered. McGraw-Hill/Irwin 7.9 © The McGraw-Hill Companies, Inc., 2003 A Network Model [80] [- 60] $700 F1 $300 [50] [0] W1 $200 [50] DC $400 [50] F2 $400 [50] $900 [70] McGraw-Hill/Irwin W2 [- 90] 7.10 © The McGraw-Hill Companies, Inc., 2003 The Optimal Solution [80] [- 60] (30) F1 (50) W1 (30) [0] DC (30) F2 (50) (40) [70] McGraw-Hill/Irwin W2 [- 90] 7.11 © The McGraw-Hill Companies, Inc., 2003 Terminology for Minimum-Cost Flow Problems 1. The model for any minimum-cost flow problem is represented by a network with flow passing through it. 2. The circles in the network are called nodes. 3. Each node where the net amount of flow generated (outflow minus inflow) is a fixed positive number is a supply node. 4. Each node where the net amount of flow generated is a fixed negative number is a demand node. 5. Any node where the net amount of flow generated is fixed at zero is a transshipment node. Having the amount of flow out of the node equal the amount of flow into the node is referred to as conservation of flow. 6. The arrows in the network are called arcs. 7. The maximum amount of flow allowed through an arc is referred to as the capacity of that arc. McGraw-Hill/Irwin 7.12 © The McGraw-Hill Companies, Inc., 2003 Assumptions of a Minimum-Cost Flow Problem 1. At least one of the nodes is a supply node. 2. At least one of the other nodes is a demand node. 3. All the remaining nodes are transshipment nodes. 4. Flow through an arc is only allowed in the direction indicated by the arrowhead, where the maximum amount of flow is given by the capacity of that arc. (If flow can occur in both directions, this would be represented by a pair of arcs pointing in opposite directions.) 5. The network has enough arcs with sufficient capacity to enable all the flow generated at the supply nodes to reach all the demand nodes. 6. The cost of the flow through each arc is proportional to the amount of that flow, where the cost per unit flow is known. 7. The objective is to minimize the total cost of sending the available supply through the network to satisfy the given demand. (An alternative objective is to maximize the total profit from doing this.) McGraw-Hill/Irwin 7.13 © The McGraw-Hill Companies, Inc., 2003 Properties of Minimum-Cost Flow Problems • The Feasible Solutions Property: Under the previous assumptions, a minimum-cost flow problem will have feasible solutions if and only if the sum of the supplies from its supply nodes equals the sum of the demands at its demand nodes. • The Integer Solutions Property: As long as all the supplies, demands, and arc capacities have integer values, any minimum-cost flow problem with feasible solutions is guaranteed to have an optimal solution with integer values for all its flow quantities. McGraw-Hill/Irwin 7.14 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model 3 4 5 6 7 8 9 10 11 B C D From F1 F1 DC DC F2 F2 To W1 DC W1 W2 DC W2 Ship 30 50 30 50 30 40 Total Cost $110,000 E F G Capacity Unit Cost $700 $300 $200 $400 $400 $900 <= <= <= <= [80] 50 50 50 50 H [- 60] $700 F1 $300 [50] [0] F2 3 4 5 6 7 8 W1 $200 [50] [70] McGraw-Hill/Irwin $400 [50] $900 J Nodes Net Flow F1 80 F2 70 DC 0 W1 -60 W2 -90 K L = = = = = Supply/Demand 80 70 0 -60 -90 J DC $400 [50] I Net Flow =SUMIF(From,I4,Ship)-SUMIF(To,I4,Ship) =SUMIF(From,I5,Ship)-SUMIF(To,I5,Ship) =SUMIF(From,I6,Ship)-SUMIF(To,I6,Ship) =SUMIF(From,I7,Ship)-SUMIF(To,I7,Ship) =SUMIF(From,I8,Ship)-SUMIF(To,I8,Ship) W2 [- 90] 7.15 © The McGraw-Hill Companies, Inc., 2003 The SUMIF Function • The SUMIF formula can be used to simplify the node flow constraints. =SUMIF(Range A, x, Range B) • For each quantity in (Range A) that equals x, SUMIF sums the corresponding entries in (Range B). • The net outflow (flow out – flow in) from node x is then =SUMIF(“From labels”, x, “Flow”) – SUMIF(“To labels”, x, “Flow”) McGraw-Hill/Irwin 7.16 © The McGraw-Hill Companies, Inc., 2003 Typical Applications of Minimum-Cost Flow Problems Kind of Application Supply Nodes Transshipment Nodes Demand Nodes Operation of a distribution network Sources of goods Intermediate storage facilities Customers Solid waste management Sources of solid waste Processing facilities Landfill locations Operation of a supply network Vendors Intermediate warehouses Processing facilities Coordinating product mixes at plants Plants Production of a specific product Market for a specific product Cash flow management Sources of cash at a specific time Short-term investment options Needs for cash at a specific time McGraw-Hill/Irwin 7.17 © The McGraw-Hill Companies, Inc., 2003 The BMZ Maximum Flow Problem • The BMZ Company is a European manufacturer of luxury automobiles. Its exports to the United States are particularly important. • BMZ cars are becoming especially popular in California, so it is particularly important to keep the Los Angeles center well supplied with replacement parts for repairing these cars. • BMZ needs to execute a plan quickly for shipping as much as possible from the main factory in Stuttgart, Germany to the distribution center in Los Angeles over the next month. • The limiting factor on how much can be shipped is the limited capacity of the company’s distribution network. Question: How many units should be sent through each shipping lane to maximize the total units flowing from Stuttgart to Los Angeles? McGraw-Hill/Irwin 7.18 © The McGraw-Hill Companies, Inc., 2003 The BMZ Distribution Network [60 unit s max.] RO Rotte rdam [50 unit s max.] Ne w York NY [80 unit s max.] Ne w O rl e an s LA Los An gel e s [70 unit s max]NO McGraw-Hill/Irwin {40 units max.] ST S tu ttgart [70 unit s max.] Borde au x [40 unit s max.] BO [50 unit s max.] LI Lis bon [30 unit s max.] 7.19 © The McGraw-Hill Companies, Inc., 2003 A Network Model for BMZ RO [60] [50] NY [80] [40] BO LA [70] ST [50] [70] NO [40] [30] LI McGraw-Hill/Irwin 7.20 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model for BMZ 3 4 5 6 7 8 9 10 11 12 13 14 B C D From Stuttgart Stuttgart Stuttgart Rotterdam Bordeaux Bordeaux Lisbon New Y ork New Orleans To Rotterdam Bordeaux Lisbon New Y ork New Y ork New Orleans New Orleans Los Angeles Los Angeles Ship 50 70 30 50 30 40 30 80 70 Maximum Flow 150 McGraw-Hill/Irwin E F <= <= <= <= <= <= <= <= <= Capacity 50 70 40 60 40 50 30 80 70 7.21 G H I Nodes Stuttgart Rotterdam Bordeaux Lisbon New Y ork New Orleans Los Angeles Net Flow 150 0 0 0 0 0 -150 J K Supply/Demand = = = = = 0 0 0 0 0 © The McGraw-Hill Companies, Inc., 2003 Assumptions of Maximum Flow Problems 1. All flow through the network originates at one node, called the source, and terminates at one other node, called the sink. (The source and sink in the BMZ problem are the factory and the distribution center, respectively.) 2. All the remaining nodes are transshipment nodes. 3. Flow through an arc is only allowed in the direction indicated by the arrowhead, where the maximum amount of flow is given by the capacity of that arc. At the source, all arcs point away from the node. At the sink, all arcs point into the node. 4. The objective is to maximize the total amount of flow from the source to the sink. This amount is measured in either of two equivalent ways, namely, either the amount leaving the source or the amount entering the sink. McGraw-Hill/Irwin 7.22 © The McGraw-Hill Companies, Inc., 2003 BMZ with Multiple Supply and Demand Points • BMZ has a second, smaller factory in Berlin. • The distribution center in Seattle has the capability of supplying parts to the customers of the distribution center in Los Angeles when shortages occur at the latter center. Question: How many units should be sent through each shipping lane to maximize the total units flowing from Stuttgart and Berlin to Los Angeles and Seattle? McGraw-Hill/Irwin 7.23 © The McGraw-Hill Companies, Inc., 2003 Network Model for the expanded BMZ Problem HA [40] [60] BN [30] [20] RO SE [40] BE [60] [10] LA [20] [50] NY [40] [80] BO [70] ST [50] [70] NO [40] [30] LI McGraw-Hill/Irwin 7.24 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 B C D From Stuttgart Stuttgart Stuttgart Berlin Berlin Rotterdam Bordeaux Bordeaux Lisbon Hamburg Hamburg New Orleans New Y ork New Y ork Boston Boston To Rotterdam Bordeaux Lisbon Rotterdam Hamburg New Y ork New Y ork New Orleans New Orleans New Y ork Boston Los Angeles Los Angeles Seattle Los Angeles Seattle Ship 40 70 30 20 60 60 30 40 30 30 30 70 80 40 10 20 Maximum Flow 220 McGraw-Hill/Irwin E F <= <= <= <= <= <= <= <= <= <= <= <= <= <= <= <= Capacity 50 70 40 20 60 60 40 50 30 30 40 70 80 40 10 20 7.25 G H I Nodes Stuttgart Berlin Hamburg Rotterdam Bordeaux Lisbon Boston New Y ork New Orleans Los Angeles Seattle Net Flow 140 80 0 0 0 0 0 0 0 -160 -60 J K Supply/Demand = = = = = = = 0 0 0 0 0 0 0 © The McGraw-Hill Companies, Inc., 2003 Some Applications of Maximum Flow Problems 1. Maximize the flow through a distribution network, as for BMZ. 2. Maximize the flow through a company’s supply network from its vendors to its processing facilities. 3. Maximize the flow of oil through a system of pipelines. 4. Maximize the flow of water through a system of aqueducts. 5. Maximize the flow of vehicles through a transportation network. McGraw-Hill/Irwin 7.26 © The McGraw-Hill Companies, Inc., 2003 Littletown Fire Department • Littletown is a small town in a rural area. • Its fire department serves a relatively large geographical area that includes many farming communities. • Since there are numerous roads throughout the area, many possible routes may be available for traveling to any given farming community. Question: Which route from the fire station to a certain farming community minimizes the total number of miles? McGraw-Hill/Irwin 7.27 © The McGraw-Hill Companies, Inc., 2003 The Littletown Road System 8 6 A 1 3 6 Fire Station 4 D B McGraw-Hill/Irwin 7.28 Farming Communit y 5 2 4 7 6 3 G E 2 C 6 3 5 4 4 F H 7 © The McGraw-Hill Companies, Inc., 2003 The Network Representation A 3 (Origin) O 1 6 4 B 6 4 5 2 8 D 5 E 4 7 C McGraw-Hill/Irwin 3 6 3 F G 2 4 6 T (Destinat ion) 7 H 7.29 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 B C D From Fire St. Fire St. Fire St. A A B B B B C C D D E E E E F F G G G H H To A B C B D A C D E B E E F D F G H G Farm Com. F H Farm Com. G Farm Com. On Route 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 Total Distance 19 McGraw-Hill/Irwin E F G Distance 3 6 4 1 6 1 2 4 5 2 7 3 8 3 6 5 4 3 4 3 2 6 2 7 7.30 H I Nodes Fire St. A B C D E F G H Farm Com. Net Flow 1 0 0 0 0 0 0 0 0 -1 J K = = = = = = = = = = Supply/Demand 1 0 0 0 0 0 0 0 0 -1 © The McGraw-Hill Companies, Inc., 2003 Assumptions of a Shortest Path Problem 1. You need to choose a path through the network that starts at a certain node, called the origin, and ends at another certain node, called the destination. 2. The lines connecting certain pairs of nodes commonly are links (which allow travel in either direction), although arcs (which only permit travel in one direction) also are allowed. 3. Associated with each link (or arc) is a nonnegative number called its length. (Be aware that the drawing of each link in the network typically makes no effort to show its true length other than giving the correct number next to the link.) 4. The objective is to find the shortest path (the path with the minimum total length) from the origin to the destination. McGraw-Hill/Irwin 7.31 © The McGraw-Hill Companies, Inc., 2003 Applications of Shortest Path Problems 1. Minimize the total distance traveled. 2. Minimize the total cost of a sequence of activities. 3. Minimize the total time of a sequence of activities. McGraw-Hill/Irwin 7.32 © The McGraw-Hill Companies, Inc., 2003 Minimizing Total Cost: Sarah’s Car Fund • Sarah has just graduated from high school. • As a graduation present, her parents have given her a car fund of $21,000 to help purchase and maintain a three-year-old used car for college. • Since operating and maintenance costs go up rapidly as the car ages, Sarah may trade in her car on another three-year-old car one or more times during the next three summers if it will minimize her total net cost. (At the end of the four years of college, her parents will trade in the current used car on a new car for Sarah.) Question: When should Sarah trade in her car (if at all) during the next three summers? McGraw-Hill/Irwin 7.33 © The McGraw-Hill Companies, Inc., 2003 Sarah’s Cost Data Operating and Maintenance Costs for Ownership Year Trade-in Value at End of Ownership Year Purchase Price 1 2 3 4 1 2 3 4 $12,000 $2,000 $3,000 $4,500 $6,500 $8,500 $6,500 $4,500 $3,000 McGraw-Hill/Irwin 7.34 © The McGraw-Hill Companies, Inc., 2003 Shortest Path Formulation 25,000 17,000 10,500 10,500 (Origin) 0 5,500 1 5,500 2 5,500 3 5,500 4 (Destinat ion) 10,500 17,000 McGraw-Hill/Irwin 7.35 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model B 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 Y ear Y ear Y ear Y ear 1 2 3 4 From Y ear 0 Y ear 0 Y ear 0 Y ear 0 Y ear 1 Y ear 1 Y ear 1 Y ear 2 Y ear 2 Y ear 3 C D E Operating & Maint. Cost $2,000 $3,000 $4,500 $6,500 Trade-in Value at End of Y ear $8,500 $6,500 $4,500 $3,000 Purchase Price $12,000 On Route 0 1 0 0 0 0 0 0 1 0 Cost $5,500 $10,500 $17,000 $25,000 $5,500 $10,500 $17,000 $5,500 $10,500 $5,500 To Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear 1 2 3 4 2 3 4 3 4 4 Total Cost McGraw-Hill/Irwin F G H Nodes Net Flow Y ear 0 1 Y ear 1 0 Y ear 2 0 Y ear 3 0 Y ear 4 -1 I J = = = = = Supply/Demand 1 0 0 0 -1 $21,000 7.36 © The McGraw-Hill Companies, Inc., 2003 Minimizing Total Time: Quick Company • The Quick Company has learned that a competitor is planning to come out with a new kind of product with great sales potential. • Quick has been working on a similar product that had been scheduled to come to market in 20 months. • Quick’s management wishes to rush the product out to meet the competition. • Each of four remaining phases can be conducted at a normal pace, at a priority pace, or at crash level to expedite completion. However, the normal pace has been ruled out as too slow for the last three phases. • $30 million is available for all four phases. Question: At what pace should each of the four phases be conducted? McGraw-Hill/Irwin 7.37 © The McGraw-Hill Companies, Inc., 2003 Time and Cost of the Four Phases Remaining Research Development Design of Mfg. System Initiate Production and Distribution Normal 5 months — — — Priority 4 months 3 months 5 months 2 months Crash 2 months 2 months 3 months 1 month Level Remaining Research Development Design of Mfg. System Initiate Production and Distribution Normal $3 million — — — Priority 6 million $6 million $9 million $3 million Crash 9 million 9 million 12 million 6 million Level McGraw-Hill/Irwin 7.38 © The McGraw-Hill Companies, Inc., 2003 Shortest Path Formulation , 0 1 h) as r (C 2 5 3 ty) 2, 21(Priorit y)3, 12(Priorit y)4, 9 o ri i (C 3 r P ( ras 1, 27 2 h) ( Cr ash 2 5 al) ) 2, 18 5 4, 6 3, 9 m ) (Priorit y) r (Priorit y) ty o 3 i r (C 3 (N io r as (Origin) 0, 30 4 1, 24 (Pr (Priorit y) (C 2 h) (C 2 ra 2 s h 2, 15 5 ra s 4, 3 3, 6 ) h) (Priorit y) ((P riority) 3 ri ty ) (C 3 ras 1, 21 ri o h) (Cr (P2 ash 5 3, 3 2 4, 0 ) 2, 12(Priorit y) (Priorit y) 0 ra 1 h) s (C 0 T (Destinat ion) 1 s h) ra (C 0 McGraw-Hill/Irwin 7.39 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 B C D From (0, 30) (0, 30) (0, 30) (1, 27) (1, 27) (1, 24) (1, 24) (1, 21) (1, 21) (2, 21) (2, 21) (2, 18) (2, 18) (2, 15) (2, 15) (2, 12) (3, 12) (3, 12) (3, 9) (3, 9) (3, 6) (3, 6) (3, 3) (4, 9) (4, 6) (4, 3) (4, 0) To (1, 27) (1, 24) (1, 21) (2, 21) (2, 18) (2, 18) (2, 15) (2, 15) (2, 12) (3, 12) (3, 9) (3, 9) (3, 6) (3, 6) (3, 3) (3, 3) (4, 9) (4, 6) (4, 6) (4, 3) (4, 3) (4, 0) (4, 0) (T) (T) (T) (T) On Route 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 Total Time 10 McGraw-Hill/Irwin E F G Time 5 4 2 3 2 3 2 3 2 5 3 5 3 5 3 5 2 1 2 1 2 1 2 0 0 0 0 7.40 H I J K Nodes (0, 30) (1, 27) (1, 24) (1, 21) (2, 21) (2, 18) (2, 15) (2, 12) (3, 12) (3, 9) (3, 6) (3, 3) (4, 9) (4, 6) (4, 3) (4, 0) (T) Net Flow 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 = = = = = = = = = = = = = = = = = Supply/Demand 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 © The McGraw-Hill Companies, Inc., 2003 The Optimal Solution Phase Level Time Cost Remaining research Crash 2 months $9 million Priority 3 months 6 million Crash 3 months 12 million Priority 2 months 3 million 10 months $30 million Development Design of manufacturing system Initiate production and distribution Total McGraw-Hill/Irwin 7.41 © The McGraw-Hill Companies, Inc., 2003 Minimum Spanning Trees: The Modern Corp. Problem • Modern Corporation has decided to have a state-of-the-art fiberoptic network installed to provide high-speed communication (data, voice, and video) between its major centers. • Any pair of centers do not need to have a cable directly connecting them in order to take advantage of the technology. All that is necessary is to have a series of cables that connect the centers. Question: Which cables should be installed to provide highspeed communications between every pair of centers. McGraw-Hill/Irwin 7.42 © The McGraw-Hill Companies, Inc., 2003 Modern Corporation’s Major Centers B 2 7 2 G 5 5 A 4 C E 7 4 1 D McGraw-Hill/Irwin 3 1 F 4 7.43 © The McGraw-Hill Companies, Inc., 2003 The Optimal Solution B 2 2 5 C A E 3 1 D McGraw-Hill/Irwin G 1 F 7.44 © The McGraw-Hill Companies, Inc., 2003 Assumptions of a Minimum-Spanning Tree Problem 1. You are given the nodes of a network but not the links. Instead, you are given the potential links and the positive cost (or a similar measure) for each if it is inserted into the network. 2. You wish to design the network by inserting enough links to satisfy the requirement that there be a path between every pair of nodes. 3. The objective is to satisfy this requirement in a way that minimizes the total cost of doing so. McGraw-Hill/Irwin 7.45 © The McGraw-Hill Companies, Inc., 2003 Algorithm for a Minimum-Spanning-Tree Problem 1. Choice of the first link: Select the cheapest potential link. 2. Choice of the next link: Select the cheapest potential link between a node that already is touched by a link and a node that does not yet have such a link. 3. Repeat step 2 over and over until every node is touched by a link (perhaps more than one). At that point, an optimal solution (a minimum spanning tree) has been obtained. (Ties for the cheapest potential link at each step may be broken arbitrarily.) McGraw-Hill/Irwin 7.46 © The McGraw-Hill Companies, Inc., 2003 Application of Algorithm to Modern Corp.: First Link B 2 7 2 G 5 5 A 4 C E 7 4 1 D McGraw-Hill/Irwin 3 1 F 4 7.47 © The McGraw-Hill Companies, Inc., 2003 Application of Algorithm to Modern Corp.: Second Link B 2 7 2 G 5 5 A 4 C E 7 4 1 D McGraw-Hill/Irwin 3 1 F 4 7.48 © The McGraw-Hill Companies, Inc., 2003 Application of Algorithm to Modern Corp.: Third Link B 2 7 2 G 5 5 A 4 C E 7 4 1 D McGraw-Hill/Irwin 3 1 F 4 7.49 © The McGraw-Hill Companies, Inc., 2003 Application of Algorithm to Modern Corp.: Fourth Link B 2 7 2 G 5 5 A 4 C E 7 4 D McGraw-Hill/Irwin 3 1 1 F 4 7.50 © The McGraw-Hill Companies, Inc., 2003 Application of Algorithm to Modern Corp.: Fifth Link B 2 7 2 G 5 5 A 4 C E 7 4 D McGraw-Hill/Irwin 3 1 1 F 4 7.51 © The McGraw-Hill Companies, Inc., 2003 Application of Algorithm to Modern Corp.: Final Link B 2 7 2 G 5 5 A 4 C E 7 4 D McGraw-Hill/Irwin 3 1 1 F 4 7.52 © The McGraw-Hill Companies, Inc., 2003 Applications of Minimum-Spanning-Tree Problems 1. Design of telecommunication networks (computer networks, leaseline telephone networks, cable television networks, etc.) 2. Design of a lightly-used transportation network to minimize the total cost of providing the links (rail lines, roads, etc.) 3. Design of a network of high-voltage electrical power transmission lines. 4. Design of a network of wiring on electrical equipment (e.g., a digital computer system) to minimize the total length of the wire. 5. Design of a network of pipelines to connect a number of locations. McGraw-Hill/Irwin 7.53 © The McGraw-Hill Companies, Inc., 2003 Network Optimization Problems Many optimization problems can be represented by a graphical network representation. Examples: – – – – – Distribution problems Routing problems Maximum flow problems Designing computer / phone / road networks Equipment replacement McGraw-Hill/Irwin 7.54 © The McGraw-Hill Companies, Inc., 2003 Components of a Minimum-Cost-Flow Model • Nodes – can represent a location, point in time, or state – supply node (flow is generated) – demand node (flow is consumed) – transshipment node (flow in = flow out) • Arcs – can represent potential flow (e.g., a shipping lane) or a transition from state to state. – directional (one-way) • if both ways, use two arcs – cost (assumed proportional to flow) – may have capacity limitations McGraw-Hill/Irwin 7.55 © The McGraw-Hill Companies, Inc., 2003 Minimum-Cost-Flow Model • Objective: Minimize the total cost of all flow, while sending supply, subject to constraints, through the network to satisfy demand. • Integer Solutions Property: If supplies, demands, and arc capacities are integer, then the optimal flow will also be integer. • Network Simplex Method: A streamlined version of the simplex method. – extremely efficient – computer software may have graphical interface (with nodes and arcs) • Excel uses the standard simplex method. However, the minimumcost-flow model is a useful tool for modeling a problem: – – – – visual intuitive easy to set up transforms easily to a spreadsheet model McGraw-Hill/Irwin 7.56 © The McGraw-Hill Companies, Inc., 2003 Minimum-Cost-Flow Model • Consider a directed network with n nodes. The decision variables are xij, the flow through arc (i, j). The given information includes: – cij: cost per unit of flow from i to j (may be negative), – uij: capacity (or upper bound) on flow from i to j, – bi: net flow generated at i. • This last value has a sign convention: – bi > 0 if i is a supply node, – bi < 0 if i is a demand node, – bi = 0 if i is a transshipment node. • The objective is to minimize the total cost of sending the supply through the network to satisfy the demand. McGraw-Hill/Irwin 7.57 © The McGraw-Hill Companies, Inc., 2003 Minimum-Cost-Flow Model • Linear programming formulation for this model is… McGraw-Hill/Irwin 7.58 © The McGraw-Hill Companies, Inc., 2003 Minimum-Cost-Flow Model • Things you can do with this model… – Lower bounds on arcs. If a variable xij has a lower bound of lij, upper bound of uij, and cost of cij, change the problem as follows: • Replace the upper bound with uij - lij, • Replace the supply at i with bi - lij, • Replace the supply at j with bi + lij, – Now this is a minimum cost flow problem. Add cijlij to the objective after solving and lij to the flow on arc (i, j) to obtain a solution of the original problem. – Upper bounds on flow through a node. Replace the node i with nodes i' and i''. Create an arc from i' to i'' with the appropriate capacity, and cost 0. Replace every arc (j, i) with one from j to i' and every arc (i, j) with one from i'' to j. Lower bounds can also be handled this way. – Convex, piecewise linear costs on arc flows (for minimization). This is handled by introducing multiple arcs between the nodes, one for each portion of the piecewise linear function. The convexity will assure that costs are handled correctly in an optimal solution. McGraw-Hill/Irwin 7.59 © The McGraw-Hill Companies, Inc., 2003 Multi-Echelon Distribution Consider a multi-echelon distribution problem. Product must be distributed from a pair of factories to three warehouses. Product is then shipped to five distribution centers. A private trucking fleet is used for all shipping. Some shipping lanes are currently capacitated due to a limited number of trucks. $6.00 WH1 $4.00 [2000] F1 [-800] DC2 [-700] DC3 [-1500] DC4 [-900] DC5 [-1100] $6.75 [300] [900] DC1 $8.25 $3.75 $7.50 WH2 $2.50 [1200] [3000] [500] F2 $6.50 $5.25 $8.75 WH3 $7.75 Question: How many units should be shipped along each shipping lane? McGraw-Hill/Irwin 7.60 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model 3 4 5 6 7 8 9 10 11 12 13 14 15 16 B C D From F1 F1 F2 F2 WH1 WH1 WH2 WH2 WH2 WH3 WH3 To WH1 WH2 WH2 WH3 DC1 DC2 DC2 DC3 DC4 DC4 DC5 Ship 900 1100 1200 1800 800 100 600 1500 200 700 1100 E F G <= Capacity 900 <= 1200 <= 300 <= 500 Unit Cost $4.00 $3.75 $2.50 $5.25 $6.00 $6.75 $8.25 $7.50 $6.50 $8.75 $7.75 H I J K L Nodes F1 F2 WH1 WH2 WH3 DC1 DC2 DC3 DC4 DC5 Net Flow 2000 3000 0 0 0 -800 -700 -1500 -900 -1100 = = = = = = = = = = Supply/Demand 2000 3000 0 0 0 -800 -700 -1500 -900 -1100 Total Cost $57,800 J 3 4 5 6 7 8 9 10 11 12 13 McGraw-Hill/Irwin 7.61 Net Flow =D4+D5 =D6+D7 =D8+D9-D4 =D10+D11+D12-D5-D6 =D13+D14-D7 =-D8 =-D9-D10 =-D11 =-D12-D13 =-D14 © The McGraw-Hill Companies, Inc., 2003 The SUMIF Function • The SUMIF formula can be used to simplify the node flow constraints. =SUMIF(Range A, x, Range B) • For each quantity in (Range A) that equals x, SUMIF sums the corresponding entries in (Range B). • The net outflow (flow out – flow in) from node x is then =SUMIF(“From labels”, x, “Flow”) – SUMIF(“To labels”, x, “Flow”) McGraw-Hill/Irwin 7.62 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model using SUMIF 3 4 5 6 7 8 9 10 11 12 13 14 15 16 B C D From F1 F1 F2 F2 WH1 WH1 WH2 WH2 WH2 WH3 WH3 To WH1 WH2 WH2 WH3 DC1 DC2 DC2 DC3 DC4 DC4 DC5 Flow 900 1100 1200 1800 800 100 600 1500 200 700 1100 E F G <= Capacity 900 <= 1200 <= 300 <= 500 Unit Cost $4.00 $3.75 $2.50 $5.25 $6.00 $6.75 $8.25 $7.50 $6.50 $8.75 $7.75 H I J K L Nodes F1 F2 WH1 WH2 WH3 DC1 DC2 DC3 DC4 DC5 Net Flow 2000 3000 0 0 0 -800 -700 -1500 -900 -1100 = = = = = = = = = = Supply/Demand 2000 3000 0 0 0 -800 -700 -1500 -900 -1100 Total Cost $57,800 J 3 4 5 6 7 8 9 10 11 12 13 McGraw-Hill/Irwin Net Flow =SUMIF($B$4:$B$14,I4,$D$4:$D$14)-SUMIF($C$4:$C$14,I4,$D$4:$D$14) =SUMIF($B$4:$B$14,I5,$D$4:$D$14)-SUMIF($C$4:$C$14,I5,$D$4:$D$14) =SUMIF($B$4:$B$14,I6,$D$4:$D$14)-SUMIF($C$4:$C$14,I6,$D$4:$D$14) =SUMIF($B$4:$B$14,I7,$D$4:$D$14)-SUMIF($C$4:$C$14,I7,$D$4:$D$14) =SUMIF($B$4:$B$14,I8,$D$4:$D$14)-SUMIF($C$4:$C$14,I8,$D$4:$D$14) =SUMIF($B$4:$B$14,I9,$D$4:$D$14)-SUMIF($C$4:$C$14,I9,$D$4:$D$14) =SUMIF($B$4:$B$14,I10,$D$4:$D$14)-SUMIF($C$4:$C$14,I10,$D$4:$D$14) =SUMIF($B$4:$B$14,I11,$D$4:$D$14)-SUMIF($C$4:$C$14,I11,$D$4:$D$14) =SUMIF($B$4:$B$14,I12,$D$4:$D$14)-SUMIF($C$4:$C$14,I12,$D$4:$D$14) =SUMIF($B$4:$B$14,I13,$D$4:$D$14)-SUMIF($C$4:$C$14,I13,$D$4:$D$14) 7.63 © The McGraw-Hill Companies, Inc., 2003 The Minimum-Cost-Flow Model is an LP • Any minimum cost flow model consists of a set of nodes: – Supply node(s), with supply si – Demand node(s), with demand di – Transshipment nodes • A set of arcs from node i to node j – with cost cij – some with limited capacity kij • LP Formulation: Let xij = flow from i to j Minimize Cost = ∑ ij cij xij subject to Flow: ∑all j flowing out of i xij – ∑all j flowing into i xji = (si, di, or 0) Capacity: xij ≤ kij and xij ≥ 0. McGraw-Hill/Irwin 7.64 © The McGraw-Hill Companies, Inc., 2003 Maximum Flow Problem An oil company has the following pipeline network, where each pipeline is labeled with its maximum flow rate (in thousands of gallons per hour). 8 D B 7 3 10 A 6 1 F 4 10 2 C 12 G 2 8 E Question: What is the maximum possible flow rate from A to G? McGraw-Hill/Irwin 7.65 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 B C D From A A B B B C C C D D E E F To B C C D F B E F F G F G G Ship 7 10 0 7 0 0 8 2 0 7 0 8 2 Maximum Flow McGraw-Hill/Irwin E F G <= <= <= <= <= <= <= <= <= <= <= <= <= Capacity 10 10 1 8 6 1 12 4 3 7 2 8 2 H I Nodes A B C D E F G Net Flow 17 0 0 0 0 0 -17 J K Supply/Demand = = = = = 0 0 0 0 0 17 7.66 © The McGraw-Hill Companies, Inc., 2003 Shortest Path Problem The travel times along various routes in the Pacific Northwest is shown below. Question: What is the quickest route from Seattle to Denver? McGraw-Hill/Irwin 7.67 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 B C D E From Seattle Seattle Seattle Portland Boise Boise Boise Butte Butte Butte Butte Billings Chey enne Salt Lake City Grand Junction To Portland Boise Butte Boise Butte Chey enne Salt Lake City Billings Chey enne Salt Lake City Boise Chey enne Denv er Grand Junction Denv er On Route 0 0 1 0 0 0 0 1 0 0 0 1 1 0 0 Time (hr) 3 9 10 7 7 14 6 4 12 7 7 7 1 5 4 McGraw-Hill/Irwin Total Time F G H Nodes Seattle Portland Boise Butte Billings Salt Lake City Chey enne Grand Junction Denv er Net Flow 1 0 0 0 0 0 0 0 -1 I J = = = = = = = = = Supply/Demand 1 0 0 0 0 0 0 0 -1 22 7.68 © The McGraw-Hill Companies, Inc., 2003 Equipment Replacement A production department needs to purchase a new machine. As the machine ages, it requires additional maintenance and also has a higher defect rate. The production department plans to replace the machine every few years. The purchase price of a new machine is $10,000. The maintenance cost and cost of defective product is given below. A used machine has no resale value. Age of machine Maintenance Cost Cost of Defects First Year $3,000 $2,000 Second Year $4,000 $4,000 Third Year $6,000 $7,000 Fourth Year $10,000 $11,000 Fifth Year $20,000 $24,000 Question: What is the best replacement policy over the next five years? McGraw-Hill/Irwin 7.69 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Solution B 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Age of Machine First Y ear Second Y ear Third Y ear Fourth Y ear Fif th Y ear C D Maintenance Cost $3,000 $4,000 $6,000 $10,000 $20,000 Cost of Defects $2,000 $4,000 $7,000 $11,000 $24,000 From Y ear 0 Y ear 0 Y ear 0 Y ear 0 Y ear 0 Y ear 1 Y ear 1 Y ear 1 Y ear 1 Y ear 2 Y ear 2 Y ear 2 Y ear 3 Y ear 3 Y ear 4 McGraw-Hill/Irwin To Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear Y ear 1 2 3 4 5 2 3 4 5 3 4 5 4 5 5 On Route 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 Total Cost $59,000 E F G H I J Year Y ear 0 Y ear 1 Y ear 2 Y ear 3 Y ear 4 Y ear 5 Net Flow 1 0 0 0 0 -1 = = = = = = Supply/Demand 1 0 0 0 0 -1 Purchase Cost $10,000 Cost $15,000 $23,000 $36,000 $57,000 $101,000 $15,000 $23,000 $36,000 $57,000 $15,000 $23,000 $36,000 $15,000 $23,000 $15,000 7.70 © The McGraw-Hill Companies, Inc., 2003 Planning Vehicle Replacement at Phillips Petroleum • Phillips Petroleum had a fleet of 1,500 cars and 3,800 trucks. • Modeled replacement strategy as shortest path model (20-year time horizon)—solved model once for each class of vehicle. • Could keep, purchase (replace), or lease, at 3-month intervals. • Costs considered included: – Maintenance and operating costs (fuel, oil, repair), – Leasing cost for leased vehicles, – Purchasing cost for purchased vehicles, – State license fees and road taxes, – Tax effects (investment tax credits, depreciation) • First used to make lease-or-buy decision, then vehicle-replacement strategy, and more recently for other equipment (non-vehicle). For more details, see Waddell (1983) Jul-Aug Interfaces article, “A Model for Equipment Replacement Decisions and Policies”, downloadable at www.mhhe.com/hillier2e/articles. McGraw-Hill/Irwin 7.71 © The McGraw-Hill Companies, Inc., 2003