Simplex Algorithm
Simplex Algorithm
1 Overview
Subject to
Further information: Linear programming Ax ≤ b, xi ≥ 0
The simplex algorithm operates on linear programs in
with x = (x1 , . . . , xn ) the variables of the problem, c
Optimal = (c1 , . . . , cn ) are the coefficients of the objective func-
solution tion, A is a p×n matrix, and b = (b1 , . . . , bp ) constants
with bj ≥ 0 . There is a straightforward process to con-
vert any linear program into one in standard form so this
results in no loss of generality.
In geometric terms, the feasible region defined by all val-
ues of x such that
Ax ≤ b, xi ≥ 0
Starting
vertex
is a (possibly unbounded) convex polytope. There is a
A system of linear inequalities defines a polytope as a feasible simple characterization of the extreme points or vertices
region. The simplex algorithm begins at a starting vertex and of this polytope, namely an element x = (x1 , . . . , xn ) of
moves along the edges of the polytope until it reaches the vertex the feasible region is an extreme point if and only if the
of the optimum solution. subset of column vectors Ai corresponding to the nonzero
entries of x (xi ̸= 0) are linearly independent.[7] In this
standard form: context such a point is known as a basic feasible solution
(BFS).
Maximize It can be shown that for a linear program in standard form,
if the objective function has a maximum value on the fea-
cT · x sible region then it has this value on (at least) one of the
1
2 3 STANDARD FORM
extreme points.[8] This in itself reduces the problem to After Dantzig included an objective function as part of
a finite computation since there is a finite number of ex- his formulation during mid-1947, the problem was math-
treme points, but the number of extreme points is unman- ematically more tractable. Dantzig realized that one of
ageably large for all but the smallest linear programs.[9] the unsolved problems that he mistook as homework in
It can also be shown that if an extreme point is not a his professor Jerzy Neyman's class (and actually later
maximum point of the objective function then there is an solved), was applicable to finding an algorithm for linear
edge containing the point so that the objective function programs. This problem involved finding the existence
is strictly increasing on the edge moving away from the of Lagrange multipliers for general linear programs over
a continuum of variables, each bounded between zero
point.[10] If the edge is finite then the edge connects to
another extreme point where the objective function has and one, and satisfying linear constraints expressed in the
form of Lebesgue integrals. Dantzig later published his
a greater value, otherwise the objective function is un-
bounded above on the edge and the linear program has “homework” as a thesis to earn his doctorate. The col-
umn geometry used in this thesis gave Dantzig insight that
no solution. The simplex algorithm applies this insight
by walking along edges of the polytope to extreme points made him believe that the Simplex method would be very
efficient.[16]
with greater and greater objective values. This contin-
ues until the maximum value is reached or an unbounded
edge is visited, concluding that the problem has no solu-
tion. The algorithm always terminates because the num- 3 Standard form
ber of vertices in the polytope is finite; moreover since
we jump between vertices always in the same direction The transformation of a linear program to one in standard
(that of the objective function), we hope that the number form may be accomplished as follows.[17] First, for each
of vertices visited will be small.[10] variable with a lower bound other than 0, a new variable is
The solution of a linear program is accomplished in two introduced representing the difference between the vari-
steps. In the first step, known as Phase I, a starting ex- able and bound. The original variable can then be elimi-
treme point is found. Depending on the nature of the nated by substitution. For example, given the constraint
program this may be trivial, but in general it can be solved
by applying the simplex algorithm to a modified version
of the original program. The possible results of Phase I x1 ≥ 5
are either that a basic feasible solution is found or that
a new variable, y1 , is introduced with
the feasible region is empty. In the latter case the linear
program is called infeasible. In the second step, Phase II,
the simplex algorithm is applied using the basic feasible
y1 = x1 − 5
solution found in Phase I as a starting point. The possible
results from Phase II are either an optimum basic feasible x1 = y1 + 5
solution or an infinite edge on which the objective func- The second equation may be used to eliminate x1 from
tion is unbounded below.[11][12][13] the linear program. In this way, all lower bound con-
straints may be changed to non-negativity restrictions.
Second, for each remaining inequality constraint, a new
2 History variable, called a slack variable, is introduced to change
the constraint to an equality constraint. This variable rep-
George Dantzig worked on planning methods for the US resents the difference between the two sides of the in-
Army Air Force during World War II using a desk calcu- equality and is assumed to be nonnegative. For example,
lator. During 1946 his colleague challenged him to mech- the inequalities
anize the planning process in order to entice him into not
taking another job. Dantzig formulated the problem as
linear inequalities inspired by the work of Wassily Leon- x2 + 2x3 ≤ 3
tief, however, at that time he didn't include an objective as −x4 + 3x5 ≥ 2
part of his formulation. Without an objective, a vast num-
ber of solutions can be feasible, and therefore to find the are replaced with
“best” feasible solution, military-specified “ground rules”
must be used that describe how goals can be achieved as
opposed to specifying a goal itself. Dantzig’s core in- x2 + 2x3 + s1 = 3
sight was to realize that most such ground rules can be −x4 + 3x5 − s2 = 2
translated into a linear objective function that needs to s1 , s2 ≥ 0
be maximized.[14] Development of the simplex method
was evolutionary and happened over a period of about a It is much easier to perform algebraic manipulation on
year.[15] inequalities in this form. In inequalities where ≥ appears
3
such as the second one, some authors refer to the variable of the variable represented by a 1 in its column is equal
introduced as a surplus variable. to the b value at that row.
Third, each unrestricted variable is eliminated from the Conversely, given a basic feasible solution, the columns
linear program. This can be done in two ways, one is by corresponding to the nonzero variables can be expanded
solving for the variable in one of the equations in which it to a nonsingular matrix. If the corresponding tableau is
appears and then eliminating the variable by substitution. multiplied by the inverse of this matrix then the result is
The other is to replace the variable with the difference of a tableau in canonical form.[20]
two restricted variables. For example, if z1 is unrestricted Let
then write
[ ]
1 −cTB −cTD 0
z1 = z1+ − z1− 0 I D b
z1+ , z1− ≥ 0
be a tableau in canonical form. Additional row-addition
The equation may be used to eliminate z1 from the linear transformations can be applied to remove the coefficients
program. cT
When this process is complete the feasible region will be B from the objective function. This process is called pric-
in the form ing out and results in a canonical tableau
[ ]
1 0 −c̄TD zB
Ax = b, xi ≥ 0 0 I D b
It is also useful to assume that the rank of A is the number where zB is the value of the objective function at the
of rows. This results in no loss of generality since other- corresponding basic feasible solution. The updated co-
wise either the system Ax = b has redundant equations efficients, also known as relative cost coefficients, are the
which can be dropped, or the system is inconsistent and rates of change of the objective function with respect to
the linear program has no solution.[18] the nonbasic variables.[12]
feasible solution; the choice of pivot element at each step which the minimum is achieved then a dropping variable
is largely determined by the requirement that this pivot choice rule[23] can be used to make the determination.
improve the solution.
6.3 Example
6.1 Entering variable selection
See also: Revised simplex algorithm § Numerical
Since the entering variable will, in general, increase from example
0 to a positive number, the value of the objective function
will decrease if the derivative of the objective function Consider the linear program
with respect to this variable is negative. Equivalently, the
value of the objective function is decreased if the pivot
Minimize
column is selected so that the corresponding entry in the
objective row of the tableau is positive. Z = −2x − 3y − 4z
If there is more than one column so that the entry in the
Subject to
objective row is positive then the choice of which one to
add to the set of basic variables is somewhat arbitrary and 3x + 2y + z ≤ 10
several entering variable choice rules[21] such as Devex al-
2x + 5y + 3z ≤ 15
gorithm[22] have been developed.
x, y, z ≥ 0
If all the entries in the objective row are less than or equal
to 0 then no choice of entering variable can be made and With the addition of slack variables s and t, this is repre-
the solution is in fact optimal. It is easily seen to be opti- sented by the canonical tableau
mal since the objective row now corresponds to an equa-
tion of the form
1 2 3 4 0 0 0
0 3 2 1 1 0 10
z(x) = zB +variables nonbasic to corresponding terms nonnegative 0 2 5 3 0 1 15
Note that by changing the entering variable choice rule so where columns 5 and 6 represent the basic variables s and
that it selects a column where the entry in the objective t and the corresponding basic feasible solution is
row is negative, the algorithm is changed so that it finds
the maximum of the objective function rather than the
minimum. x = y = z = 0, s = 10, t = 15.
br /arc
Z = −60+2x+11y+4t
3 = −20 + 2x+11y+4t
3
is the minimum over all r so that arc > 0. This is called the
[21]
minimum ratio test. If there is more than one row for so the minimum value of Z is −20.
5
the tableau by virtue of B being a subset of the columns such as Fourier–Motzkin elimination. However, in 1972,
of [A, I]. This implementation is referred to as the "stan- Klee and Minty[33] gave an example, the Klee-Minty
dard simplex algorithm”. The storage and computation cube, showing that the worst-case complexity of simplex
overhead are such that the standard simplex method is a method as formulated by Dantzig is exponential time.
prohibitively expensive approach to solving large linear Since then, for almost every variation on the method, it
programming problems. has been shown that there is a family of linear programs
In each simplex iteration, the only data required are the for which it performs badly. It is an open question if
first row of the tableau, the (pivotal) column of the tableau there is a variation with polynomial time, or even sub-
exponential worst-case complexity.[34][35]
corresponding to the entering variable and the right-hand-
side. The latter can be updated using the pivotal column Analyzing and quantifying the observation that the sim-
and the first row of the tableau can be updated using the plex algorithm is efficient in practice, even though it has
(pivotal) row corresponding to the leaving variable. Both exponential worst-case complexity, has led to the devel-
the pivotal column and pivotal row may be computed di- opment of other measures of complexity. The simplex
rectly using the solutions of linear systems of equations algorithm has polynomial-time average-case complexity
involving the matrix B and a matrix-vector product us- under various probability distributions, with the precise
ing A. These observations motivate the "revised simplex average-case performance of the simplex algorithm de-
algorithm", for which implementations are distinguished pending on the choice of a probability distribution for
by their invertible representation of B.[26] the random matrices.[35][36] Another approach to study-
In large linear-programming problems A is typically a ing "typical phenoma" uses Baire category theory from
sparse matrix and, when the resulting sparsity of B general topology, and to show that (topologically) “most”
is exploited when maintaining its invertible representa- matrices can be solved by the simplex algorithm in a poly-
tion, the revised simplex algorithm is a much more ef- nomial number of steps. Another method to analyze the
ficient than the standard simplex method. Commer- performance of the simplex algorithm studies the behav-
cial simplex solvers are based on the revised simplex ior of worst-case scenarios under small perturbation – are
algorithm.[25][26][27][28][29] worst-case scenarios stable under a small change (in the
sense of structural stability), or do they become tractable?
Formally, this method uses random problems to which is
8.2 Degeneracy: stalling and cycling added a Gaussian random vector ("smoothed complex-
ity").[37]
If the values of all basic variables are strictly positive,
then a pivot must result in an improvement in the objec-
tive value. When this is always the case no set of ba- 9 Other algorithms
sic variables occurs twice and the simplex algorithm must
terminate after a finite number of steps. Basic feasible so-
lutions where at least one of the basic variables is zero are Other algorithms for solving linear-programming prob-
lems are described in the linear-programming arti-
called degenerate and may result in pivots for which there
is no improvement in the objective value. In this case cle. Another basis-exchange pivoting algorithm is the
there is no actual change in the solution but only a change criss-cross algorithm.[38][39] There are polynomial-time
in the set of basic variables. When several such pivots algorithms for linear programming that use interior
occur in succession, there is no improvement; in large point methods: these include Khachiyan's ellipsoidal al-
industrial applications, degeneracy is common and such gorithm, Karmarkar's projective algorithm, and path-
"stalling" is notable. Worse than stalling is the possibil- following algorithms.[13]
ity the same set of basic variables occurs twice, in which
case, the deterministic pivoting rules of the simplex al-
gorithm will produce an infinite loop, or “cycle”. While 10 Linear-fractional programming
degeneracy is the rule in practice and stalling is common,
cycling is rare in practice. A discussion of an example
Main article: Linear-fractional programming
of practical cycling occurs in Padberg.[25] Bland’s rule
prevents cycling and thus guarantees that the simplex al-
Linear–fractional programming (LFP) is a generalization
gorithm always terminates.[25][30][31] Another pivoting al-
of linear programming (LP). In LP the objective func-
gorithm, the criss-cross algorithm never cycles on linear
programs.[32] tion is a linear function, while the objective function of
a linear–fractional program is a ratio of two linear func-
tions. In other words, a linear program is a fractional–
8.3 Efficiency linear program in which the denominator is the constant
function having the value one everywhere. A linear–
The simplex method is remarkably efficient in prac- fractional program can be solved by a variant of the
tice and was a great improvement over earlier methods simplex algorithm[40][41][42][43] or by the criss-cross algo-
7
[2] Murty (1983, Comment 2.2) [25] M. Padberg, Linear Optimization and Extensions, Second
Edition, Springer-Verlag, 1999.
[3] Murty (1983, Note 3.9)
[26] George B. Dantzig and Mukund N. Thapa. 2003. Linear
[4] Stone, Richard E.; Tovey, Craig A. (1991). “The simplex Programming 2: Theory and Extensions. Springer-Verlag.
and projective scaling algorithms as iteratively reweighted
least squares methods”. SIAM Review. 33 (2): 220–237. [27] Dmitris Alevras and Manfred W. Padberg, Linear Opti-
doi:10.1137/1033049. JSTOR 2031142. MR 1124362. mization and Extensions: Problems and Extensions, Uni-
versitext, Springer-Verlag, 2001. (Problems from Pad-
[5] Stone, Richard E.; Tovey, Craig A. (1991). “Erratum: berg with solutions.)
The simplex and projective scaling algorithms as itera-
tively reweighted least squares methods”. SIAM Review. [28] Maros, István; Mitra, Gautam (1996). “Simplex algo-
33 (3): 461. doi:10.1137/1033100. JSTOR 2031443. rithms”. In J. E. Beasley. Advances in linear and integer
MR 1124362. programming. Oxford Science. pp. 1–46. MR 1438309.
[6] Strang, Gilbert (1 June 1987). “Karmarkar’s algorithm [29] Maros, István (2003). Computational techniques of the
and its place in applied mathematics”. The Mathemat- simplex method. International Series in Operations Re-
ical Intelligencer. New York: Springer. 9 (2): 4– search & Management Science. 61. Boston, MA: Kluwer
10. doi:10.1007/BF03025891. ISSN 0343-6993. MR Academic Publishers. pp. xx+325. ISBN 1-4020-7332-
'''883185'''. 1. MR 1960274.
13 References
• Murty, Katta G. (1983). Linear programming. New
York: John Wiley & Sons, Inc. pp. xix+482. ISBN
9
16.2 Images
• File:Lock-green.svg Source: https://upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg License: CC0 Contributors: en:File:
Free-to-read_lock_75.svg Original artist: User:Trappist the monk
• File:Max_paraboloid.svg Source: https://upload.wikimedia.org/wikipedia/commons/7/72/Max_paraboloid.svg License: CC BY-SA 4.0
Contributors: Own work Original artist: IkamusumeFan
• File:Simplex-description-en.svg Source: https://upload.wikimedia.org/wikipedia/commons/e/ef/Simplex-description-en.svg License:
CC BY-SA 3.0 Contributors: https://commons.wikimedia.org/wiki/File:Simplex_description.png Original artist: Victor Treushchenko
• File:Simplex-method-3-dimensions.png Source: https://upload.wikimedia.org/wikipedia/commons/d/d4/
Simplex-method-3-dimensions.png License: CC-BY-SA-3.0 Contributors: Created using gimp based on Image:Elongated_pentagonal_
orthocupolarotunda.png. Original artist: User:Sdo
• File:Wikibooks-logo-en-noslogan.svg Source: https://upload.wikimedia.org/wikipedia/commons/d/df/Wikibooks-logo-en-noslogan.
svg License: CC BY-SA 3.0 Contributors: Own work Original artist: User:Bastique, User:Ramac et al.