Presentation is loading. Please wait.

Presentation is loading. Please wait.

SIMPLEX METHOD. Simplex Method Most real-world linear programming problems have more than two variables and are thus too large for a graphical solution.

Similar presentations


Presentation on theme: "SIMPLEX METHOD. Simplex Method Most real-world linear programming problems have more than two variables and are thus too large for a graphical solution."— Presentation transcript:

1 SIMPLEX METHOD

2 Simplex Method Most 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 solutionhigher profit or lowest costis 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.1 The Flair Furniture Companys product mix problem was formulated using linear programming, in Unit 9, as follows: Maximize profit = 7X 1 + 5X 2 subject to: 2X 1 + 1X X 1 + 3X 2 24 To convert these inequality constraints to equalities, we add slack variables S 1 and S 2 to the left side of the inequality. The first constraint becomes 2X 1 +1X 2 + S 1 = 10 and the second becomes 4X 1 +3X 2 + S 2 = 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: 2X 1 + 1X 2 + 1S 1 + 0S 2 = 10 4X 1 + 3X 2 + 0S 1 + 1S 2 = 24 Since 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 = 7X 1 + 5X 2 + 0S 1 + 0S 2

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: Solution Mix Quantity (RHS) X1X1 X2X2 S1S1 S2S2 S1S2S1S

7 o 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. o As in the graphical approach of Unit 9, we begin the initial solution procedure at the origin, where X 1 = 0, X 2 = 0, and profit = $0. The values of the two other variables must then be nonzero. Since 2X 1 + 1X 2 + 1S 1 = 10, we see that S 1 = 10. Likewise,S 2 = 24. These two slack variables comprise the initial solution mixas a matter of fact, their values are found in the quantity column next to each variable. Since X 1 and X 2 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 as X1 X2 S1 S2 =

9 o 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 S 1 and S 2. Variables not in the solution mix or basis (X 1 and X 2 in this case) are called nonbasic variables. Of course, if the optimal solution to this LP problem turned out to be X 1 = 3, X 2 = 4, S 1 = 0, and S 2 = 0, or X1 X2 S1 S = Then X 1 and X 2 would be the final basic variables, while S 1 and S 2 would be the nonbasic variables.

10 EXAMPLE 10.2 Let us complete the initial simplex tableau for the example above. Solution Mix Quantity (RHS) CjCj $7 $5 $0 $0 $0 X 1 X 2 S 1 S 2 S1 S Z j C j - Z j $0 (total profit) $0 $7 $0 $5 $0

11 The terms and rows which you have not seen before are described below. C j : profit contribution per unit of each variable. C j 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, C j indicates the unit profit for each variable currently in the solution mix. Z j : In the quantity column, Z j 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 Z j value for each column is found by multiplying the C j of the row by the number in that row and j th column, and summing.

