lec07
Lecture 7. Linear Programming
7.1 Linear program and the fundamental theorem
Suppose a factory can produce two kinds of products. The profit for producing one unit of the first kind of products is 1, and the profit for producing one unit of the second kind of products is 6. Suppose a factory has a limited amount of resources such that
- the first kind of products cannot exceed 200 units,
- the second kind of products cannot exceed 300 units, and
- the overall amount of products cannot exceed 400 units.
Given these, you are to decide how many units of the first kind of products and how many units of the second kind of products to produce respectively, so that the overall profit is maximized. This problem can be formulated as follows:
A linear program may have both equality and inequality constraints. It is easy to rewrite equality constraints by inequalities. Can we rewrite inequality constraints by equalities? In fact, the standard form of linear programming only allows equality constraints and a special type of inequalities.
We say that a linear program is in standard form if the following are all true:
- Non-negativity constraints for all variables;
- All remaining constraints are expressed as equality constraints;
- The right hand side vector,
, is non-negative.
Namely, the standard form can be expressed as follows:
Now the question is how to convert a linear program into the standard form? Clearly the third requirement is trivial. We only need to consider the first two requirement.
First, for the second requirement, consider a simple example
Next we consider the first requirement. If a variable has non-positive constraints, such as
Consider the following linear program:
The standard form is useful in algorithm design and analysis, especially in the algorithms based on primal dual method.
For convenience, in this course we will use the form
Consider the following linear program:

When a linear program achieve its optimal value
Is this observation always true?
Fundamental Theorem of Linear Programming
Suppose a linear program has an optimal solution. Then there exists an optimal solution at a vertex (extreme point).
First, we define what a vertex and an extreme point are.
A point
A point
An important fact is that, these two types of points are equivalent for polyhedra.
For any polyhedron
Suppose
-
Sufficiency: Suppose
is a vertex, then there exists indices such that and satisfying . The constraints are linearly independent, so is invertible.
Assume is not an extreme point, that is, there exists and such that . After substituting we have . Note that . So it holds that and . Thus, we conclude that . Since is invertible, it yields , which leads to a contradiction. -
Necessity: Assume
is an extreme point but not a vertex in . Let . Since is not a vertex, there does not exist linearly independent constraints that are tight at . Hence there exists , such that for all .
Let . We argue that for some sufficiently small as follows. , note that (since ). , we have . Then there exists such that and .
Taking
, we have . Hence is an extreme point, which leads to a contradiction.
However, a polyhedron may not contain any vertex.
A polyhedron
- Necessity: Assume there exists a line
and for some .- If
is on the line , it's obvious that cannot be an extreme point. - If
is not on the line , we claim that and are also in . For any and , by convexity. Let . It follows that . Thus, since is closed, Similarly, we have . Hence, cannot be an extreme point.
- If
- Sufficiency: If
contains no extreme point, then there exists such that . Thus, for all , we have for all , which gives that .
We now prove the fundamental theorem of linear programming.
Let
Suppose
The fundamental theorem of linear programming gives us an algorithm to solve linear programs by enumerating all (
However, consider the
7.2 Simplex method
We now introduce a (usually) efficient algorithm: the simplex method. We remark here that the simplex method is not a polynomial-time algorithm. However, it runs fast except for some artificially designed cases.
The key idea is that when we find a vertex of the feasible set, move from the current vertex to a "better" neighbor, where two vertices are neighbors if they share
Assume
How can we know whether a neighbor is "better"? Note that our goal is to compute
Two vertices are neighbors if they share
Consider the following linear program:
- Suppose we start from
. Since the coefficient for is positive, we could increase . When , the constraints are , , and . To make the objective function as small as possible, we should increase the value of until some constraint is tight. Then we increase to and arrive at . Now the constraint is tight. - At
, we create a new coordinate system. The point in the original coordinate system becomes . - Let
and . We then rewrite the linear programming as follows - Now we repeat the above process. We increase
and let , . The objective function becomes . - Since the coefficients for both
and are negative now, we know that is an optimal solution. Substituting and we have and .
As shown above, the first step is to choose a variable whose coefficient is positive, and then increase it. What should we do if we have multiple variables who have negative coefficients?
The following example shows we may encounter some tricky problems if we choose a wrong variable. Consider the linear program with the same objective function as above, but the constraints are
- Suppose in the first step, we choose to increase
. Then the tight constraint should be and cannot increase any more. - Let
and . The new constraints are - Unfortunately, we choose to increase
and repeat the process again and again……
Clearly it is possible to fail in this case, which is called degeneracy. Moreover, since we have exponentially many vertices for a polytope in
In fact, it is a central open problem if there is an implementation of the simplex method that always runs in polynomial time. We may have some natural choices when deciding the next vertex to move to in the simplex method. For example, we can choose an adjacent vertex with the highest cost, or, we can choose an adjacent vertex randomly. However, for each of those implementations of the simplex method that researchers have thought about, there are examples that makes the implementation runs in exponential time.
Fortunately, those examples are rare: in practice, the simplex method is very efficient. Theoretical computer scientists have been spending efforts on explaining this phenomenon. There is an entire field called smoothed analysis, introduced by Shang-hua Teng & Daniel Spielman, that deals with this. Most notably, Teng & Spielman showed that, if we add a random Gaussian noise to either
We also remark that, although the simplex method does not provably run in polynomial time (yet), there exist other methods for solving linear programs that provably run in polynomial time. We will discuss this more later in this course. Therefore, whenever a problem can be formulated by a linear program, it is polynomial time solvable.
Two-phase Simplex
Now the question is, what if the origin point
However, what if there is no known feasible solutions? The following two-phase simple method gives an algorithm to find a feasible solution of a linear program.
- First, convert the linear program into the standard form:
subject to and , where . - Next, add slack variables
for constraints. Then the constraints are , and . - Now it is clear that there exists a trivial solution
and . - Finally, we can check whether
is possible by solving the following linear program