2 Simplex MethodMost real-world linear programming problems have more than two variables and are thus too large for a graphical solution procedure. A procedure called the simplex method may be used to find the optimal solution instead. The simplex method is actually an algorithm (or a et of instructions) which examines corner points in a methodical fashion until the best solution—higher profit or lowest cost—is found. Computer programs have been. written to solve LP problems with as many as several thousand variables, but it is still useful to understand the mechanics of the algorithm.
3 CONVERTING THE CONSTRAINTS TO EQUATIONS The first step of the simplex method requires that we convert each inequality constraint in an LP formulation into an equation. Less-than or equal-to constraints (≤) can be converted to equations by adding slack variables, as illustrated in Example 10.1
4 EXAMPLE 10.1The Flair Furniture Company’s product mix problem was formulated using linear programming, in Unit 9, as follows:Maximize profit = 7X1 + 5X2subject to: X1 + 1X2 ≤ 104X1 + 3X2 ≤ 24To convert these inequality constraints to equalities, we add slack variables S1 and S2 to the left side of the inequality.The first constraint becomes2X1 +1X2 + S1 = 10and the second becomes4X1 +3X2 + S2 = 24
5 To include all variables in each equation (a requirement of the next simplex step), slack variables not appearing in each equation are added with a coefficient of zero. The equations then appear as:2X1 + 1X2 + 1S1 + 0S2 = 104X1 + 3X2 + 0S1 + 1S2 = 24Since slack variables represent unused resources (such as time on a machine or man-hours available), they yield no profit but must be added to the objective function with zero profit coefficients. Thus, the objective function becomes:maximize profit = 7X1 + 5X2 + 0S1 + 0S2
6 SETTING UP THE FIRST SIMPLEX TABLEAU To simplify handling the equations and objective function in an LP problem, we place all the coefficients into a tabular form. The two constraint equations of Example 10.1 could be expressed as:SolutionMixQuantity(RHS)X1X2S1S2S1S21024241311
7 The constants on the right-hand side (RHS) of the equality have been moved to the left of the table for convenience. The numbers (2,1,1,0) and (4,3,0,1) represent the coefficients of the first equation and second equation, respectively.As in the graphical approach of Unit 9, we begin the initial solution procedure at the origin, where X1 = 0, X2 = 0, and profit = $0. The values of the two other variables must then be nonzero. Since 2X1 + 1X2 + 1S1 = 10, we see that S1 = 10. Likewise,S2 = 24. These two slack variables comprise the initial solution mix—as a matter of fact, their values are found in the quantity column next to each variable. Since X1 and X2 are not in the solution mix, their initial values are automatically equal to zero.
8 In many management science and operations research books, this initial solution is termed a basic feasible solution and is described in vector, or column, form asX1X2S1S21024=
9 Variables in the solution mix, often called the basis in LP terminology, are referred to as basic variables. In this example, the basic variables are S1 and S2 . Variables not in the solution mix or basis (X1 and X2 in this case) are called nonbasic variables. Of course, if the optimal solution to this LP problem turned out to be X1= 3, X2= 4, S1= 0, and S2= 0, orX1X2S1S234=Then X1 and X2 would be the final basic variables, while S1 and S2 would be the nonbasic variables.
10 EXAMPLE 10.2Let us complete the initial simplex tableau for the example above.$ $ $ $0CjSolutionMixQuantity(RHS)X X S S2$0S1S21024241311ZjCj - Zj$0(total profit)$0$7$0$5$0$0
11 The terms and rows which you have not seen before are described below. Cj: profit contribution per unit of each variable. Cj applies to both the top row and first column. In the row it indicates the unit profit for all variables given in the LP objective function. In the column, Cj indicates the unit profit for each variable currently in the solution mix.Zj: In the quantity column, Zj provides the total contribution (gross profit in this case) of the given solution. In the other columns (under the variables) it represents the gross profit given up by adding one unit of this variable into the current solution. The Zj value for each column is found by multiplying the Cj of the row by the number in that row and jth column, and summing.
12 The calculations for the Z in the table are as follows: Zj (for total profit) = ($0)(l0) + ($0)(24) = $0Zj (for column X1) = ($0)(2) + ($0)(4) = $0Zj (for column X2) = ($0)(l) + ($0)(3) = $0Zj (for column S1( = ($0)(l) + ($0)(0) = $0Zj (for column S2) = ($0)(0) +($0)(l) = $0Cj - Zj: This number represents the net profit (that is, the profit gained minus the profit given up), which will result from introducing one unit of each product (variable) into the solution. It is not calculated for the quantity column. To compute these numbers, simply subtract the total from the Cj value at the very top of each variable’s column.
13 The calculations for the net profit per unit (Cj - Zj) row in this example are: ColumnX X S S2Cj for column:$ $ $ $0Zj for column:$ $ $ $0Cj – Zj for column$ $ $ $0
14 It was obvious to us when we computed a profit of $0 that this initial solution was not optimal. By examining numbers in the Cj - Zj row of the table in Example 10.2, we see that total profit can be increased by $7 for each unit of X1 (tables) and by $5 for each unit of X2 (chairs) added to the solution mix. A negative number in the Cj - Zj row would tell us that profits would decrease if the corresponding variable were added to the solution mix. An optimal solution is reached in the simplex method when the Cj - Zj row contains no positive numbers. Such is not the case in our initial tableau.
15 SIMPLEX SOLUTION PROCEDURES Once an initial tableau has been completed, we proceed through a series of five steps to compute all the numbers needed in the next tableau. The calculations are not difficult, but they are complex enough that the smallest arithmetic error can produce a very wrong answer.We shall first list the five steps and then apply them in determining the second and third tableaus for the data in Example 10.2
16 Step 1: Determine which variable to enter into the solution mix next Step 1: Determine which variable to enter into the solution mix next. This is done by identifying the column (and hence, variable) with the largest positive number in the Cj - Zj row of the previous tableau. This means that we will now be producing some of the product contributing the greatest additional profit/unit.Step 2: Determine which variable to replace. Since we have just chosen anew variable to enter the solution mix, we must decide which variable currently in the solution will have to leave to make room for it. Step 2 is accomplished by dividing each amount in the quantity column by the corresponding number in the column selected in step1. The row with the smallest nonnegative number calculated in this fashion will be replaced in the next tableau. (This smallest number, by the way, gives the maximum number of units of the variable which may be placed in the solution.) This row is often referred to as the pivot row, and the column identified in step 1 called the pivot column. The number at the intersection of the pivot row and column is referred to as the pivot number.
17 corresponding number in Step 3: Compute new values for the pivot row. To do this, we simply divide every number in the row by the pivot number.Step 4: Compute new values for each remaining row. (In our sample problems there have been only two rows in the LP tableau, but most larger problems have many more rows.) All remaining row(s) are calculated as follows:number above orbelow pivotnumber= (numbers in old row)X(new row numbers)corresponding number inthe new row, i.e., therow replaced in step 3
18 Step5: Compute the and Cj - Zj rows, as previously demonstrated in the initial tableau. If all numbers in the Cj - Zj row are zero or negative, an optimal solution has been reached, If this is not the case, return to step 1.All these computations are best illustrated by way of an example, and best understood by way of several practice problems.
19 EXAMPLE 10.3The initial simplex tableau completed in the table in Example 10.2 is repeated below. We shall follow the five steps just given until an optimal solution to the LP problem is reached.$ $ $ $0CjSolutionMixQuantity(RHS)X X S S2Pivotrow$0S1S21024241311Pivot numberZjCj - Zj$0$0$7$0$5$0$0Pivot column
20 Step 1: Variable X will enter the solution next because it has the highest contribution to profit value, Cj - Zj: Its column becomes the pivot column (identified with an arrow).Step 2: Each number in the quantity column is divided by the corresponding number in the X1 column: 10/2 = 5 for the first row and 24/4 = 6 for the second row. The smaller of these, 5, identifies the pivot row, the pivot number, and the variable to be replaced. The pivot row is identified above by an arrow and the pivot number is circled. Variable X1 replaces variable S1 in the solution mix column, as seen in the second tableau.Step 3: The pivot row is replaced by dividing every number in it by the pivot number (10/2 = 5, 2/2 = 1, 1/2 = 1/2, 1/2 = 1/2, 0/2 = 0). This new version of the entire pivot row appears below.
21 (corresponding number CjSolution MixQuantityX X S S2.$7X1511/21/2Step 4: The new values for the S2 row are calculated.(number innew S2 row)(number belowpivot number)(corresponding numberIn the new X1 row)(number inold S2 row)=-XX=-54244-X144-X1/2134-4X1/2-2X-411
23 2nd tableau$ $ $ $0CjSolutionMixQuantityX X S S2$7$0X1S25411/211/2-21PivotrowPivot numberZjCj - Zj$35total profit$7$0$7/2$3/2$7/2-$7/2$0Pivot column
24 Since not all numbers in the Cj – Zj row of this latest tableau are zero or negative, the above solution (that is, X1 = 5, S2 = 4, X2 = 0, S1 = 0, profit = $35) is not optimal arid we proceed to a third tableau and repeat the five steps.Step 1: Variable X2 will enter the solution next by virtue of the fact that its Cj - Zj = 3/2 is the largest (and only) positive number in the row. This means that for every unit of X2 that we start to produce, the objective function will increase in value by $3/2, or $1.50.Step 2: The pivot row becomes the S2 row because the ratio 4/1 = 4 is smaller than the ratio 5/(1/2) = 10.Step 3: The pivot row is replaced by dividing every number in it by the (circled) pivot number. Since every number is divided by 1, there is no change.
25 (corresponding number Step 4: The new values for the X row are computed:(number innew X1 row)(number abovepivot number)(corresponding numberIn the new X2 row)(number inold X1 row)=-XX=-4351/2-X111/2-X11/21/2-1/2X-23/21/2X1-1/2-1/2
26 Step 5: The Z and Cj - Zj rows are calculated. Zj (for total profit) = ($7)(3) + ($5)(4) = $41Zj (for X1 column) = ($7)(1) + ($5)(0) = $7Zj (for X2 column) = ($7)(0) + ($5)(1) = $5Zj (for S1 column) = ($7)(3/2) + ($5)(-2) = $1/2Zj (for S2 column) = ($7)(-1/2) + ($5)(1) = $3/2
27 3rd tableau$ $ $ $0CjSolutionMixQuantityX X S S2$7$5X1X234113/2-2-1/21ZjCj - Zj$41$7$0$5$0$1/2-$1/2$3/2-$3/2
28 Since every number in the third tableau’s Cj - Zj row is zero or negative, an optimal solution has been reached. That solution is: X1 = 3 (tables), and X2 = 4 (chairs),S1 = 0 (slack in 1st resource), S2 = 0 (slack in 2nd resource), and profit = $41.It is interesting to compare the step-by-step solutions found in each simplex tableau above with the graphical corner-point solutions that we found in the last unit.
29 SUMMARY OF SIMPLEX STEPS FOR MAXIMIZATION PROBLEMS The steps involved in using the simplex method to help solve an LP problem in which the objective function is to be maximized can be summarized as:Choose the variable with the greatest positive Cj - Zj to enter the solution.Determine the row to be replaced by selecting the one with the smallest (nonnegative) quantity to pivot column ratio.Calculate the new values for the pivot row.Calculate the new values for the other row(s).Calculate the Cj and Cj - Zj values for this tableau. If there are any Cj - Zj greater than zero, return to step 1.
30 ARTIFICIAL AND SURPLUS VARIABLES Constraints in linear programming problems are seldom all of the “less-than-or-equal-to” (≤) variety seen in the examples thus far in this unit. Just as common are “greater-than-or-equal-to” (≥) constraints and equalities. To use the simplex method, each of these must be converted to a special form also. If they are not, the simplex technique is unable to set an initial feasible solution in the first tableau.
31 EXAMPLE 10.4The following constraints were formulated for an LP problem for the Baby Doll Company. We shall convert each for use in the simplex algorithm.Constraint 1: 25X1 + 30X2 = 900To convert an equality, we simply add an “artificial” variable (A1) to the equation:25X1 +30X2 +A1 = 900An artificial variable is a variable that has no physical meaning in terms of a real-world LP problem. It simply allows us to create a basic feasible solution to start the simplex algorithm. An artificial variable may not appear in the final solution to the problem.
32 Constraint 2: 5X1 + 13X2 + 8X3 ≥ 2,100To handle ≥ constraints, a “surplus” variable (S1) is first subtracted and then an artificial variable (A2) is added to form a new equation:5X1 + 13X2 + 8X3 - S1 + A2 = 2,100A surplus variable does have a physical meaning—that being the amount over and above a required minimum level set on the right-hand side of a greater-than-or-equal-to constraint.
33 Whenever an artificial or surplus variable is added to one of the constraints, it must also be included in the other equations and in the problem’s objective function, just as was done for slack variables. Each artificial variable is assigned an extremely high cost to ensure that it does not appear in he final solution. Rather than set an actual dollar figure of $10,000 or $1,000,000, however, we simply use the symbol SM to represent a very large number. Surplus variables, like slack variables, carry a zero cost.
34 EXAMPLE 10.5The Muddy River Chemical Corp. must produce 1000 lb of a special mixture of phosphate and potassium for a customer. Phosphate costs $5/lb and potassium costs $6/lb. No more than 300 lb of phosphate can be used and at least 150 lb of potassium must be used.We wish to formulate this as a linear programming problem and to convert the constraints and objective function into the form needed for the simplex algorithm.LetX1 number of pounds of phosphate in the mixtureX2= number of pounds of potassium in the mixture
36 SOLVING MINIMIZATION PROBLEMS Now that we have illustrated a few examples of LP problems with the three different types of constraints, we are ready to solve a minimization problem using the simplex algorithm. Minimization problems are quite similar to the maximization problems tackled earlier in this unit. The one significant difference involves the row. Since our objective is now to minimize costs, the new variable to enter the solution in each tableau (the pivot column) will be the one with the largest negative number in the Cj-Zj row. Thus, we will be choosing the variable that decreases costs the most. In minimization problems, an optimal solution is reached when all numbers in the Cj-Zj row are zero or positive—just the opposite from the maximization case.
37 All other simplex steps, as seen below, remain the same. Choose the variable with the largest negative Cj-Zj to enter the solution.Determine the row to be replaced by selecting the one with the smallest (nonnegative) quantity to pivot column ratio.Calculate new values for the pivot row.Calculate new values for the other rows.Calculate the Cj-Zj values for this tableau. If there are any Cj-Zj numbers less than zero, return to step1.
38 EXAMPLE 10.6Let us begin to solve Muddy River Chemical’s LP formulation of Example 10.5 using the simplex algorithm. The initial tableau is set up just as in earlier examples. We note the presence of the $M costs associated with artificial variables A1 and A2 but treat them as if they were any large number. They have the effect of forcing the artificial variables out of the solution quickly because of their large costs.
39 $ $ $ $ $M $MCjSolutionMixQuantityX X S S A A2$M$0A1S1A21,000300150111-111
40 As you recall, the numbers in the row are computed by multiplying the C column on the far left of the tableau times the corresponding numbers in each other columnZj (for total cost) = ($M)(1,000) + ($0)(300)+ ($M)(l50) = $1 ,150MZj (for X1 column) = ($M)(1) + ($0)(1)+ ($M)(0) = $MCj-Zj = $5 – M = -$M + 5Zj (for X2 column) = ($M)(1) + ($0)(0)+ ($M)(1) = $2MCj-Zj = $6 – 2M = -$2M + 6
42 Zj (for A2 column) = ($M)(0) + ($0)(0) + ($M)(1) = $M Cj-Zj = $M – M = $0$ $ $ $ $M $MCjSolutionMixQuantityX X S S A A2$M$0A1S1A21,000300150111-111ZjCj - Zj$1,150 M(total cost)$M $2M $ $M $M $M-$M $2M $ $M $ $0
43 Variable X2 will enter the solution next because it has the largest negative Cj-Zj entry. Variable A2 will be removed from the solution because the ratio 150/1 is smaller than the ratios of the quantity column numbers to the corresponding X2 column numbers in the other two rows. That is, 150/1 (the third or A2 row) is less than 1,000/1 (the first row) and less than 300/0 (the second row). This latter ratio, by the way, involving division by zero, is considered an undefined number—or one that is infinitely large—and hence we may ignore it.The numbers in the pivot row do not change, in this case, because they are each divided by the (circled) pivot number, that is, 1. The other rows are altered as fol1ows: