Chapter 7 (Binary Integer Programming) Including two CD-rom supplements McGraw-Hill/Irwin 9.1 © The McGraw-Hill Companies, Inc., 2003 Assumptions of linear programming Proportionality: the gross margin and resource requirements per unit of activity are assumed to be constant regardless of the level of the activity use Additivity: no interaction effects between activities Homogeneity: all units of the same resource or activity are identical Continuity: resources can be used and activities produced in any fractional units Deterministic coefficients: all coefficients in the model are known with certainty Optimization: One proper objective function to be maximized or minimized Finiteness: only a finite number of activities and constraints is considered McGraw-Hill/Irwin 9.2 © The McGraw-Hill Companies, Inc., 2003 Types of Integer Programming Problems • Pure integer programming problems are those where all the decision variables must be integers. • Mixed integer programming problems only require some of the variables (the “integer variables”) to have integer values so the divisibility assumption holds for the rest (the “continuous variables”). • Binary variables are variables whose only possible values are 0 and 1. • Binary integer programming (BIP) problems are those where all the decision variables restricted to integer values are further restricted to be binary variables. – Such problems can be further characterized as either pure BIP problems or mixed BIP problems, depending on whether all the decision variables or only some of them are binary variables. McGraw-Hill/Irwin 9.3 © The McGraw-Hill Companies, Inc., 2003 The TBA Airlines Problem • TBA Airlines is a small regional company that specializes in short flights in small airplanes. • The company has been doing well and has decided to expand its operations. • The basic issue facing management is whether to purchase more small airplanes to add some new short flights, or start moving into the national market by purchasing some large airplanes, or both. Question: How many airplanes of each type should be purchased to maximize their total net annual profit? McGraw-Hill/Irwin 9.4 © The McGraw-Hill Companies, Inc., 2003 Data for the TBA Airlines Problem Small Airplane Large Airplane Net annual profit per airplane $1 million $5 million Purchase cost per airplane 5 million 50 million 2 — Maximum purchase quantity McGraw-Hill/Irwin 9.5 Capital Available $100 million © The McGraw-Hill Companies, Inc., 2003 Linear Programming Formulation Let S = Number of small airplanes to purchase L = Number of large airplanes to purchase Maximize Profit = S + 5L ($millions) subject to Capital Available: 5S + 50L ≤ 100 ($millions) Max Small Planes: S ≤ 2 and S ≥ 0, L ≥ 0. McGraw-Hill/Irwin 9.6 © The McGraw-Hill Companies, Inc., 2003 Graphical Method for Linear Programming McGraw-Hill/Irwin 9.7 © The McGraw-Hill Companies, Inc., 2003 Violates Divisibility Assumption of LP • Divisibility Assumption of Linear Programming: Decision variables in a linear programming model are allowed to have any values, including fractional values, that satisfy the functional and nonnegativity constraints. Thus, these variables are not restricted to just integer values. • Since the number of airplanes purchased by TBA must have an integer value, the divisibility assumption is violated. McGraw-Hill/Irwin 9.8 © The McGraw-Hill Companies, Inc., 2003 Integer Programming Formulation Let S = Number of small airplanes to purchase L = Number of large airplanes to purchase Maximize Profit = S + 5L ($millions) subject to Capital Available: 5S + 50L ≤ 100 ($millions) Max Small Planes: S ≤ 2 and S ≥ 0, L ≥ 0 S, L are integers. McGraw-Hill/Irwin 9.9 © The McGraw-Hill Companies, Inc., 2003 Graphical Method for Integer Programming • When an integer programming problem has just two decision variables, its optimal solution can be found by applying the graphical method for linear programming with just one change at the end. • We begin as usual by graphing the feasible region for the LP relaxation, determining the slope of the objective function lines, and moving a straight edge with this slope through this feasible region in the direction of improving values of the objective function. • However, rather than stopping at the last instant the straight edge passes through this feasible region, we now stop at the last instant the straight edge passes through an integer point that lies within this feasible region. • This integer point is the optimal solution. McGraw-Hill/Irwin 9.10 © The McGraw-Hill Companies, Inc., 2003 Graphical Method for Integer Programming McGraw-Hill/Irwin 9.11 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model B 3 4 5 6 7 8 9 10 11 12 13 14 Unit Prof it ($millions) Capital ($millions) Units Produced Maximum Small Airplanes McGraw-Hill/Irwin C Small Airplane 1 D Large Airplane 5 Capital Per Unit Produced 5 50 Small Airplane 0 <= 2 9.12 Large Airplane 2 E Capital Spent 100 F G <= Capital Av ailable 100 Total Prof it ($millions) 10 © The McGraw-Hill Companies, Inc., 2003 The default Tolerance field on the Solver Options dialog (relevant only for ILP models) is 5%. This means that the Solver ILP optimization procedure is continued only until the ILP solution OV is within 5% of the ILP’s optimum OV. A higher Tolerance speeds up Solver at the risk of a reported solution further from the true ILP optimum. Setting Tolerance to 0% forces Solver to find the ILP optimum but with much longer 9.13 solution times. McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2003 Applications of Binary Variables • Since binary variables only provide two choices, they are ideally suited to be the decision variables when dealing with yes-or-no decisions. • Examples: – Should we undertake a particular fixed project? – Should we make a particular fixed investment? – Should we locate a facility in a particular site? McGraw-Hill/Irwin 9.14 © The McGraw-Hill Companies, Inc., 2003 California Manufacturing Company • The California Manufacturing Company is a diversified company with several factories and warehouses throughout California, but none yet in Los Angeles or San Francisco. • A basic issue is whether to build a new factory in Los Angeles or San Francisco, or perhaps even both. • Management is also considering building at most one new warehouse, but will restrict the choice to a city where a new factory is being built. Question: Should the California Manufacturing Company expand with factories and/or warehouses in Los Angeles and/or San Francisco? McGraw-Hill/Irwin 9.15 © The McGraw-Hill Companies, Inc., 2003 Data for California Manufacturing Decision Number Yes-or-No Question Decision Variable Net Present Value (Millions) Capital Required (Millions) 1 Build a factory in Los Angeles? x1 $8 $6 2 Build a factory in San Francisco? x2 5 3 3 Build a warehouse in Los Angeles? x3 6 5 4 Build a warehouse in San Francisco? x4 4 2 Capital Available: $10 million McGraw-Hill/Irwin 9.16 © The McGraw-Hill Companies, Inc., 2003 Binary Decision Variables Decision Number Decision Variable Possible Value 1 x1 0 or 1 Build a factory in Los Angeles Do not build this factory 2 x2 0 or 1 Build a factory in San Francisco Do not build this factory 3 x3 0 or 1 Build a warehouse in Los Angeles Do not build this warehouse 4 x4 0 or 1 Build a warehouse in San Francisco Do not build this warehouse McGraw-Hill/Irwin Interpretation of a Value of 1 9.17 Interpretation of a Value of 0 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let x1 = 1 if build a factory in L.A.; 0 otherwise x2 = 1 if build a factory in S.F.; 0 otherwise x3 = 1 if build a warehouse in Los Angeles; 0 otherwise x4 = 1 if build a warehouse in San Francisco; 0 otherwise Maximize NPV = 8x1 + 5x2 + 6x3 + 4x4 ($millions) subject to Capital Spent: 6x1 + 3x2 + 5x3 + 2x4 ≤ 10 ($millions) Max 1 Warehouse: x3 + x4 ≤ 1 Warehouse only if Factory: x3 ≤ x1 x4 ≤ x2 and x1, x2, x3, x4 are binary variables. McGraw-Hill/Irwin 9.18 © 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 NPV ($millions) Warehouse C LA 6 D SF 4 Factory 8 5 Capital Required ($millions) Warehouse LA 5 SF 2 Factory 6 3 Build? Warehouse Factory McGraw-Hill/Irwin LA 0 <= 1 Total NPV ($millions) SF 0 <= 1 E Capital Spent 9 Total Warehouses 0 F G <= Capital Av ailable 10 <= Maximum Warehouses 1 13 9.19 © The McGraw-Hill Companies, Inc., 2003 Sensitivity Analysis with Solver Table 23 24 25 26 27 28 29 30 31 32 33 34 35 36 B Capital Av ailable ($millions) 5 6 7 8 9 10 11 12 13 14 15 McGraw-Hill/Irwin C Warehouse in LA? 0 0 0 0 0 0 0 0 0 0 1 1 D Warehouse in SF? 0 1 1 1 1 0 0 1 1 1 0 0 9.20 E Factory in LA? 1 0 0 0 0 1 1 1 1 1 1 1 F Factory in SF? 1 1 1 1 1 1 1 1 1 1 1 1 G Total NPV ($millions) 13 9 9 9 9 13 13 17 17 17 19 19 © The McGraw-Hill Companies, Inc., 2003 Management’s Conclusion • Management’s initial tentative decision had been to make $10 million of capital available. • With this much capital, the best plan would be to build a factory in both Los Angeles and San Francisco, but no warehouses. • An advantage of this plan is that it only uses $9 million of this capital, which frees up $1 million for other projects. • A heavy penalty (a reduction of $4 million in total net present value) would be paid if the capital made available were to be reduced below $9 million. • Increasing the capital made available by $1 million (to $11 million) would enable a substantial ($4 million) increase in the total net present value. Management decides to do this. • With this much capital available, the best plan is to build a factory in both cities and a warehouse in San Francisco. McGraw-Hill/Irwin 9.21 © The McGraw-Hill Companies, Inc., 2003 Some Other Applications • Investment Analysis – Should we make a certain fixed investment? – Examples: Turkish Petroleum Refineries (1990), South African National Defense Force (1997), Grantham, Mayo, Van Otterloo and Company (1999) • Site Selection – Should a certain site be selected for the location of a new facility? – Example: AT&T (1990) • Designing a Production and Distribution Network – Should a certain plant remain open? Should a certain site be selected for a new plant? Should a distribution center remain open? Should a certain site be selected for a new distribution center? Should a certain distribution center be assigned to serve a certain market area? – Examples: Ault Foods (1994), Digital Equipment Corporation (1995) All references available for download at www.mhhe.com/hillier2e/articles McGraw-Hill/Irwin 9.22 © The McGraw-Hill Companies, Inc., 2003 Some Other Applications • Dispatching Shipments – Should a certain route be selected for a truck? Should a certain size truck be used? Should a certain time period for departure be used? – Examples: Quality Stores (1987), Air Products and Chemicals, Inc. (1983), Reynolds Metals Co. (1991), Sears, Roebuck and Company (1999) • Scheduling Interrelated Activities – Should a certain activity begin in a certain time period? – Examples: Texas Stadium (1983), China (1995) • Scheduling Asset Divestitures – Should a certain asset be sold in a certain time period? – Example: Homart Development (1987) • Airline Applications: – Should a certain type of airplane be assigned to a certain flight leg? Should a certain sequence of flight legs be assigned to a crew? – Examples: American Airlines (1989, 1991), Air New Zealand (2001) All references available for download at www.mhhe.com/hillier2e/articles McGraw-Hill/Irwin 9.23 © The McGraw-Hill Companies, Inc., 2003 Wyndor with Setup Costs (Variation 1) Suppose that two changes are made to the original Wyndor problem: 1. For each product, producing any units requires a substantial one-time setup cost for setting up the production facilities. 2. The production runs for these products will be ended after one week, so D and W in the original model now represent the total number of doors and windows produced, respectively, rather than production rates. Therefore, these two variables need to be restricted to integer values. McGraw-Hill/Irwin 9.24 © The McGraw-Hill Companies, Inc., 2003 Graphical Solution to Original Wyndor Problem W Production rate for windows 8 Opt imal solution 6 4 (2, 6) Fe asible Re gion P = 3,600 = 300 D+ 500 W 2 0 McGraw-Hill/Irwin 4 6 2 Production rate for doors 9.25 8 10 D © The McGraw-Hill Companies, Inc., 2003 Net Profit for Wyndor Problem with Setup Costs Net Profit ($) Number of Units Produced McGraw-Hill/Irwin Doors Windows 0 0(300) – 0 = 0 0 (500) – 0 = 0 1 1(300) – 700 = –400 1(500) – 1,300 = –800 2 2(300) – 700 = –100 2(500) – 1,300 = –300 3 3(300) – 700 = 200 3(500) – 1,300 = 200 4 4(300) – 700 = 500 4(500) – 1,300 = 700 5 Not feasible 5(500) – 1,300 = 1,200 6 Not feasible 6(500) – 1,300 = 1,700 9.26 © The McGraw-Hill Companies, Inc., 2003 Feasible Solutions for Wyndor with Setup Costs McGraw-Hill/Irwin 9.27 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let D = Number of doors to produce, W = Number of windows to produce, y1 = 1 if perform setup to produce doors; 0 otherwise, y2 = 1 if perform setup to produce windows; 0 otherwise . Maximize P = 300D + 500W – 700y1 – 1,300y2 subject to Original Constraints: Plant 1: D≤4 Plant 2: 2W ≤ 12 Plant 3: 3D + 2W ≤ 18 Produce only if Setup: Doors: D ≤ 99y1 Windows: W ≤ 99y2 and D ≥ 0, W ≥ 0, y1 and y2 are binary. McGraw-Hill/Irwin 9.28 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model B 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Unit Prof it Setup Cost Plant 1 Plant 2 Plant 3 Units Produced Only If Setup Setup? McGraw-Hill/Irwin C Doors $300 $700 D Windows $500 $1,300 Hours Used Per Unit Produced 1 0 0 2 3 2 Doors 0 <= 0 0 Windows 6 <= 99 1 9.29 E Hours Used 0 12 12 F G <= <= <= Hours Av ailable 4 12 18 H Production Prof it $3,000 - Total Setup Cost $1,300 Total Prof it $1,700 © The McGraw-Hill Companies, Inc., 2003 Wyndor with Mutually Exclusive Products (Variation 2) Suppose that now the only change from the original Wyndor problem is: • The two potential new products (doors and windows) would compete for the same customers. Therefore, management has decided not to produce both of them together. – At most one can be chosen for production, so either D = 0 or W = 0, or both. McGraw-Hill/Irwin 9.30 © The McGraw-Hill Companies, Inc., 2003 Feasible Solution for Wyndor with Mutually Exclusive Products McGraw-Hill/Irwin 9.31 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let D = Number of doors to produce, W = Number of windows to produce, y1 = 1 if produce doors; 0 otherwise, y2 = 1 if produce windows; 0 otherwise. Maximize P = 300D + 500W subject to Original Constraints: Plant 1: D≤4 Plant 2: 2W ≤ 12 Plant 3: 3D + 2W ≤ 18 Auxiliary variables must =1 if produce any: Doors: D ≤ 99y1 Windows: W ≤ 99y2 Mutually Exclusive: y1 + y2 ≤ 1 and D ≥ 0, W ≥ 0, y1 and y2 are binary. McGraw-Hill/Irwin 9.32 © 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 Unit Prof it Plant 1 Plant 2 Plant 3 Units Produced Only If Produce Produce? McGraw-Hill/Irwin C Doors $300 D Windows $500 Hours Used Per Unit Produced 1 0 0 2 3 2 Doors 0 <= 0 0 Windows 6 <= 99 1 E Hours Used 0 12 12 Total Produced 1 F G <= <= <= Hours Av ailable 4 12 18 <= Maximum To Produce 1 Total Prof it $3,000 9.33 © The McGraw-Hill Companies, Inc., 2003 Wyndor with Either-Or Constraints (Variation 3) Suppose that now the only change from the original Wyndor problem is: • The company has just opened a new plant (plant 4) that is similar to plant 3, so the new plant can perform the same operations as plant 3 to help produce the two new products (doors and windows). • However, management wants just one of the plants to be chosen to work on these new products. The plant chosen should be the one that provides the most profitable product mix. McGraw-Hill/Irwin 9.34 © The McGraw-Hill Companies, Inc., 2003 Data for Wyndor with Either-Or Constraints (Variation 3) Production Time Used for Each Unit Produced (Hours) Plant Doors Windows Production Time Available per Week (Hours) 1 1 0 4 2 0 2 12 3 3 2 18 4 2 4 28 Unit Profit $300 $500 McGraw-Hill/Irwin 9.35 © The McGraw-Hill Companies, Inc., 2003 Graphical Solution with Plant 3 or Plant 4 McGraw-Hill/Irwin 9.36 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let D = Number of doors to produce, W = Number of windows to produce, y = 1 if plant 4 is used; 0 if plant 3 is used Maximize P = 300D + 500W subject to Plant 1: D≤4 Plant 2: 2W ≤ 12 Plant 3: Plant 4: 3D + 2W ≤ 18 + 99y 2D + 4W ≤ 28 + 99(1 – y) and D ≥ 0, W ≥ 0, y1 and y2 are binary. McGraw-Hill/Irwin 9.37 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Model B C Doors $300 D Windows $500 3 4 Unit Prof it 5 6 7 Hours Used Per Unit Produced 8 Plant 1 1 0 9 Plant 2 0 2 10 Plant 3 3 2 11 Plant 4 2 4 12 13 Doors Windows 14 Units Produced 4 5 15 16 Which Plant to Use? (0=Plant 3, 1=Plant 4) McGraw-Hill/Irwin 9.38 E Hours Used 4 10 22 28 F G H <= <= <= <= Modif ied Hours Av ailable 4 12 117 28 Hours Av ailable 4 12 18 28 Total Prof it $3,700 1 © The McGraw-Hill Companies, Inc., 2003 Good Products Company Production Planning • The Research and Development Division of the Good Products Company has developed three possible new products. • To avoid undue diversification of the company’s product line, management has imposed the following restriction: – From the three possible new products, at most two should be chosen to be produced. • Each of these products can be produced in either of two plants. For administrative reasons, management has imposed the following restriction: – Just one of the two plants should be chosen to be the sole producer of the two new products. McGraw-Hill/Irwin 9.39 © The McGraw-Hill Companies, Inc., 2003 Data for the Good Products Company Production Time Used for Each Unit Produced (Hours) Plant Product 1 Product 2 Product 3 Production Time Available per Week (Hours) 1 3 4 2 30 2 4 6 2 40 Unit Profit 5 7 3 ($thousands) Sales potential 7 5 9 (units per week) McGraw-Hill/Irwin 9.40 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let xi = Number of units of product i to produce per week (i = 1, 2, 3), yi = 1 if product i is produced; 0 otherwise (i = 1, 2, 3), y4 = 1 if plant 2 is used; 0 if plant 1 is used Maximize Profit = 5x1 + 7x2 + 3x3 ($thousands) subject to Auxiliary variables must =1 if produce any & Max Sales: Product 1: x1 ≤ 7y1 Product 2: x2 ≤ 5y2 Product 3: x3 ≤ 9y3 Either plant 1 (y4 = 0) or plant 2 (y4 = 1): Plant 1: 3x1 + 4x2 + 2x3 + 99y4 ≤ 30 Plant 2: 4x1 + 6x2 + 2x3 + 99(1 – y4) ≤ 40 and xi ≥ 0 (i = 1, 2, 3), yi are binary (i = 1, 2, 3, 4). McGraw-Hill/Irwin 9.41 © 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 Unit Prof it ($thousands) Plant 1 Plant 2 C Product 1 5 D Product 2 7 E Product 3 3 Hours Used Per Unit Produced 3 4 2 4 6 2 Only If Produce Maximum Sales Product 1 5.5 <= 7 7 Product 2 0 <= 0 5 Product 3 9 <= 9 9 Produce? 1 0 1 Units Produced Which Plant to Use? (0=Plant 1, 1=Plant 2) McGraw-Hill/Irwin 9.42 1 F Hours Used 34.5 40 Total Produced 2 G H I <= <= Modif ied Hours Av ailable 129 40 Hours Av ailable 30 40 <= Maximum To Produce 2 Total Prof it ($thousands) 54.5 © The McGraw-Hill Companies, Inc., 2003 Supersuds Corporation Marketing Plan • The Supersuds Corporation is developing its marketing plan for next year’s new products. • For three of these products, the decision has been made to purchase a total of five TV spots for commercials on national television networks. • Each spot will feature a single product. Question: How should the five spots be allocated to these three products? McGraw-Hill/Irwin 9.43 © The McGraw-Hill Companies, Inc., 2003 Data for the Supersuds Corp. Problem Profit (Millions) Number of TV Spots Product 1 Product 2 Product 3 0 $0 $0 $0 1 1 0 –1 2 3 2 2 3 3 3 4 McGraw-Hill/Irwin 9.44 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let yij = 1 if there are j TV spots for product i; 0 otherwise (i = 1, 2, 3; j = 1, 2, 3) Maximize Profit = y11 + 3y12 + 3y13 + 2y22 + 3y23 – y31 + 2y32 + 4y33 ($millions) subject to Mutually Exclusive: Product 1: Product 2: Product 3: Total available spots: y11 + y12 + y13 ≤ 1 y21 + y22 + y23 ≤ 1 y31 + y32 + y33 ≤ 1 y11 + 2y12 + 3y13 + y21 + 2y22 + 3y23 + y31 + 2y32 + 3y33 ≤ 5 and yij are binary (i = 1, 2, 3; j = 1, 2, 3). McGraw-Hill/Irwin 9.45 © 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 Profit ($millions) Number of Spots C D E F 1 2 3 Product 1 1 3 3 Product 2 0 2 3 Product 3 -1 2 4 Product 1 0 1 0 1 <= 1 Product 2 0 0 0 0 <= 1 Product 3 0 0 1 1 <= 1 2 0 3 Solution Number 1 of 2 Spots 3 Total Max Of One Number of Spots McGraw-Hill/Irwin 9.46 G H I Total Prof it ($millions) 7 Total Spots 5 = Required Spots 5 © The McGraw-Hill Companies, Inc., 2003 Southwestern Airways Crew Scheduling • Southwestern Airways needs to assign crews to cover all its upcoming flights. • We will focus on assigning 3 crews based in San Francisco (SFO) to 11 flights. Question: How should the 3 crews be assigned 3 sequences of flights so that every one of the 11 flights is covered? McGraw-Hill/Irwin 9.47 © The McGraw-Hill Companies, Inc., 2003 Southwestern Airways Flights Seat tl e (SEA) San Francis co (SFO) Denver (DEN) Chi cago ORD) Los Angel es (LAX) McGraw-Hill/Irwin 9.48 © The McGraw-Hill Companies, Inc., 2003 Data for the Southwestern Airways Problem Feasible Sequence of Flights Flights 1 1. SFO–LAX 1 2. SFO–DEN 2 3 5 6 1 1 3. SFO–SEA 3 3 4 3 4 4 4 6 7 9.49 3 5 5 3 3 4 5 7 2 4 2 3 2 2 2 11. SEA–LAX 1 5 2 10. SEA–SFO 12 4 3 9. DEN–ORD McGraw-Hill/Irwin 1 2 7. ORD–SEA 2 11 1 3 3 10 1 1 2 2 9 1 2 8. DEN–SFO 8 1 1 6. ORD–DEN Cost, $1,000s 7 1 4. LAX–ORD 5. LAX–SFO 4 8 5 2 4 4 2 9 9 8 9 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let xj = 1 if flight sequence j is assigned to a crew; 0 otherwise. (j = 1, 2, … , 12). Minimize Cost = 2x1 + 3x2 + 4x3 + 6x4 + 7x5 + 5x6 + 7x7 + 8x8 + 9x9 + 9x10 + 8x11 + 9x12 (in $thousands) subject to Flight 1 covered: Flight 2 covered: : Flight 11 covered: x1 + x4 + x7 + x10 ≥ 1 x2 + x5 + x8 + x11 ≥ 1 : x6 + x9 + x10 + x11 + x12 ≥ 1 Three Crews: x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 ≤ 3 and xj are binary (j = 1, 2, … , 12). McGraw-Hill/Irwin 9.50 © 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 B C D E Cost ($thousands) 1 2 2 3 3 4 Includes Segment? SFO-LAX SFO-DEN SFO-SEA LAX-ORD LAX-SFO ORD-DEN ORD-SEA DEN-SFO DEN-ORD SEA-SFO SEA-LAX Fly Sequence? McGraw-Hill/Irwin 1 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 2 0 0 0 1 0 0 0 0 0 0 1 0 3 1 F G Flight 4 5 6 7 1 0 0 1 0 1 0 1 0 0 0 4 1 0 1 0 0 0 1 0 1 1 0 0 5 0 H I J Sequence 6 7 8 5 7 8 0 0 1 0 1 0 0 0 0 0 1 6 0 1 0 0 1 0 0 1 0 0 1 0 7 0 0 1 0 0 0 0 1 0 1 1 0 8 0 K L 9 9 10 11 12 9 8 9 0 0 1 1 0 1 0 1 0 0 1 9 0 1 0 0 1 1 0 1 0 0 0 1 M 0 1 0 0 1 0 1 0 1 0 1 N 0 0 1 1 0 0 1 0 0 1 1 10 11 12 0 1 0 O Total 1 1 1 1 1 1 1 1 1 1 1 Total Sequences 3 P Q >= >= >= >= >= >= >= >= >= >= >= At Least One 1 1 1 1 1 1 1 1 1 1 1 <= Number of Crews 3 Total Cost ($thousands) 9.51 18 © The McGraw-Hill Companies, Inc., 2003 Integer Programming • When are “non-integer” solutions okay? – Solution is naturally divisible • e.g., $, pounds, hours – Solution represents a rate • e.g., units per week – Solution only for planning purposes • When is rounding okay? – When numbers are large • e.g., rounding 114.286 to 114 is probably okay. • When is rounding not okay? – When numbers are small • e.g., rounding 2.6 to 2 or 3 may be a problem. – Binary variables • yes-or-no decisions McGraw-Hill/Irwin 9.52 © The McGraw-Hill Companies, Inc., 2003 The Challenges of Rounding • Rounded Solution may not be feasible. • Rounded solution may not be close to optimal. • There can be many rounded solutions. – Example: Consider a problem with 30 variables that are noninteger in the LP-solution. How many possible rounded solutions are there? x2 5 4 3 2 1 1 McGraw-Hill/Irwin 9.53 2 3 4 5 x1 © The McGraw-Hill Companies, Inc., 2003 How Integer Programs are Solved x2 5 4 3 2 1 1 McGraw-Hill/Irwin 2 3 9.54 4 5 x1 © The McGraw-Hill Companies, Inc., 2003 How Integer Programs are Solved x2 5 4 3 2 1 1 McGraw-Hill/Irwin 2 3 9.55 4 5 x1 © The McGraw-Hill Companies, Inc., 2003 Applications of Binary Variables • Making “yes-or-no” type decisions – – – – • Build a factory? Manufacture a product? Do a project? Assign a person to a task? Set-covering problems – Make a set of assignments that “cover” a set of requirements. • Fixed costs – If a product is produced, must incur a fixed setup cost. – If a warehouse is operated, must incur a fixed cost. McGraw-Hill/Irwin 9.56 © The McGraw-Hill Companies, Inc., 2003 Example #1 (Capital Budgeting) • Norwood Development is considering the potential of four different development projects. • Each project would be completed in at most three years. • The required cash outflow for each project is given in the table below, along with the net present value of each project to Norwood, and the cash that is available each year. Project 1 Project 2 Project 3 Project 4 Cash Available ($million) Year 1 9 7 6 11 28 Year 2 6 4 3 0 13 Year 3 6 0 4 0 10 NPV 30 16 22 14 Cash Outflow Required ($million) Question: Which projects should be undertaken? McGraw-Hill/Irwin 9.57 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let yi = 1 if project i is undertaken; 0 otherwise (i = 1, 2, 3, 4). Maximize NPV = 30y1 + 16y2 + 22y3 + 14y4 subject to Year 1: 9y1 + 7y2 + 6y3 + 11y4 ≤ 28 ($million) Year 2 (cumulative): 15y1 + 11y2 + 9y3 + 11y4 ≤ 41 ($million) Year 3 (cumulative): 21y1 + 11y2 + 13y3 + 11y4 ≤ 51 ($million) and yi are binary (i = 1, 2, 3, 4). McGraw-Hill/Irwin 9.58 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Solution A 1 2 3 4 5 6 7 8 9 10 11 12 13 B C D E F G H I <= <= <= Cumulativ e Av ailable 28 41 51 Norwood Development Capital Budgeting NPV ($million) Y ear 1 Y ear 2 Y ear 3 Undertake? McGraw-Hill/Irwin Project 1 30 Project 2 16 Project 3 22 Project 4 14 Cumulativ e Outf low Required ($million) 9 7 6 11 15 11 9 11 21 11 13 11 Project 1 1 Project 2 1 Project 3 1 9.59 Project 4 0 Cumulativ e Outf low 22 35 45 Total NPV ($million) 68 © The McGraw-Hill Companies, Inc., 2003 Additional Considerations (Logic and Dependency Constraints) • At least one of projects 1, 2, or 3 • Project 2 can’t be done unless project 3 is done • Either project 3 or project 4, but not both • No more than two projects total Question: What constraints would need to be added for each of these additional considerations? McGraw-Hill/Irwin 9.60 © The McGraw-Hill Companies, Inc., 2003 Example #2 (Set Covering Problem) • The Washington State legislature is trying to decide on locations at which to base search-and-rescue teams. • The teams are expensive, so they would like as few as possible. • Response time is critical, so they would like every county to either have a team located in that county or in an adjacent county. Question: Where should search-and-rescue teams be located? McGraw-Hill/Irwin 9.61 © The McGraw-Hill Companies, Inc., 2003 The Counties of Washington State McGraw-Hill/Irwin 9.62 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let yi = 1 if a team is located in county i; 0 otherwise (i = 1, 2, … , 37). Minimize Number of Teams = y1 + y2 + … + y37 subject to County 1 covered: y1 + y2 ≥ 1 County 2 covered: y1 + y2 + y3 + y6 + y7 ≥ 1 County 3 covered: y2 + y3 + y4 + y7 + y8 + y14 ≥ 1 : County 37 covered: y32 + y36 + y37 ≥ 1 and yi are binary (i = 1, 2, … , 37). McGraw-Hill/Irwin 9.63 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Solution A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 B C D E F G H I J K L M N Team? 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 # Teams Nearby 2 1 1 1 3 1 1 1 1 1 1 1 1 2 1 1 1 1 1 >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Search & Rescue Location 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 County Clallam Jef f erson Gray s Harbor Pacif ic Wahkiakum Kitsap Mason Thurston Whatcom Skagit Snohomish King Pierce Lewis Cowlitz Clark Skamania Okanogan Team? 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 Total Teams: 8 McGraw-Hill/Irwin # Teams Nearby 1 1 2 1 1 1 1 1 1 1 1 1 2 2 2 1 2 1 >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9.64 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 County Chelan Douglas Kittitas Grant Y akima Klickitat Benton Ferry Stev ens Pend Oreille Lincoln Spokane Adams Whitman Franklin Walla Walla Columbia Garf ield Asotin © The McGraw-Hill Companies, Inc., 2003 Example #3 (Fixed Costs) • Woodridge Pewter Company is a manufacturer of three pewter products: platters, bowls, and pitchers. • The manufacture of each product requires Woodridge to have the appropriate machinery and molds available. The machinery and molds for each product can be rented at the following rates: for the platters, $400/week; for the bowls, $250/week; for the pitcher, $300/week. • Each product requires the amounts of labor and pewter given in the table below. The sales price and variable cost are also given in the table. Labor Hours Pewter (pounds) Sales Price Variable Cost Platter 3 5 $100 $60 Bowl 1 4 85 50 Pitcher 4 3 75 40 130 240 Available Question: Which products should be produced, and in what quantity? McGraw-Hill/Irwin 9.65 © The McGraw-Hill Companies, Inc., 2003 Algebraic Formulation Let x1 = Number of platters produced, x2 = Number of bowls produced, x3 = Number of pitchers produced, yi = 1 if lease machine and mold for product i; 0 otherwise (i = 1, 2, 3). Maximize Profit = ($100–$60)x1 + ($85–$50)x2 + ($75–$40)x3 – $400y1 – $250y2 – $300y3 subject to Labor: 3x1 + x2 + 4x3 ≤ 130 hours Pewter: 5x1 + 4x2 + 3x3 ≤ 240 pounds Allow production only if machines and molds are purchased: x1 ≤ 99y1 x2 ≤ 99y2 x3 ≤ 99y3 and xi ≥ 0, and yi are binary (i = 1, 2, 3). McGraw-Hill/Irwin 9.66 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Solution A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 B C D E F Bowls $85 $50 $250 Pitchers $75 $40 $300 G H <= <= Av ailable 130 240 Woodridge Pewter Company Sales Price Variable Cost Fixed Cost Constraint Labor (hrs.) Pewter (lbs.) Lease Equipment? Production Quantity Produce only if Lease McGraw-Hill/Irwin Platters $100 $60 $400 Usage (per unit produced) 3 1 4 5 4 3 0 0 <= 0 1 60 <= 99 9.67 Total 60 240 0 0 <= 0 Rev enue Variable Cost Fixed Cost Prof it $5,100 $3,000 $250 $1,850 © The McGraw-Hill Companies, Inc., 2003 Applications of Binary Variables • Making “yes-or-no” type decisions – – – – • Build a factory? Manufacture a product? Do a project? Assign a person to a task? Fixed costs – If a product is produced, must incur a fixed setup cost. – If a warehouse is operated, must incur a fixed cost. • Either-or constraints – Production must either be 0 or ≥ 100. • Subset of constraints – meet 3 out of 4 constraints. McGraw-Hill/Irwin 9.68 © The McGraw-Hill Companies, Inc., 2003 Capital Budgeting with Contingency Constraints (Yes-or-No Decisions) • A company is planning their capital budget over the next several years. • There are 10 potential projects they are considering pursuing. • They have calculated the expected net present value of each project, along with the cash outflow that would be required over the next five years. • Also, suppose there are the following contingency constraints: – at least one of project 1, 2 or 3 must be done, – project 4 and project 5 cannot both be done, – project 7 can only be done if project 6 is done. Question: Which projects should they pursue? McGraw-Hill/Irwin 9.69 © The McGraw-Hill Companies, Inc., 2003 Data for Capital Budgeting Problem Cash Outflow Required ($million) 1 2 3 4 5 6 7 8 9 10 Cash Available ($million) Year 1 1 4 0 4 4 3 2 8 2 6 25 Year 2 2 2 2 2 2 4 2 3 3 6 25 Year 3 3 2 5 2 4 2 3 4 8 2 25 Year 4 4 4 5 4 5 3 1 2 1 1 25 Year 5 1 1 0 6 5 5 5 1 1 2 25 NPV 20 25 22 30 42 25 18 35 28 33 ($million) Project McGraw-Hill/Irwin 9.70 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Solution A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 B C D E F G H I J K L Project 5 42 Project 6 25 Project 7 18 Project 8 35 Project 9 28 Project 10 33 M N O <= <= <= <= <= Cumulativ e Av ailable 25 50 75 100 125 Capital Budgeting with Contingency Constraints NPV ($million) Project 1 20 Project 2 25 Project 3 22 Cumulativ e Cash Outf low Required ($million) Y ear 1 1 4 0 Y ear 2 3 6 2 Y ear 3 6 8 7 Y ear 4 10 12 12 Y ear 5 11 13 12 Undertake? Project 1 1 Contingency Constraints Project 1,2,3 3 Project 4,5 1 Project 7 1 McGraw-Hill/Irwin Project 4 30 4 6 8 12 18 4 6 10 15 20 3 6 8 11 16 2 4 7 8 13 8 11 15 17 18 2 5 13 14 15 6 12 14 15 17 Project 5 1 Project 6 1 Project 7 1 Project 8 0 Project 9 1 Project 10 1 Project 2 1 Project 3 1 Project 4 0 >= <= <= 1 1 1 Project 6 9.71 Cumulativ e Total Outf low 22 44 73 97 117 Total NPV ($million) 213 © The McGraw-Hill Companies, Inc., 2003 Electrical Generator Startup Planning (Fixed Costs) • An electrical utility company owns five generators. • To generate electricity, a generator must be started up, and associated with this is a fixed startup cost. • All of the generators are shut off at the end of each day. Generator Fixed Startup Cost Variable Cost (per MW) Capacity (MW) A B C D E $2,450 $1,600 $1,000 $1,250 $2,200 $3 $4 $6 $5 $4 2,000 2,800 4,300 2,100 2,000 Question: Which generators should be started up to meet the total capacity needed for the day (6000 MW)? McGraw-Hill/Irwin 9.72 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Solution A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 B C D E F G H I J Total MW 6000 >= MW Needed 6,000 Electrical Utility Generator Startup Planning Generator A $2,450 $3 2,000 Generator B $1,600 $4 2,800 Generator C $1,000 $6 4,300 Generator D $1,250 $5 2,100 Generator E $2,200 $4 2,000 Startup? 1 1 0 1 0 MW Generated 2,100 <= 2,000 3,000 <= 2,800 0 <= 0 900 <= 2,100 0 <= 0 Fixed Startup Cost Cost per Megawatt Max Capacity (MW) Capacity Fixed Cost Variable Cost Total Cost McGraw-Hill/Irwin 9.73 $5,300 $22,800 $28,100 © The McGraw-Hill Companies, Inc., 2003 Quality Furniture (Either-Or Constraints) • Reconsider the Quality Furniture Problem: – The Quality Furniture Corporation produces benches and picnic tables. The firm has a limited supply of two resources: labor and wood. 1,600 labor hours are available during the next production period. The firm also has a stock of 9,000 pounds of wood available. Each bench requires 3 labor hours and 12 pounds of wood. Each table requires 6 labor hours and 38 pounds of wood. The profit margin on each bench is $8 and on each table is $18. • Now suppose that they would not produce any fewer than 200 units of either product (i.e., either produce 0 or at least 200). Question: What product mix will maximize their total profit? McGraw-Hill/Irwin 9.74 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Solution A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 B C D E F G <= <= Resources Av ailable 1,600 9,000 Quality Furniture (with either-or constraints) Prof it Min Production (if any ) Labor Wood Produce? Min Production Production Quantities McGraw-Hill/Irwin Max Production Max Possible Benches $8.00 200 Tables $18.00 200 Use of Resources 3 6 12 38 1 0 200 <= 533.33 <= 533 533 0 <= 0 <= 0 237 9.75 Resources Used 1600 6400 Total Prof it $4,266.67 © The McGraw-Hill Companies, Inc., 2003 Meeting a Subset of Constraints • Consider a linear programming model with the following constraints, and suppose that meeting 3 out of 4 of these is good enough – – – – 12x1 + 24x2 + 18x3 ≥ 2,400 15x1 + 32x2 + 12x3 ≥ 1,800 20x1 + 15x2 + 20x3 ≤ 2,000 18x1 + 21x2 + 15x3 ≤ 1,600 McGraw-Hill/Irwin 9.76 © The McGraw-Hill Companies, Inc., 2003 Meeting a Subset of Constraints Let yi = 1 if constraint i is enforced; 0 otherwise. Constraints: y1 + y2 + y3 + y4 ≥ 3 12x1 + 24x2 + 18x3 ≥ 2,400y1 15x1 + 32x2 + 12x3 ≥ 1,800y2 20x1 + 15x2 + 20x3 ≤ 2,000 + M (1 – y3) 18x1 + 21x2 + 15x3 ≤ 1,600 + M (1 – y4) where M is a large number. McGraw-Hill/Irwin 9.77 © The McGraw-Hill Companies, Inc., 2003 Facility Location • Consider a company that operates 5 plants and 3 warehouses that serve customers in 4 different regions. • To lower costs, they are considering streamlining by closing one or more plants and warehouses. • Associated with each plant are fixed costs, shipping costs, and production costs. Each plant has a limited capacity. • Associated with each warehouse are fixed costs and shipping costs. Each warehouse has a limited capacity. Questions: Which plants should they keep open? Which warehouses should they keep open? How should they divide production among the open plants? How much should be shipped from each plant to each warehouse, and from each warehouse to each customer? McGraw-Hill/Irwin 9.78 © The McGraw-Hill Companies, Inc., 2003 Data for Facility Location Problem (Shipping + Production) Cost (per unit) Fixed Cost (per month) WH #1 WH #2 WH #3 Capacity (units per month) Plant 1 $42,000 $650 $750 $850 400 Plant 2 50,000 500 350 550 300 Plant 3 45,000 450 450 350 300 Plant 4 50,000 400 500 600 350 Plant 5 47,000 550 450 350 375 Shipping Cost (per unit) Fixed Cost (per month) Cust. 1 Cust. 2 Cust. 3 Cust. 4 Capacity (per month) WH #1 $45,000 $25 $65 $70 $35 600 WH #2 25,000 50 25 40 60 400 WH #3 65,000 60 20 40 45 900 250 225 200 275 Demand: McGraw-Hill/Irwin 9.79 © The McGraw-Hill Companies, Inc., 2003 Spreadsheet Solution A B C D E Warehouse 2 $750 $350 $450 $500 $450 Warehouse 3 $850 $550 $350 $600 $350 Warehouse 2 0 300 0 0 0 300 Warehouse 3 0 0 275 0 375 650 Customer 1 $25 $50 $60 Customer 2 $65 $25 $20 Customer 3 $70 $40 $40 Customer 4 $35 $60 $45 Customer 1 0 250 0 250 >= 250 Customer 2 0 0 225 225 >= 225 Customer 3 0 50 150 200 >= 200 Customer 4 0 0 275 275 >= 275 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Plant to Warehouse 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 Warehouse to Customer Shipping + Production Cost Warehouse 1 Plant 1 $650 Plant 2 $500 Plant 3 $450 Plant 4 $400 Plant 5 $550 Shipment Quantities Plant 1 Plant 2 Plant 3 Plant 4 Plant 5 Total Shipped Shipping Cost Warehouse 1 Warehouse 2 Warehouse 3 Shipment Quantities Warehouse 1 Warehouse 2 Warehouse 3 Total Shipped Needed Warehouse 1 0 0 0 0 0 0 McGraw-Hill/Irwin F G H Fixed Cost $42,000 $50,000 $45,000 $50,000 $47,000 Total Shipped 0 300 275 0 375 <= <= <= <= <= I 9.80 K L M Capacity 400 300 300 350 375 Actual Capacity 0 300 300 0 375 Open? 0 1 1 0 1 Fixed Cost $45,000 $25,000 $65,000 Shipped Out 0 300 650 J <= <= <= Shipping Cost (P-->W) Shipping Cost (W-->C) Fixed Cost (P) Fixed Cost (W) Total Cost Total Costs $332,500 $37,375 $142,000 $90,000 $601,875 Capacity 600 400 900 Shipped In 0 300 650 <= <= <= Actual Capacity 0 400 900 Open? 0 1 1 © The McGraw-Hill Companies, Inc., 2003