1.7 Linear programming - finding a feasible vertex Now we look at how to modify the simplex method if the starting vertex is not in the feasible region. We illustrate the technique with the following example. Example 1. Bill is a fussy eater and only eats ham and eggs. Furthermore, due to a tight budget he only eats enough of these to get the minimum daily requirements (MDR) of protein and vitamins. In particular, 1. Each pound of ham costs $1 and has 5 oz of protein and 2 grams of vitamins. 2. A dozen eggs costs $4 and has 3 oz of protein and 1 gram of vitamins. 3. The MDR of protein is 7 oz and the MDR of vitamins is 6 grams. How much ham and eggs should Bill eat to get the MDR of protein and vitamins and mimimized his costs? Here is a table showing this information. Foods Cost (c) Nutrional needs Protein Vitamins Ham (x) Eggs (y) $1 / lb $4 / doz MDR 5 oz / lb 3 oz / doz 7 oz 2 gm / lb 1 gm / doz 6 gm Let x = amount of ham Bill eats (lbs) y = amount of eggs Bill eats (doz) c = cost of eating x lbs of ham and y doz eggs. So the problem is Minimize y 6 c = x + 4y (cost) 5 subject to 5x + 3y 7 (protein MDR) 4 2x + y 6 (vitamin MDR) 3 x 0, y 0 2 1 Here is a graph showing those (x, y) that satisfy the inequalities. 0.5 1.0 1.5 2.0 2.5 Note that if one satisfies the vitamin constraint, then one automatically satisfies the protein constraint. The feasible region only has two vertices, (0, 6) and (3, 0). We want to find the vertex with the smallest c value. The lines of constant c have slope - 1/4. One can see the vertex with smallest c value is (3, 0). Even though we can solve this problem graphically, it is instructive to also solve it using the simplex algorithm so we can use it to solve larger problems that would be hard to solve graphically. 1.7 - 1 3.0 x Step 1. Introduce slack variables. Let p = 5x + 3y – 7 = excess protein in Bill's diet v = 2x + y - 6 = excess vitamins in Bill's diet So the problem is Minimize c = x + 4y E0 subject to - 5x - 3y + p - 2x - y = -7 E1 +v = -6 E2 x 0, y 0, v 0, p 0 Step 2. We start out at the vertex where the values of the non-basic variables are 0 and the values of the basic variables are determined by the constraints, i.e. (x, y) = (0, 0). In terms of all the variables this is the vertex (x, y, p, v) = (0, 0, - 7, - 6). The problem is that this vertex doesn't satisfy the constraints because p = - 7 and v = - 6 at this vertex and we need these to be non-negative. So before trying to minimize c we have to first get to a vertex in the feasible region. We do this by trying to do one or more pivots to increase p and v so they are non-negative. We first focus on the first constraint - 5x - 3y + p = - 7 that contains the variable p that is negative and try to bring p up to 0 and then worry about v. We can do this by a method almost the same as a regular linear programming problem, namely we do one or more pivots to increase p except we only try to bring p up to 0 instead of trying to maximize p. We rewrite the constraint as 5x + 3y = 7 + p. Can we increase p by increasing some non-basic variable from 0 to a positive value? The answer is yes if some non-basic variable has a positive coefficient. The non-basic variable x has the largest coefficient which is 5 which is positive. Step 3. How far can we increase x keeping y = 0 and keeping p 0. At this point there are no other constraints that are satisfied that we need to keep satisfied. So we only have to worry about keeping p 0. Looking at the constraint that includes p which is the first constraint 5x + 3y = 7 + p we see that with y = 0 and p 0 we get 5x 7 x 7/5 or We don't worry about trying to make v in the second constraint - 2x - y + v = - 6 non-negative at this time. So we increase x is to x = 7/5. This causes p to increase to 0. So we do a pivot swapping x and p. Step 4. We divide the pivot equation E1 by - 5 so that x becomes a basic variable and p a non-basic variable. This gives 3 1 x + 5y - 5p 7 = 5 E1' We then use this equation to eliminate x from the objective function E0 and the other constraint E2. After doing this the problem has become 1.7 - 2 Minimize 17 5 1 7 y + 5p subject to 3 1 x + 5y - 5p 1 5 E0' = -5 + c = 2 y - 5p + v = - 7 5 16 5 E1' E2' x 0, y 0, v 0, p 0 The basic variables are now x and v and the non-basic variables are y and p and we are now at the vertex 7 16 (x, y, p, v) = (5, 0, 0, - 5 ). Three of the variables are non-negative, but v is not. So we are not yet at a feasible vertex at which to start the basic simplex algorithm. 1 2 16 We now focus on the second constraint 5 y - 5 p + v = - 5 that contains the variable v that is negative and try to bring v up to 0 keeping the remaining variables non-negative. To do this we do one or more pivots to increase v up to 1 2 16 0. We rewrite the constraint as - 5 y + 5 p = - 5 + v. Can we increase v by increasing some non-basic variable from 0 to a positive value? The answer is yes if some non-basic variable has a positive coefficient. The non-basic variable y 2 has the largest coefficient which is 5 which is positive. How far can we increase p keeping y = 0 and keeping v 0 and keeping x (defined by the first constraint) also non1 2 16 negative. First consider the constraint - 5 y + 5 p = - 5 + v. Putting y = 0 this becomes 2 p 5 16 = - 5 + v Since v 0 this becomes 2 p 5 16 - 5 p 8 So if we could increase p up to 8 this would increase v up to 0. However, we must consider the other constraint 3 1 7 x + 5 y - 5 p = 5. Here we need to keep x 0. So we put in y = 0 and x 0 which gives 1 7 - 5p 5 p -7 So we need to keep p larger than – 7 which is no problem, since we are going to keep it non-negative. So we increase p up to 8 which increases v up to 0. So we do a pivot swapping p and v. 2 We divide the pivot equation E2 by - 5 so that p becomes a basic variable and v a non-basic variable. This gives 1 5 -2y + p - 2v = -8 E2'' We then use this equation to eliminate p from the objective function E0 and the other constraint E1. After doing this the problem has become 1.7 - 3 Minimize 7 2 1 y E0'' + 2v = -3 + c subject to 1 x - 2y 1 E1'' 5 E2'' - 2v = 3 1 -2y + p - 2v = 8 x 0, y 0, v 0, p 0 The basic variables are now x and p and the non-basic variables are y and v and we are now at the vertex (x, y, p, v) = (3, 0, 8, 0) and c = 3. All the variables x, y, v and p are non-negative so we are at a feasible vertex at which to start the basic simplex algorithm. Since the coefficients of y and v in the objective function E0'' are positive, we can not make c any smaller than 3. So we have found the minimum of c and we don't need to do any more iterations. If some coefficients were negative we would do more iterations to reduce c further. Objective function value: 3 Structure variables: Variable x y Value 3 0 Coefficient increase in order_ to increase value from 0 0 7 2 Slack variables Variable p Slack 8 v 0 Dual price 0 7 2 In other words we eat 3 lbs of ham and no eggs. We satisfy the vitamin constraint exactly, but we eat 8 units of protein more than we need to. The price of eggs would have to be reduced by $3.50/doz from $4/doz to $0.50/doz in order that they be competitive with ham. The dual price of $0.50 for vitamins means that Bill should be willing to pay up to $0.50/gm for vitamin pills. Example 2. Consider the problem Minimize c = x + 4y subject to -x - y 7 x 0, y 0 1.7 - 4 If x and y are non negative the - x - y 0. So it is impossible to satisfy the constraint -x - y 6. So there is no feasible solution for this problem. Problem 1. Minimize c = 7x + 3y + 8z subject to 8x + 2y + z 3, 3x + 6y + 4z 4, 4x + y +5z 1, x + 5y + 2z 7 and x 0, y 0, z 0. (For a solution, see Example 1.10.5 in section 1.10 of the Notes.) 1.7 - 5