TExcelTAD
Home › Optimization › The Geometry of Linear Programs

The Geometry of Linear Programs

The feasible set of an LP is a polyhedron, and a linear objective is a direction. Sliding a hyperplane perpendicular to that direction until it last touches the polyhedron shows the central fact of linear programming: if an LP has an optimum, it has one at a vertex. The simplex method is a walk along the vertices.

Vertices and basic feasible solutions

A point x\mathbf{x} of a polyhedron PP is a vertex (extreme point) if it is not the midpoint of two other points of PP. Algebraically, for P={x:Ax≤b}P = \{\mathbf{x} : A\mathbf{x} \le \mathbf{b}\} in Rn\mathbb{R}^n, x\mathbf{x} is a vertex if it is feasible and nn linearly independent constraints are active there. For the standard form Ax=bA\mathbf{x} = \mathbf{b}, x≥0\mathbf{x} \ge 0 with AA of size m×nm \times n, vertices are the basic feasible solutions: choose mm independent columns BB, solve ABxB=bA_B\mathbf{x}_B = \mathbf{b}, set the rest to zero, and keep the result if xB≥0\mathbf{x}_B \ge 0.

The fundamental theorem

If an LP in standard form has an optimal solution, then it has an optimal basic feasible solution. Proof idea: if an optimal x\mathbf{x} is not a vertex, it is the midpoint of x±d\mathbf{x} \pm \mathbf{d} inside PP; linearity forces cTd=0\mathbf{c}^T\mathbf{d} = 0, so you can slide along d\mathbf{d} without changing the cost until another variable hits zero, ending at a point with more active constraints.

Brute force: enumerate all vertices

For small problems you can list every basis. This makes the theorem concrete (and shows why it is not an algorithm: there are (nm)\binom{n}{m} bases):

python · try it yourself
import numpy as np
from itertools import combinations

# max 3a + 5b s.t. a + 2b <= 8, 2a + b <= 10, a, b >= 0, in standard form with slacks s1, s2
A = np.array([[1.0, 2.0, 1.0, 0.0], [2.0, 1.0, 0.0, 1.0]]); b = np.array([8.0, 10.0])
c = np.array([-3.0, -5.0, 0.0, 0.0])
best = None
for basis in combinations(range(4), 2):
    AB = A[:, basis]
    if abs(np.linalg.det(AB)) < 1e-12:
        continue
    x = np.zeros(4); x[list(basis)] = np.linalg.solve(AB, b)
    feasible = np.all(x >= -1e-12)
    print(f"basis {basis}: (a, b) = {np.round(x[:2], 4) + 0}, feasible: {feasible}, profit: {-c @ x:.1f}")
    if feasible and (best is None or c @ x < c @ best):
        best = x
print("best vertex (a, b):", best[:2])
basis (0, 1): (a, b) = [4. 2.], feasible: True, profit: 22.0
basis (0, 2): (a, b) = [5. 0.], feasible: True, profit: 15.0
basis (0, 3): (a, b) = [8. 0.], feasible: False, profit: 24.0
basis (1, 2): (a, b) = [ 0. 10.], feasible: False, profit: 50.0
basis (1, 3): (a, b) = [0. 4.], feasible: True, profit: 20.0
basis (2, 3): (a, b) = [0. 0.], feasible: True, profit: 0.0
best vertex (a, b): [4. 2.]

Six bases, four feasible vertices (0,0)(0, 0), (5,0)(5, 0), (4,2)(4, 2), (0,4)(0, 4), and the best is (4,2)(4, 2), matching the course intro.

Unbounded and degenerate cases

  • Unbounded: if the polyhedron is unbounded in a direction d\mathbf{d} with cTd<0\mathbf{c}^T\mathbf{d} < 0, the cost goes to −∞-\infty.
  • Multiple optima: if c\mathbf{c} is perpendicular to an edge or face, every point on it is optimal (but a vertex is still among them).
  • Degeneracy: more than nn constraints active at a vertex (in 2D, three lines through one point). Different bases describe the same vertex, and the simplex method can make "steps" of length zero; in rare cases it cycles without care.
