Integer Linear Programming Professor Ahmadi Slide 1 Chapter 11 Integer Linear Programming Types of Integer Linear Programming Models Graphical Solution for an All-Integer LP Spreadsheet Solution for an All-Integer LP Application Involving 0-l Variables Special 0-1 Constraints Slide 2 Types of Integer Programming Models A linear program in which all the variables are restricted to be integers is called an integer linear program (ILP). If only a subset of the variables are restricted to be integers, the problem is called a mixed integer linear program (MILP). Binary variables are variables whose values are restricted to be 0 or 1. If all variables are restricted to be 0 or 1, the problem is called a 0-1 or binary integer program. Slide 3 Example: All-Integer LP Consider the following all-integer linear program: Max 3x1 + 2x2 s.t. 3x1 + x2 < 9 x1 + 3x2 < 7 -x1 + x2 < 1 x1, x2 > 0 and integer Slide 4 Example: All-Integer LP LP Relaxation x2 -x1 + x2 < 1 5 3x1 + x2 < 9 4 Max 3x1 + 2x2 3 LP Optimal (2.5, 1.5) 2 x1 + 3x2 < 7 1 1 2 3 4 5 6 7 x1 Slide 5 Example: All-Integer LP LP Relaxation Solving the problem as a linear program ignoring the integer constraints, the optimal solution to the linear program gives fractional values for both x1 and x2. From the graph on the previous slide, we see that the optimal solution to the linear program is: x1 = 2.5, x2 = 1.5, z = 10.5 Slide 6 Example: All-Integer LP Rounding Up If we round up the fractional solution (x1 = 2.5, x2 = 1.5) to the LP relaxation problem, we get x1 = 3 and x2 = 2. From the graph on the next page, we see that this point lies outside the feasible region, making this solution infeasible. Slide 7 Example: All-Integer LP Rounded Up Solution x2 5 -x1 + x2 < 1 3x1 + x2 < 9 4 Max 3x1 + 2x2 3 ILP Infeasible (3, 2) 2 LP Optimal (2.5, 1.5) x1 + 3x2 < 7 1 1 2 3 4 5 6 7 x1 Slide 8 Example: All-Integer LP Rounding Down By rounding the optimal solution down to x1 = 2, x2 = 1, we see that this solution indeed is an integer solution within the feasible region, and substituting in the objective function, it gives z = 8. We have found a feasible all-integer solution, but have we found the optimal all-integer solution? --------------------The answer is NO! The optimal solution is x1 = 3 and x2 = 0 giving z = 9, as evidenced in the next two slides. Slide 9 Example: All-Integer LP Complete Enumeration of Feasible ILP Solutions There are eight feasible integer solutions to this problem: x1 x2 z 1. 0 0 0 2. 1 0 3 3. 2 0 6 4. 3 0 9 optimal solution 5. 0 1 2 6. 1 1 5 7. 2 1 8 8. 1 2 7 Slide 10 Example: All-Integer LP x2 5 -x1 + x2 < 1 3x1 + x2 < 9 4 3 Max 3x1 + 2x2 2 ILP Optimal (3, 0) x1 + 3x2 < 7 1 1 2 3 4 5 6 7 x1 Slide 11 Special 0-1 Constraints When xi and and xj represent binary variables designating whether projects i and j have been completed, the following special constraints may be formulated: • At most k out of n projects will be completed: Sxj < k • Project j is conditional on project i: xj - xi < 0 • Project i is a co-requisite for project j: xj - xi = 0 • Projects i and j are mutually exclusive: xi + xj < 1 Slide 12 Example: Chattanooga Electronics Chattanooga Electronics, Inc. is planning to expand its operations into other electronic equipment. The company has identified seven new product lines it can carry. Relevant information about each line follows: Initial Floor Space Exp. Rate Product Line Investment (Sq.Ft.) of Return 1. Digital TVs $6,000 125 8.1% 2. HD TVs 12,000 150 9.0 3. Large Screen TVs 20,000 200 11.0 4. DVDs 14,000 40 10.2 5. DVD/RWs 15,000 40 10.5 6. Video Games 2,000 20 14.1 7. PC Computers 32,000 100 13.2 Slide 13 Chattanooga Electronics - Continued Define the Decision Variables xj = 1 if product line j is introduced; = 0 otherwise. Where the Product lines are defined as: 1. (X1) = Digital TVs 2. (X2) = HD TVs 3. (X3) = Large Screen TVs 4. (X4) = DVDs 5. (X5) = DVD/RWs 6. (X6) = Video Games 7. (X7) = Computers Slide 14 Example: Chattanooga Electronics Chattanooga Electronics has decided that: 1. they should not stock large screen TVs (X3) unless they stock either digital (X1) or HD TVs (X2). 2. also, they will not stock both types of DVDs (X4 & X5). 3. they will stock video games (X6) only if they stock HD TVs (X2). 4. the company wishes to introduce at least three new product lines. 5. If the company has $45,000 to invest and 420 sq. ft. of floor space available, formulate an integer linear program for Chattanooga Electronics to maximize its overall expected rate of return. Slide 15 Example: Chattanooga Electronics Define the Objective Function Maximize total overall expected return: Max .081(6000)x1 + .09(12000)x2 + .11(20000)x3 + .102(14000)x4 + .105(15000)x5 + .141(2000)x6 + .132(32000)x7 or Max 486x1 + 1080x2 + 2200x3 + 1428x4 + 1575x5 + 282x6 + 4224x7 Slide 16 Example: Chattanooga Electronics Define the Constraints 1) Money: 60x1 + 12x2 + 20x3 + 14x4 + 15x5 + 2x6 + 32x7 < 45 2) Space: 125x1 +150x2 +200x3 +40x4 +40x5 +20x6 +100x7 < 420 Slide 17 Example: Chattanooga Electronics Define the Constraints (continued) 3) Stock large screen TVs (X3) only if stock digital (X2) or HD (X2): 4) Do not stock both types of DVDs (X4 & X5): 5) Stock video games (X6) only if they stock HD TV's (X2): 6) At least 3 new lines: 7) Variables are 0 or 1: xj = 0 or 1 for j = 1, , , 7 Slide 18 Example: Mo’s Programming Mo's Programming has five idle Programmers and four custom Programs to develop. The estimated time (in hours) it would take each Programmer to write each Program is listed below. (An 'X' in the table indicates an unacceptable Programmer-Program assignment.) Programmer Program 1 2 3 4 5 Java 19 23 20 21 18 C++ 11 14 X 12 10 Assembler 12 8 11 X 9 Pascal X 20 20 18 21 Slide 19 Example: Mo’s Programming Formulate an integer program for determining the Programmer-Program assignments that minimize the total estimated time spent writing the four Programs. No Programmer is to be assigned more than one Program and each Program is to be worked on by only one Programmer. -------------------This problem can be formulated as a 0-1 integer program. The LP solution to this problem will automatically be integer (0-1). Slide 20 Example: Mo’s Programming Define the decision variables xij = 1 if Program i is assigned to Programmer j = 0 otherwise. Number of decision variables = [(number of Programs)(number of Programmers)] - (number of unacceptable assignments) = [4(5)] - 3 = 17 Define the objective function Minimize total time spent writing Programs: Min 19x11 + 23x12 + 20x13 + 21x14 + 18x15 + 11x21 + 14x22 + 12x24 + 10x25 + 12x31 + 8x32 + 11x33 + 9x35 + 20x42 + 20x43 + 18x44 + 21x45 Slide 21 Example: Mo’s Programming Define the Constraints Exactly one Programmer per Program: 1) x11 + x12 + x13 + x14 + x15 = 1 2) x21 + x22 + x24 + x25 = 1 3) x31 + x32 + x33 + x35 = 1 4) x42 + x43 + x44 + x45 = 1 Slide 22 Example: Mo’s Programming Define the Constraints (continued) No more than one Program per Programmer: 5) x11 + x21 + x31 < 1 6) x21 + x22 + x23 + x24 < 1 7) x31 + x33 + x34 < 1 8) x41 + x42 + x44 < 1 9) x51 + x52 + x53 + x54 < 1 Non-negativity: xij > 0 for i = 1, . . ,4 and j = 1, . . ,5 Slide 23 The End of Chapter 6 Slide 24