12 o The calculations for the Z in the table are as follows: Z j (for total profit) = ($0)(l0) + ($0)(24) = $0 Z j (for column X 1 ) = ($0)(2) + ($0)(4) = $0 Z j (for column X 2 ) = ($0)(l) + ($0)(3) = $0 Z j (for column S 1 ( = ($0)(l) + ($0)(0) = $0 Z j (for column S 2 ) = ($0)(0) +($0)(l) = $0 o C j - Z j : 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 C j value at the very top of each variables column.

13 The calculations for the net profit per unit (C j - Z j ) row in this example are: X1 X2 S1 S2 $7 $5 $0 $0 $0 $0 $7 $5 $0 $0 Column Cj for column: Z j for column: C j – Z j for column

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 C j - Z j 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 C j - Z j 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 C j - Z j 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. This is done by identifying the column (and hence, variable) with the largest positive number in the C j - Z j 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 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: (new row numbers) = (numbers in old row) number above or below pivot number corresponding number in the new row, i.e., the row replaced in step 3 X

18 Step5: Compute the and C j - Z j rows, as previously demonstrated in the initial tableau. If all numbers in the C j - Z j 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.3 The 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. Solution Mix Quantity (RHS) CjCj $7 $5 $0 $0 $0 X 1 X 2 S 1 S 2 S1S2S1S Z j C j - Z j $0 $7 $0 $5 $0 Pivot column Pivot row Pivot number

20 Step 1: Variable X will enter the solution next because it has the highest contribution to profit value, C j - Z j : 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 X 1 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 X 1 replaces variable S 1 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 . Solution MixQuantityX 1 X 2 S 1 S 2 CjCj $7X1X1 511/2 0 Step 4: The new values for the S 2 row are calculated. (number in new S 2 row) (number in old S 2 row) (number below pivot number) (corresponding number In the new X 1 row) =-X ========== X X X X X 1/2 1

22 Step 5: The Z j and C j - Z j rows are calculated. Z j (for total profit) = ($7)(5) + ($0)(4) = $35 Z j (for X 1 column) = ($7)(1) + ($0)(0) = $7 C j – Z j = $7- $7 $0 Z j (for X 2 column) = ($7)(1/2) + ($0)(1) = $7/2 C j - Z j = $5 - $7/2 = $3/2 Z j (for S 1 column) = ($7)(1/2) + ($0)(-2) = $7/2 C j - Z j = $0 - $7/2 = -$7/2 Z j (for S 2 column) = ($7)(0) + ($0)(1) = $0 C j - Z j = $0 - $0 = $0 Solution MixQuantityX 1 X 2 S 1 S 2 CjCj $0S2S $7X1X1 511/2 0

23 Solution Mix Quantity CjCj $7 $5 $0 $0 $7 $0 X 1 X 2 S 1 S 2 X1S2X1S /2 1 1/ Z j C j - Z j $35 total profit $7 $0 $7/2 $3/2 $7/2 -$7/2 $0 Pivot number Pivot row Pivot column 2 nd tableau

24 Since not all numbers in the C j – Z j row of this latest tableau are zero or negative, the above solution (that is, X 1 = 5, S 2 = 4, X 2 = 0, S 1 = 0, profit = $35) is not optimal arid we proceed to a third tableau and repeat the five steps. Step 1: Variable X 2 will enter the solution next by virtue of the fact that its C j - Z j = 3/2 is the largest (and only) positive number in the row. This means that for every unit of X 2 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 S 2 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 Step 4: The new values for the X row are computed: (number in new X 1 row) (number in old X 1 row) (number above pivot number) (corresponding number In the new X 2 row) =-X ========== /2 -1/2 5 1/ X X X X X

26 Step 5: The Z and C j - Z j rows are calculated. Z j (for total profit) = ($7)(3) + ($5)(4) = $41 Z j (for X 1 column) = ($7)(1) + ($5)(0) = $7 Z j (for X 2 column) = ($7)(0) + ($5)(1) = $5 Z j (for S 1 column) = ($7)(3/2) + ($5)(-2) = $1/2 Z j (for S 2 column) = ($7)(-1/2) + ($5)(1) = $3/2

27 Solution Mix Quantity CjCj $7 $5 $0 $0 $7 $5 X 1 X 2 S 1 S 2 X1X2X1X / /2 1 Z j C j - Z j $41 $7 $0 $5 $0 $1/2 -$1/2 $3/2 -$3/2 3 rd tableau

28 Since every number in the third tableaus C j - Z j row is zero or negative, an optimal solution has been reached. That solution is: X 1 = 3 (tables), and X 2 = 4 (chairs),S 1 = 0 (slack in 1st resource), S 2 = 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: 1. Choose the variable with the greatest positive C j - Z j to enter the solution. 2. Determine the row to be replaced by selecting the one with the smallest (nonnegative) quantity to pivot column ratio. 3. Calculate the new values for the pivot row. 4. Calculate the new values for the other row(s). 5. Calculate the C j and C j - Z j values for this tableau. If there are any C j - Z j 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.4 o The 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: 25X X 2 = 900 To convert an equality, we simply add an artificial variable (A 1 ) to the equation: 25X 1 +30X 2 +A 1 = 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 may not appear in the final solution to the problem.

32 Constraint 2: 5X X 2 + 8X 3 2,100 To handle constraints, a surplus variable (S 1 ) is first subtracted and then an artificial variable (A 2 ) is added to form a new equation: 5X X 2 + 8X 3 - S 1 + A 2 = 2,100 A surplus variable does have a physical meaningthat 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 problems 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.5 The 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. Let X1 number of pounds of phosphate in the mixture X2= number of pounds of potassium in the mixture

35 Objective function: minimize cost = $5X 1 + $6X 2 Objective function in simplex form: minimize costs = $5X 1 + $6X 2 + $0S 1 + $0S 2 + $MA 1 +$MA 2 Regular formSimplex form 1 st constraint: 2 nd constraint: 3 rd constraint: 1X 1 + 1X 2 = 1,000 (lb) 1X (lb) 1X 2 150(lb) 1X 1 + 1X 2 1X 1 +1S 1 1X 2 -1S 2 +1A 1 +1A 2 = 1,000 = 300 = 150

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 C j -Z j 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 C j -Z j row are zero or positivejust the opposite from the maximization case.

37 All other simplex steps, as seen below, remain the same. 1. Choose the variable with the largest negative C j -Z j to enter the solution. 2. Determine the row to be replaced by selecting the one with the smallest (nonnegative) quantity to pivot column ratio. 3. Calculate new values for the pivot row. 4. Calculate new values for the other rows. 5. Calculate the C j -Z j values for this tableau. If there are any C j -Z j numbers less than zero, return to step1.

38 EXAMPLE 10.6 o Let us begin to solve Muddy River Chemicals 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 A 1 and A 2 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 Solution Mix Quantity CjCj $5 $6 $0 $0 $M $M $M $0 $M X 1 X 2 S 1 S 2 A 1 A 2 A1S1A2A1S1A2 1,

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 column Z j (for total cost) = ($M)(1,000) + ($0)(300) + ($M)(l50) = $1,150M Z j (for X 1 column) = ($M)(1)+ ($0)(1) + ($M)(0) = $M C j -Z j = $5 – M = -$M + 5 Z j (for X 2 column) = ($M)(1)+ ($0)(0) + ($M)(1) = $2M C j -Z j = $6 – 2M = -$2M + 6

41 Z j (for S 1 column) = ($M)(0)+ ($0)(1) + ($M)(0) = $0 C j -Z j = $0 – 0 = $0 Z j (for S 2 column) = ($M)(0)+ ($0)(0) + ($M)(-1) = -$M C j -Z j = $0 – M = -$M Z j (for A 1 column) = ($M)(1)+ ($0)(0) + ($M)(0) = $M C j -Z j = $M – M = $0

42 Z j (for A 2 column) = ($M)(0)+ ($0)(0) + ($M)(1) = $M C j -Z j = $M – M = $0 Solution Mix Quantity CjCj $5 $6 $0 $0 $M $M $M $0 $M X 1 X 2 S 1 S 2 A 1 A 2 A1S1A2A1S1A2 1, Z j C j - Z j $1,150 M (total cost) $M $2M $0 -$M $M $M -$M $2M + 6 $0 -$M $0 $0

43 Variable X 2 will enter the solution next because it has the largest negative C j -Z j entry. Variable A 2 will be removed from the solution because the ratio 150/1 is smaller than the ratios of the quantity column numbers to the corresponding X 2 column numbers in the other two rows. That is, 150/1 (the third or A 2 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 numberor one that is infinitely largeand 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:

44 A 1 Row S 1 Row 850 = 1,000 - (1)(150) 300 = (0)(150) 1 = 1 - (1)(0) 1 = 1 - (0)(0) 0 = 1 - (1)(1) 0 = 0 - (0)(1) 0 = 0 - (1)(0) 1 = 1 - (0)(0) 1 = 0 - (1)(-1) 0 = 0 - (0)(-1) 1 = 1 - (1)(0) 0 = 0 - (0)(0) -1 = 0 - (1)(1) 0 = 0 - (0)(1)

45 Solution Mix Quantity CjCj $5 $6 $0 $0 $M $M $M $0 $6 X 1 X 2 S 1 S 2 A 1 A 2 A1S1X2A1S1X Z j C j - Z j $850M $M $6 $0 $M-6 $M -$M+6 -$M + 5 $0 $0 -$M+6 $0 $2M-6 2 ND TABLEAU


Download ppt "SIMPLEX METHOD. Simplex Method Most real-world linear programming problems have more than two variables and are thus too large for a graphical solution."

Similar presentations


Ads by Google