Linear Programming: Simplex Method, Geometry & LP Duality
Linear programming is the backbone of practical optimization: it maximizes or minimizes a linear objective over a convex polytope defined by linear constraints. The simplex method exploits the geometry of this polytope — searching only its vertices — while LP duality reveals a symmetric companion problem whose optimal value always matches.
Concepts
The feasible region of an LP is a convex polytope. The optimal solution always lies at a vertex. The objective function sweeps as a hyperplane — the last vertex it touches is optimal.
A factory must schedule production of two products, each using some raw material and machine time, to maximize profit subject to resource limits. Each constraint is a line in the plane; the feasible region is a polygon — a convex polytope. Because profit is linear, the maximum always occurs at a corner. Linear programming formalizes this insight for any number of variables and constraints, and the simplex method exploits the corner structure to find the optimum efficiently.
Standard Form
Every LP can be converted to standard form:
where , , and . Inequality constraints are converted by adding a slack variable ; free variables are split as with both parts non-negative.
The standard form is not just notational convenience — it exposes the basis structure that the simplex method exploits. Each basis selects linearly independent columns of and corresponds to exactly one vertex (extreme point) of the feasible polytope. Every LP algorithm is, at some level, a strategy for searching or interpolating between these vertices.
Geometric Interpretation
The feasible set is a convex polytope. Because the objective is linear, the optimal value is attained at a vertex (extreme point) of this polytope — a point that cannot be written as a strict convex combination of two other feasible points.
A basic feasible solution (BFS) corresponds to a vertex algebraically: choose linearly independent columns of to form a basis matrix ; set non-basic variables to zero; the basic variables are .
Every vertex of the polytope is a BFS and vice versa. Since there are finitely many bases, the simplex method searches this finite set rather than a continuous domain.
Simplex Method
Starting from an initial BFS, simplex iterates:
- Optimality check. Compute reduced costs for each non-basic variable . If all , the current BFS is optimal.
- Entering variable. Choose the non-basic variable with the most negative reduced cost (Bland's rule uses the smallest index to prevent cycling).
- Leaving variable. Increase along the edge of the polytope; the first basic variable to hit zero leaves the basis. The minimum ratio test gives the leaving index: .
- Pivot. Update , , and the BFS.
Each pivot moves to an adjacent vertex with no worse objective value. With a non-degeneracy assumption, simplex terminates finitely. The revised simplex method maintains via rank-1 updates (LU factorization in practice), keeping each iteration at work.
LP Duality
Every primal LP has a dual LP. For the standard primal:
the dual is:
Weak duality. For any primal-feasible and dual-feasible :
so every dual objective value is a lower bound on every primal objective value.
Strong duality (fundamental theorem of LP). If both problems are feasible, their optimal values coincide:
Strong duality follows from the simplex certificate at optimality: when reduced costs are all non-negative, the multipliers satisfy dual feasibility with equality.
Complementary slackness. A primal-dual pair is optimal if and only if:
Complementary slackness is the basis of primal-dual algorithms and the economic interpretation of shadow prices: a non-zero primal variable forces its reduced cost to zero.
The dual variables are shadow prices — the marginal value of relaxing the -th constraint by one unit. This interpretation is central to sensitivity analysis in resource allocation.
Worked Example
2-Variable Resource Allocation
A factory makes two products. Each unit of product 1 uses 2 hours of labor and 1 kg of material; product 2 uses 1 hour and 3 kg. Available: 8 labor-hours, 9 kg material. Profit: 5 per unit of product 1, 4 per unit of product 2.
Formulation (convert max to min):
Add slacks :
Vertex enumeration. The four candidate vertices come from setting pairs of variables to zero:
| Vertex | Feasible? | Profit | |
|---|---|---|---|
| O | (0, 0) | Yes | 0 |
| A | (4, 0) | Yes | 20 |
| B | (3, 2) | Yes | 23 |
| C | (0, 3) | Yes | 12 |
Point B is the intersection of both active constraints: solving and gives , profit = 23.
Simplex pivots. Starting BFS: , , . Basis .
- Reduced costs: , . Most negative: enters.
- Ratios: , . Min ratio: leaves. New BFS: .
- Reduced costs recomputed: . enters.
- Ratios in updated tableau: can increase to 2. leaves. BFS: .
- All reduced costs now non-negative. Optimal: profit = 23.
Dual problem and strong duality. The dual is:
At optimality, . With corresponding to :
Strong duality holds: primal and dual optimal values both equal 23.
Connections
Where Your Intuition Breaks
LP duality appears perfectly symmetric: primal minimizes , dual maximizes , and strong duality says their optima coincide. This symmetry might suggest that solving one automatically solves the other. In practice, the two formulations have very different algorithmic behavior: primal simplex pivots columns, dual simplex pivots rows, and each can be dramatically faster or slower depending on whether the problem is primal- or dual-degenerate. Degenerate problems — where multiple bases correspond to the same vertex — can cause cycling without careful pivot rules. The theoretical symmetry of strong duality does not translate to equivalent computational behavior; choosing primal vs. dual simplex requires understanding the problem's structure.
Complexity
| Algorithm | Worst-case | Typical practice |
|---|---|---|
| Simplex (various pivots) | Exponential (Klee-Minty) | Very fast, polynomial-average |
| Ellipsoid method (Khachian 1979) | — first polynomial | Impractical |
| Interior-point (Karmarkar 1984) | iterations, polynomial | Fast in practice for large LPs |
Simplex is exponential in theory but polynomial in practice because real-world polytopes have far fewer vertices reachable on the "short" path between any two BFS. The average-case analysis (Spielman-Teng smoothed complexity) shows simplex runs in expected polynomial time under small random perturbations — explaining the empirical gap.
Degeneracy and Cycling
A BFS is degenerate if any basic variable equals zero. Degenerate pivots move to the same vertex without changing the objective, and a sequence of degenerate pivots can cycle forever. Bland's rule (always pick the smallest-index entering/leaving variable) guarantees termination by preventing cycles.
In practice, degeneracy is the rule rather than the exception — many real LPs have highly degenerate BFS because constraints are nearly redundant or data is structured. Commercial solvers use perturbation or lexicographic pivoting to handle degeneracy robustly.
Shadow Prices and Sensitivity
The dual optimal quantifies the value of relaxing each constraint. In the factory example, means one additional labor-hour is worth profit units. This sensitivity analysis is why LP duality is central to economics and operations: the dual solves the pricing problem that is dual to the allocation problem.
Enjoying these notes?
Get new lessons delivered to your inbox. No spam.