When the objective and constraints are all linear, the simplex algorithm finds the global optimum by walking along vertices of a polytope.
A linear program (LP) is an optimization problem where both the objective function and all constraints are linear:
Linear programs arise naturally in transportation, manufacturing, economics, and operations research. Many non-linear problems can be approximated as LPs. Modern solvers handle millions of variables and millions of constraints.
Linear programs can be written in three equivalent forms:
| Form | Structure | Use Case |
|---|---|---|
| General | min c>x s.t. ALEx ≤ bLE, AEQx = bEQ | Natural problem statement |
| Standard | min c>x s.t. Ax ≤ b, x ≥ 0 | Simplified for analysis |
| Equality | min c>x s.t. Ax = b, x ≥ 0 | Used by simplex algorithm |
Converting between forms: equalities become two inequalities, unrestricted variables x become x+ − x− (both ≥ 0), and inequalities become equalities by adding slack variables s ≥ 0: Ax + s = b.
The objective c>x creates parallel contour lines perpendicular to c, increasing in the direction of c. Each inequality w>x ≤ b defines a half-space. The feasible set is the intersection of all half-spaces — a convex polytope.
Possible outcomes:
| Case | Description |
|---|---|
| Vertex optimum | A single vertex minimizes the objective (most common) |
| Edge/face optimum | An entire edge or face achieves the minimum (infinite solutions) |
| Unbounded | The objective can decrease without limit (insufficient constraints) |
| Infeasible | No point satisfies all constraints (over-constrained) |
In equality form (Ax = b, x ≥ 0) with A ∈ Rm×n, a vertex is defined by a partition B of m indices. The basic variables xB = AB−1b are determined by the constraints; the remaining non-basic variables xV are set to zero.
A partition B defines a vertex only if xB ≥ 0 (all basic variables are non-negative). The simplex algorithm works by swapping indices between B and V, moving from one vertex to an adjacent vertex.
At each vertex, the simplex algorithm checks whether moving to a neighboring vertex would improve the objective. The test uses the reduced cost μV:
If any component of μV is negative, moving in that direction decreases the objective. The most negative component determines which non-basic variable enters the basis. If all components are non-negative, the current vertex is optimal.
When moving from one vertex to a neighbor, we travel along an edge of the polytope. We increase the entering variable xq from zero until another basic variable hits zero (becomes non-basic). This edge transition determines how far we move and which variable leaves the basis.
The entering variable increases until:
where d = AB−1A{q} and the minimum is taken over positive components of d. The index achieving this minimum is the leaving variable.
The simplex algorithm needs a starting vertex, but finding one can be as hard as solving the LP itself. The solution: solve an auxiliary linear program designed to find a feasible vertex.
The auxiliary LP introduces artificial variables z and minimizes their sum. If the solution has z = 0, we have found a feasible vertex for the original problem. If z ≠ 0, the original problem is infeasible.
Linear programs have zero duality gap: the optimal primal value equals the optimal dual value. This means we can verify a candidate solution (x*, λ*) by checking three conditions:
| Check | Condition |
|---|---|
| Primal feasibility | Ax* = b, x* ≥ 0 |
| Dual feasibility | A>λ* ≤ c |
| Equal objectives | c>x* = b>λ* |
Watch the simplex algorithm walk along vertices of a 2D polytope. The blue region is the feasible set. The orange dot is the current vertex. The arrow shows the direction of the objective function c.
Click Step to pivot to the next vertex. The algorithm moves toward lower objective values.
| Concept | Key Fact |
|---|---|
| LP structure | Linear objective + linear constraints = convex polytope |
| Simplex algorithm | Walks vertices, each step improves or maintains objective |
| Vertices | Defined by partitions; m tight constraints in m-dim equality form |
| Initialization | Auxiliary LP finds a feasible vertex |
| Duality | Zero gap; dual certificates verify optimality |