The Simplex Method Lecture 5 Standard and Canonical Forms and Setting up the Tableau Lecture 5 Slide 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 Lecture 5 Slide 2
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 Lecture 5 Slide 3
x + y => 2 is the same as 2x + 2y => 4 2 2 y y 1.5 1.5 1 1 0.5 0.5 0.5 1 1.5 2 0.5 1 1.5 2 x x Lecture 5 Slide 4
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. Lecture 5 Slide 5
Multiply x + y => 2 by -1 (x + y => 2) * (-1) -x y <= -2 and they are equivalent. 2 2 y y 1.5 1.5 1 1 0.5 0.5 0.5 1 1.5 2 0.5 1 1.5 2 x x Lecture 5 Slide 6
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. Lecture 5 Slide 7
Adding Slack Variables When a Constraint is in the form: x + y <= v, 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. Lecture 5 Slide 8
Adding Surplus Variables When a Constraint is in the form: x + y => v, 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. Lecture 5 Slide 9
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 Note that s => 0 since v <= x + y. Lecture 5 Slide 10
Conversion to Standard Form, An Example Let our problem be: Maximize 4x + 5y + 2z Subject to (1) 2x - y - 2z => 8 (2) x + 2y - z = 16 (3) x - 2y + z <= 12 x => 0, y => 0, z => 0 Lecture 5 Slide 11
Constraint (1) This is a => constraint, so we need to add a surplus variable (S1). Maximize 4x + 5y + 2z Subject to (1) 2x - y - 2z - S1 = 8 (2) x + 2y - z = 16 (3) x - 2y + z <= 12 x => 0, y => 0, z => 0, s1 => 0 Lecture 5 Slide 12
Constraint (2) This was an equality in the original problem, so no change. Maximize 4x + 5y + 2z Subject to (1) 2x - y - 2z - S1 = 8 (2) x + 2y - z = 16 (3) x - 2y + z <= 12 x => 0, y => 0, z => 0, s1 => 0 Lecture 5 Slide 13
Constraint (3) This is a <= constraint, so we need to add a slack variable (S3). Maximize 4x + 5y + 2z Subject to (1) 2x - y - 2z - S1 = 8 (2) x + 2y - z = 16 (3) x - 2y + z + S3 = 12 x => 0, y => 0, z => 0, s1 => 0, s3 => 0 Lecture 5 Slide 14
Conventional Presentation Use x1, x2, x3 etc in place of x,y or z. Slack or Surplus Variables are denoted by: S concatenated with the constraint number Hence S1 and S3 in the example. Lecture 5 Slide 15
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. Lecture 5 Slide 16
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. Lecture 5 Slide 17
Example of Canonical Form Maximize 4x1 + 5x2 + 2x3 Subject to (1) 2x1 - x2-2x3 - S1 + A1 = 8 (2) x1 + 2x2 - x3 + A2 = 16 (3) x1-2x2 + x3 + S3 = 12 x1 => 0, x2 => 0, x3 => 0, s1 => 0, s3 => 0, A1 => 0, A2 => 0 Lecture 5 Slide 18
Artificial Variables Addition of a Slack variable to a constraint results in a constraint that satisfies the Canonical Form. Addition of a Surplus variable was not sufficient since the coefficient is (-1), so we add in an artificial variable (A1). If the original constraint was an equality we need to add in an artificial variable (A2). Lecture 5 Slide 19
Artificial Variables cont We want to drive the values of the Artificial variables down to zero and to accomplish this we add them into the objective function. We use a coefficient -M or +M representing a very large ve or +ve number. For a maximization problem use -M. For a minimization problem use +M. Lecture 5 Slide 20
Our Example in Full Canonical Form Maximize 4x1 + 5x2 + 2x3 - M*A1 - M*A2 Subject to (1) 2x1 - x2-2x3 - S1 + A1 = 8 (2) x1 + 2x2 - x3 + A2 = 16 (3) x1-2x2 + x3 + S3 = 12 x1 => 0, x2 => 0, x3 => 0, s1 => 0, s3 => 0, A1 => 0, A2 => 0 Lecture 5 Slide 21
Setting up The Simplex Tableau To set up the Simplex Tableau we will: Identify the Basic and Nonbasic 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. Lecture 5 Slide 22
Basic and Nonbasic 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 Nonbasic Variables. Lecture 5 Slide 23
Basic and Nonbasic Variables cont In our example we added S3, A1 and A2 to satisfy the condition for the Canonical Form. These are the Basic Variables. Maximize 4x1 + 5x2 + 2x3 Subject to (1) 2x1 - x2-2x3 - S1 + A1 = 8 (2) x1 + 2x2 - x3 + A2 = 16 (3) x1-2x2 + x3 + S3 = 12 x1 => 0, x2 => 0, x3 => 0, s1 => 0, s3 => 0, A1 => 0, A2 => 0 The Nonbasic Variables are x1, x2, x3, and S1. Lecture 5 Slide 24
Setting up the Basic (Feasible) Solution A Basic Feasible Solution for an LP in the Canonical form is one where: The Nonbasic variables are set to zero, and The Basic variables take on the values of the RHS of their constraint. Lecture 5 Slide 25
Setting up the Basic (Feasible) Solution cont A Basic Solution is a Basic Feasible Solution if:- All of the variables (Basic and Nonbasic) are greater than or equal to zero. Lecture 5 Slide 26
The Basic Feasible Solution to Our Example Problem. Maximize 4x1 + 5x2 + 2x3 - M*A1 - M*A2 Subject to (1) 2x1 - x2-2x3 - S1 + A1 = 8 (2) x1 + 2x2 - x3 + A2 = 16 (3) x1-2x2 + x3 + S3 = 12 x1 => 0, x2 => 0, x3 => 0, s1 => 0, s3 => 0, A1 => 0, A2 => 0 A1 = 8, A2 = 16, S3 = 12. x1 = 0, x2 = 0, x3 = 0, s1 = 0. The Objective Function Value: z = -24M. [(8 * -M)+(16 * -M)+(1 * 0)] Lecture 5 Slide 27
Graphical Equivalence The Basic Feasible Solution is equivalent to our first Objective Function line in the graphical solution. 7 y 6 5 4 3 2 1 x 1 2 3 4 5 6 Lecture 5 Slide 28
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. Lecture 5 Slide 29
Names of Variables x1 x2 x3 S1 S3 A1 A2 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. Lecture 5 Slide 30
Basic Variables x1 x2 x3 S1 S3 A1 A2 Basis Cj Objective Function Coefficients. Bi A1 A2 S3 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. Lecture 5 Slide 31
Objective Function Coefficients x1 x2 x3 S1 S3 A1 A2 Basis Cj 4 5 2 0 0 -M -M Bi A1 -M A2 -M S3 0 Coefficients of the Left Hand Sides of the Constraints. Right Hand Side Values of Constraints Sum of RHS * Zj Sum of Each Column * Cj Column. Cj for all j Maximize 4x1 + 5x2 + 2x3 - M*A1 - M*A2 Cj - Zj Cj row value less Zj row value. Lecture 5 Slide 32
Coefficients and RHS Values of the Constraints x1 x2 x3 S1 S3 A1 A2 Basis Cj 4 5 2 0 0 -M -M Bi A1 -M 2-1 -2-1 1 8 A2 -M 1 2-1 1 16 S3 0 1-2 1 1 12 (1) 2x1 Zj - x2 Sum - 2x3of Each - S1 Column * Cj + Column. A1 Sum of RHS * Cj = for all 8 j (2) x1 + 2x2 - x3 + A2 = 16 Cj - Zj Cj row value less Zj row value. (3) x1-2x2 + x3 + S3 = 12 Lecture 5 Slide 33
The Zj Row x1 x2 x3 S1 S3 A1 A2 Basis Cj 4 5 2 0 0 -M -M Bi * A1 -M 2-1 -2-1 0 1 0 8 * A2 -M 1 2-1 0 0 0 1 16 * + + S3 0 1-2 1 0 1 0 0 12 = Zj -3M -M 3M M 0 -M -M sum of RHS * Cj for all j Cj - Zj Cj row value less Zj row value Lecture 5 Slide 34
The Objective Function Value x1 x2 x3 S1 S3 A1 A2 Basis Cj 4 5 2 0 0 -M -M Bi A1 -M 2-1 -2-1 0 1 0 8 -M * 8 + -M * 16 + 0 * 12 = A2 -M 1 2-1 0 0 0 1 16 S3 0 1-2 1 0 1 0 0 12 Zj -3M -M 3M M 0 -M -M -24M Cj - Zj Cj row value less Zj row value Lecture 5 Slide 35
The Cj Zj Row x1 x2 x3 S1 S3 A1 A2 Basis Cj 4 5 2 0 0 -M -M Bi A1 -M 2-1 -2-1 0 1 0 8 A2 -M 1 2-1 0 0 0 1 16 S3 0 1-2 1 0 1 0 0 12 Zj -3M -M 3M M 0 -M -M -24M Cj - Zj 4 - (-3M) 5 - (-M) 2-3M - M 0 -M - (-M) -M - (-M) Lecture 5 Slide 36
The Initial Basic Feasible Solution in the Simplex Tableau x1 x2 x3 S1 S3 A1 A2 Basis Cj 4 5 2 0 0 -M -M Bi A1 -M 2-1 -2-1 0 1 0 8 A2 -M 1 2-1 0 0 0 1 16 S3 0 1-2 1 0 1 0 0 12 Zj -3M -M 3M M 0 -M -M -24M Cj - Zj 4 + 3M 5 + M 2-3M - M 0 0 0 Lecture 5 Slide 37