Integer Program Examples 1) You have $14,000 to invest in any of 4 investments. The following table indicates how much is needed in order to purchase the investment and the expected value of the investment after one year. You cannot partially invest in the investments (must fully purchase or not purchase). How do you maximize your investment? Investment 1 2 3 4 Purchase Price $5 $7 $4 $3 Expected Value at year end $16 $22 $12 $8 Integer Program Examples 1) You have $14,000 to invest in any of 4 investments. The following table indicates how much is needed in order to purchase the investment and the expected value of the investment after one year. You cannot partially invest in the investments (must fully purchase or not purchase). How do you maximize your investment? Investment 1 2 3 4 Purchase Price(000s) $5 $7 $4 $3 Let xi = 1 if investment i is made 0 if not Max Z = 16x1 + 22x2 + 12x3 + 8x4 s.t 5x1 + 7x2 + 4x3 + 3x4 <= 14 x1, x2, x3, x4 <= 1 x1, x2, x3, x4 >= 0 LP OPTIMUM FOUND AT STEP 3 OBJECTIVE FUNCTION VALUE 1) 44.00000 VARIABLE VALUE X1 1.000000 X2 1.000000 X3 0.500000 X4 0.000000 ROW 2) 3) 4) 5) 6) REDUCED COST 0.000000 0.000000 0.000000 1.000000 SLACK OR SURPLUS DUAL PRICES 0.000000 3.000000 0.000000 1.000000 0.000000 1.000000 0.500000 0.000000 1.000000 0.000000 NO. ITERATIONS= 3 Expected Value at year end (000s) $16 $22 $12 $8 Integer Program Examples Max Z = 16x1 + 22x2 + 12x3 + 8x4 s.t 5x1 + 7x2 + 4x3 + 3x4 <= 14 x1, x2, x3, x4 = 0 or 1 LP OPTIMUM FOUND AT STEP 0 OBJECTIVE VALUE = 44.0000000 NEW INTEGER SOLUTION OF 42.0000000 RE-INSTALLING BEST SOLUTION... AT BRANCH OBJECTIVE FUNCTION VALUE 1) 42.00000 VARIABLE VALUE X1 0.000000 X2 1.000000 X3 1.000000 X4 1.000000 ROW 2) 3) 4) 5) 6) REDUCED COST -16.000000 -22.000000 -12.000000 -8.000000 SLACK OR SURPLUS DUAL PRICES 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 NO. ITERATIONS= 0 BRANCHES= 0 DETERM.= 1.000E 0 0 PIVOT 0 Integer Program Examples 2) 3-job, 4-machine Job Shop scheduling problem. Three products, A,B, and C are to be produced using four machines. The technological sequence and the processing time on the machines for the three products are shown in the figure below. For instance, product A is processed on machine 1 first for a1 hours, then on machine 3 for a3 hours, and finally on machine 4 for a4 hours. Each machine can work on only one product at a time. Moreover, each product requires a different set of tools for machining, which requires each machine to complete the processing of one product before taking up the next one (no preemption). In addition, it is required to complete product B in no more than d hours from the starting time. The problem is to determine the sequence in which the various products are processed on the machines so as to complete all the products in the least possible time. machine / process time Product A: 1 / a1 ------------- 3 / a3 ----------------- 4 / a4 Product B: 1 / b1 ------------- 2 / b2 ----------------- 4 / b4 Product C: 2 / c2 ------------- 3 / c3 Integer Program Examples 2) 3-job, 4-machine Job Shop scheduling problem. Three products, A,B, and C are to be produced using four machines. The technological sequence and the processing time on the machines for the three products are shown in the figure below. For instance, product A is processed on machine 1 first for a1 hours, then on machine 3 for a3 hours, and finally on machine 4 for a4 hours. Each machine can work on only one product at a time. Moreover, each product requires a different set of tools for machining, which requires each machine to complete the processing of one product before taking up the next one (no preemption). In addition, it is required to complete product B in no more than d hours from the starting time. The problem is to determine the sequence in which the various products are processed on the machines so as to complete all the products in the least possible time. machine / process time Product A: 1 / a1 ------------- 3 / a3 ----------------- 4 / a4 Product B: 1 / b1 ------------- 2 / b2 ----------------- 4 / b4 Product C: 2 / c2 ------------- 3 / c3 xA1 – start time of product A on machine 1 . xC3 – start time of product C on machine 3 Technological Route A) xA1 + a1 <= xA3 xA3 + a3 <= xA4 B) xB1 + b1 <= xB2 xB2 + b2 <= xB4 C) xC2 + c2 <= xC3 One product Machine at a time 1) 2) 3) 4) xA1 + a1 <= xB1 or xB1 + b1 <= xA1 xA1 + a1 – xB1 <= My1 where y1 = 0 or 1 xB1 + b1 – xA1 <= M(1-y1) xB2 + b2 – xC2 <= My2 xC2 + c2 – xB2 <= M(1-y2) xA3 + a3 – xC3 <= My3 xC3 + c3 – xA3 <= M(1-y3) xA4 + a4 – xB4 <= My4 xB4 + b4 – xA4 <= M(1-y4) B finished by d xB4 + b4 <= d All jobs completed z >= xA4 + a4 z >= xB4 + b4 z >= xC3 + c3 Objective: Min z Integer Program Examples ! Job Shop Scheduling – Integer Programming Example 2 ! ! Product A) 1/3 -> 3/4 -> 4/2 ! Product B) 1/2 -> 2/4 -> 4/2 d = 12 ! Product C) 2/3 -> 3/4 ! Min z ST xA1 - xA3 <= -3 xA3 - xA4 <= -4 xA4 - z <= -2 xB1 - xB2 <= -2 xB2 - xB4 <= -4 xB4 <= 9 xB4 - z <= -2 xC2 - xC3 <= -3 xC3 - z <= -4 xA1 - xB1 - 99 y1 <= -3 xB1 - xA1 + 99y1 <= 97 xB2 - xC2 - 99 y2 <= -4 xC2 - xB2 + 99 y2 <= 96 xA3 - xC3 - 99 y3 <= -4 xC3 - xA3 + 99 y3 <= 95 xA4 - xB4 - 99 y4 <= -2 xB4 - xA4 + 99 y4 <= 96 y1 <= 1 y2 <= 1 y3 <= 1 y4 <= 1 End INT y1 INT y2 INT y3 INT y4 Integer Program Examples LAST INTEGER SOLUTION IS THE BEST FOUND RE-INSTALLING BEST SOLUTION... OBJECTIVE FUNCTION VALUE 1) 11.00000 VARIABLE VALUE REDUCED COST Y1 0.000000 -99.000000 Y2 1.000000 0.000000 Y3 0.000000 0.000000 Y4 0.000000 0.000000 Z 11.000000 0.000000 XA1 0.000000 1.000000 XA3 3.000000 0.000000 XA4 7.000000 0.000000 XB1 3.000000 0.000000 XB2 5.000000 0.000000 XB4 9.000000 0.000000 XC2 0.000000 0.000000 XC3 7.000000 0.000000 ROW SLACK OR SURPLUS DUAL PRICES 2) 0.000000 0.000000 3) 0.000000 0.000000 4) 2.000000 0.000000 5) 0.000000 1.000000 6) 0.000000 1.000000 7) 0.000000 0.000000 8) 0.000000 1.000000 9) 4.000000 0.000000 10) 0.000000 0.000000 11) 0.000000 1.000000 12) 94.000000 0.000000 13) 90.000000 0.000000 14) 2.000000 0.000000 15) 0.000000 0.000000 16) 91.000000 0.000000 17) 0.000000 0.000000 18) 94.000000 0.000000 19) 1.000000 0.000000 20) 0.000000 0.000000 21) 1.000000 0.000000 22) 1.000000 0.000000 NO. ITERATIONS= 107 BRANCHES= 2 DETERM.= 1.000E 0 Integer Program Examples ** Solution without integer constraint ** LP OPTIMUM FOUND AT STEP 11 OBJECTIVE FUNCTION VALUE 1) 9.000000 VARIABLE VALUE Z 9.000000 XA1 0.000000 XA3 3.000000 XA4 7.000000 XB1 0.000000 XB2 2.000000 XB4 7.000000 XC2 0.000000 XC3 5.000000 Y1 0.030303 Y2 0.060606 Y3 0.020202 Y4 0.020202 REDUCED COST 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ROW SLACK OR SURPLUS DUAL PRICES 2) 0.000000 1.000000 3) 0.000000 1.000000 4) 0.000000 1.000000 5) 0.000000 0.000000 6) 1.000000 0.000000 7) 2.000000 0.000000 8) 0.000000 0.000000 9) 2.000000 0.000000 10) 0.000000 0.000000 11) 0.000000 0.000000 12) 94.000000 0.000000 13) 0.000000 0.000000 14) 92.000000 0.000000 15) 0.000000 0.000000 16) 91.000000 0.000000 17) 0.000000 0.000000 18) 94.000000 0.000000 19) 0.969697 0.000000 20) 0.939394 0.000000 21) 0.979798 0.000000 22) 0.979798 0.000000 NO. ITERATIONS= 11 Integer Program Examples 3) There are six cities in a county. The county must determine where to build fire stations. The county wants to build the minimum number of fire stations needed to ensure that at least one fire station is with 15 minutes (driving time) of each city. The times (in minutes) required to drive between the cities are shown below. A fire station must be built within a city. Determine where the fire stations are to be built. To From City 1 City 2 City 3 City 4 City 5 City 6 City 1 0 10 20 30 30 20 City 2 10 0 25 35 20 10 City 3 20 25 0 15 30 20 City 4 30 35 15 0 15 25 City 5 30 20 30 15 0 14 City 6 20 10 20 25 14 0 Integer Program Examples 3) There are six cities in a county. The county must determine where to build fire stations. The county wants to build the minimum number of fire stations needed to ensure that at least one fire station is with 15 minutes (driving time) of each city. The times (in minutes) required to drive between the cities are shown below. A fire station must be built within a city. Determine where the fire stations are to be built. To From City 1 City 2 City 3 City 4 City 5 City 6 City 1 0 10 20 30 30 20 City 2 10 0 25 35 20 10 City 3 20 25 0 15 30 20 City 4 30 35 15 0 15 25 City 5 30 20 30 15 0 14 City 6 20 10 20 25 14 0 x1 – 1 if built in city 1, 0 otherwise Min x1 + x2 + x3 + x4 + x5 + x6 ST x1 + x2 >= 1 x1 + x2 + x6 >= 1 x3 + x4 >= 1 x3 + x4 + x5 >= 1 x4 + x5 + x6 >= 1 x2 + x5 + x6 >= 1 xi = 0 or 1 for all i