
















































































Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Esta página não é visível na pré-visualização
Não perca as partes importantes!

















































































Recall that we defined integer programming problems in our discussion of the Divisibility As- sumption in Section 3.1. Simply stated, an integer programming problem (IP) is an LP in which some or all of the variables are required to be non-negative integers. † In this chapter (as for LPs in Chapter 3), we find that many real-life situations may be formu- lated as IPs. Unfortunately, we will also see that IPs are usually much harder to solve than LPs. In Section 9.1, we begin with necessary definitions and some introductory comments about IPs. In Section 9.2, we explain how to formulate integer programming models. We also dis- cuss how to solve IPs on the computer with LINDO, LINGO, and Excel Solver. In Sections 9.3–9.8, we discuss other methods used to solve IPs.
An IP in which all variables are required to be integers is called a pure integer pro- gramming problem. For example, max z 3 x 1 2 x 2 s.t. x 1 x 2 6 (1) x 1 , x 2 0, x 1 , x 2 integer is a pure integer programming problem. An IP in which only some of the variables are required to be integers is called a mixed integer programming problem. For example, max z 3 x 1 2 x 2 s.t. x 1 x 2 6 x 1 , x 2 0, x 1 integer is a mixed integer programming problem ( x 2 is not required to be an integer). An integer programming problem in which all the variables must equal 0 or 1 is called a 0–1 IP. In Section 9.2, we see that 0–1 IPs occur in surprisingly many situations. ‡^ The following is an example of a 0–1 IP: max z x 1 x 2 s.t. x 1 2 x 2 2 (2) 2 x 1 x 2 1 x 1 , x 2 0 or 1 Solution procedures especially designed for 0–1 IPs are discussed in Section 9.7.
†A nonlinear integer programming problem is an optimization problem in which either the objective function or the left-hand side of some of the constraints are nonlinear functions and some or all of the variables must be integers. Such problems may be solved with LINGO or Excel Solver. ‡Actually, any pure IP can be reformulated as an equivalent 0–1 IP (Section 9.7).
The concept of LP relaxation of an integer programming problem plays a key role in the solution of IPs.
D E F I N I T I O N The LP obtained by omitting all integer or 0–1 constraints on variables is called the LP relaxation of the IP.
For example, the LP relaxation of (1) is max z 3 x 1 2 x 2 s.t. x 1 x 2 6 (1 ) x 1 , x 2 0 and the LP relaxation of (2) is max z x 1 x 2 s.t. x 1 2 x 2 2 (2 ) s.t. 2 x 1 x 2 1 x 1 , x 2 0 Any IP may be viewed as the LP relaxation plus additional constraints (the constraints that state which variables must be integers or be 0 or 1). Hence, the LP relaxation is a less constrained, or more relaxed, version of the IP. This means that the feasible region for any IP must be contained in the feasible region for the corresponding LP relaxation. For any IP that is a max problem, this implies that Optimal z -value for LP relaxation optimal z -value for IP (3) This result plays a key role when we discuss the solution of IPs. To shed more light on the properties of integer programming problems, we consider the following simple IP: max z 21 x 1 11 x 2 s.t. 7 x 1 4 x 2 13 (4) x 1 , x 2 0; x 1 , x 2 integer From Figure 1, we see that the feasible region for this problem consists of the following set of points: S {(0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1)}. Unlike the feasible region for any LP, the one for (4) is not a convex set. By simply computing and comparing the z -values for each of the six points in the feasible region, we find the optimal solution to (4) is z 33, x 1 0, x 2 3. If the feasible region for a pure IP’s LP relaxation is bounded, as in (4), then the feasi- ble region for the IP will consist of a finite number of points. In theory, such an IP could be solved (as described in the previous paragraph) by enumerating the z -values for each feasible point and determining the feasible point having the largest z -value. The problem with this approach is that most actual IPs have feasible regions consisting of billions of feasible points. In such cases, a complete enumeration of all feasible points would require a large amount of computer time. As we explain in Section 9.3, IPs often are solved by cleverly enumerating all the points in the IP’s feasible region. Further study of (4) sheds light on other interesting properties of IPs. Suppose that a naive analyst suggests the following approach for solving an IP: First solve the LP relax- ation; then round off (to the nearest integer) each variable that is required to be an inte- ger and that assumes a fractional value in the optimal solution to the LP relaxation. Applying this approach to (4), we first find the optimal solution to the LP relaxation: x 1 ^173 , x 2 0. Rounding this solution yields the solution x 1 2, x 2 0 as a possible
476 C H A P T E R 9 Integer Programming
Stockco is considering four investments. Investment 1 will yield a net present value (NPV) of $16,000; investment 2, an NPV of $22,000; investment 3, an NPV of $12,000; and in- vestment 4, an NPV of $8,000. Each investment requires a certain cash outflow at the pres- ent time: investment 1, $5,000; investment 2, $7,000; investment 3, $4,000; and investment 4, $3,000. Currently, $14,000 is available for investment. Formulate an IP whose solution will tell Stockco how to maximize the NPV obtained from investments 1–4. Solution As in LP formulations, we begin by defining a variable for each decision that Stockco must make. This leads us to define a 0–1 variable:
xj ( j 1, 2, 3, 4) (^)
For example, x 2 1 if investment 2 is made, and x 2 0 if investment 2 is not made. The NPV obtained by Stockco (in thousands of dollars) is Total NPV obtained by Stockco 16 x 1 22 x 2 12 x 3 8 x 4 (5) To see this, note that if xj 1, then (5) includes the NPV of investment j , and if xj 0, (5) does not include the NPV of investment j. This means that whatever combination of investments is undertaken, (5) gives the NPV of that combination of projects. For exam- ple, if Stockco invests in investments 1 and 4, then an NPV of 16,000 8,000 $24, is obtained. This combination of investments corresponds to x 1 x 4 1, x 2 x 3 0, so (5) indicates that the NPV for this investment combination is 16(1) 22(0) 12(0) 8(1) $24 (thousand). This reasoning implies that Stockco’s objective function is max z 16 x 1 22 x 2 12 x 3 8 x 4 (6) Stockco faces the constraint that at most $14,000 can be invested. By the same reasoning used to develop (5), we can show that Total amount invested (in thousands of dollars) 5 x 1 7 x 2 4 x 3 3 x 4 (7) For example, if x 1 0, x 2 x 3 x 4 1, then Stockco makes investments 2, 3, and 4. In this case, Stockco must invest 7 4 3 $14 (thousand). Equation (7) yields a to- tal amount invested of 5(0) 7(1) 4(1) 3(1) $14 (thousand). Because at most $14,000 can be invested, x 1 , x 2 , x 3 , and x 4 must satisfy 5 x 1 7 x 2 4 x 3 3 x 4 14 (8) Combining (6) and (8) with the constraints xj 0 or 1 ( j 1, 2, 3, 4) yields the fol- lowing 0–1 IP: max z 16 x 1 22 x 2 12 x 3 8 x 4 s.t. 5 x 1 7 x 2 4 x 3 3 x 4 14 (9) xj 0 or 1 ( j 1, 2, 3, 4)
R E M A R K S 1 In Section 9.5, we show that the optimal solution to (9) is x 1 0, x 2 x 3 x 4 1, z $42,000. Hence, Stockco should make investments 2, 3, and 4, but not 1. Investment 1 yields a higher NPV per dollar invested than any of the others (investment 1 yields $3.20 per dollar invested, investment 2, $3.14; investment 3, $3; and investment 4, $2.67), so it may seem surprising that in- vestment 1 is not undertaken. To see why the optimal solution to (9) does not involve making the “best” investment, note that any investment combination that includes investment 1 cannot use more than $12,000. This means that using investment 1 forces Stockco to forgo investing $2,000. On the other hand, the optimal investment combination uses all $14,000 of the investment budget. This en-
if investment j is made otherwise
478 C H A P T E R 9 Integer Programming
E X A M P L E 1 Capital Budgeting IP
ables the optimal combination to obtain a higher NPV than any combination that includes invest- ment 1. If, as in Chapter 3, fractional investments were allowed, the optimal solution to (9) would be x 1 x 2 1, x 3 0.50, x 4 0, z $44,000, and investment 1 would be used. This simple ex- ample shows that the choice of modeling a capital budgeting problem as a linear programming or as an integer programming problem can significantly affect the optimal solution to the problem. 2 Any IP, such as (9), that has only one constraint is referred to as a knapsack problem. Suppose that Josie Camper is going on an overnight hike. There are four items Josie is considering taking along on the trip. The weight of each item and the benefit Josie feels she would obtain from each item are listed in Table 1. Suppose Josie’s knapsack can hold up to 14 lb of items. For j 1, 2, 3, 4, define
xj (^)
Then Josie can maximize the total benefit by solving (9).
In the following example, we show how the Stockco formulation can be modified to handle additional constraints.
Modify the Stockco formulation to account for each of the following requirements: 1 Stockco can invest in at most two investments. 2 If Stockco invests in investment 2, they must also invest in investment 1. 3 If Stockco invests in investment 2, they cannot invest in investment 4. Solution 1 Simply add the constraint x 1 x 2 x 3 x 4 2 (10) to (9). Because any choice of three or four investments will have x 1 x 2 x 3 x 4 3, (10) excludes from consideration all investment combinations involving three or more investments. Thus, (10) eliminates from consideration exactly those combinations of in- vestments that do not satisfy the first requirement. 2 In terms of x 1 and x 2 , this requirement states that if x 2 1, then x 1 must also equal
1 if Josie takes item j on the hike 0 otherwise
T A B L E 1 Weights and Benefits for Items in Josie’s Knapsack Weight Item (Pounds) Benefit 1 5 16 2 7 22 3 4 12 4 3 18
E X A M P L E 2 Capital Budgeting (Continued)
Note that the cost of renting machinery depends only on the types of clothing produced, not on the amount of each type of clothing. This enables us to express the cost of renting machinery by using the following variables:
y 1 (^)
y 2 (^)
y 3 (^)
In short, if xj 0, then yj 1, and if xj 0, then yj 0. Thus, Gandhi’s weekly profits (weekly sales revenue) (weekly variable costs) (weekly costs of renting machinery). Also, Weekly cost of renting machinery 200 y 1 150 y 2 100 y 3 (13)
To justify (13), note that it picks up the rental costs only for the machines needed to man- ufacture those products that Gandhi is actually manufacturing. For example, suppose that shirts and pants are manufactured. Then y 1 y 3 1 and y 2 0, and the total weekly rental cost will be 200 100 $300. Because the cost of renting, say, shirt machinery does not depend on the number of shirts produced, the cost of renting each type of machinery is called a fixed charge. A fixed charge for an activity is a cost that is assessed whenever the activity is undertaken at a nonzero level. The presence of fixed charges will make the formulation of the Gandhi problem much more difficult. We can now express Gandhi’s weekly profits as Weekly profit (12 x 1 8 x 2 15 x 3 ) (6 x 1 4 x 2 8 x 3 ) (200 y 1 150 y 2 100 y 3 ) 6 x 1 4 x 2 7 x 3 200 y 1 150 y 2 100 y 3
Thus, Gandhi wants to maximize
z 6 x 1 4 x 2 7 x 3 200 y 1 150 y 2 100 y 3
Because its supply of labor and cloth is limited, Gandhi faces the following two constraints:
Constraint 1 At most, 150 hours of labor can be used each week.
Constraint 2 At most, 160 sq yd of cloth can be used each week.
Constraint 1 is expressed by
3 x 1 2 x 2 6 x 3 150 (Labor constraint) (14)
1 if any pants are manufactured 0 otherwise
1 if any shorts are manufactured 0 otherwise
1 if any shirts are manufactured 0 otherwise
T A B L E 3 Revenue and Cost Information for Gandhi
Clothing Sales Variable Type Price ($) Cost ($)
Shirt 12 6 Shorts 18 4 Pants 15 8
Constraint 2 is expressed by 4 x 1 3 x 2 4 x 3 160 (Cloth constraint) (15) Observe that xj 0 and xj integer ( j 1, 2, 3) must hold along with yj 0 or 1 ( j 1, 2, 3). Combining (14) and (15) with these restrictions and the objective function yields the following IP: max z 6 x 1 4 x 2 7 x 3 200 y 1 150 y 2 100 y 3 s.t. 3 x 1 2 x 2 6 x 3 150 s.t. 4 x 1 3 x 2 4 x 3 160 (IP 1) s.t. 3 x 1 x 1 , x 2 , x 3 0; x 1 , x 2 , x 3 integer s.t. 3 x 1 y 1 , y 2 , y 3 0 or 1 The optimal solution to this problem is found to be x 1 30, x 3 10, x 2 y 1 y 2 y 3 0. This cannot be the optimal solution to Gandhi’s problem because it indicates that Gandhi can manufacture shirts and pants without incurring the cost of renting the needed machinery. The current formulation is incorrect because the variables y 1 , y 2 , and y 3 are not present in the constraints. This means that there is nothing to stop us from setting y 1 y 2 y 3 0. Setting yi 0 is certainly less costly than setting yi 1, so a minimum- cost solution to (IP 1) will always set yi 0. Somehow we must modify (IP 1) so that whenever xi 0, yi 1 must hold. The following trick will accomplish this goal. Let M 1 , M 2 , and M 3 be three large positive numbers, and add the following constraints to (IP 1): x 1 M 1 y 1 (16) x 2 M 2 y 2 (17) x 3 M 3 y 3 (18) Adding (16)–(18) to IP 1 will ensure that if xi 0, then yi 1. To illustrate, let us show that (16) ensures that if x 1 0, then y 1 1. If x 1 0, then y 1 cannot be 0. For if y 1 0, then (16) would imply x 1 0 or x 1 0. Thus, if x 1 0, y 1 1 must hold. If any shirts are produced ( x 1 0), (16) ensures that y 1 1, and the objective function will in- clude the cost of the machinery needed to manufacture shirts. Note that if y 1 1, then (16) becomes x 1 M 1 , which does not unnecessarily restrict the value of x 1. If M 1 were not chosen large, however (say, M 1 10), then (16) would unnecessarily restrict the value of x 1. In general, Mi should be set equal to the maximum value that xi can attain. In the current problem, at most 40 shirts can be produced (if Gandhi produced more than 40 shirts, the company would run out of cloth), so we can safely choose M 1 40. The reader should verify that we can choose M 2 53 and M 3 25. If x 1 0, (16) becomes 0 M 1 y 1. This allows either y 1 0 or y 1 1. Because y 1 0 is less costly than y 1 1, the optimal solution will choose y 1 0 if x 1 0. In sum- mary, we have shown that if (16)–(18) are added to (IP 1), then xi 0 will imply yi 1, and xi 0 will imply yi 0. The optimal solution to the Gandhi problem is z $75, x 3 25, y 3 1. Thus, Gandhi should produce 25 pants each week.
The Gandhi problem is an example of a fixed-charge problem. In a fixed-charge prob- lem, there is a cost associated with performing an activity at a nonzero level that does not depend on the level of the activity. Thus, in the Gandhi problem, if we make any shirts at all (no matter how many we make), we must pay the fixed charge of $200 to rent a shirt machine. Problems in which a decision maker must choose where to locate facilities are often fixed-charge problems. The decision maker must choose where to locate various fa-
482 C H A P T E R 9 Integer Programming
terest. Because Nickles can earn 20% annually, each year West funds will result in 0.20(560,000) $112,000 in lost interest. Similar calculations for the annual cost of lost interest for each possible assignment of a region to a city yield the results shown in Table
484 C H A P T E R 9 Integer Programming
T A B L E 5 Calculation of Annual Lost Interest Annual Lost Assignment Interest Cost ($) West to L.A. 0.20(70,000)2 28, West to Chicago 0.20(70,000)6 84, West to N.Y. 0.20(70,000)8 112, West to Atlanta 0.20(70,000)8 112, Midwest to L.A. 0.20(50,000)6 60, Midwest to Chicago 0.20(50,000)2 20, Midwest to N.Y. 0.20(50,000)5 50, Midwest to Atlanta 0.20(50,000)5 50, East to L.A. 0.20(60,000)8 96, East to Chicago 0.20(60,000)5 60, East to N.Y. 0.20(60,000)2 24, East to Atlanta 0.20(60,000)5 60, South to L.A. 0.20(40,000)8 64, South to Chicago 0.20(40,000)5 40, South to N.Y 0.20(40,000)5 40, South to Atlanta 0.20(40,000)2 16,
The type 1 constraints state that for region i ( i 1, 2, 3, 4) exactly one of xi 1 , xi 2 , xi 3 , and xi 4 must equal 1 and the others must equal 0. This can be accomplished by including the following four constraints:
x 11 x 12 x 13 x 14 1 (West region constraint) (20) x 21 x 22 x 23 x 24 1 (Midwest region constraint) (21) x 31 x 32 x 33 x 34 1 (East region constraint) (22) x 41 x 42 x 43 x 44 1 (South region constraint) (23)
The type 2 constraints state that if
xij 1 (that is, customers in region i send payments to city j ) (24)
then yj must equal 1. For example, suppose x 12 1. Then there must be a lockbox at city 2, so y 2 1 must hold. This can be ensured by adding 16 constraints of the form
xij yj ( i 1, 2, 3, 4; j 1, 2, 3, 4) (25)
If xij 1, then (25) ensures that yj 1, as desired. Also, if x 1 j x 2 j x 3 j x 4 j 0, then (25) allows yj 0 or yj 1. As in the fixed-charge example, the act of minimizing costs will result in yj 0. In summary, the constraints in (25) ensure that Nickles pays for a lockbox at city i if it uses a lockbox at city i. Combining (19)–(23) with the 4(4) 16 constraints in (25) and the 0–1 restrictions on the variables yields the following formulation:
min z 28 x 11 84 x 12 112 x 13 112 x 14 60 x 21 20 x 22 50 x 23 50 x 24 min z 96 x 31 60 x 32 24 x 33 60 x 34 64 x 41 40 x 42 40 x 43 16 x 44 min z 50 y 1 50 y 2 50 y 3 50 y 4 s.t. x 11 x 12 x 13 x 14 1 (West region constraint) s.t. x 21 x 22 x 23 x 24 1 (Midwest region constraint) s.t. x 31 x 32 x 33 x 34 1 (East region constraint) s.t. x 41 x 42 x 43 x 44 1 (South region constraint) s.t. x 11 y 1 , x 21 y 1 , x 31 y 1 , x 41 y 1 , x 12 y 2 , x 22 y 2 , x 32 y 2 , x 42 y 2 , s.t. x 13 y 3 , x 23 y 3 , x 33 y 3 , x 43 y 3 , x 14 y 4 , x 24 y 4 , x 34 y 4 , x 44 y 4 All xij and yj 0 or 1 The optimal solution is z 242, y 1 1, y 3 1, x 11 1, x 23 1, x 33 1, x 43 1. Thus, Nickles should have a lockbox operation in Los Angeles and New York. West cus- tomers should send payments to Los Angeles, and all other customers should send pay- ments to New York. There is an alternative way of modeling the Type 2 constraints. Instead of the 16 con- straints of the form xij yj , we may include the following four constraints:
x 11 x 21 x 31 x 41 4 y 1 (Los Angeles constraint) x 12 x 22 x 32 x 42 4 y 2 (Chicago constraint) x 13 x 23 x 33 x 43 4 y 3 (New York constraint) x 14 x 24 x 34 x 44 4 y 4 (Atlanta constraint)
For the given city, each constraint ensures that if the lockbox is used, then Nickles must pay for it. For example, consider x 14 x 24 x 34 x 44 4 y 4. The lockbox in Atlanta is used if x 14 1, x 24 1, x 34 1, or x 44 1. If any of these variables equals 1, then the Atlanta constraint ensures that y 4 1, and Nickles must pay for the lockbox. If all these variables are 0, then the act of minimizing costs will cause y 4 0, and the cost of the At-
objective function (and with the fact that each variable must equal 0 or 1), we obtain the following 0–1 IP:
min z x 1 x 2 x 3 x 4 x 5 x 6 s.t. x 1 x 2 x 3 x 4 x 5 x 5 1 (City 1 constraint) s.t. x 1 x 2 x 3 x 4 x 5 x 6 1 (City 2 constraint) s.t. x 1 x 2 x 3 x 4 x 5 x 6 1 (City 3 constraint) s.t. x 1 x 2 x 3 x 4 x 5 x 6 1 (City 4 constraint) s.t. x 1 x 2 x 3 x 4 x 5 x 6 1 (City 5 constraint) s.t. x 1 x 2 x 2 x 3 x 5 x 6 1 (City 6 constraint) xi 0 or 1 ( i 1, 2, 3, 4, 5, 6)
One optimal solution to this IP is z 2, x 2 x 4 1, x 1 x 3 x 5 x 6 0. Thus, Kil- roy County can build two fire stations: one in city 2 and one in city 4.
As noted, Example 5 represents a class of IPs known as set-covering problems. In a set-covering problem, each member of a given set (call it set 1) must be “covered” by an acceptable member of some set (call it set 2). The objective in a set-covering problem is to minimize the number of elements in set 2 that are required to cover all the elements in set 1. In Example 5, set 1 is the cities in Kilroy County, and set 2 is the set of fire sta- tions. The station in city 2 covers cities 1, 2, and 6, and the station in city 4 covers cities 3, 4, and 5. Set-covering problems have many applications in areas such as airline crew scheduling, political districting, airline scheduling, and truck routing.
The following situation commonly occurs in mathematical programming problems. We are given two constraints of the form
f ( x 1 , x 2 ,... , xn ) 0 (26) g ( x 1 , x 2 ,... , xn ) 0 (27)
We want to ensure that at least one of (26) and (27) is satisfied, often called either–or constraints. Adding the two constraints (26) and (27) to the formulation will ensure that at least one of (26) and (27) is satisfied:
f ( x 1 , x 2 ,... , xn ) My (26 ) g ( x 1 , x 2 ,... , xn ) M (1 y ) (27 )
T A B L E 7 Cities within 15 Minutes of Given City
City Within 15 Minutes
1 1, 2 2 1, 2, 6 3 3, 4 4 3, 4, 5 5 4, 5, 6 6 2, 5, 6
In (26) and (27), y is a 0–1 variable, and M is a number chosen large enough to en- sure that f ( x 1 , x 2 ,... , xn ) M and g ( x 1 , x 2 ,... , xn ) M are satisfied for all values of x 1 , x 2 ,... , xn that satisfy the other constraints in the problem. Let us show that the inclusion of constraints (26) and (27) is equivalent to at least one of (26) and (27) being satisfied. Either y 0 or y 1. If y 0, then (26) and (27) become f 0 and g M. Thus, if y 0, then (26) (and possibly (27)) must be satisfied. Similarly, if y 1, then (26) and (27) become f M and g 0. Thus, if y 1, then (27) (and possibly (26)) must be satisfied. Therefore, whether y 0 or y 1, (26) and (27) ensure that at least one of (26) and (27) is satisfied. The following example illustrates the use of either–or constraints.
Dorian Auto is considering manufacturing three types of autos: compact, midsize, and large. The resources required for, and the profits yielded by, each type of car are shown in Table 8. Currently, 6,000 tons of steel and 60,000 hours of labor are available. For pro- duction of a type of car to be economically feasible, at least 1,000 cars of that type must be produced. Formulate an IP to maximize Dorian’s profit. Solution Because Dorian must determine how many cars of each type should be built, we define x 1 number of compact cars produced x 2 number of midsize cars produced x 3 number of large cars produced Then contribution to profit (in thousands of dollars) is 2 x 1 3 x 2 4 x 3 , and Dorian’s ob- jective function is max z 2 x 1 3 x 2 4 x 3 We know that if any cars of a given type are produced, then at least 1,000 cars of that type must be produced. Thus, for i 1, 2, 3, we must have xi 0 or xi 1,000. Steel and labor are limited, so Dorian must satisfy the following five constraints: Constraint 1 x 1 0 or x 1 1,000. Constraint 2 x 2 0 or x 2 1,000. Constraint 3 x 3 0 or x 3 1,000. Constraint 4 The cars produced can use at most 6,000 tons of steel. Constraint 5 The cars produced can use at most 60,000 hours of labor.
488 C H A P T E R 9 Integer Programming
E X A M P L E 6 Either–Or Constraint
T A B L E 8 Resources and Profits for Three Types of Cars Car Type Resource Compact Midsize Large Steel required 1.5 tons 3 tons 5 tons Labor required 30 hours 25 hours 40 hours
Profit yielded ($) 2,000 3,000 4,
In many applications, the following situation occurs: We want to ensure that if a constraint f ( x 1 , x 2 ,... , xn ) 0 is satisfied, then the constraint g ( x 1 , x 2 ,... , xn ) 0 must be satis- fied, while if f ( x 1 , x 2 ,... , xn ) 0 is not satisfied, then g ( x 1 , x 2 ,... , xn ) 0 may or may not be satisfied. In short, we want to ensure that f ( x 1 , x 2 ,... , xn ) 0 implies g ( x 1 , x 2 ,
... , xn ) 0. To ensure this, we include the following constraints in the formulation: g ( x 1 , x 2 ,... , xn ) My (28) f ( x 1 , x 2 ,... , xn ) M (1 y ) (29) y 0 or 1 As usual, M is a large positive number. ( M must be chosen large enough so that f M and g M hold for all values of x 1 , x 2 ,... , xn that satisfy the other constraints in the problem.) Observe that if f 0, then (29) can be satisfied only if y 0. Then (28) im- plies g 0, or g 0, which is the desired result. Thus, if f 0, then (28) and (29) en- sure that g 0. Also, if f 0 is not satisfied, then (29) allows y 0 or y 1. By choos- ing y 1, (28) is automatically satisfied. Thus, if f 0 is not satisfied, then the values of x 1 , x 2 ,... , xn are unrestricted and g 0 or g 0 are both possible. To illustrate the use of this idea, suppose we add the following constraint to the Nickles lock- box problem: If customers in region 1 send their payments to city 1, then no other customers may send their payments to city 1. Mathematically, this restriction may be expressed by If x 11 1, then x 21 x 31 x 41 0 (30) Because all xij must equal 0 or 1, (30) may be written as If x 11 0, then x 21 x 31 x 41 0, or x 21 x 31 x 41 0 (30 ) If we define f x 11 and g x 21 x 31 x 41 , we can use (28) and (29) to express (30) [and therefore (30)] by the following two constraints: x 21 x 31 x 41 My x 11 M (1 y ) y 0 or 1 Because g and f can never exceed 3, we can choose M 3 and add the following con- straints to the original lockbox formulation: x 21 x 31 x 41 3 y x 11 3(1 y ) y 0 or 1
The next example shows how 0–1 variables can be used to model optimization problems involving piecewise linear functions. A piecewise linear function consists of several straight-line segments. The piecewise linear function in Figure 2 is made of four straight- line segments. The points where the slope of the piecewise linear function changes (or the range of definition of the function ends) are called the break points of the function. Thus, 0, 10, 30, 40, and 50 are the break points of the function pictured in Figure 2.
490 C H A P T E R 9 Integer Programming
†This section covers topics that may be omitted with no loss of continuity.
To illustrate why piecewise linear functions can occur in applications, suppose we manufacture gasoline from oil. In purchasing oil from our supplier, we receive a quantity discount. The first 500 gallons of oil purchased cost 25¢ per gallon; the next 500 gallons cost 20¢ per gallon; and the next 500 gallons cost 15¢ per gallon. At most, 1,500 gallons of oil can be purchased. Let x be the number of gallons of oil purchased and c ( x ) be the cost (in cents) of purchasing x gallons of oil. For x 0, c ( x ) 0. Then for 0 x 500, c ( x ) 25 x. For 500 x 1,000, c ( x ) (cost of purchasing first 500 gallons at 25¢ per gallon) (cost of purchasing next x 500 gallons at 20¢ per gallon) 25(500) 20( x 500) 20 x 2,500. For 1,000 x 1,500, c ( x ) (cost of purchasing first 1,000 gallons) (cost of purchasing next x 1,000 gallons at 15¢ per gallon) c (1,000) 15( x 1,000) 7,500 15 x. Thus, c ( x ) has break points 0, 500, 1,000, and 1,500 and is graphed in Figure 3. A piecewise linear function is not a linear function, so one might think that linear pro- gramming could not be used to solve optimization problems involving these functions. By using 0–1 variables, however, piecewise linear functions can be represented in linear form. Suppose that a piecewise linear function f ( x ) has break points b 1 , b 2 ,... , bn. For some k ( k 1, 2,... , n 1), b (^) k x b (^) k 1. Then, for some number zk (0 zk 1), x may be written as x zkbk (1 zk ) bk 1 Because f ( x ) is linear for bk x bk 1 , we may write f ( x ) zk f ( bk ) (1 zk ) f ( bk 1 )
c ( x )
x 10 20 30 40 50
c ( x )
x 500 1,000 1,
6,
12,
18,
24,
30,
F I G U R E 2 A Piecewise Linear Function
F I G U R E 3 Cost of Purchasing Oil
Constraint 4 The oil mixed to make gas 2 must be at least 60% oil 1.
Constraint 1 yields
x 11 x 12 x 500
Constraint 2 yields
x 21 x 22 1,
Constraint 3 yields
x 11
x
11 x 21
0.5 or 0.5 x 11 0.5 x 21 0
Constraint 4 yields
x 12
x
12 x 22
0.6 or 0.4 x 12 0.6 x 22 0
Also all variables must be nonnegative. Thus, Euing Gas must solve the following opti- mization problem:
max z 12 x 11 12 x 21 14 x 12 14 x 22 c ( x ) s.t. 0.5 x 11 0.5 x 11 0.4 x 12 0.6 x 12 x 500 s.t. 0.5 x 11 0.5 x 21 0.4 x 12 0.6 x 22 1, s.t. 0.5 x 11 0.5 x 21 0.4 x 12 0.6 x 12 0 s.t. 0.5 x 11 0.5 x 11 0.4 x 12 0.6 x 22 0 max z 12 xij 0, 0 x 1, Because c ( x ) is a piecewise linear function, the objective function is not a linear func- tion of x , and this optimization is not an LP. By using the method described earlier, how- ever, we can transform this problem into an IP. After recalling that the break points for c ( x ) are 0, 500, 1,000, and 1,500, we proceed as follows:
Step 1 Replace c ( x ) by c ( x ) z 1 c (0) z 2 c (500) z 3 c (1,000) z 4 c (1,500).
Step 2 Add the following constraints:
x 0 z 1 500 z 2 1,000 z 3 1,500 z 4 z 1 y 1 , z 2 y 1 y 2 , z 3 y 2 y 3 , z 4 y 3 z 1 z 2 z 3 z 4 1, y 1 y 2 y 3 1 yi 0 or 1 ( i 1, 2, 3); zi 0 ( i 1, 2, 3, 4)
Our new formulation is the following IP:
max z 12 x 11 12 x 21 14 x 12 14 x 22 z 1 c (0) z 2 c (500) max z z 3 c (1,000) z 4 c (1,500) s.t. 0.5 x 11 0.5 x 21 0.4 x 12 0.6 x 22 x 500 s.t. 0.5 x 11 0.5 x 21 0.4 x 12 0.6 x 22 1, s.t. 0.5 x 11 0.5 x 21 0.4 x 12 0.6 x 22 0 s.t. 0.5 x 11 0.5 x 21 0.4 x 12 0.6 x 22 0 x 0 z 1 500 z 2 1,000 z 3 1,500 z 4 (31) z 1 y 1 (32) z 2 y 1 y 2 (33) z 3 y 2 y 3 (34)
z 4 y 3 (35) y 1 y 2 y 3 1 (36) z 1 z 2 z 3 z 4 1 (37) yi 0 or 1 ( i 1, 2, 3); zi 0 ( i 1, 2, 3, 4) xij 0 To see why this formulation works, observe that because y 1 y 2 y 3 1 and yi 0 or 1, exactly one of the yi ’s will equal 1, and the others will equal 0. Now, (32)–(37) imply that if yi 1, then zi and zi 1 may be positive, but all the other zi ’s must equal 0. For in- stance, if y 2 1, then y 1 y 3 0. Then (32)–(35) become z 1 0, z 2 1, z 3 1, and z 4 0. These constraints force z 1 z 4 0 and allow z 2 and z 3 to be any nonnegative number less than or equal to 1. We can now show that (31)–(37) correctly represent the piecewise linear function c ( x ). Choose any value of x , say x 800. Note that b 2 500 800 1,000 b 3. For x 800, what values do our constraints assign to y 1 , y 2 , and y 3? The value y 1 1 is impossible, because if y 1 1, then y 2 y 3 0. Then (34)–(35) force z 3 z 4 0. Then (31) reduces to 800 x 500 z 2 , which cannot be satisfied by z 2 1. Similarly, y 3 1 is impossible. If we try y 2 1 (32) and (35) force z 1 z 4 0. Then (33) and (34) imply z 2 1 and z 3 1. Now (31) becomes 800 x 500 z 2 1,000 z 3. Because z 2 z 3 1, we obtain z 2 ^25 ^ and z 3 ^35 . Now the objective function reduces to
12 x 11 12 x 21 14 x 21 14 x 22
2 c ( 5
3 c ( 5
Because
c (800)
2 c ( 5
3 c ( 5
our objective function yields the correct value of Euing’s profits! The optimal solution to Euing’s problem is z 12,500, x 1,000, x 12 1,500, x 22 1,000, y 3 z 3 1. Thus, Euing should purchase 1,000 gallons of oil 1 and pro- duce 2,500 gallons of gas 2.
In general, constraints of the form (31)–(37) ensure that if b (^) i x bi 1 , then yi 1 and only zi and zi 1 can be positive. Because c ( x ) is linear for b (^) i x bi 1 , the objec- tive function will assign the correct value to c ( x ). If a piecewise linear function f ( x ) involved in a formulation has the property that the slope of f ( x ) becomes less favorable to the decision maker as x increases, then the tedious IP formulation we have just described is unnecessary.
Dorian Auto has a $20,000 advertising budget. Dorian can purchase full-page ads in two magazines: Inside Jocks (IJ) and Family Square (FS). An exposure occurs when a person reads a Dorian Auto ad for the first time. The number of exposures generated by each ad in IJ is as follows: ads 1–6, 10,000 exposures; ads 7–10, 3,000 exposures; ads 11–15, 2,500 exposures; ads 16, 0 exposures. For example, 8 ads in IJ would generate 6(10,000) 2(3,000) 66,000 exposures. The number of exposures generated by each ad in FS is as follows: ads 1–4, 8,000 exposures; ads 5–12, 6,000 exposures; ads 13–15, 2,000 exposures; ads 16, 0 exposures. Thus, 13 ads in FS would generate 4(8,000)
494 C H A P T E R 9 Integer Programming
E X A M P L E 8 Media Selection with Piecewise Linear Functions