ch04
ch04
Chapter 4.
4.1. Introduction
• The simplex method is an efficient algorithm developed by George
Dantzig in 1947.
• It is widely programmed in powerful OR software for solving
quantitative decision making problem in business.
• The simplex method is an algebraic procedure while its underlying
concepts are geometric.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:3
3x1+2x2=18
x1=4
(2,6)
Max Z = 3x1 + 5x2 (0,6) 2x2=12
Z=30 1 2 Z=36
s.t. x1 ≤ 4 (1)
2x2 ≤ 12 (2)
3x1 + 2x2 ≤ 18 (3) (4,3)
Feasible
x1 ≥ 0, x2 ≥ 0 Region
Z=27
0
(0,0) (4,0) x1
Z=0 Z=12
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:6
Optimality Test:
Adjacent CPF solutions are better
=⇒ (0, 0) is NOT an optimal solution.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:7
Iteration 1:
• Considering the two edges of the feasible region that emanate from
(0, 0), choose to move along the edge that leads up the x2 axis.
(With an objective function of Z = 3x1 + 5x2, moving up the x2
axis increases Z at a faster rate than moving along the x1 axis.)
• Stop at the first new constraint boundary: 2x2 = 12.
• Solve for the intersection of the new set of constraint boundaries:
(0, 6).
Optimality Test:
An adjacent CPF solution is better
=⇒ (0, 6) is NOT an optimal solution.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:8
Iteration 2:
• Considering the two edges of the feasible region that emanate from
(0, 6), choose to move along the edge that increases Z.
• Stop at the first new constraint boundary encountered when moving
in that direction: 3x1 + 2x2 = 18.
• Solve for the intersection of the new set of constraint boundaries:
(2, 6).
Optimality Test:
None of the adjacent CPF solutions are better
=⇒ (2, 6) is an optimal solution.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:9
End
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:10
• Prototype Example:
Let si be the slack variable for the constraint i (i = 1, 2, 3).
x1 + s1 = 4
x1 ≤ 4 ⇐⇒
s1 ≥ 0
2x2 + s2 = 12
2x2 ≤ 12 ⇐⇒
s2 ≥ 0
3x1 + 2x2 + s3 = 18
3x1 + 2x2 ≤ 18 ⇐⇒
s3 ≥ 0
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:13
Augmented Solution:
• An augmented solution is a solution for the original variables (the
decision variables) that has been augmented by the corresponding
values of the slack variables.
• (x1, x2) = (3, 2) is a solution of the original model;
(x1, x2, s1, s2, s3) = (3, 2, 1, 8, 5) is the corresponding augmented
solution.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:14
Basic Solution:
• A basic solution is an augmented corner-point solution.
• (x1, x2) = (4, 6) is a corner-point infeasible solution of the original
model;
(x1, x2, s1, s2, s3) = (4, 6, 0, 0, −6) is the corresponding augmented
solution (a basic solution).
Optimality Test
• At the initial BF solution, Z = 3x1 + 5x2 = 0.
• Obviously, increasing the values of x1 or x2 can bring an improve-
ment to Z. So, the current BF solution is NOT optimal.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:20
Iteration 1
1. Determining Where to Go
• Choose the non-basic variable with the largest rate of improvement
in Z.
• Increasing this non-basic variable from zero will convert it to a basic
variable for the next BF solution. It is called the entering (basic)
variable for iteration 1.
• Prototype Example:
Objective function: Z = 3x1 + 5x2
Rate of improvement in Z by increasing x1 = 3
Rate of improvement in Z by increasing x2 = 5
Thus, we should choose x2.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:21
Optimality Test
• The current eq.(0) gives the current objective function:
Z = 30 + 3x1 − (5/2)s2
Iteration 2
1. Determining Where to Go
Now, Z = 30 + 3x1 − (5/2)s2, Z can be increased by increasing x1,
but not s2. Therefore, we choose x1 as the entering variable.
Optimality Test
• Since increasing the non-basic variables (s2 and s3) would not
increase Z, the current BF solution is optimal.
• The optimal BF solution is (x∗1 , x∗2 , s∗1 , s∗2 , s∗3 ) = (2, 6, 2, 0, 0), which
implies the optimal solution to the original problem is (x∗1, x∗2 ) =
(2, 6) and the corresponding optimal value Z ∗ = 36.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:29
Initialization (Iteration 0)
BV Z x1 x2 s1 s2 s3 RHS
Z 1 −3 −5 0 0 0 0
s1 0 1 0 1 0 0 4
s2 0 0 2 0 1 0 12
s3 0 3 2 0 0 1 18
Optimality Test
• The current BF solution is optimal if and only if every coefficient
in row 0 is non-negative.
• Now, the coefficients of both x1 and x2 in row 0 are negative,
therefore the current BF solution is NOT optimal.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:31
Iteration 1
1. Determining the Entering Variable (Determining Where to Go)
• Select the non-basic variable with the “most negative” coefficient.
• The column below this coefficient is called the pivot column.
↓
BV Z x1 x2 s1 s2 s3 RHS
Z 1 −3 −5 0 0 0 0
s1 0 1 0 1 0 0 4
s2 0 0 2 0 1 0 12
s3 0 3 2 0 0 1 18
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:32
Optimality Test
The coefficient of x1 in row 0 is negative, therefore the current BF
solution is NOT optimal.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:34
Iteration 2
BV Z x1 x2 s1 s2 s3 RHS Ratio
Z 1 −3 0 0 5/2 0 30
s1 0 1 0 1 0 0 4 4/1 = 4
x2 0 0 1 0 1/2 0 6
s3 0 3 0 0 −1 1 6 6/3 = 2
BV Z x1 x2 s1 s2 s3 RHS
Z 1 0 0 0 3/2 1 36
s1 0 0 0 1 1/3 −1/3 2
x2 0 0 1 0 1/2 0 6
x1 0 1 0 0 −1/3 1/3 2
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:35
Optimality Test
• Since none of the coefficients in row 0 are negative, the current BF
solution is optimal.
• The optimal BF solution is (x∗1 , x∗2 , s∗1 , s∗2 , s∗3 ) = (2, 6, 2, 0, 0), which
implies the optimal solution to the original problem is (x∗1, x∗2 ) =
(2, 6) and the corresponding Z ∗ = 36.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:36
Question:
How to choose an entering variable when two or more non-basic
variables are tied for having the most negative coefficient in row 0?
Answer:
Choose arbitrarily.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:39
Question:
How to choose a leaving variable when two or more rows have the
same minimum ratio?
Answer:
Choose arbitrarily and change the choice of the variable in the case
of having loop.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:40
Example 4.2.
Max Z = 0.75x1 − 20x2 + 0.5x3 − 6x4
s.t. 0.25x1 − 8x2 − x3 + 9x4 ≤ 0 (1)
0.50x1 − 12x2 − 0.5x3 + 3x4 ≤ 0 (2)
x3 ≤ 1 (3)
xj ≥ 0 (j = 1, 2, 3, 4)
Let si be the slack variable for the constraint i (i = 1, 2, 3).
The augmented form of the problem:
Max Z = 0.75x1 − 20x2 + 0.5x3 − 6x4
s.t. 0.25x1 − 8x2 − x3 + 9x4 + s1 = 0 (1)
0.50x1 − 12x2 − 0.5x3 + 3x4 + s2 = 0 (2)
x3 + s3 = 1 (3)
xj ≥ 0 (j = 1, 2, 3, 4), si ≥ 0 (i = 1, 2, 3)
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:42
ITERATION 0
ROW BV x1 x2 x3 x4 s1 s2 s3 RHS RATIO
0 Z -0.750 20.000 -0.500 6.000 0.000 0.000 0.000 0.000
1 s1 0.250 -8.000 -1.000 9.000 1.000 0.000 0.000 0.000 0
2 s2 0.500 -12.000 -0.500 3.000 0.000 1.000 0.000 0.000 0
3 s3 0.000 0.000 1.000 0.000 0.000 0.000 1.000 1.000 ---
ITERATION 1
ROW BV x1 x2 x3 x4 s1 s2 s3 RHS RATIO
0 Z 0.000 -4.000 -3.500 33.000 3.000 0.000 0.000 0.000
1 x1 1.000 -32.000 -4.000 36.000 4.000 0.000 0.000 0.000
2 s2 0.000 4.000 1.500 -15.000 -2.000 1.000 0.000 0.000
3 s3 0.000 0.000 1.000 0.000 0.000 0.000 1.000 1.000
ITERATION 2
ROW BV x1 x2 x3 x4 s1 s2 s3 RHS RATIO
0 Z 0.000 0.000 -2.000 18.000 1.000 1.000 0.000 0.000
1 x1 1.000 0.000 8.000 -84.000 -12.000 8.000 0.000 0.000 0
2 x2 0.000 1.000 0.375 -3.750 -0.500 0.250 0.000 0.000 0
3 s3 0.000 0.000 1.000 0.000 0.000 0.000 1.000 1.000 1
ITERATION 3
ROW BV x1 x2 x3 x4 s1 s2 s3 RHS RATIO
0 Z 0.250 0.000 0.000 -3.000 -2.000 3.000 0.000 0.000
1 x3 0.125 0.000 1.000 -10.500 -1.500 1.000 0.000 0.000 ---
2 x2 -0.047 1.000 0.000 0.188 0.062 -0.125 0.000 0.000 0
3 s3 -0.125 0.000 0.000 10.500 1.500 -1.000 1.000 1.000 0.095
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:43
ITERATION 4
ROW BV x1 x2 x3 x4 s1 s2 s3 RHS RATIO
0 Z -0.500 16.000 0.000 0.000 -1.000 1.000 0.000 0.000
1 x3 -2.500 56.000 1.000 0.000 2.000 -6.000 0.000 0.000 0
2 x4 -0.250 5.333 0.000 1.000 0.333 -0.667 0.000 0.000 0
3 s3 2.500 -56.000 0.000 0.000 -2.000 6.000 1.000 1.000 ---
ITERATION 5
ROW BV x1 x2 x3 x4 s1 s2 s3 RHS RATIO
0 Z -1.750 44.000 0.500 0.000 0.000 -2.000 0.000 0.000
1 s1 -1.250 28.000 0.500 0.000 1.000 -3.000 0.000 0.000
2 x4 0.167 -4.000 -0.167 1.000 0.000 0.333 0.000 0.000
3 s3 0.000 0.000 1.000 0.000 0.000 0.000 1.000 1.000
ITERATION 6
ROW BV x1 x2 x3 x4 s1 s2 s3 RHS RATIO
0 Z -0.750 20.000 -0.500 6.000 0.000 0.000 0.000 0.000
1 s1 0.250 -8.000 -1.000 9.000 1.000 0.000 0.000 0.000
2 s2 0.500 -12.000 -0.500 3.000 0.000 1.000 0.000 0.000
3 s3 0.000 0.000 1.000 0.000 0.000 0.000 1.000 1.000
Case 2
x1 − 2x2 ≤ −3 ⇐⇒ −x1 + 2x2 ≥ 3 (nonstandard form)
See Section 4.8.
Case 3
x1 − 2x2 = −3 ⇐⇒ −x1 + 2x2 = 3 (nonstandard form)
See Section 4.8.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:56
Artificial-variable technique:
1. Introduce a non-negative artificial variable to the constraint that
needs an initial basic variable.
2. Reduce the values of the artificial variables by some techniques (see
Section 4.8) at each iteration until all of them become zero.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:63
Algorithm:
1. Let M → ∞ (a huge positive number).
2. Penalize the problem by subtracting the terms M ai (for all i) from
the objective function.
3. Convert the penalized problem to the canonical form by elementary
row operations.
4. Solve the penalized problem by the simplex method.
5. If ai = 0 (for all i) in the optimal simplex tableau, then the final
basic feasible solution is optimal, otherwise, the original LP problem
is infeasible.
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:66
Then, the big-M problem can be rewritten as the simplex tableau (in
canonical form):
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:69
Iteration 0
BV Z x1 x2 e3 s1 a2 a3 RHS Ratio
−1.1M −0.9M M −12M
Z 1 +0.4 +0.5 0 0 0
s1 0 0.3 0.1 0 1 0 0 2.7 2.7/0.3 = 9
a2 0 0.5 0.5 0 0 1 0 6.0 6/0.5 = 12
a3 0 0.6 0.4 −1 0 0 1 6.0 6/0.6 = 10
Iteration 1
BV Z x1 x2 e3 s1 a2 a3 RHS Ratio
−16M/30 M 11M/3 −21M/10
Z 1 0 +11/30 −4/3 0 0 −36/10
x1 0 1 1/3 0 10/3 0 0 9 27
a2 0 0 1/3 0 −5/3 1 0 3/2 4.5
a3 0 0 1/5 −1 −2 0 1 3/5 3
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:70
Iteration 2
BV Z x1 x2 e3 s1 a2 a3 RHS Ratio
−10M/6 −5M/3 16M/6 −5M/10
Z 1 0 0 +11/6 +7/3 0 −11/6 −47/10
x1 0 1 0 5/3 20/3 0 −5/3 8 4.8
a2 0 0 0 5/3 5/3 1 −5/3 1/2 0.3
x2 0 0 1 −5 −10 0 5 3
Iteration 3
BV Z x1 x2 e3 s1 a2 a3 RHS
M M
Z 1 0 0 0 1/2 −11/10 −21/4
x1 0 1 0 0 5 −1 0 15/2
e3 0 0 0 1 1 3/5 −1 3/10
x2 0 0 1 0 −5 3 0 9/2
Chi-Kong Ng, SEEM2420, Dept. of SEEM, CUHK 4:71