The Simplex Method - Part 1
The Simplex Method - Part 1
Linear Optimization
Based on the book Introduction to Linear Optimization by D. Bertsimas and J.N. Tsitsiklis
Outline
minimize c′ x
subject to Ax = b
x ≥ 0.
Definition 3.1
Let x be a point in a polyhedron P.
A vector d ∈ Rn is said to be a
feasible direction at x, if there exists
a positive scalar θ for which
x + θd ∈ P.
Optimality conditions
xB =
Optimality conditions
xB = B−1 b.
Optimality conditions
xB + θdB ,
n = 5, m = 3
Optimality conditions
▶ How about the nonnegativity constraints?
▶ We recall that the variable xj is increased, and all other
nonbasic variables stay at zero level.
▶ Thus, we need only worry about the basic variables. We
distinguish two cases:
n = 5, m = 3
Optimality conditions
xB + θdB ≥ 0,
xB(i) = 0
dB(i) < 0.
c′ (x + θd) − c′ x = θc′ d.
X
n X
m
′
cd= ci di = cB(i) dB(i) + cj = c′B dB + cj = cj − c′B B−1 Aj .
i=1 i=1
Definition 3.2
Let x be a basic solution, let B be an associated basis matrix,
and let cB be the vector of costs of the basic variables. For
each j, we define the reduced cost c̄j of the variable xj
according to the formula
minimize c1 x1 + c2 x2 + c3 x3 + c4 x4
subject to x1 + x2 + x3 + x4 = 2
2x1 + 3x3 + 4x4 = 2
x1 , x2 , x3 , x4 ≥ 0.
minimize c1 x1 + c2 x2 + c3 x3 + c4 x4
subject to x1 + x2 + x3 + x4 = 2
2x1 + 3x3 + 4x4 = 2
x1 , x2 , x3 , x4 ≥ 0.
minimize c1 x1 + c2 x2 + c3 x3 + c4 x4
subject to x1 + x2 + x3 + x4 = 2
2x1 + 3x3 + 4x4 = 2
x1 , x2 , x3 , x4 ≥ 0.
minimize c1 x1 + c2 x2 + c3 x3 + c4 x4
subject to x1 + x2 + x3 + x4 = 2
2x1 + 3x3 + 4x4 = 2
x1 , x2 , x3 , x4 ≥ 0.
3 1
c′ d = − c1 + c2 + c3 .
2 2
▶ This is the same as the reduced cost of the variable x3 .
Optimality conditions
We now calculate the reduced cost
for the case of a basic variable (j = B(i) for some i ∈ {1, . . . , m}).
▶ Since B = [AB(1) · · · AB(m) ], we have
Theorem 3.1
Consider a basic feasible solution x associated with a basis
matrix B, and let c̄ be the corresponding vector of reduced
costs.
(a) If c̄ ≥ 0, then x is optimal.
(b) If x is optimal and nondegenerate, then c̄ ≥ 0.
Theorem 3.1
Consider a basic feasible solution x associated with a basis
matrix B, and let c̄ be the corresponding vector of reduced
costs.
(a) If c̄ ≥ 0, then x is optimal.
(b) If x is optimal and nondegenerate, then c̄ ≥ 0.
Theorem 3.1
Consider a basic feasible solution x associated with a basis
matrix B, and let c̄ be the corresponding vector of reduced
costs.
(a) If c̄ ≥ 0, then x is optimal.
(b) If x is optimal and nondegenerate, then c̄ ≥ 0.
Definition 3.3
A basis matrix B is said to be optimal if:
(a) B−1 b ≥ 0, and
(b) c̄′ = c′ − c′B B−1 A ≥ 0′ .
Optimality conditions
▶ If an optimal basis is found, the corresponding basic
solution is feasible, satisfies the optimality conditions, and
is therefore optimal.
▶ On the other hand, it can happen that we have found a
basis that is not optimal, and the corresponding basic
solution is optimal.
▶ In this case at least one reduced cost is negative.
▶ Thus the basic solution is degenerate.
Definition 3.3
A basis matrix B is said to be optimal if:
(a) B−1 b ≥ 0, and
(b) c̄′ = c′ − c′B B−1 A ≥ 0′ .
3.2 Development of the simplex method
Development of the simplex method
x + θd, where θ ≥ 0.
θ∗ = max{θ ≥ 0 | x + θd ∈ P}.
θ∗ c′ d = θ∗ c̄j .
Development of the simplex method
A(x + θd) = Ax = b ∀θ ∈ R,
∗ xi
θ = min − .
i | di <0 di
minimize c1 x1 + c2 x2 + c3 x3 + c4 x4
subject to x1 + x2 + x3 + x4 = 2
2x1 + 3x3 + 4x4 = 2
x1 , x2 , x3 , x4 ≥ 0.
x = (1, 1, 0, 0).
c̄3 = −3.
Example 3.2
▶ Since c̄3 is negative, we form the 3rd basic direction, which is
3 1
d = − , , 1, 0 .
2 2
▶ We consider vectors of the form
x + θd, with θ ≥ 0.
▶ As θ increases, the only component of x that decreases is the
first one (because d1 < 0).
▶ The largest possible value of θ is given by
x1 2
θ∗ = − = .
d1 3
▶ This takes us to the point
2 4 2
y=x+ d= 0, , , 0 .
3 3 3
Example 3.2
minimize c1 x1 + c2 x2 + c3 x3 + c4 x4
subject to x1 + x2 + x3 + x4 = 2
2x1 + 3x3 + 4x4 = 2
x1 , x2 , x3 , x4 ≥ 0.
▶ Consider our new vector y
4 2
y= 0, , , 0 .
3 3
▶ The columns corresponding to the nonzero variables at the
new vector y are A2 = (1, 0) and A3 = (1, 3), and are linearly
independent.
▶ Therefore, they form a basis and the vector y is the
corresponding basic feasible solution.
▶ In particular, A3 (or x3 ) has entered the basis and A1 (or x1 )
has exited the basis.
Development of the simplex method
y = x + θ∗ d.
▶ Hence
xB(ℓ)
yB(ℓ) = xB(ℓ) + θ∗ dB(ℓ) = xB(ℓ) − = 0.
dB(ℓ)
d
B(ℓ)
Development of the simplex method
▶ The basic variable xB(ℓ) has become zero, and the nonbasic
variable xj has become positive.
▶ This suggests that xj should replace xB(ℓ) in the basis.
▶ Accordingly, we take the old basis matrix B and replace AB(ℓ)
with Aj :
B̄ = AB(1) · · · AB(ℓ−1) Aj AB(ℓ+1) · · · AB(m) .
Theorem 3.2
(a) The columns AB̄(i) , i = 1, . . . , m, are linearly independent
and, therefore, B̄ is a basis matrix.
(b) The vector y = x + θ∗ d is a basic feasible solution
associated with the basis matrix B̄.
u = −dB = B−1 Aj ,
ui = −dB(i) , for i = 1, . . . , m.
Development of the simplex method
Theorem 3.3
Assume that the feasible set is nonempty and that every basic
feasible solution is nondegenerate. Then, the simplex method
terminates after a finite number of iterations. At termination,
there are the following two possibilities:
(a) We have an optimal basis B and an associated basic
feasible solution which is optimal.
(b) We have found a vector d satisfying Ad = 0, d ≥ 0, and
c′ d < 0, and the optimal cost is −∞.
Proof (1/3):
▶ Case 1. The algorithm terminates in Step 2:
c̄j ≥ 0 for all nonbasic indices j.
▶ Then the optimality conditions in Theorem 3.1 have been
met.
▶ B is an optimal basis, and the current basic feasible solution
is optimal.
Development of the simplex method
Proof (2/3):
▶ Case 2. The algorithm terminates in Step 3:
no component of u is positive.
▶ Then we are at a basic feasible solution x and we have
discovered a nonbasic variable xj s.t. c̄j < 0 and the jth
basic direction d satisfies Ad = 0, d ≥ 0.
▶ In particular, x + θd ∈ P for all θ > 0.
▶ Since c′ d = c̄j < 0, by taking θ arbitrarily large, the cost can
be made arbitrarily negative, and the optimal cost is −∞.
Development of the simplex method
Proof (3/3):
▶ At each iteration, the algorithm moves by a positive
amount θ∗ along a direction d that satisfies c′ d < 0.
▶ Therefore, the cost of every successive basic feasible
solution visited by the algorithm is strictly less than the
cost of the previous one.
▶ In particular, no basic feasible solution can be visited twice.
▶ Since there is a finite number of basic feasible solutions
(Corollary 2.1), the algorithm must eventually
terminate.
Development of the simplex method
Theorem 3.2
(a) The columns AB(i) , i ̸= ℓ, and Aj are linearly independent
and, therefore, B̄ is a basis matrix.
(b) The vector y = x + θ∗
d is a basic feasible solution
associated with the basis matrix B̄.
The simplex method for degenerate problems
(b) Even if θ∗ is positive, it may happen that more than one of the
original basic variables becomes zero at the new point x + θ∗ d.
▶ Since only one of them exits the basis, the others remain in
the basis at zero level, and the new basic feasible solution is
degenerate.
The simplex method for degenerate problems
Example:
(b) Choose a column with c̄j < 0 for which the corresponding cost
decrease θ∗ |c̄j | is largest.
▶ This rule offers the possibility of reaching optimality after a
smaller number of iterations.
▶ On the other hand, the computational burden at each
iteration is larger, because we need to compute θ∗ for each
column with c̄j < 0.
▶ The available empirical evidence suggests that the overall
running time does not improve.
Pivot Selection
a′ b = a1 b1 + a2 b2 + · · · + an bn .
Definition 1.2
Let f and g be functions that map positive numbers to positive
numbers.
(a) We write f(n) = O(g(n)) if there exist positive numbers
n0 and c such that
Ax = b.
Example 1.11
Suppose that we have a choice of two algorithms:
▶ The running time of the first is 10n /100 (exponential).
▶ The running time of the second is 10n3 (polynomial).
Polynomial vs Exponential time algorithms
Example 1.11
Suppose that we have a choice of two algorithms:
▶ The running time of the first is 10n /100 (exponential).
▶ The running time of the second is 10n3 (polynomial).
Example 1.11
Suppose that we have a choice of two algorithms:
▶ The running time of the first is 10n /100 (exponential).
▶ The running time of the second is 10n3 (polynomial).
−u = −B−1 Aj .
▶ The stepsize
xB(i)
θ∗ = min .
i=1,...,m | ui >0 ui
▶ The main difference between alternative implementations lies
in:
▶ The way that the vectors B−1 Aj are computed,
▶ The amount of related information that is carried from one
iteration to the next.
Implementations of the simplex method
p′ = c′B B−1 .
c̄j = cj − p′ Aj .
u = B−1 Aj .
Naive implementation
and the variable that will exit the basis, and construct the new
basic feasible solution.
Naive implementation
and the variable that will exit the basis, and construct the new
basic feasible solution.
Naive implementation: running time
p′ B = c′B and Bu = Aj .
▶ Let
B = [AB(1) · · · AB(m) ]
be the basis matrix at the beginning of an iteration and let
Definition 3.4
Given a matrix, the operation of adding a constant multiple of
one row to the same or to another row is called an elementary
row operation.
Let
1 0 2 1 2
Q = 0 1 0 , C = 3 4 ,
0 0 1 5 6
and note that
1+2·5 2+2·6 11 14
QC = 3 4 = 3 4 .
5 6 5 6
Q = I + Dij ,
where Dij is a matrix with all entries equal to zero, except for
the (i, j)th entry which is equal to β.
▶ The determinant of such a matrix Q is equal to 1 and,
therefore, Q is invertible.
Revised simplex method
QK QK−1 · · · Q2 Q1 .
▶ We have
1 0 −4
B−1 B̄ = [e1 e2 u] = 0 1 2 .
0 0 2
p′ = c′B B−1 .
Revised simplex method: implementation
c̄j = cj − p′ Aj .
u = B−1 Aj .
Revised simplex method: implementation
▶ We determine
xB(i)
θ∗ = min
i=1,...,m | ui >0 ui
and the variable that will exit the basis, and construct the new
basic feasible solution, and the new basis matrix B̄.
Revised simplex method: implementation
▶ We determine
xB(i)
θ∗ = min [O(m) operations]
i=1,...,m | ui >0 ui
and the variable that will exit the basis, and construct the new
basic feasible solution, and the new basis matrix B̄.
Revised simplex method: implementation
▶ We determine
xB(i)
θ∗ = min [O(m) operations]
i=1,...,m | ui >0 ui
and the variable that will exit the basis, and construct the new
basic feasible solution, and the new basis matrix B̄.
▶ We construct the inverse B̄−1 of B̄.
Revised simplex method: implementation
▶ We determine
xB(i)
θ∗ = min [O(m) operations]
i=1,...,m | ui >0 ui
and the variable that will exit the basis, and construct the new
basic feasible solution, and the new basis matrix B̄.
▶ We construct the inverse B̄−1 of B̄. [O(m2 ) operations]
Revised simplex method: running time
O(m3 + mn)
arithmetic operations.
The full tableau implementation
The full tableau implementation
B−1 [b | A]
▶ If the ℓth basic variable exits the basis, the ℓth row of the
tableau is called the pivot row.
▶ The element belonging to both the pivot row and the pivot
column is called the pivot element.
▶ Note that the pivot element is uℓ and is always positive
(unless u ≤ 0, in which case the algorithm has met the
termination condition in Step 3).
B−1 [b | A]
b = Ax.
B̄−1 [b | A].
− c′B xB
xB(1) (B−1 A1 )1 ... u1 ... (B−1 An )1
.. .. .. ..
. . . .
xB(ℓ) (B−1 A1 )ℓ ... uℓ ... (B−1 An )ℓ
.. .. .. ..
. . . .
xB(m) (B−1 A1 )m ... um ... (B−1 An )m
The zeroth row
It is customary to augment the simplex tableau by including a
top row, to be referred to as the zeroth row.
▶ The rest of the zeroth row is the row vector of reduced
costs, that is, the vector
▶ The rule for updating the zeroth row turns out to be identical
to the rule used for the other rows of the tableau:
Add a multiple of the pivot row to the zeroth row to set the
reduced cost of the entering variable to zero.
▶ We will now verify that this update rule produces the correct
results for the zeroth row.
The zeroth row
▶ At the beginning of a typical iteration, the zeroth row is of the
form
[−c′B B−1 b | c′ − c′B B−1 A] = [0 | c′ ] − c′B B−1 [b | A].
| {z }
a row vector
▶ Hence, it is equal to [0 | c′ ]
plus a linear combination of the
rows of [b | A].
▶ Let column j be the pivot column, and row ℓ be the pivot row.
▶ Note that the pivot row is of the form
h′ [b | A],
where the vector h′ is the ℓth row of B−1 .
▶ Hence, after a multiple of the pivot row is added to the zeroth
row, that row is again equal to [0 | c′ ] plus a (different) linear
combination of the rows of [b | A], and is of the form
[0 | c′ ] − p′ [b | A],
for some vector p.
The zeroth row
cB̄(i) − p′ AB̄(i) = 0 i = 1, . . . , m.
▶ Hence, with our update rule, the updated zeroth row of the
tableau is equal to
as desired.
The full tableau implementation
We can now summarize the mechanics of the full tableau
implementation.
O(mn).
minimize c′ x
subject to Ax = b
x ≥ 0.
minimize c′ x + 0′ y
subject to Ax + Iy = b
x, y ≥ 0.
Comparison of the full tableau and the revised simplex
▶ Consider a LP problem in standard form
minimize c′ x
subject to Ax = b
x ≥ 0.
minimize c′ x + 0′ y
subject to Ax + Iy = b
x, y ≥ 0.
[A | I].
O(mn).
Comparison of the full tableau and the revised simplex
O(m2 ).