Purpose

Linear programming optimizes a linear objective subject to linear constraints. A huge number of combinatorial problems reduce to it, and LPs are solvable in polynomial time. This note covers the geometry, the standard form transformations, and three worked formulations: max-flow, min-cost flow, and the LP relaxation of weighted vertex cover.

Linear Systems

Systems of linear equations (key word being equality) can be solved via Gaussian elimination. The solution space of such a system is a point, a line, a plane, or a hyperplane in higher dimensions.

Let be a column vector in , and a column vector of variables. We can represent a linear expression using the inner product of these two vectors:

A hyperplane is the set of points such that for some . A half-space is the set of points on one side of a hyperplane, or .

The intersection of a set of half-spaces is a polytope, which is a convex set. A convex set is a set where the line segment between any two points in the set stays inside the set.

Linear Programs

A linear program optimizes a linear objective function subject to linear constraints. For example:

In matrix form, stacking the constraint vectors as rows of :

Standard Form

Any linear program can be written in the standard form below.

The transformations: negate the objective to turn a min into a max, negate a constraint to flip a into a , and split an equality into two inequalities. For example:

becomes

When a variable lacks a non-negativity constraint, replace it with the difference of two non-negative variables. For example, in

replace with , where :

Standard form in one line

Maximize subject to and . Four transformations reach it from any LP: negate the objective to turn min into max, negate a constraint to flip into , split an equality into two inequalities, and write an unconstrained variable as the difference of two non-negative ones.

Components of a Linear Program

When formulating a problem as an LP, decide each of these:

  • The set of variables.
  • Bounds on the variables, e.g. non-negativity.
  • The objective function, and whether it is a minimization or maximization.
  • The constraints, which must be linear, each either an equality or an inequality.

LPs capture problems like 2-person zero-sum games, shortest path, max-flow, matching, and multi-commodity flow, and the polynomial solvability of LPs makes them a workhorse for approximation algorithms.

Max-Flow

Given a graph with source and sink , introduce a variable for the flow on each edge (see network flows).

The constraints:

  • for all , since flow is non-negative
  • for all , the capacity constraint
  • for all , the conservation constraint

The objective maximizes flow out of the source:

The optimal LP solution is not necessarily an integer flow, though for max-flow an integer optimum always exists when capacities are integers.

Duality intuition

Every maximization LP has a dual minimization LP with the same optimal value. The dual of the max-flow LP is a fractional min-cut, so the max-flow min-cut theorem is LP duality specialized to this program.

Min-Cost Flow

Add a cost per unit of flow on each edge, and minimize total cost while shipping a required flow value :

Weighted Vertex Cover

Given a graph where each vertex has a cost , find the vertex cover minimizing .

Give each vertex a variable , intended to be if and otherwise. Covering every edge means each edge needs at least one chosen endpoint, which is the linear constraint :

With the extra restriction this is exactly weighted vertex cover, which is NP-hard, so the integer program is not directly solvable in polynomial time. Dropping the integrality restriction gives the LP relaxation above, which is solvable in polynomial time and whose optimum satisfies , since every true vertex cover is a feasible LP solution.

Rounding recovers a real cover: take . Every edge constraint forces at least one endpoint to be , so is a vertex cover. Rounding at most doubles each variable, so

which makes this a 2-approximation for weighted vertex cover.

The LP optimum can sit strictly below OPT

On a triangle with unit costs, everywhere is feasible with value , while the smallest vertex cover has two vertices. On the gap between and approaches a factor of , so any analysis that bounds the output against cannot prove a ratio better than for this relaxation.