Chapter 4 - Solving Linear Programs Part 2
Chapter 4 - Solving Linear Programs Part 2
1
Structure of a Tableau Form
𝑧𝑗 Z value
Checking Variables
𝑐𝑗 −𝑧𝑗
2
Solution by Simplex Tableau: Example 1
3
Simplex Method: Processes of Simplex Method
Stage 1
Stage 2
4
Example 1 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)
• Maximization Problem
– If the coefficients of all non-basic variables are
negative, this basic solution is optimal
– If the coefficient of any non-basic variables is
positive, this basic solution is not optimal
– If the coefficients of some non-basic variables are 0
and those of other non-basic variables are all
negative, this basic solution is optimal and this
problem has alternate optima
5
Example 1 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)
Stage 1
Stage 2
7
Example 1 (Stage 2)
Select an Entering Variable (Q3)
• Maximization problem
– Select the non-basic variable with a positive coefficient in the
objective function
• 𝑥1 is a non-basic variable with a positive coefficient
𝑥1 is the entering
variable
Stage 1
Stage 2
10
Example 1 (Stage 2)
Develop New Simplex Pivot (Q4)
• Using the equation of the leaving variable and the
entering variable to get a new basic feasible solution
– Change the coefficients of all basic variables to be 1.
𝑠𝑡
0 1
𝐵 = {𝑠1 , 𝑠2 , 𝑠3 } Change the 𝐵 = {𝑠1 , 𝑠2 , 𝑥1 }
𝑥1 + 2𝑥2 + 𝒔𝟏 = 12 basic variable 𝒙𝟏 + 2𝑥2 + 𝒔𝟏 = 12
4𝑥1 + 5𝑥2 + 𝒔𝟐 = 40 4𝒙𝟏 + 5𝑥2 + 𝒔𝟐 = 40
𝑥1 + 𝒔𝟑 = 5 𝒙𝟏 + 𝑠3 = 5 ⇒ 𝒙𝟏 = 5 − 𝑠3
𝑍 = 0 + 5𝑥1 + 8𝑥2 𝑍 = 0 + 5𝑥1 + 8𝑥2
0 𝒔𝟑 0 1 0 0 0 1 5 5 pivot row
𝑧𝑗 0 0 0 0 0 0
𝑐𝑗 − 𝑧𝑗 5 8 0 0 0
𝒔1 0
𝒔2 0
1st 𝒙𝟏 5
𝑧𝑗
𝑐𝑗 − 𝑧𝑗
𝑠𝑡
1
𝐵0 = {𝑠1 , 𝑠2 , 𝑠3 } 𝐵 = {𝑠1 , 𝑠2 , 𝑥1 }
𝑥1 + 2𝑥2 + 𝒔𝟏 = 12 𝒙𝟏 + 2𝑥2 + 𝒔𝟏 = 12
4𝑥1 + 5𝑥2 + 𝒔𝟐 = 40 4𝒙𝟏 + 5𝑥2 + 𝒔𝟐 = 40
𝑥1 + 𝒔𝟑 = 5 𝒙𝟏 + 𝑠3 = 5
12
𝑍 = 0 + 5𝑥1 + 8𝑥2 𝑍 = 0 + 5𝑥1 + 8𝑥2
Example 1 (Stage 2)
Develop New Simplex Pivot (Q4)
Modify the constraints such that 1. Divide the pivot row by the pivot
1. The coefficients of all basic variables are 1 element to get a new pivot row
[1 0 0 0 1 5 ] ← [ 1 0 0 0 1 5 ] / 1
2. Each constraint contains only one basic variable
1. Divide the pivot row by the pivot element to get a new pivot row
[1 0 0 0 1 5] ← [1 0 0 0 1 5] / 1
2. Replace each non-pivot row i with: (aij is the value in entering column j of current row i )
[new row i] = [current row i] − [(aij) x (new pivot row)]
[ 0 2 1 0 -1 7 ] ← [ 1 2 1 0 0 12] − [ 1 x [ 1 0 0 0 1 5 ] ]
[ 0 5 0 1 -4 20] ← [ 4 5 0 1 0 40] − [ 4 x [1 0 0 0 1 5 ] ] 15
Example 1 (Stage 2)
Develop New Simplex Pivot (Q4)
• Modify the objective function such that it does not
contain any basic variable.
Tableau Basis 𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 Value Ratio
𝑐𝑗 5 8 0 0 0
𝑠1 0 1 2 1 0 0 12 12
𝑠2 0 4 5 0 1 0 40 10
0 𝒔𝟑 0 1 0 0 0 1 5 5
𝑧𝑗 0 0 0 0 0 0
𝑐𝑗 − 𝑧𝑗 5 8 0 0 0
𝑠1 0 0 2 1 0 -1 7
𝑠2 0 0 5 0 1 -4 20
1st 𝒙𝟏 5 1 0 0 0 1 5
𝑧𝑗 5 0 0 0 5 25
𝑐𝑗 − 𝑧𝑗 0 8 0 0 -5
𝟎×𝟐+𝟎×𝟓+𝟓×𝟎 𝟎 × 𝟕 + 𝟎 × 𝟐𝟎 + 𝟓 × 𝟓
𝑠𝑡
1
B0={s 1, s2, s3} B ={s1, s2, x1}
𝑍 = 0 + 5𝑥1 + 8𝑥2 𝑍 = 25 + 8𝑥2 − 5𝑠3
18
Example 1 (Stage 2)
Check whether a Basic Solution is Optimal (Q2)
19
Example 1(Stage 2)
Check whether a Basic Solution is Optimal (Q2)
• Final tableau
Tableau Basis 𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 Value Ratio
𝑐𝑗 5 8 0 0 0
𝑥2 8 0 1 0.5 0 -0.5 3.5
𝑠2 0 0 0 -2.5 1 -1.5 2.5
2nd 𝑥1 5 1 0 0 0 1 5
𝑧𝑗 5 8 4 0 1 53
𝑐𝑗 − 𝑧𝑗 0 0 -4 0 -1 All
Non-
𝑛𝑑 positive
• 𝐵 2
= {𝒙𝟏 , 𝒙𝟐 , 𝒔𝟐 }
• Optimal solution is
{𝑥1∗ ,𝑥2∗ ,𝑠1∗ ,𝑠2∗ ,𝑠3∗ } = {5, 3.5, 0, 2.5, 0}
𝑍 ∗ = 53
20
Example 1 (Summary of Stage 2)
Simplex method with Tableau form
Tableau Basis 𝒙𝟏 𝒙𝟐 𝒔𝟏 𝒔𝟐 𝒔𝟑 Value Ratio
𝑐𝑗 5 8 0 0 0
𝒔1 0 1 2 1 0 0 12 12
𝒔2 0 4 5 0 1 0 40 10
0 𝒔3 0 1 0 0 0 1 5 5
𝑧𝑗 0 0 0 0 0 0
𝑐𝑗 − 𝑧𝑗 5 8 0 0 0
𝒔1 0 0 2 1 0 -1 7 3.5
𝒔2 0 0 5 0 1 -4 20 4
1st 𝒙𝟏 5 1 0 0 0 1 5 ∞
𝑧𝑗 5 0 0 0 5 25
𝑐𝑗 − 𝑧𝑗 0 8 0 0 -5
𝒙𝟐 8 0 1 0.5 0 -0.5 3.5 Optima
𝒔2 0 0 0 -2.5 1 -1.5 2.5 {𝑥1∗ , 𝑥2∗ , 𝑠1∗ , 𝑠2∗ , 𝑠3∗ }
2nd 𝒙𝟏 5 1 0 0 0 1 5
= {5, 3.5, 0, 2.5, 0}
𝑧𝑗 5 8 4 0 1 53
𝑍 ∗ = 53
𝑐𝑗 − 𝑧𝑗 0 0 -4 0 -1
21
Example 2
Initial Tabular Form Formulation
22
Example 2
Initial Tabular Form Formulation
𝒁′ = −𝒙𝟏 − 𝒙𝟐 + 𝟑𝒙𝟑 + 𝟎𝒔𝟏 + 𝟎𝒔𝟐 − 𝑴𝒂𝟏 − 𝑴𝒂𝟐
⇒ 𝒁′ = −𝟒𝑴 + 𝟑𝑴 − 𝟏 𝒙𝟏 + 𝑴 − 𝟏 𝒙𝟐 + −𝟔𝑴 + 𝟑 𝒙𝟑 − 𝑴𝒔𝟐
Tableau Basis 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒔𝟏 𝒔𝟐 𝒂𝟏 𝒂𝟐 Value Ratio
𝑐𝑗 -1 -1 3 0 0 -M -M
𝒔𝟏 0 1 -2 1 1 0 0 0 11
𝒂𝟏 -M 2 1 -4 0 -1 1 0 3
0 𝒂𝟐 -M 1 0 -2 0 0 0 1 1
𝑧𝑗 0 0 0 0 0 0 0 0
𝑐𝑗 − 𝑧𝑗 -1 -1 3 0 0 -M -M
25
Example 2 (Stage 2)
Select an Entering Variable (Q3)
• Maximization problem
– Select the non-basic variable with a positive coefficient in the
objective function
• 𝑥1 is a non-basic variable with a positive coefficient
B0={𝑠1 , 𝑎1 , 𝑎2 }
𝑥1 is the entering
𝑥1 − 2𝑥2 + 𝑥3 + 𝒔𝟏 = 11
variable
2𝑥1 + 𝑥2 − 4𝑥3 − 𝑠2 + 𝒂𝟏 = 3
𝑥1 − 2𝑥3 + 𝒂𝟐 = 1
𝑍′ = −4𝑀 + 3𝑀 − 1 𝑥1 + 𝑀 − 1 𝑥2 + −6𝑀 + 3 𝑥3 − 𝑀𝑠2
Tableau Basis 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝒔𝟏 𝒔𝟐 𝒂𝟏 𝒂𝟐 Value Ratio
𝑐𝑗 -1 -1 3 0 0 -M -M
𝒔𝟏 0 1 -2 1 1 0 0 0 11
𝒂𝟏 -M 2 1 -4 0 -1 1 0 3
0 𝒂𝟐 -M 1 0 -2 0 0 0 1 1
𝑧𝑗 -3M -M 6M 0 M -M -M -4M
𝑐𝑗 − 𝑧𝑗 3M-1 M-1 -6M+3 0 -M 0 0
Pivot Column 26
Example 2 (Stage 2)
Decide the Leaving Variable (Q3)
• The leaving variable is the one that first goes to zero as the
value of entering variable increases from zero
– Set 𝑥1 to the maximum while maintaining all variables non-negative.
𝑥1 will replace 𝑎2 as
the new basic variable
27
Example 2 (Stage 2)
Develop New Simplex Pivot (Q4)
Case I: Infeasibility
31
Special Case I: Infeasibility
An Example
Infeasibility occurs if the solution reaches optimality but
an artificial variable remains positive in the final tableau
General form of an LP problem Standard form of an LP problem
𝑐𝑗 3 5 0 0 -M
𝑥2 5 1 1 1 0 0 3
𝑎1 -M 0 0 -1 -1 1 2
1st
𝑧𝑗 5 5 M+5 M -M -2M+15
𝑐𝑗 − 𝑧𝑗 -2 0 -M-5 -M 0
34
Special Case II: Unbounded LP
Basis 𝒙𝟏 … Value
𝑐𝑗 6 …
𝑥2 8 -3 … 8 The coefficients of the
entering column are all
… 0 -2 … 4
non-positive
𝑠1 0 0 … 5
𝑧𝑗 -24 …
𝑐𝑗 − 𝑧𝑗 30 …
35
Special Case II: Unbounded LP
An Example
max 𝑍 = 2𝑥1 + 3𝑥2 𝑍 = 2𝑥1 + 3𝑥2 𝑥2
s.t. 𝑥 − 𝑥 ≤ 3 𝑥1 − 𝑥2 + 𝒔𝟏 = 3
1 2
𝑥1 ≤4 𝑥1 + 𝒔𝟐 = 4 𝑥1 ≤ 4
Basis 𝒙𝟏 𝒙𝟐 𝑠1 𝑠2 Value
𝑥1 − 𝑥2 ≤ 3
𝑐𝑗 2 3 0 0
𝑠1 0 1 -1 1 0 3 𝑍 = 2𝑥1 + 3𝑥2
𝑠2 0 1 0 0 1 4
0
0 0 0 0 0 𝑥1
𝑧𝑗 0
𝑐𝑗 − 𝑧𝑗 2 3 0 0
Basis 𝒙𝟏 𝒙𝟐 𝑠1 𝑠2 Value
𝑥1 − 𝑥2 ≤ 3
𝑐𝑗 2 3 0 0
𝑥1 2 1 0 0 1 4 𝑍 = 2𝑥1 + 3𝑥2
𝑥2 3 0 1 -1 1 1 0
𝑥1
𝑧𝑗 2 3 -3 5 11 0
𝑐𝑗 − 𝑧𝑗 0 0 3 -5 If x1 is first chosen to be
Tableau entering variable, then
after two 1st iteration: x1 in, s1 out
iterations 2nd iteration: x2 in, s2 out
All coefficients in the entering
column of s1 are non-positive
37
Special Case III: Alternate Optima
An Example
• If the coefficients of some non-basic 𝑥2
variables are 0 and those of other
non-basic variables are all negative 𝑥1 ≤ 4
in the objective function, this basic
solution is optimal and this problem
has alternate optima
𝑥1 + 2𝑥2 ≤ 10
max 𝑍 = 𝑥1 + 2𝑥2 𝑍 = 0 + 𝑥1 + 2𝑥2
s.t. 𝑥 + 2𝑥 ≤ 10 𝑥1 + 2𝑥2 + 𝒔𝟏 = 10 𝑍 = 𝑥1 + 2𝑥2
1 2
𝑥1 ≤4 𝑥1 + 𝒔𝟐 = 4 0
0 𝑥1
𝑍 = 10 − 1.0𝑠1 − 0.0𝑠2
Final Tableau: 𝑥1 = 4 − 𝑠2
1 1
𝑥2 = 3 − 𝑠1 + 𝑠2
2 2
38
Special Case III: Alternate Optima
An Example
Alternate optima exist if a non-basic variable in the final
tableau has a 𝑐𝑗 − 𝑧𝑗 value equal to 0.
𝑥2
Basis 𝒙𝟏 𝒙𝟐 𝑠1 𝒔𝟐 Value
𝑐𝑗 1 2 0 0
𝑥1 1 1 0 0 1 4
1 1
𝑥2 2 0 1 − 3
2 2
𝑧𝑗 1 2 1.0 0 10
𝑐𝑗 − 𝑧𝑗 0 0 -1.0 0 0
0 𝑥1
Set up the
initial tableau
Compute Alternate
Infeasibility
𝑐𝑗 − 𝑧𝑗 optima
Yes Yes
Optimality Yes Infeasibility No Alternate optima No Unique
check check check optima
No
Yes
Unboundedness Unboundedness
check
No
Compute new
tableau
40