The Simplex Algorithm
Author: Aster Santana, Andrea Rujano.
Consider the following linear program (LP) in standard form:
mincTxs.t.Ax=bx≥0.
where A is a m×n matrix and b,c
and x are vectors of appropriate length.
Suppose that the rows of A are linearly
independent (which implies that n≥m,
i.e., the LP has more variables than constraints).
We rewrite the LP above by decomposing the decision
variables between basic and non-basic
variables. Let B and N be the set of indices
of the basic and non-basic variables, respectively,
where B has m elements and N has n−m
elements. Then we write x as follows:
x=[xBxN].
Similarly, we decompose c and A as follows:
c=[cBcN],A=[ABAN].
Now we rewrite the problem as follows:
mincTBxB+cTNxNs.t.ABxB+ANxN=bxB,xN≥0.
Since we have assumed that the rows of
A are linearly independent, we know that
AB is an invertible matrix.
Therefore, we can rewrite the constraints as follows:
ABxB+ANxN=bABxB=b−ANxNxB=A−1B(b−ANxN)xB=A−1Bb−A−1BANxN.
By using this expression for xB,
the objective function can be re-written as:
cTBxB+cTNxN=cTB(A−1Bb−A−1BANxN)+cTNxN=cTBA−1Bb−cTBA−1BANxN+cTNxN=cTBA−1Bb−(cTBA−1BAN+cTN)xN=cTBA−1Bb+(cTN−cTBA−1BAN)xN.
The problem now becomes:
mincTBA−1Bb+(cTN−cTBA−1BAN)xNs.t.xB=A−1Bb−A−1BANxNxB,xN≥0.
At any iteration of the simplex method, the non-basic
variables are set to zero, i.e., xN=0.
As a result, the values of the basic variables are
given by xB=A−1Bb.
And the objective value is given by cTBA−1Bb.
To perform a simplex iteration (which is called a pivoting), we attempt to increase one of the non-basic variables from zero. But which one should we choose?
To answer this question, we re-write the problem using summation notation:
mincTBA−1Bb+∑j∈N(cj−cTBA−1BAj)xjs.t.xB=A−1Bb−∑j∈NA−1BAjxjxB≥0,xj≥0,∀j∈N.
From here, it’s easy to see that it only makes sense
to increase from zero a non-basic variable xj if
its coefficient cj−cTBA−1BAj is negative.
This coefficient is called the reduced cost
of xj. In fact, if the reduced cost of xj
is negative, then increasing xj will decrease
the objective value, which is desirable since this is
a minimization problem. On the other hand, if the
reduced cost of every non-basic variable is non-negative,
we conclude that the current solution is optimal.
Now that we have a way to decide which
non-basic variables can be made a basic
variable (i.e., pick one with negative reduced cost),
suppose x1 is non-basic and has a negative
reduced cost.
From an optimization perspective, we want to
increase x1 as much as possible.
What can stop us from increasing x1 indefinitely?
The answer comes from the expression
xB=A−1Bb−∑j∈NA−1BAjxj.
Which is the same as
xB=A−1Bb−A−1BA1x1
since xj=0 for all j∈N such that j≠1.
Therefore, if the vector A−1BA1 has
any positive component, as we increase x1
the corresponding basic variables on the
right-hand-side will decrease, and eventually,
one of them will reach zero and become a
non-basic variable!
If we were to keep increasing x1, then
some basic variables would become negative,
which is not allowed as all variables must be
non-negative. This completes one iteration of
the simplex method.
If you have any questions, comments, or would like to chat more about this topic, just reach out to us.