Ip-Opgaver 10.8
Ip-Opgaver 10.8
1 Smoked ham
(Chvatal 1.6, adapted from Greene et al. (1957)) A meat packing plant produces 480 hams, 400 pork bellies, and 230 picnic hams every day; each of these products can be sold either fresh or smoked. The total number of hams, bellies, and picnics that can be smoked during a normal working day is 420; in addition up to 250 products can be smoked on overtime at a higher cost. The net prots are as follows: Fresh $8 $4 $4 Smoked on regular time $14 $12 $13 Smoked on overtime $11 $7 $9
For example, the following schedule yields a total net prot of $9.965: Fresh 165 295 55 Smoked on regular time 280 70 70 Smoked on overtime 35 35 105
The objective is to nd the schedule that maximizes the total net prot. Formulate as an LP problem in the standard form.
Use the theorem of complementary slackness to nd out whether this strategy is optimal or not.
4 Nonlinear models
In management science we normally operate with linear objectives of the form cx and linear constraints of the form Ax b. The nature of a problem may however demand, that a product of some variables is introduced: 2x 4y xy 10
a) Assuming that x and y are binary variables, show how this constraint can be written in linear form. (Hint: introduce a new binary variable to indicate the product xy). b) Assume now that x and y are integer variables, with 0 x 3 and 0 y 3. Rewrite the above inequality in linear form. (Hint: Express the variables in binary form, e.g. x 2 1 2 , where 1 2 0 1 ).
5 Airplanes
(Hillier and Lieberman 13.10) An airline company is considering the purchase of new long-, medium-, and short-range jet passenger airplanes. The purchase price would be $33.500.000 for each long-range plane, $25.000.000 for each medium-range plane, and $17.500.000 for each short-range plane. The board of directors has authorized a maximum commitment of $750.000.000 for these purchases. Regardless of which airplanes are purchased, air travel of all distances is expected to be sufciently large enough so that these planes would be utilized at essentially maximum capacity. It is estimated that the net annul prot (after subtracting capital recovery costs) would be $2.100.000 per long-range plane, $1.500.000 per medium-range plane, and $1.150.000 per short-range plane. It is predicted that enough trained pilots will be available to the company to crew 30 new airplanes. If only short-ranged planes were purchased, the maintenance facilities would be able to handle 40 new planes. However, each medium-range plane is equivalent to 1 1 3 short-range planes, and each long-range plane is 2 equivalent to 1 3 short-range planes in terms of their use of the maintenance facilities. The information given here was obtained by a preliminary analysis of the problem. A more detailed analysis will be conduced subsequently. However, using the predicted data as a rst approximation, management wishes to know how many planes of each type should be purchased to maximize prot. a) Formulate the problem as an IP model. b) Use GAMS or CPLEX to solve this problem.
6 Fashionable professor
(Hillier and Lieberman 13.11) An American professor will be spending a short sabbatical leave at the University of Iceland. She wishes to bring all needed items with her on the airplane. After collecting together the professional items that she must have, she nds that airline regulations on space and weight for checked luggage will severely limit the clothes she can take. (She plans to carry on a warm coat, and the purchase a warm Icelandic sweater upon arrival in Iceland). Clothes under considerations for checked luggage include 3 skirts, 3 slacks, 4 tops, and 3 dresses. The professor wants to maximize the number of outts she will have in Iceland (including the special dress she will wear on the airplane). Each dress constitutes on outt. Other outts consists of a combination of top and either a skirt or slacks. However, certain combinations are not fashionable and so will not qualify as an outt. In the following table, the combinations that will make an outt are marked with an x.
Skirt
Slacks
1 2 3 1 2 3
1 x x x x
Top 2 3 x x x x x x
4 x x x x
Icelandic Sweater x x x x
The weight (in grams) and volume (in cubic centimeters) of each item is shown in the following table: 1 Skirt 2 3 1 Slacks 2 3 1 Top 2 3 4 1 Dress 2 3 Total allowed Weight 600 450 700 600 550 500 350 300 300 450 600 700 800 4.000 Volume 5.000 3.500 3.000 3.500 6.000 4.000 4.000 3.500 3.000 5.000 6.000 5.000 4.000 32.000
a) Formulate a binary IP model to choose which items of clothing to take. b) Solve the model to optimality, using GAMS or CPLEX.
7 Product lines
(Hillier and Lieberman 13.12) The research and development division of a company has been developing four possible new product lines. Management must now make a decision as to which of these four products actually will be produced and at what levels. Therefore, they have asked the Operations Research Department to formulate a mathematical programming model to nd the most protable product mix. A substantial cost is associated with beginning the production of any product, as given in the rst row of the following table. The marginal net revenue from each unit product is given in the second row of the table. 1 $50.000 $70 Product 2 3 $40.000 $70.000 $60 $90 4 $60.000 $80
Let the continuous decision variables x1 x2 x3 and x4 be the production level of products 1 2 3 and 4, respectively. Management has imposed the following policy constraints on these variables 1. No more than two of the products can be produced. 2. Product 3 or 4 can be produced if product 1 or 2 is produced. 3. One of the constraints 5x1 satised.
3x2
6x3
4x4
6x2
3x3
5x 4
6000 must be
Introduce binary variables to formulate an MIP model. (Hint: Let Xi denote whether product i is produced. Then contraint 2 can be written X3 X4 X1 X2 . If XA denotes when the rst inequality in 3 is satised, and XB denotes when the second inequality is satised, then the constraint 3 is XA XB . You may choose 0 01)
8 Model building
(Hillier and Lieberman 13.13) Consider the following mathematical model: minimize z subject to the restrictions 1. Either x1
x1
x2
3 or x2
3.
3. x1
4. x1
x2
0, or 3, or 6. 0
0, x2
Formulate this problem as an MIP model. (Hint: The rst constraint is an exclusive or. You may choose
0 01 in this exercise).
9 Branch-and-bound
(Hillier and Lieberman 13.16) Consider the following IP problem maximize z 5x1 x2 subject to x1 2x2 4 x1 x2 1 4x1 x2 12 x1 x2 0 integers
a) Solve the problem graphically. b) Solve the LP-relaxation graphically. Round the solution to the nearest integer solution and check whether it is feasible. Then enumerate all the rounded solutions (rounding each noninteger value either up or down), check them for feasibility, and calculate z for those that are feasible. Are any of these feasible rounded solutions optimal to the IP problem? c) Use the MIP branch-and-bound algorithm described in Wolsey Section 7.4 to solve this problem. For each subproblem, solve its LP-relaxation graphically.
10 Cover inequalities
We consider a large IP model maximize c subject to A
(1)
where is a vector of boolean variables. If we solve the LP-relaxation of (1) we obtain a solution vector . If all i are integers, we are done. Otherwise assume that some of the i are fractional. In this case it would be useful to add a cover inequality to the formulation which cuts off the current LP-solution. Thus consider a single constraint from (1) where some of the variables i of the LP-solution have fractional values. (2) ai i b
i I
minimize subject to
1
i I
i xi
a i xi
i I
1 i
(3)
xi
0 1
1
which is a knapsack problem in minimization form. Notice that the coefcients satisfy that 1 i 0, and when 1 i 0 we may x xi to zero. If we obtain a solution to (3) where 1 we may construct a cover inequality as follows. Let C i I : xi 1 (4)
be the set of items chosen in (3). Then we may add a new inequality
i C
i C
(5)
to the formulation (1). a) Prove that the set C is a minimal cover. b) Prove that the inequality (5) is violated for the current LP-solution .
102 63 124 8 5 62 23 84 45 8 0 1
Solve the LP-relxation of the problem (by hand or using GAMS or CPLEX). d) Derive a valid cover inequality for this problem using the technique described above. e) Add the new inequality to the problem, and solve the LP-relaxation using GAMS or CPLEX.
11 Valid inequalities
(Nemhauser and Wolsey II.1.9.1). Let S x Z 2 : 4x1 x2 28 x1 4x2 27 x1 x2 1 . Determine the facets of conv S graphically. Then derive each of the facets of conv S as a Chvatal-Gomory inequality. (Hint: see Wolsey page 119 for denition of Chvatal-Gomory inequalities)
x
x1
Z 3 : 19x1
x2
28x2 8
184x3
5x3
13 Valid inequalities
(Nemhauser and Wolsey II.1.9.3). For S show that
7x2
4x4
2x3 3x4 12
12 2x1
5x2
1x3 4x4
10
is a valid inequality by disjunctive arguments. (Hint: see Wolsey page 130 for denitions)
14 Node packing
V E . The Node packing problem asks to select the (Nemhauser and Wolsey II.1.9.4). Given a graph G largest number of nodes, such that if node i and j are chosen, then i j E. Let xi 1 if node i is in packing, xi 0 otherwise. Then our constraints are:
xi
xj
1 for all i j 3
0 1
i 1
xi
16 Gomory cuts
Consider the problem (the constraints are similar to those in exercise 11). maximize 7x1 subject to 4x1 x1 x1
x2 x2 4x2 x2 x1 x2
28 27 1 0 integer
(6)
a) Solve the LP-relaxed problem by hand using the simplex algorithm. Remember to add slack variables. b) Derive a Gomory cut and add it to the problem. c) Solve the improved formulation by hand or by GAMS or CPLEX.
17 Matching in a graph
A clique Kn in a graph is a complete graph dened on n vertices (i.e. all vertices are connected by an edge). In the following E is the set of edges, and V is the set of vertices.
The matching problem asks for the largest subset of edges, such that no vertex has more than one adjacent edge. a) Using xe 0 1 to indicate whether an edge e is chosen, formulate the matching problem as an optimization problem. b) Prove that an LP-optimal solution is xe c) Assuming that n is odd, derive the cut
e E
1 n
for all e
E.
xe
n 2
d) Is the inequality facet dening? e) For n 5, formulate and solve the problem to LP-optimality using GAMS or CPLEX. What is the effect of the cut.
18 Node packing
Given a graph G V E The node packing problem asks to nd the largest subset of nodes, such that no two selected nodes are interconnected by an edge.
Let xi
0 1
indicate whether a node i is chosen.
a) Write up all valid inequalities for the above graph. Inequalities from cliques as well as odd cycles should be considered.
19 Knapsack Problem
The knapsack problem is a well-known NP-hard optimization problem. Given a number of items j with associated prots p j and weights w j , select a subset of these items such that the selected prot is maximized without exceeding a given capacity c. In the present version, we will assume that an item may be selected zero, one or more times. This variant is called the Unbounded Knapsack Problem in the literature. max n j
p jx j
s.t.
n j 1 w jx j
xj
0 1
pj 3 4 2 5 4
(7)
a) A charter tourist would like to bring the following items for his vacations: item shirt trousers T-shirt shoes jacket The capacity of the knapsack is c wj 10 11 8 14 12
20 Column generation
We are considering the cutting stock problem: Given an unlimited number of long tubes of length c. We need to cut some small pieces of length w1 w2 wm . At least bi pieces of length wi are demanded. Our objective is to minimize the number of long tubes used. Thus we have the following LP-formulation:
min x s.t.
Ax x
(8)
where the columns in A are all possible patterns of cutting a single tube (i.e. m c and all ai j 0, i 1 ai j integer). The solution vector xi states how many times a given cutting pattern is used in the optimal solution. Since the number of possible cutting patterns can be large (exponential) we will use delayed column generation to introduce cutting patterns only when needed. For small instances, column generation can be run by hand with a little support by GAMS or CPLEX.
0 Choose an initial solution, where only one kind of pieces are cut from each tube. These cutting patterns form the initial value of A. 1 Solve the system (8) for the current value of A by using GAMS or CPLEX. 2 Print out the dual variables y. 3 Solve the knapsack problem (7) with p
A plumber (blikkenslager) is repairing the heating system at DIKU. For this purpose he needs to cut some tubes: 4 pieces of length 3, 3 pieces of length 5, and 2 pieces of length 6. All the pieces are cut from some long tubes of length 10.
a) Use column generation to nd a lower bound on the number of long tubes needed. Use GAMS or CPLEXto solve the linear problem (8), while subproblems in step 2 and 3 can be solved by using the technique from exercise 19. Compare the found lower bound LC with the linear bound L0 n j
1 wj
b) Solve the model to integer optimality by any technique you like (guessing is OK). Compare the optimal solution to the two lower bounds derived in question a.
1 2 4 3 5 6 7 8 9 10
The numbers refer to the edge numbers. We use the boolean variable x i i is used in the tour. Prove that the following inequaltiy holds x1
0 1
x2
x3
x4
x6
x8
22 Lagrangian relaxation
(Wolsey section 10, exercise 5) Consider a 0-1 Knapsack Problem maximize 10y1 subject to 3y1 y1 y2 y3
4y2 y2 01
14y3 4y3
(9)
a) Construct a lagrangian dual by dualizing the knapsack constraint. What is the optimal value of the dual variable? b) Suppse one runs the subgradient algorithm using step size (b) in Theorem 10.4 (Wolsey), starting with u0 0, 0 1 and 1 2 . What is the value of the lagrangian multiplier after 5 iterations of the algorithm.
23 Lagrangian relaxation
(Wolsey section 10, exercise 8) Consider the assignment problem with budget constraint. There are given a set M of employees who should be assigned to the set N of jobs. Each job should be covered by exactly one employee, and every employee should have exactly one job. If employee i is doing the job j a net prot of ci j can be expected. However in order to let employee i do the job j a teaching cost of a i j must be 9
paid. The total teaching costs may not exceed the limit b. The objective is to maximize the net prot. If we introduce the binary variable xi j to denote that employee i gets the job j we get the following formulation maximize i subject to j i i xi j
M j N ci j xi j
1 x 1 M ij M j N a i j xi j 01
N xi j
fori M for j N b
(10)
Discuss the strength of different possible Lagrangian relaxations, and the ease or difculty of solving the Lagrangian subproblems, and the Lagrangian dual.
24 A Logical Labyrinth
The puzzle is taken from The Lady or the Tiger (by Smullyan 1982, formulated as IP-model by Martin J. Chlond, Cath M.Toase). The relevant chapter, Ladies or Tigers, contains 12 puzzles of increasing difculty. In each puzzle a prisoner is faced with a decision where he must open one of several doors. In the rst few examples each room contains either a lady or a tiger and in the more difcult examples rooms may also be empty. The following puzzle is the most difcult. If the prisoner opens a door to nd a lady he will marry her and if he opens a door to nd a tiger he will be eaten alive. We assume that the prisoner would prefer to be married than eaten alive. It is also assumed that the lady is in some way special to the prisoner and he would prefer to nd and marry her rather than an open a door into and empty room. Each of the doors has a sign bearing a statement that may be either true or false. The puzzle involves nine rooms. The statements on the nine doors are:
(use: )
(use: )
In addition, the prisoner is informed that only one room contains a lady; each of the others either contains a tiger or is empty. The sign on the door of the room containing the lady is true, the signs on all the doors containing tigers are false, and the signs on the doors of empty rooms can be either true or false. The puzzle as stated does not have a unique solution until the prisoner is told whether or not room eight is empty and this knowledge enables him to nd a unique solution. Dene subscripts i 1 9 and j 1 3 where (1 lady, 2 tiger, 3 empty) and as above variables are 1 if door i hides prize j xi j 0 otherwise
ti
1 0
10
1 Formulate the model as an IP model. 2 Use CPLEX to solve the model. 3 What was the additional information the prisoner needed to know to nd a unique solution? The Second Trial This puzzle involves two rooms. The statement on door one says, At least one of these rooms contains a lady. The statement on door two says, A tiger is in the other room. The statements are either both true or both false. 4 Formulate the model as an IP model. 5 Use CPLEX to solve the model. 6 Give a complete classication of the two rooms.
brd: 4 kg mel
Salgsprisen for de 3 produkter er henholdsvis 4, 6 og 2 kr. Leverancerne af mel og margarine er dog begrnset til hjst 50 kg mel, og 30 kg margarine. akager produceret, opskriv et LP-problem som 1 Idet x1 x2 og x3 betegner antal brd, basser og sm maksimerer salgsprisen Bageriet er i samme concern som leverandren af mel og margarine, a/s melmarg. Firmaet overvejer om de kan slge de 50 kg mel og 30 kg margarine til andre bagerier. 2 Hvis y1 angiver salgsprisen for et kg mel, og y2 angiver salgsprisen for et kg margarine, hvad er den mindste salgspris melmarg kan tage, s aledes at ingen konkurrenter kan lave brd billigere end brdsnask. Opskiv en LP-model som lser dette problem. Der er kun to variable i dette nye problem. 3 Ls melmargs problem grask. 4 Find den optimale lsning til brdsnask ved at bruge komplementr slk stningen. Bageriet brdsnask kan ogs a producere crossainter. 5 Hvis der bruges 2 kg mel og 3 kg margarine til at producere en crossaint. Hvad skal salgsprisen vre for at det kan betale sig at producere crossainter. Bageriet brdsnask kan kbe yderligere mel og margarine p a det frie marked. Der er dog kun tale om sm a mngder som er til salg. 6 Mel kan kbes for 1.25 kr, og margarine kan kbes for 1.75. Skal man kbe disse ressourcer?
12
meaning of constraint 1 x x 0 1
b b b) b) b b b) b)
1 n j 1 a jx j n a x b j 1 j j
b 1
1 n j 1 a jx j n j 1 a jx j b 1 1 1
b 1
1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 2 1 1
Logical conditions may be modeled by associating an indicator variable i with every condition Xi such that Xi i 1
2
1 1 1 1
1 2 2 0 2 0
1 1
The equations in the right side of the table can either be added directly to the model, or they can be used to trigger a new indicator variable which can be used in other parts of the model. Notice that in LP and MIP constraints implicitly are linked by an and, i.e. all the constraints must be satised. This however means that conditions linked by an and are much easier to model than those linked by an or. In many situations it may be fruitful to rewrite an expression to an equivalent and form as illustrated in the following example:
X1
can be rewritten to
X2
X3
X4
X3
X1
1
X3
Introducing an indicator variable i with each of the logical conditions Xi we get the constraints
X1
X4 4
X2
X2
2 .
X4
0
1
If i is maximized in the objective function then it is often sufcient to ensure i If i is minimized in the objective function then it is often sufcient to ensure i
Xi
Xi Xi
"!"#$%
. .
13