Simplex is the first systematically method for solving linear program via a sequence of Gaussian eliminations. It was invented by George Dantzig in 1947 [1]. Algebraically, it converts the linear program from one slack form into to an equivalent one whose objective value does not decrease and possibly increase. It keeps going until the optimal is reached. Geometrically, it is a greedy search strategy that moves from a vertex of the feasible region to another one, with the objective value at the new vertex as least as good as or possibly improved over the previous one. It is an exponential algorithm, although most of time it does a lot better. In this blog we walk through a simple example to illustrate this.
In this case we are operating a factory with two products. Both product have 1 unit of profit. Making the products needs to use two kind of machine. Product one uses 1 hour of machine one and product two uses 2 hours of machine one. Further, product one uses 2 hours of machine two and product two uses 1 hour of machine two. Both machines operate at most 6 hours each day. We want to maximize our profit:
It can be represented concisely in matrix form:
where
We call the set of points that satisfy the constraints of the optimization problem the feasible region
It is obvious that the optimal is obtained at , which gives the objective value . It is a vertex of the feasible region.
Slack Form
In general, it might not be obvious what the optimal point is. But if the elements of are non-negative, the origin is a feasible point, from which we can begin our search. To make the search easier, we are going to introduce an additional number of variables, the slack variables and that correspond to the constraints and objective value.
rewrite the optimization into slack form:
They are called slacks variables because they correspond how much slack you have in the inequalities in the original problem. For this slack form, we also call and basic variables, and the original variables non-basic variables.
Now the feasible region is considered as the intersection of the two subspaces
We can represent the LP in slack form even more concisely in a table:
where the last column denotes the objective function. This example has a trivial starting point : . It is called a basic solution in which all non-basic variables are set to zero. It can be read from the tabular form: the identity matrix correspond to basic variables, and .
Pivoting
Look at the original LP:
As we would like to maximize the objective, we would like to increase the value of or as much as possible. Suppose we just increase one variable at a time. For example, we can increase variable and keep the value of to be .
How much can we increase ? After increasing , we need to maintain the inequality constraints:
The values of and decrease as increases. By they can be drop below . The maximum possible increases of is bounded by . If we set , and .
Note that increases from to and decreases from to . This process is called pivoting.
How do we perform pivoting in the tabular form? By the replacement we have just performed -- normalizing the second row, and using it to eliminate all other elements in the first column.
Recall the original table:
We divide the second row by a factor of 2 to normalize it, and subtract the first and third row by the second row
Observe the first two rows of the tabular form:
If we set and , the constraints they implies becomes
Again the unity columns correspond to non-zero elements and we can read the solution from the tabular form.
Correctness of Pivoting
Before we continue our search on the tabular form, we need to show that pivoting is correct in the sense that, after pivoting, the tabular form represents the same optimization.
In particular, we need to guarantee that the feasible regions are the same and the objective function are equivalent defined on the feasible regions.
We focus on the extended matrix that represents the constraints:
FACT 1. Doing a row replacement on does not change , where row replacement is defined as
i.e., adding times the -th row to the -th row, for .
To see this, denote and the sets before and after the replacement respectively. implies that each point belonging to belongs to , and vice-versa. Specifically, the row replacement corresponds to left multiplying by a matrix
which is a diagonal matrix with an additional in the position. It is invertible with inverse matrix
The previous claim becomes .
But wait. Why do we subtract the last row from the second one? Fact 1 has justified the replacement operation on , but not on the objective coefficients (the last row in the tabular form). To illustrate the meaning of the operation, recall that
Hence is the value of the objective function. After normalizing the second row, it becomes
The constraint holds for any feasible point of the linear programming. Therefore,
The last in the table is the inverse constant in the objective functions after the replacement of variable.
Back to our search
To improve the current solution further, we note that the coefficient of is positive. We can increase the value of . The maximum increase is given by , determined by the first row:
To make the change explicitly, we perform elimination by the first row
which give solution and objective value . It is indeed optimal solution for the problem, as all coefficients of the optimization are non-positive.
Optimality Condition and Strong Duality
We investigate the result deeper by viewing the initial tabular form in abbreviation as
The series of Gaussian elimination can be interpreted as left multiplying a matrix:
where each ( ) matrix is invertible and represents a Gaussian elimination, i.e., if we left multiple a matrix by , it is equivalent to perform Gaussian elimination on the matrix. The matrix product has the form
because we never use the last row to eliminate the other rows.
Now:
In our example,
we have
The optimality condition of simplex algorithm implies that
This is the optimal solution for the dual program of the primal:
If simplex algorithm stops, it implies strong duality holds:
- The optimal value of the primal program equals to the optimal one of the dual program, assuming that both values exist and are bounded.
Geometric Interpretation
In the beginning we claim that the simplex algorithm move from one vertex to another. We prove it rigorously in this section. First we need a few definitions:
Vertex
A vertex is a point , such that and , s.t., .
In other words, is a vertex of if it is not contained in a line segment of .
Theorem. If LP has an optimal solution, then it has an optimal solution that is a vertex of its feasible set.
Proof. Denote the optimal solution of the LP with maximum number of zero components. If is not a vertex, then and , such that .
As is optimal, we have and . By , it concludes that .
Define . As and so that for , .
But . Let .
- is feasible, for small enough .
- is optimal, since .
- for .
We can find some (either positive or false) to make for some . Now contains more zeros than , a contradiction.
Basic Solution
A solution of is called a basic solution if (columns in that correspond to non-zero components in ) are linearly independent.
Basic Feasible Solution
A basic solution is called basic feasible solution if , i.e., .
With respect to the feasible region of LP in slack form, the vertices have have following property:
Lemma:. A point is a vertex of if and only if it is a basic feasible solution. Here and (otherwise some row constraints of the are redundant).
Proof: Denote the set of indices of positive components in and the set of
Only if: If does not have full column rank, then , such that . Then for small enough , both and are feasible point in . Now , a contradiction.
If: As columns of are linearly independent, the only solution of to is given by . Hence, is now the unique solution to . If is not a vertex, , such that . But in this case we must have , as and . A contradiction.
.
Corollary: The simplex algorithm moves from vertex to vertex.
Proof: The positive components in the solution correspond to the columns in the identity matrix in the tabular form of simplex, which are linearly independent.
Correctness of Simplex (TO FINISH)
Though not shown in the example, there are two issue associated with simplex algorithm.
- How do we find an initial solution? If there are negative component in , then is not a feasible solution.
- How do we guarantee that simplex terminates?
In the previous example, at each step we choose to increase the variable with largest coefficient. In some rare cases, this results in a loop of the algorithm.
One method for avoiding looping is called Bland's rule:
- If there is a positive coefficient in the objective function, choose the one with largest coefficient.
- If there are multiple rows with tight constraints, choose the one with largest coefficient.
Theorem. Blands' rule guarantees that the algorithm stops.
Proof. Suppose that on the contrary, the algorithm loops. Denote the set of basis in the loop. In each base, there is entering variable and one leaving variable. Every variable that leaves the base must enter another base later. We called these variable fickle variables. Denote the fickle variable with the largest index.
- the dictionary that leaves the base, and the variable that enters the base.
- the dictionary that enters the base again.
We have
- is the entering variable in , therefore .
- is the entering variable in , and , by the definition of , we have .
- Hence, .
- . Then , and is fickle. By definition, . But is not entering , we know that .
- . But since is fickle, we have . In this case, is chosen in preference to . A contradiction.
Reference
[1]. Dantzig, George B. "Origins of the simplex method." A history of scientific computing. 1990. 141-151.