Simplex Algorithm
Abstract
This is pseudocode for the core of the Simplex Algorithm, adapted from A Gentle Introduction to Optimization.
.1
{ } \SetAlgoNoEnd\SetAlgoNoLine
InputInput\SetKwInOutOutputOutput
\InputLinear program (P) and feasible basis
\OutputAn optimal solution for (P) or a certificate proving that (P) is unbounded
Rewrite (P) so that it is in canonical form for the basis
Let be the basic feasible solution for
\If
stop
( is optimal)
Select such that
\If
stop
((P) is unbounded)
Let r be any index i where the following minimum is attained:
(1) |
Let be the basis element
Set \
Go to step 1
Notes:
-
1.
Recall is the vector of coefficients in our objective function , and is the th element of .
-
2.
is with the columns corresponding to basis removed.
-
3.
is the matrix with linearly independent rows that comprise our constraints. is the th column of (a vector, though we aren’t writing it with the arrow above), and or is a matrix comprised of a subset of the columns of , keeping them in the original order.