Simplex Algorithm
Simplex Algorithm
Simplex Algorithm
Napat Rujeerapaiboon
Semester I, AY2019/2020
Simplex Tableaux
r T xN = cBT B −1 b
x0 −
−1 (∗)
xB + B NxN = B −1 b
xB 0 I −1
B N B −1 b
Explicit formulation:
2 1
x0 − 5 x3 − 5 x4 = −8
1 2
x2 − 5 x3 + 5 x4 = 5
3 1
− 5 x3 + 5 x4 + x5 = 1
3 1
x1 + 5 x3 − 5 x4 = 3
Example: Simplex Tableaux
1 − 25 − 15 −8
1 − 15 2
5 5
− 35 1
5 1 1
3
1 5 − 15 3
Example: Simplex Tableaux
Appending zeroes:
1 0 0 − 25 − 15 0 −8
0 0 1 − 15 2
5 0 5
0 0 0 − 35 1
5 1 1
0 1 0 35 − 15 0 3
Example: Simplex Tableaux
Introducing labels:
BV x0 x1 x2 x3 x4 x5 RHS
x0 1 0 0 − 25 − 15 0 −8
x2 0 0 1 − 15 2
5 0 5
x5 0 0 0 − 35 1
5 1 1
3
x1 0 1 0 5 − 15 0 3
|I\I 0 | = |I 0 \I| = 1.
Pivoting
We say that
• xp leaves the basis;
• xq enters the basis.
Pivoting (cont)
To swap xp and xq we
1. divide row p by the pivot element ypq :
ypj
yqj0 = ∀j = 0, . . . , n (1)
ypq
yiq
2. subtract the ypq -fold multiple of row p from row i ∈ I\{p}:
yiq
yij0 = yij − ypj ∀j = 0, . . . , n (2)
ypq
βq
3. subtract the ypq -fold multiple of row p from objective row:
βq
βj0 = βj − ypj ∀j = 0, . . . , n (3)
ypq
Pivoting (Remarks)
BV x0 x1 x2 x3 x4 x5 x6 RHS
x0 1 0 0 0 1 2 1 1
x1 0 1 0 0 1 1 −1 5
x2 0 0 1 0 2 −3 1 3
x3 0 0 0 1 −1 2 −1 −1
BV x0 x1 x2 x3 x4 x5 x6 RHS
x0 1 0 0 0 1 2 1 1
x1 0 1 0 0 1 1 −1 5
x2 0 0 1 0 2 −3 1 3
x3 0 0 0 1 −1 2 −1 −1
BV x0 x1 x2 x3 x4 x5 x6 RHS
x0 1 0 0 0 1 2 1 1
x1 0 1 0 0 1 1 −1 5
x2 0 0 1 0 2 −3 1 3
x3 0 0 0 1 −1 2 −1 −1
x0
x4 0 1 0 0 1 1 −1 5
x2
x3
BV x0 x1 x2 x3 x4 x5 x6 RHS
x0 1 0 0 0 1 2 1 1
x1 0 1 0 0 1 1 −1 5
x2 0 0 1 0 2 −3 1 3
x3 0 0 0 1 −1 2 −1 −1
x0
x4 0 1 0 0 1 1 −1 5
x2 0 −2 1 0 0 −5 3 −7
x3
BV x0 x1 x2 x3 x4 x5 x6 RHS
x0 1 0 0 0 1 2 1 1
x1 0 1 0 0 1 1 −1 5
x2 0 0 1 0 2 −3 1 3
x3 0 0 0 1 −1 2 −1 −1
x0
x4 0 1 0 0 1 1 −1 5
x2 0 −2 1 0 0 −5 3 −7
x3 0 1 0 1 0 3 −2 4
BV x0 x1 x2 x3 x4 x5 x6 RHS
x0 1 0 0 0 1 2 1 1
x1 0 1 0 0 1 1 −1 5
x2 0 0 1 0 2 −3 1 3
x3 0 0 0 1 −1 2 −1 −1
x0 1 −1 0 0 0 1 2 −4
x4 0 1 0 0 1 1 −1 5
x2 0 −2 1 0 0 −5 3 −7
x3 0 1 0 1 0 3 −2 4
BV x0 x1 x2 x3 x4 x5 x6 RHS
x0 1 0 0 0 1 2 1 1
x1 0 1 0 0 1 1 −1 5
x2 0 0 1 0 2 −3 1 3
x3 0 0 0 1 −1 2 −1 −1
x0 1 −1 0 0 0 1 2 −4
x4 0 1 0 0 1 1 −1 5
x2 0 −2 1 0 0 −5 3 −7
x3 0 1 0 1 0 3 −2 4
Pivot equations ensure that the other basic columns and the
objective column remain unchanged!
Pivot Selection
By definition, we have
• βi = 0 for all i ∈ I (basic variables);
• βi = −ri for all i ∈
/ I (nonbasic variables).
Choosing xq (cont)
Two cases:
• if βi ≤ 0 ∀i ∈
/ I, then the current BFS is optimal.
X
x0 = β0 − βi xi ≥ β0 ∀xi ≥ 0
i ∈I
/
xq ≤ x , yi0
iq if yiq > 0,
xi = yi0 − yiq xq ≥ 0 ⇐⇒ yiq
x ≤x ,∞ if yiq ≤ 0.
q iq
xq ≤ min x iq . (∗∗)
i∈I
Choosing xp (cont)
Two cases:
• If βi ≤ 0 for all i ∈
/ I, then the current BFS is optimal.
⇒ We are done! Otherwise. . .
• Any xq with q ∈
/ I and βq > 0 can enter the basis.
⇒ Choose a suitable xq . . .
yi0
if yiq > 0,
Recall: x iq , yiq
∞ if yiq ≤ 0.
Pivoting Conventions
• Step 2: If ∃j ∈
/ I with βj > 0 and yij ≤ 0 for all i ∈ I:
STOP — no finite minimum exists.
minimize:
x0 = −4x1 − 2x2 + x3
Subject to:
x1 +x2 +x3 ≤ 4
x1 −x2 −2x3 ≤ 3
3x1 +2x2 +x3 ≤ 12
x1 , x2 , x3 ≥ 0.
Example (Simplex Algorithm)
minimize:
x0 = −4x1 − 2x2 + x3
Subject to:
x1 , x2 , x3 , x4 , x5 , x6 ≥ 0.
We have thus an initial BFS for I = {4, 5, 6}.
Example (Simplex Algorithm)
BV x0 x1 x2 x3 x4 x5 x6 RHS
x0 1 4 2 −1 0
x4 1 1 1 1 4
x5 1 −1 −2 1 3
x6 3 2 1 1 12
x0 1 6 7 −4 −12
x4 2 3 1 −1 1
x1 1 −1 −2 1 3
x6 5 7 −3 1 3
Example (Simplex Algorithm)
BV x0 x1 x2 x3 x4 x5 x6 RHS
x0 1 6 7 −4 −12
x4 2 3 1 −1 1
x1 1 −1 −2 1 3
x6 5 7 −3 1 3
4
x0 1 3 − 73 5
−3 − 43
3
2 1 1 1
x3 3 1 3 −3 3
1 2 1 11
x1 1 3 3 3 3
1
x6 3 − 73 − 23 1 2
3
Example (Simplex Algorithm)
BV x0 x1 x2 x3 x4 x5 x6 RHS
4
x0 1 3 − 37 − 53 − 43
3
2 1
x3 3 1 3 − 13 1
3
1 2 1 11
x1 1 3 3 3 3
1 7
x6 3 − 3 − 23 1 2
3
x0 1 −2 −3 −1 −15
3 1
x2 1 2 2 − 12 1
2
1 1 1 7
x1 1 −2 2 2 2
x6 − 21 − 52 − 12 1 1
2
Solution: x1 = 72 , x2 = 21 , and x3 = 0.
Degenerate BS’s
x2
demand constraint:
x1 6 4
x1
Degenerate BS’s (cont)
x2
x1
Degenerate BS’s (cont)
The highlighted BS corresponds to the index sets
I = {1, 2, 3}, I = {1, 2, 4} and I = {1, 2, 5}.
x2
x5 = 0
x4 = 0
x3 = 0
x1
Degenerate BFS’s: Definition