The Simplex Method 1 The Simplex Method Formulate Constrained Maximization or Minimization Problem Convert to Standard Form Convert to Canonical Form Set Up the Tableau and the Initial Basic Feasible Solution Apply The Simplex Algorithm Perform Sensitivity Analysis 2 1
A Simple Example Revenue Maximization The Nutty Wood Co. makes chairs and tables from Walnut and Oak. The company wants to maximize revenue. Management would be happy to make chairs alone, tables alone or both as it can sell as much as it can produce. 3 Nutty Wood Co. Revenue Maximization cont A table sells for $400, needs 5 cubic feet of Walnut and 2.5 cubic feet of Oak. A chair which takes 2 cubic feet of Oak and 1 cubic foot of Walnut sells for $125. Only 400 cubic feet of Walnut and only 250 cubic feet of Oak is available. 4 2
The Decision Variables The decision to be made is how many tables and how many chairs to make, so the decision variables are: Let c be the number of chairs built. Let t be the number of tables made. Sales prices are parameters as it is assumed that these are givens. 5 The Objective Function What is the objective? How do we express this in terms of Decision variables c and t? What is the Objective Function? 6 3
The Objective Function Maximize revenue is the objective. Revenue is Sales Price by Number Sold. Revenue = (125 * c) + (400 * t) So the Objective Function is: Max Revenue =(125 * c) + (400 * t) 7 Constraints A constraint is something that prevents us from doing something. In this example we are limited by the amount of Oak and Walnut available. The Oak constraint is that using 2.5 cubic feet for a table and 2 cubic feet for a chair we can use no more than 250 cubic feet. 8 4
Constraints cont The Walnut constraint is that using 5 cubic feet for a table and 1 cubic foot for a chair we can use no more than 400 cubic feet. How do we express the constraints mathematically? 9 Constraints cont The Walnut constraint is that using 5 cubic feet for a table and 1 cubic foot for a chair we can use no more than 400 cubic feet. So: (2 * c) + (2.5 * t) 250 (1 * c) + (5 * t) 400 are the constraints. 10 5
Bounds on the Problem Nutty Wood Co. do not make fewer than zero chairs or tables. How do we express this? 11 Bounds on the Problem Nutty Wood Co. do not make fewer than zero chairs or tables. We express this with lower bounds as follows: c 0 t 0 Note this allows for zero in both cases. 12 6
Write Down The Full Model 13 The Model Maximize 125c + 400t (Revenue) Subject to 2c + 2.5t 250 (Oak Constraint) 1c + 5t 400 (Walnut Constraint) c 0 (Lower Bounds) t 0 14 7
The Simplex Method Formulate Constrained Maximization or Minimization Problem Convert to Standard Form Convert to Canonical Form Set Up the Tableau and the Initial Basic Feasible Solution Apply The Simplex Algorithm Perform Sensitivity Analysis 15 Simple Mathematical Operations on Constraints Any constraint may be multiplied or divided through by a positive number without changing the constraint. x + y => 2 is the same as 2x + 2y => 4 16 8
x + y => 2 is the same as 2x + 2y => 4 2 y Equation 1: x + y => 2 2 y Equation 2:2 x +2 y => 4 1.5 1.5 1 1 0.5 0.5 0.5 1 1.5 2 x 0.5 1 1.5 2 x 17 Simple Mathematical Operations on Constraints When a >, =>, <= or < constraint is multiplied or divided through by a negative number, the direction of the constraint must be changed. 18 9
Multiply x + y => 2 by -1 (x + y => 2) * (-1) -x y <= -2 and they are equivalent. 2 y Equation 1: x + y => 2 2 y Equation 2:- x - y < = -2 1.5 1.5 1 1 0.5 0.5 0.5 1 1.5 2 x 0.5 1 1.5 2 x 19 Standard Form A Linear Program is in Standard Form if: All the constraints are written as equalities. All variables are required to be non-negative. This involves the addition of Slack variables and Surplus variables. 20 10
Adding Slack Variables When a Constraint is in the form: x + y <= v : With bounds (x => 0, y => 0) We add a Slack Variable to take up the slack between the value of (x + y) and the value of v. Thus x + y + s = v. Note that s => 0 since x + y <= v. 21 Adding Surplus Variables When a Constraint is in the form: x + y => v: With bounds (x => 0, y => 0) We add a Surplus Variable to account for the surplus left over when the value of v is deducted from the values of (x + y). Thus x + y = v + s Note that s => 0 since x + y => v. 22 11
Adding Surplus Variables cont We then shuffle s to the left hand side of the equality by subtracting s from both sides, giving: x + y s = v x=> 0, y =>0, and s => 0 23 Conversion to Standard Form, Nutty Wood Co. maximize 125c + 400t (Revenue) Subject to 2c + 2.5t 250 (Oak Constraint) 1c + 5t 400 (Walnut Constraint) c 0 (Lower Bounds) t 0 24 12
Oak Constraint (1) This is a <= constraint, so we need to add a surplus variable (S1). maximize 125c + 400t + 0S1 (Revenue) Subject to 2c + 2.5t + S1 = 250 (Oak Constraint) 1c + 5t 400 (Walnut Constraint) c 0 (Lower Bounds) t 0 S 1 0 25 Walnut Constraint (2) This is <= constraint, so we need to add a surplus variable (S2). maximize 125c + 400t + 0S1 + 0S2 (Revenue) Subject to 2c + 2.5t + S1 = 250 (Oak Constraint) 1c + 5t + S2 = 400 (Walnut Constraint) c 0 (Lower Bounds) t 0 S 0, S 0 1 2 26 13
Conventional Presentation Use x1, x2, x3 etc in place of c, t, x, y or z. Slack or Surplus Variables are denoted by: S concatenated with the constraint number Hence S1 and S3 in the example. 27 Negative Values on RHS If any RHS values are negative we multiply through the equality by (-1) to make the RHS value positive. e.g. 2x 1 3x 2 S = -12 becomes -2x 1 + 3x 2 + S = 12. 28 14
The Simplex Method Formulate Constrained Maximization or Minimization Problem Convert to Standard Form Convert to Canonical Form Set Up the Tableau and the Initial Basic Feasible Solution Apply The Simplex Algorithm Perform Sensitivity Analysis 29 Canonical Form A Linear Program is in Canonical Form if: It is in Standard Form, and For each constraint, there exists a variable that appears only in the constraint, and its coefficient in that constraint is +1. 30 15
Example of Canonical Form maximize 125x1 + 400x 2 + 0S1 + 0S2 (Revenue) Subject to 2x1 + 2.5x2 + 1S1 1x1 + 5x2 + 1S2 = 250 = 400 (Oak Constraint) (Walnut Constraint) x1 0 (Lower Bounds) x2 0 S1 0, S2 0 31 Nutty Wood Co. in Full Canonical Form maximize 125x1 + 400x 2 + 0S1 + 0S2 (Revenue) Subject to 2x1 + 2.5x2 + 1S1 1x1 + 5x2 + 1S2 = 250 = 400 (Oak Constraint) (Walnut Constraint) x1 0 (Lower Bounds) x2 0 S1 0, S2 0 32 16
The Simplex Method Formulate Constrained Maximization or Minimization Problem Convert to Standard Form Convert to Canonical Form Set Up the Tableau and the Initial Basic Feasible Solution Apply The Simplex Algorithm Perform Sensitivity Analysis 33 Setting up The Simplex Tableau To set up the Simplex Tableau we will: Identify the Basic and Non-basic variables. Set up a Basic Feasible Solution. Look at the form of the Simplex Tableau, and Enter the LP and values of the Initial Basic Solution into the Simplex Tableau. 34 17
Basic and Non-basic Variables Recall from the definition of the Canonical Form. For each constraint, there exists a variable that appears only in the constraint, and its coefficient in that constraint is +1. These variables are the initial Basic Variables. The other variables are the Non-basic Variables. 35 Basic and Non-basic Variables cont In our example we added S1 and S2 to satisfy the conditions for the Canonical Form. These are the Basic Variables. maximize 125x1 + 400x2 + 0S1 + 0S2 (Revenue) Subject to 2x1 + 2.5x2 + 1S1 1x1 + 5x2 + 1S2 = 250 = 400 (Oak Constraint) (Walnut Constraint) x1 0 (Lower Bounds) x2 0 S1 0, S2 0 The Non-basic Variables are x1 and x2. 36 18
Setting up the Basic (Feasible) Solution A Basic Feasible Solution for an LP in the Canonical form is one where: The Non-basic variables are set to zero, and The Basic variables take on the values of the RHS of their constraint. 37 Setting up the Basic (Feasible) Solution cont A Basic Solution is a Basic Feasible Solution if: All of the variables (Basic and Non-basic) are greater than or equal to zero. 38 19
The Initial Basic Feasible Solution to Nutty Wood Co. maximize 125x1 + 400x2 + 0S1 + 0S2 (Revenue) Subject to 2x1 + 2.5x2 + 1S1 = 250 (Oak Constraint) 1x1 + 5x2 + 1S2 = 400 (Walnut Constraint) x1 0 (Lower Bounds) x2 0 S1 0, S2 0 S1 = 250, S2 = 400. x1 = 0, x2 = 0. The Objective Function Value: z = 0 39 The Form of The Simplex Tableau Names of the Variables Basis Cj Objective Function Coefficients Bi Names of the Basic Variables Objective Function Coefficients of Basic Variables Coefficients of the Left Hand Sides of the Constraints. Right Hand Side Values of Constraints Zj Sum of (Each Column * Cj Column). Sum of (RHS * Cj ) for all j Cj - Zj Cj row value less Zj row value. 40 20
Names of Variables Basis Cj Objective Function Coefficients Bi Names of the Basic Variables Objective Function Coefficients of Basic Variables Zj Coefficients of the Left Hand Sides of the Constraints. Sum of (Each Column * Cj Column). Right Hand Side Values of Constraints Sum of (RHS * Cj ) for all j Cj - Zj Cj row value less Zj row value. 41 Basic Variables Basis Cj Objective Function Coefficients Bi S1 S2 Objective Function Coefficients of Basic Variables Zj Coefficients of the Left Hand Sides of the Constraints. Sum of (Each Column * Cj Column). Right Hand Side Values of Constraints Sum of (RHS * Cj ) for all j Cj - Zj Cj row value less Zj row value. 42 21
Objective Function Coefficients maximize 125x1 + 400x2 + 0S1 + 0S2 = Revenue - 125x1-400x2-0S1-0S2 + Revenue = 0 S1 0 S2 0 Zj Coefficients of the Left Hand Sides of the Constraints. Sum of (Each Column * Cj Column). Right Hand Side Values of Constraints Sum of (RHS * Cj ) for all j Cj - Zj Cj row value less Zj row value. 43 Coefficients and RHS Values of the Constraints 2x1 + 2.5x2 + 1S1 = 250 (Oak Constraint) 1x1 + 5x2 + 1S2 = 400 (Walnut Constraint) S1 0 2 2.5 1 0 250 S2 0 1 5 0 1 400 Zj Sum of (Each Column * Cj Column). Sum of (RHS * Cj ) for all j Cj - Zj Cj row value less Zj row value. 44 22
The Zj Row * S1 0 2 2.5 1 0 250 + * S2 0 1 5 0 1 400 = Zj 0 0 0 0 Sum of (RHS * Cj ) for all j Cj - Zj Cj row value less Zj row value. 45 The Objective Function Value 0 * 250 S1 0 2 2.5 + 1 0 250 0 * 400 = S2 0 1 5 0 0 1 400 Zj 0 0 0 0 0 Cj - Zj Cj row value less Zj row value. 46 23
The Cj Zj Row S1 0 2 2.5 1 0 250 S2 0 1 5 0 1 400 Zj 0 0 0 0 0 Cj - Zj -125-0 = -125-400 - 0 = -400 0-0 = 0 0-0 = 0 47 The Initial Basic Feasible Solution in the Simplex Tableau S1 0 2 2.5 1 0 250 S2 0 1 5 0 1 400 Zj 0 0 0 0 0 Cj - Zj -125-400 0 0 48 24
The Simplex Method Formulate Constrained Maximization or Minimization Problem Convert to Standard Form Convert to Canonical Form Set Up the Tableau and the Initial Basic Feasible Solution Apply The Simplex Algorithm Perform Sensitivity Analysis 49 The Simplex Algorithm 1. Find the Entering Variable STOP No Variable to Enter? Yes 2. Calculate: By how much can the Entering Variable be increased. 3. Pivot 50 25
The Meaning of the Cj, Zj and (Cj Zj) Rows Cj value The gross increase in the Objective Function Value, given a one unit increase in the amount of that variable. Zj value The gross decrease in the Objective Function Value, given a one unit increase in the amount of that variable. Cj-Zj The net effect on the Objective Function Value of a one unit increase in the amount of that variable. 51 Find the Entering Variable In a maximization we want to increase the Objective Function Value as much as possible, so: Select the variable for which the net effect is the greatest In our example, (-400) is largest (Cj-Zj), so x2 is the Entering Variable. Zj 0 0 0 0 0 Cj - Zj -125-400 0 0 52 26
Which row has the smallest quotient X2/Bi? X2 Basis Cj -400 Bi S1 0 2.5 250 S2 0 5 400 Zj 0 0 Cj - Zj -400 250/2.5 = 100 400/5 = 80 So S2 will be the variable leaving the basis since the smallest quotient is 80. 53 Pivoting Calculate New Row to Replace Pivot Row Calculate Other Rows in New Tableau Replace Leaving Variable with Entering Variable in the Basis Column Update the Objective Function Coefficient for the Entering Variable Calculate new Zj Values for Each Column Calculate New (Cj - Zj) Values for Each Column 54 27
Pivot Row, Column and Element S1 0 2 2.5 1 0 250 S2 0 1 5 0 1 400 Zj 0 0 0 0 0 Cj - Zj -125-400 0 0 55 Calculate New Row to Replace Pivot Row Divide the pivot row by the pivot element:- S1 0 2 2.5 1 0 250 S2 0 1 / 5 =1/5 5 / 5 = 1 0 / 5 =0 1 / 5 =1/5 400 / 5 =80 Zj 0 Cj - Zj 56 28
Calculate New Row 2 Multiply the New Row for X2 by the value of the coefficient in the Pivot Column and S2 Row and subtract this from S2 Row to calculate the New S2Row. S1 0 2 2.5 1 0 250 S2 0 1/5 1 0 1/5 80 a. S2 Row multiplied by Pivot Column Element of S1 row. 1/5 * 10/4 = 10/20 1 * 10/4 = 10/4 0 * 10/4 = 0 1/5 * 10/4 = 10/20 80 * 10/40 = 200 b. S1 Row minus row a. above. 2-10/20 = 3/2 2.5-2.5 = 0 1-0 =1 0-10/20 = -1/2 250-200 = 50 57 Replace Row2 Basic Variable with Entering Variable S1 0 3/2 0 1-1/2 50 S2 0 1/5 1 0 1/5 80 Zj 0 Cj - Zj Also check that the result is in Canonical form. If not review Leaving Variable. 58 29
Enter X2 s Coefficient From the Objective Function in Cj Column, Row 2 S1 0 3/2 0 1-1/2 50 X2-400 1/5 1 0 1/5 80 Zj 0 Cj - Zj 59 Recalculate the Zj and (Cj Zj) Rows as Before S1 0 3/2 0 1-1/2 50 X2-400 1/5 1 0 1/5 80 Zj 0 * 3/2 + -400 *1/5 =- 80 0 * 0 + -400 * 1 = -400 1 * 0 + - 400 * 0 = 0 0 * -1/2 + - 400 *1/5 =-80 0 Cj - Zj -125 - - 80 =-45-400 - - 400 = 0 0-0 = 0 0 - - 80 =80 60 30
Is There Another Entering Variable?? Yes, X1 has a (Cj Zj) value of -45 and is the most negative value. S1 0 3/2 0 1-1/2 50 X2-400 1/5 1 0 1/5 80 Zj -80-400 0-80 0 Cj - Zj -45 0 0 80 61 Which row has the smallest quotient X2/Bi? X1 Basis Cj -125 Bi S1 0 3/2 50 / X2-400 1/5 / 80 Zj -80 0 Cj - Zj -45 50/(3/2) = 33.33 80/(1/5) = 400 So S1 will be the variable leaving the basis since the smallest quotient is 33.33. 62 31
Calculate New Row (*) to Replace Pivot Row Divide the pivot row by the pivot element:- S1 0 3/2 / 3/2 0 / 3/2 1 / 3/2-1/2 / 3/2 50 / 3/2 X2-400 1/5 1 0 1/5 80 Zj -80-400 0-80 0 Cj - Zj -45 0 0 80 63 Calculate New Row (*) to Replace Pivot Row S1 0 1 0 2/3-1/3 33.33 X2-400 1/5 1 0 1/5 80 Zj -80-400 0-80 0 Cj - Zj -45 0 0 80 64 32
Calculate New Row 2 Multiply the New Row by the value of the coefficient in the Pivot Column and Row 2 and subtract this from Row 2 to calculate the New Row 2. S1 0 1 0 2/3-1/3 33.33 X2-400 1/5 1 0 1/5 80 a. S1 Row multiplied by Pivot Column Element of X2 row. b. X2 Row minus row a. above. 1 * 1/5 = 1/5 1/5-1/5 = 0 0 * 1/5 = 0 1-0 = 1 2/3 * 1/5 = 2/15 0-2/15 =-2/15-1/3 * 1/5 = -1/15 3/15 - - 1/15 = 4/15 100/3 * 1/5 = 100/15 = 6.67 80-100/15 = 73.33 65 Recalculate the Zj and (Cj Zj) Rows as Before X1-125 1 0 2/3-1/3 33.33 X2-400 0 1-2/15 4/15 73.33 Zj -125 * 1 + -400 * 0 = -125-125 * 0 + -400 * 1 = -400 (-125*2/3) + (-400 * - 2/15) = -30 (-125 * - 1/3) + (- 400 * 4/15) = - 65 (-125*33.33) + (- 400*73.33)= -33,500 Cj - Zj -125 - - 125 = 0-400 - - 400 = 0 0 - - 30 = 30 0 - -65 = 65 66 33
Recalculate the Zj and (Cj Zj) Rows as Before All (Cj-Zj) values are positive so no entering variable All Bi are positive... X1-125 1 0 2/3-1/3 33.33 X2-400 0 1-2/15 4/15 73.33 Zj -125-400 -30-65 -33,500 Cj - Zj 0 0 30 65 67 Recalculate the Zj and (Cj Zj) Rows as Before We have a solution we can read from the Tableau X1 number of chairs = 33.33 X2 number of tables = 73.33 Revenue = $33,500 S1 = 0, S2 = 0 : They are Non-Basic and Non- Basic Variables have value zero! X1-125 1 0 2/3-1/3 33.33 X2-400 0 1-2/15 4/15 73.33 Zj -125-400 -30-65 -33,500 Cj - Zj 0 0 30 65 68 34