python · try it yourself
import numpy as np
from scipy.optimize import linprog

# multiple optima: objective parallel to the edge a + 2b = 8
r = linprog([-1, -2], A_ub=[[1, 2], [2, 1]], b_ub=[8, 10], bounds=[(0, None)] * 2, method="highs")
print("optimum value:", -r.fun, " one optimal vertex:", np.round(r.x, 4))
for t in (0.0, 0.5, 1.0):                          # every point between (0, 4) and (4, 2) is optimal
    p = (1 - t) * np.array([0, 4]) + t * np.array([4, 2])
    print("  point", p, "value", p @ [1, 2])
optimum value: 8.0  one optimal vertex: [0. 4.]
  point [0. 4.] value 8.0
  point [2. 3.] value 8.0
  point [4. 2.] value 8.0

How many vertices?

A polyhedron defined by mm inequalities in nn dimensions can have up to roughly mn/2m^{n/2} vertices. The Klee-Minty cube is a squashed nn-cube on which a classic simplex pivot rule visits all 2n2^n vertices. In practice the simplex method visits a small multiple of mm vertices, and interior-point methods have polynomial worst-case bounds.

In software

  • Simplex-based solvers return a basic solution (a vertex); interior-point solvers return a point near the centre of the optimal face, followed by a crossover step to a vertex if requested.
  • The basis is what makes warm starts possible: after a small change, re-solving from the old basis takes a few pivots.

Exercises

Exercise 1: Count bases

How many candidate bases does a standard-form LP with m=3m = 3 and n=7n = 7 have?

Answer

(73)=35\binom{7}{3} = 35.

Solution

Each basis is a choice of 3 of the 7 columns. Some may be singular or infeasible, so the number of vertices is at most 35.

Exercise 2: Vertex or not?

For the constraints a+2b≤8a + 2b \le 8, 2a+b≤102a + b \le 10, a,b≥0a, b \ge 0, is (2,3)(2, 3) a vertex? Is (5,0)(5, 0)?

Answer

(2,3)(2, 3) is on one edge but is not a vertex; (5,0)(5, 0) is.

Solution

At (2,3)(2, 3) only a+2b=8a + 2b = 8 is active (since 2⋅2+3=7<102 \cdot 2 + 3 = 7 < 10), one constraint in 2D. At (5,0)(5, 0), 2a+b=102a + b = 10 and b=0b = 0 are active: two independent constraints.

Exercise 3: An unbounded LP (code)

Minimize −a−b-a - b subject to a−b≤1a - b \le 1, a,b≥0a, b \ge 0. What does the solver report, and along which direction does the cost decrease forever?

Answer

Unbounded, for instance along (1,1)(1, 1).

Solution
python · try it yourself
from scipy.optimize import linprog
r = linprog([-1, -1], A_ub=[[1, -1]], b_ub=[1], bounds=[(0, None)] * 2, method="highs")
print(r.status, r.message.split(".")[0])
3 The problem is unbounded

Moving along d=(1,1)\mathbf{d} = (1, 1) keeps a−ba - b unchanged and lowers the cost by 2 per unit.

Test yourself

If an LP has an optimal solution, then…

  1. it is unique
  2. an optimal solution exists at a vertex
  3. it is in the interior of the feasible set
  4. all vertices are optimal

A basic feasible solution of Ax=bA\mathbf{x} = \mathbf{b}, x≥0\mathbf{x} \ge 0 (AA is m×nm \times n) has at most… non-zero variables.

  1. nn
  2. mm
  3. n−mn - m
  4. 1

Degeneracy means…

  1. the LP is infeasible
  2. more constraints are active at a vertex than needed to define it
  3. the objective is zero
  4. there are no vertices