Session #6 Integer Programming Page 1 Integer Programming When are “non-integer” solutions okay? • Solution is naturally divisible • Solution represents a rate • Solution only for planning purposes When is rounding okay? Session #6 Integer Programming Page 2 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 non-integer in the LP solution. How many possible rounded solutions are there? Session #6 Integer Programming Page 3 How Integer Programs are Solved Session #6 Integer Programming Page 4 Applications of Binary Variables • Making “yes or no” type decisions • Set-covering problems • Fixed costs Session #6 Integer Programming Page 5 Example #1 (Capital Budgeting) Mercer 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 Mercer, and the cash that is available (from previous projects) each year. Cash Outflow Required ($million) Year 1 Year 2 Year 3 NPV Project 1 10 8 8 35 Project 2 8 5 0 18 Project 3 6 4 6 24 Project 4 12 0 0 16 Cash Available ($million) 30 15 12 Session #6 Integer Programming Page 6 Spreadsheet Solution to Example #1 A 1 2 3 4 5 6 7 8 9 10 11 12 13 3 4 5 6 7 8 9 10 11 12 13 B C D E F G H I Mercer Development Capital Budgeting NPV ($million) Year 1 Year 2 Year 3 Undertake? Project 1 35 10 8 8 Project 2 18 Project 4 16 Cash Outflow Required ($million) 8 6 5 4 0 6 Project 1 1 Project 2 1 B C D E F Project 1 Project 2 Project 3 Project 4 NPV ($million) 35 18 24 16 Year 1 10 Year 2 8 Year 3 8 Project 3 24 Cash Outflow Required ($million) 8 6 12 5 4 0 0 6 0 Project 1 Project 2 Project 3 Project 4 Undertake? 1 1 0 1 Project 3 0 12 0 0 Total Outflow 30 <= 13 <= 8 <= Available 30 15 12 Total NPV ($million) 69 Project 4 1 G H I Total Outflow =SUMPRODUCT($C$13:$F$13,C7:F7) <= 30 =SUMPRODUCT($C$13:$F$13,C8:F8) <= 15 =SUMPRODUCT($C$13:$F$13,C9:F9) <= 12 Available Total NPV ($million) =SUMPRODUCT(C13:F13,C4:F4) Session #6 Integer Programming Page 7 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: Session #6 Integer Programming Page 8 Example #2 (Set Covering Problem) Suppose the Washington State legislature is trying to decide on locations at which to base search-and-rescue teams. The teams are expensive, and hence they would like as few as possible. However, since response time is critical, they would like every county to either have a team located in that county, or in an adjacent county. Where should the teams be located. Session #6 Integer Programming Page 9 Spreadsheet Solution to Example #2 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 Search & Rescue Location 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 County Clallam Jefferson Grays Harbor Pacific Wahkiakum Kitsap Mason Thurston Whatcom Skagit Snohomish King Pierce Lewis Cowlitz Clark Skamania Okanogan Total Teams: # Teams Team? Nearby 0 1 1 1 0 2 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 2 1 2 0 2 0 1 1 2 0 1 8 >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 County Chelan Douglas Kittitas Grant Yakima Klickitat Benton Ferry Stevens Pend Oreille Lincoln Spokane Adams Whitman Franklin Walla Walla Columbia Garfield Asotin # Teams Team? Nearby 0 2 0 1 1 1 0 1 0 3 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 2 1 1 0 1 0 1 1 1 0 1 >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Session #6 Integer Programming Page 10 Spreadsheet Solution to Example #2 (Formulas) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 B 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 C County Clallam Jefferson Grays Harbor Pacific Wahkiakum Kitsap Mason Thurston Whatcom Skagit Snohomish King Pierce Lewis Cowlitz Clark Skamania Okanogan 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 Total Teams: =SUM(D5:D22,K5:K23) I 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 D 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 Team? J County Chelan Douglas Kittitas Grant Yakima Klickitat Benton Ferry Stevens Pend Oreille Lincoln Spokane Adams Whitman Franklin Walla Walla Columbia Garfield Asotin K E # Teams Nearby F G =D5+D6 =D5+D6+D7+D10+D11 =D6+D7+D8+D11+D12+D18 =D7+D8+D9+D18 =D8+D9+D18+D19 =D6+D10+D11+D15+D16+D17 =D6+D7+D10+D11+D12+D17 =D7+D11+D12+D17+D18 =D13+D14+D22 =D13+D14+D15+D22+K5 =D14+D15+D16+K5 =D10+D15+D16+D17+K5+K7 =D10+D11+D12+D16+D17+D18+K7+K8 =D7+D8+D9+D12+D17+D18+D19+D21+K9 =D9+D18+D19+D20+D21 =D19+D20+D21 =D18+D19+D20+D21+K9+K10 =D13+D14+D22+K5+K6+K12+K15 >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 L # Teams Team? Nearby 0 =D14+D15+D16+D22+K5+K6+K7 0 =D22+K5+K6+K7+K8 1 =D16+D17+K5+K6+K7+K8+K9 0 =K6+K7+K8+K9+K11+K15+K16+K17 0 =D17+D18+D21+K7+K8+K9+K10+K11 0 =D21+K9+K10+K11 0 =K8+K9+K10+K11+K19+K20 0 =D22+K12+K13+K15 1 =K12+K13+K14+K15+K16 0 =K13+K14+K16 0 =D22+K8+K12+K13+K15+K16+K17+K18 0 =K13+K14+K15+K18 0 =K8+K15+K17+K18+K19 0 =K15+K16+K17+K18+K19+K21+K22+K23 1 =K8+K11+K17+K18+K19+K20 0 =K11+K19+K20+K21 0 =K18+K20+K21+K22 1 =K18+K21+K22+K23 0 =K18+K22+K23 M N >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= >= 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Session #6 Integer Programming Page 11 Example #3 (Fixed Costs) Gandy Cloth Company is capable of manufacturing three types of clothing: shirts, shorts, and pants. The manufacture of each type of clothing requires that Gandy have the appropriate type of machinery available. This machinery can be rented at the following rates: shirt machinery, $200/week; shorts machinery, $150/week; pants machinery, $100/week. Each type of clothing requires the amount of cloth and labor given in the table below. The sales price and variable cost are also given in the table. Shirts Shorts Pants Available: Labor Hours 3 2 6 150 hours Cloth (sq. yds.) 4 3 4 160 sq. yds. Sales Price $12 $8 $15 Variable Cost $6 $4 $8 Session #6 Integer Programming Page 12 Spreadsheet Solution to Example #3 A 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 B C D E Shirt $12 $6 $200 Shorts $8 $4 $150 Pants $15 $8 $100 Constraint Labor (hrs.) Cloth (sq. yds.) 3 4 Usage (per unit produced) 2 3 6 4 Lease Equipment? 0 0 1 Production Quantity Produce only if Lease 0 <= 0 0 <= 0 25 <= 100 Big Number 100 F G H Total 150 100 <= <= Available 150 160 Revenue Variable Cost Fixed Cost Profit $375.00 $200.00 $100.00 $75.00 Gandy Cloth Company Sales Price Variable Cost Fixed Cost B Sales Price 12 Variable Cost 6 Fixed Cost 200 Constraint Labor (hrs.) 3 Cloth (sq. yds.) 4 C Shirt D Shorts 8 4 150 E Pants Usage (per unit produced) 2 6 3 4 Lease Equipment? 0 0 1 Production Quantity 0 0 25 <= <= <= Produce only if Lease =$C$18*C12 =$C$18*D12 =$C$18*E12 Big Number 100 F G Total =SUMPRODUCT($C$14:$E$14,C9:E9) =SUMPRODUCT($C$14:$E$14,C10:E10) <= <= H 15 8 100 Available Revenue Variable Cost Fixed Cost Profit 150 160 =SUMPRODUCT(C14:E14,C4:E4) =SUMPRODUCT(C5:E5,C14:E14) =SUMPRODUCT(C12:E12,C6:E6) =H13-H14-H15