Unformatted text preview: Online Tutorial The Simplex Method of Linear Programming
CONVERTING THE CONSTRAINTS TO EQUATIONS SETTING UP THE FIRST SIMPLEX TABLEAU SIMPLEX SOLUTION PROCEDURES SUMMARY OF SIMPLEX STEPS FOR MAXIMIZATION PROBLEMS ARTIFICIAL AND SURPLUS VARIABLES SOLVING MINIMIZATION PROBLEMS SUMMARY KEY TERMS SOLVED PROBLEM DISCUSSION QUESTIONS PROBLEMS 3 T3-2 O N L I N E T U T O R I A L 3 THE SIMPLEX METHOD OF L I N E A R P RO G R A M M I N G Most real-world linear programming problems have more than two variables and thus are too complex for graphical solution. A procedure called the simplex method may be used to find the optimal solution to multivariable problems. The simplex method is actually an algorithm (or a set of instructions) with which we examine corner points in a methodical fashion until we arrive at the best solution--highest profit or lowest cost. Computer programs and spreadsheets are available to handle the simplex calculations for you. But you need to know what is involved behind the scenes in order to best understand their valuable outputs. 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, which represent the amount of an unused resource. We formulate the Shader Electronics Company's product mix problem as follows, using linear programming: Maximize profit = $7X1 + $5X2 subject to LP constraints: 2 X1 + 1X2 100 4 X1 + 3 X2 240 where X1 equals the number of Walkmans produced and X2 equals the number of Watch-TVs produced. To convert these inequality constraints to equalities, we add slack variables S1 and S2 to the left side of the inequality. The first constraint becomes 2X1 + 1X2 + S1 = 100 and the second becomes 4X1 + 3X2 + S2 = 240 To include all variables in each equation (a requirement of the next simplex step), we add slack variables not appearing in each equation with a coefficient of zero. The equations then appear as 2 X1 + 1X2 + 1S1 + 0 S2 = 100 4 X1 + 3 X2 + 0 S1 + 1S2 = 240 Because slack variables represent unused resources (such as time on a machine or labor-hours available), they yield no profit, but we must add them to the objective function with zero profit coefficients. Thus, the objective function becomes Maximize profit = $7X1 + $5X2 + $0S1 + $0S2 SETTING UP THE FIRST SIMPLEX TABLEAU
To simplify handling the equations and objective function in an LP problem, we place all of the coefficients into a tabular form. We can express the preceding two constraint equations as
SOLUTION MIX S1 S2 X1 2 4 X2 1 3 S1 1 0 S2 0 1 QUANTITY (RHS) 100 240 The numbers (2, 1, 1, 0) and (4, 3, 0, 1) represent the coefficients of the first equation and second equation, respectively. SETTING UP THE F I R S T S I M P L E X T A B L E AU T3-3 As in the graphical approach, we begin the solution at the origin, where X 1 = 0, X 2 = 0, and profit = 0. The values of the two other variables, S1 and S2, then, must be nonzero. Because 2X1 + 1X2 + 1S1 = 100, we see that S1 = 100. Likewise, S2 = 240. These two slack variables comprise the initial solution mix--as a matter of fact, their values are found in the quantity column across from each variable. Because X1 and X2 are not in the solution mix, their initial values are automatically equal to zero. This initial solution is called a basic feasible solution and can be described in vector, or column, form as X1 0 X 0 2 = S1 100 S2 240 Variables in the solution mix, which is 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. Table T3.1 shows the complete initial simplex tableau for Shader Electronics. The terms and rows that you have not seen before are as follows: 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 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. The calculations for the values of Zj in Table T3.1 are as follows: Z j ( for column X1 ) = 0(2) + 0( 4) = 0 Z j ( for column X2 ) = 0(1) + 0(3) = 0 Z j ( for column S1 ) = 0(1) + 0(0) = 0 Z j ( for column S2 ) = 0(0) + 0(1) = 0 Z j ( for total profit ) = 0(100) + 0(240) = 0 Cj 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, we simply subtract the Zj total from the Cj value at the very top of each variable's column. The calculations for the net profit per unit (Cj Zj) row in this example are as follows:
COLUMN X2 S1 $5 0 $5 $0 0 $0 X1 Cj for column Zj for column Cj Zj for column $7 0 $7 S2 $0 0 $0 It was obvious to us when we computed a profit of $0 that this initial solution was not optimal. Examining numbers in the Cj Zj row of Table T3.1, we see that total profit can be increased by $7 for each unit of X1 (Walkmans) and by $5 for each unit of X2 (Watch-TVs) 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. T3-4 O N L I N E T U T O R I A L 3
Completed Initial Simplex Tableau THE SIMPLEX METHOD
Cj $0 $0 Cj OF L I N E A R P RO G R A M M I N G
$7 $5 X2 1 3 $0 $5 $0 S1 1 0 $0 $0 $0 S2 0 1 $0 $0 QUANTITY (RHS) 100 240 $0 (total profit) SOLUTION MIX S1 S2 Zj Zj X1 2 4 $0 $7 SIMPLEX SOLUTION PROCEDURES
Once we have completed an initial tableau, we proceed through a series of five steps to compute all of the numbers we need for the next tableau. The calculations are not difficult, but they are sufficiently complex that the smallest arithmetic error can produce a very wrong answer. We first list the five steps and then apply them in determining the second and third tableau for the data in the Shader Electronics example. 1. Determine which variable to enter into the solution mix next. Identify the column-- hence the variable--with the largest positive number in the Cj Zj row of the previous tableau. This step means that we will now be producing some of the product contributing the greatest additional profit per unit. 2. Determine which variable to replace. Because we have just chosen a new variable to enter into the solution mix, we must decide which variable currently in the solution to remove to make room for it. To do so, we divide each amount in the quantity column by the corresponding number in the column selected in step 1. 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 that we may place in the solution). This row is often referred to as the pivot row, and the column identified in step 1 is called the pivot column. The number at the intersection of the pivot row and pivot column is the pivot number. 3. Compute new values for the pivot row. To find them, we simply divide every number in the row by the pivot number. 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 in old row corresponding number in New row = numbers - above or below the new row, i.e., the row numbers in old row replaced in step 3 pivot number 5. Compute the Zj and Cj Zj rows, as demonstrated in the initial tableau. If all numbers in the Cj Zj row are zero or negative, we have found an optimal solution. If this is not the case, we must return to step 1. All of these computations are best illustrated by using an example. The initial simplex tableau computed in Table T3.1 is repeated below. We can follow the five steps just described to reach an optimal solution to the LP problem.
Cj 1ST TABLEAU $7 SOLUTION MIX pivot number S1 S2 Zj Cj Zj X1 2 4 $0 $7 $5 X2 1 3 $0 $5 $0 S1 1 0 $0 $0 $0 S2 0 1 $0 $0 QUANTITY 100 pivot 240 row $0 $0 $0 $0 pivot column (maximum Cj Zj values) S I M P L E X S O L U T I O N P RO C E D U R E S
Step 1: Variable X1 enters the solution next because it has the highest contribution to profit value, Cj Its column becomes the pivot column. T3-5
Zj. Step 2: Divide each number in the quantity column by the corresponding number in the X1 column: 100/2 = 50 for the first row and 240/4 = 60 for the second row. The smaller of these numbers--50--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 shown in the second tableau. Step 3: Replace the pivot row by dividing every number in it by the pivot number (2/2 = 1, 1/2 = 1/2, 1/2 = 1/2, 0/2 = 0, 100/2 = 50). This new version of the entire pivot row appears below: Cj $7 SOLUTION MIX X1 X1 1 X2 1/2 S1 1/2 S2 0 QUANTITY 50 Step 4: Calculate the new values for the S2 row. number below Number in number in new S row = old S row - pivot number 2 2 in old row = - [( 4) 0 4 = - [( 4) 1 3 -2 = - [( 4) 0 = - [( 4) 1 1 = - [( 4) 40 240 corresponding number in the new X1 row (1)] (1/ 2)] (1/ 2)] (0)] (50)] Cj $7 0 SOLUTION MIX X1 S2 Zj rows. X1 1 0 X2 1/2 1 S1 1/2 2 S2 0 1 QUANTITY 50 40 Step 5: Calculate the Zj and Cj Z j ( for X1 column ) Z j ( for X2 column ) Z j ( for S1 column ) Z j ( for S2 column ) Z j ( for total profit ) Cj $7 SOLUTION MIX X1 S2 Zj Cj Zj X1 = $7(1) + 0(0) = $7 = $7(1/ 2) + 0(1) = $7 / 2 = $7(1/ 2) + 0( -2) = $7 / 2 = $7(0) + 0(1) = 0 = $7(50) + 0( 40) = $350 $5 X2 1/2 1 $7/2 $3/2 pivot column $0 S1 1/2 2 $7/2 $ 7/2 C j - Z j = $7 - $7 = 0 C j - Z j = $ 5 - $7 / 2 = $ 3 / 2 C j - Z j = 0 - $7 / 2 = -$7 / 2 Cj - Z j = 0 - 0 = 0 $0 S2 0 1 $0 $0 QUANTITY 50 40 pivot row $350 (total profit) 2ND TABLEAU $7 $0 pivot number 1 0 $7 $0 Because not all numbers in the Cj Zj row of this latest tableau are zero or negative, the solution (that is, X1 = 50, S2 = 40, X2 = 0, S1 = 0; profit = $350) is not optimal; we then proceed to a third tableau and repeat the five steps. T3-6 O N L I N E T U T O R I A L 3 THE SIMPLEX METHOD OF L I N E A R P RO G R A M M I N G Step 1: Variable X2 enters the solution next because its Cj Zj = 3/2 is the largest (and only) positive number in the row. Thus, 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 40/1 = 40 is smaller than the ratio 50 /( 1 ) = 100. 2 Step 3: Replace the pivot row by dividing every number in it by the (circled) pivot number. Because every number is divided by 1, there is no change. Step 4: Compute the new values for the X1 row. corresponding Number in number in number above new X row = old X row - pivot number number in the 1 1 new X2 row 1 1 = - [(1/ 2) (0)] 0 1/ 2 = - [(1/ 2) (1)] 3/ 2 1/ 2 = - [(1/ 2) ( -2)] 0 -1 / 2 = - [(1/ 2) (1)] 30 50 = - [(1/ 2) ( 40)] Step 5: Calculate the Zj and Cj Z j ( for X1 column ) Z j ( for X2 column ) Z j ( for S1 column ) Z j ( for S2 column ) Z j ( for total profit ) Zj rows. = $7(1) + $5(0) = $7 = $7(0) + $5(1) = $5 = $7(3 / 2) + $5( -2) = $1/ 2 = $7( -1/ 2) + $5(1) = $3 / 2 = $7(30) + $5( 40) = $410 C j - Z j = $7 - 7 = $0 C j - Z j = $5 - 5 = $0 C j - Z j = $0 - 1/ 2 = $ -1/ 2 C j - Z j = $0 - 3 / 2 = $ - 3 / 2 The results for the third and final tableau are seen in Table T3.2. Because every number in the third tableau's Cj Zj row is zero or negative, we have reached an optimal solution. That solution is: X1 = 30 (Walkmans), and X2 = 40 (Watch-TVs), S1 = 0 (slack in first resource), S2 = 0 (slack in second resource), and profit = $410.
Completed Initial Simplex Tableau Cj $7 $5 $7 SOLUTION MIX X1 X2 Zj Cj Zj X1 1 0 $7 $0 $5 X2 0 1 $5 $0 $0 S1 3/2 2 $1/2 $1/2 $0 S2 1/2 1 $3/2 $3/2 QUANTITY 30 40 $410 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 follows: 1. Choose the variable with the greatest positive Cj Zj to enter the solution. 2. Determine the row to be replaced by selecting the one with the smallest (non-negative) ratio of quantity to pivot column. 3. Calculate the new values for the pivot row. 4. Calculate the new values for the other row(s). 5. Calculate the Cj and Cj Zj values for this tableau. If there are any Cj Zj numbers greater than zero, return to step 1. S O LV I N G M I N I M I Z AT I O N P RO B L E M S T3-7 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. Just as common are "greater-than-or-equal-to" () constraints and equalities. To use the simplex method, each of these also must be converted to a special form. If they are not, the simplex technique is unable to set an initial feasible solution in the first tableau. Example T1 shows how to convert such constraints. Example T1 The following constraints were formulated for an LP problem for the Joyce Cohen Publishing Company. We shall convert each constraint for use in the simplex algorithm. Constraint 1. equation: 25X1 + 30X2 = 900. To convert an equality, we simply add an "artificial" variable (A1) to the 25X1 + 30X2 + A1 = 900 An 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 is not allowed to appear in the final solution to the problem. Constraint 2. 5X1 + 13X2 + 8X3 2,100. To 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,100 A surplus variable does have a physical meaning--it is the amount over and above a required minimum level set on the right-hand side of a greater-than-or-equal-to constraint. 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 the final solution. Rather than set an actual dollar figure of $10,000 or $1 million, however, we simply use the symbol $M to represent a very large number. Surplus variables, like slack variables, carry a zero cost. Example T2 shows how to figure in such variables. Example T2 The Memphis Chemical Corp. must produce 1,000 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. Let X1 = number of pounds of phosphate in the mixture X2 = number of pounds of potassium in the mixture Objective function: minimize cost = $5X1 + $6X2. Objective function in simplex form: Minimize costs = $5X1 + $6X2 + $0S1 + $0S2 + $MA1 + $MA2 Regular Form 1st constraint: 1X1 + 1X2 = 1,000 2nd constraint: 1X1 300 3rd constraint: 1X2 150 Simplex Form 1X1 + 1X2 1X1 + 1S1 1X2 + 1A1 1S2 = 1,000 = 300 + 1A2 = 150 SOLVING MINIMIZATION PROBLEMS
Now that you have worked a few examples of LP problems with the three different types of constraints, you are ready to solve a minimization problem using the simplex algorithm. Minimization problems are quite similar to the maximization problem tackled earlier. The one significant difference involves the Cj Zj row. Because our objective is now to minimize costs, the new variable to T3-8 O N L I N E T U T O R I A L 3 THE SIMPLEX METHOD OF L I N E A R P RO G R A M M I N G 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. All other simplex steps, as shown, remain the same. 1. Choose the variable with the largest negative Cj Zj to enter the solution. 2. Determine the row to be replaced by selecting the one with the smallest (non-negative) quantity-to-pivot-column ratio. 3. Calculate new values for the pivot row. 4. Calculate new values for the other rows. 5. Calculate the Cj Zj values for this tableau. If there are any Cj Zj numbers less than zero, return to step 1. SUMMARY This tutorial treats a special kind of model, linear programming. LP has proven to be especially useful when trying to make the most effective use of an organization's resources. All LP problems can also be solved with the simplex method, either by computer or by hand. This method is more complex mathematically than graphical LP, but it also produces such valuable economic information as shadow prices. LP is used in a wide variety of business applications. KEY TERMS Simplex method (p. T3-2) Pivot row (p. T3-4) Pivot column (p. T3-4) Pivot number (p. T3-4) Surplus variable (p. T3-7) SOLVED PROBLEM
Solved Problem T3.1
Convert the following constraints and objective function into the proper form for use in the simplex method. Objective function: Subject to the constraints: Minimize cost = 4X1 + 1X2 3X1 + X2 = 3 4X1 + 3X2 6 X1 + 2X2 3 Solution
Minimize cost = 4X1 + 1X2 + 0S1 + 0S2 + MA1 + MA2 Subject to: 3X1 + 1X2 4X1 + 3X2 1S1 1X1 + 2X2 + 1S2 + 1A1 =3 + 1A2 = 6 =3 DISCUSSION QUESTIONS
1. Explain the purpose and procedures of the simplex method. 2. How do the graphic and simplex methods of solving linear programming problems differ? In what ways are they the same? Under what circumstances would you prefer to use the graphic approach? 3. What are the simplex rules for selecting the pivot column? The pivot row? The pivot number? 4. A particular linear programming problem has the following objective function: Maximize profit = $8X1 + $6X2 + $12X3 $2X4 Which variable should enter at the second simplex tableau? If the objective function was Minimize cost = $2.5X1 + $2.9X2 + $4.0X3 + $7.9X4 which variable would be the best candidate to enter the second tableau? 5. To solve a problem by the simplex method, when are slack variables added? 6. List the steps in a simplex maximization problem. 7. What is a surplus variable? What is an artificial variable? P RO B L E M S T3-9 PROBLEMS*
: T3.1 Each coffee table produced by John Alessi Designers nets the firm a profit of $9. Each bookcase yields a $12 profit. Alessi's firm is small and its resources limited. During any given production period (of one week), 10 gallons of varnish and 12 lengths of high-quality redwood are available. Each coffee table requires approximately 1 gallon of varnish and 1 length of redwood. Each bookcase takes 1 gallon of varnish and 2 lengths of wood. Formulate Alessi's production mix decision as a linear programming problem and solve, using the simplex method. How many tables and bookcases should be produced each week? What will the maximum profit be? a) Set up an initial simplex tableau, given the following two constraints and objective function: 1X1 + 4 X2 24 1X1 + 2 X2 16 Maximize profit = $3 X1 + $9 X2 You will have to add slack variables. Briefly list the iterative steps necessary to solve the problem in part (a). Determine the next tableau from the one you developed in part (a). Determine whether it is an optimum solution. If necessary, develop another tableau and determine whether it is an optimum solution. Interpret this tableau. Start with the same initial tableau from part (a) but use X1 as the first pivot column. Continue to iterate it (a total of twice) until you reach an optimum solution. Solve the following linear programming problem graphically. Then set up a simplex tableau and solve the problem, using the simplex method. Indicate the corner points generated at each iteration by the simplex on your graph. Maximize profit = $3X1 + $5X2 Subject to: X2 X1, X2 6 0 3X1 + 2X2 18 P : T3.2 b) c) d) e) P : T3.3 P : T3.4 Solve the following linear programming problem, first graphically and then by simplex algorithm. Minimize cost = 4X1 + 5X2 Subject to: X1 + 2X2 80 3X1 + X2 75 X1, X2 0 What are the values of the basic variables at each iteration? Which are the nonbasic variables at each iteration? P : T3.5 Barrow Distributors packages and distributes industrial supplies. A standard shipment can be packaged in a Class A container, a Class K container, or a Class T container. A single Class A container yields a profit of $8; a Class K container, a profit of $6; and a Class T container, a profit of $14. Each shipment prepared requires a certain amount of packing material and a certain amount of time. Resources Needed per Standard Shipment Class of Container A K T Total amount of resource available each week Packing Material (pounds) 2 1 3 120 pounds PackingTime (hours) 2 6 4 240 hours *Note: OM; and means the problem may be solved with POM for Windows; means the problem may be solved with Excel P means the problem may be solved with POM for Windows and/or Excel OM. T3-10 O N L I N E T U T O R I A L 3 THE SIMPLEX METHOD OF L I N E A R P RO G R A M M I N G Joe Barrow, head of the firm, must decide the optimal number of each class of container to pack each week. He is bound by the previously mentioned resource restrictions but also decides that he must keep his six fulltime packers employed all 240 hours (6 workers 40 hours) each week. Formulate and solve this problem, using the simplex method. : T3.6 Set up a complete initial tableau for the data (repeated below) that were first presented in Solved Problem T3.1. Minimize cost = 4X1 + 1X2 + 0S1 + 0S2 + MA1 + MA2 Subject to: 3X1 + 1X2 + 1A1 =3 4X1 + 3X2 1S1 + 1A2 = 6 1X1 + 2X2 + 1S2 =3 a) b) Which variable will enter the solution next? Which variable will leave the solution? Solve Problem T3.6 for the optimal solution, using the simplex method. P : T3.7 ...
View Full Document