TL;DR
A linear program asks for the best value of a linear function, such as profit or cost, subject to a set of linear limits such as "no more than 4 hours of machine time." The allowed choices form a flat-sided region, and a linear function on such a region reaches its best value at one of the corners. Linear programming is the study of finding that corner efficiently, even when there are thousands of variables.
Where you'll see it: in production planning and shipping logistics, in airline crew scheduling, in choosing the cheapest mix of ingredients that meets nutritional limits, and inside many machine-learning and control pipelines that reduce to a linear objective.
Intuition
Choices with limits
Suppose a workshop makes two products, and each product uses machine time and labour. You want the mix that earns the most money. Each limit on time or labour is a straight line in the plane of possible production amounts. Together the limits cut out a region: a polygon with straight edges. Any production plan inside the region is feasible. Any plan outside it breaks a limit.
Now the profit. A profit of for units of one product and of the other is a family of parallel straight lines, one for each profit level. Moving the profit level up slides these lines outward. The last line that still touches the region is the best one, and it touches at a corner (if it happens to lie along a whole edge, the two corners at that edge's ends tie). Nothing in the middle of an edge beats the better of its two end corners, because profit changes at a constant rate along a straight edge.
That observation is the core of linear programming. You do not have to search the whole region. You only have to compare its corners.
- x + y = 4
- x + 3y = 6
Why the corner matters
A convex set is one where the segment between any two points stays inside. The feasible region of a linear program is convex, because each linear inequality defines a half-plane, and the intersection of half-planes is convex. On a convex polygon a linear objective has no local maxima other than global ones, and it is always achieved at an extreme point. That is why the search can be restricted to corners.
The math
Standard form
A linear program is usually written as
Here is a vector of decision variables, holds the objective coefficients, is an Matrix of constraint coefficients, and holds the limits. The inequality between vectors is read entry by entry. Minimization is the same problem with , and equality or reversed constraints can be rewritten into this form by adding slack variables.
For the workshop example with profit , the constraints and are two rows of , and .
Vertices
A point of the feasible region is a vertex if it is the unique solution of linearly independent constraints set to equality. Geometrically, it is a corner. The fundamental theorem says that if a linear program has a finite optimum, then some optimal solution is a vertex.
The proof idea is short. Suppose the optimum lies strictly inside an edge. Move along the edge in the direction that keeps the objective nondecreasing, and you reach an endpoint that is at least as good. Repeating this pushes you to a corner.
Duality
Every linear program has a companion called its dual, which uses the same data to produce a bound on the optimum. For the maximization above, the dual is a minimization over multipliers :
Any feasible gives an upper bound on the primal objective, because . When both problems have optima, they are equal (strong duality). This idea is the bridge to Lagrangian Duality.
Worked examples
Maximize subject to , , , .
- List the vertices. The four corners of the region are , , and .
- Find by solving and . Subtracting gives , so and .
- Evaluate the objective at each vertex:
- gives .
- gives .
- gives .
- gives .
- Check feasibility of the best one. At , and , so it is feasible.
- The maximum is , attained at .
Interpretation: the workshop should spend all its first-type capacity and nothing on the second product. Note that the intersection vertex looks like a balanced mix but earns less. The corner comparison catches this without any intuition about balance.
Minimize subject to , , , . Think of a diet where and are servings of two foods that must together supply at least 8 units of protein and 9 units of vitamin.
- The feasible region is unbounded upward, but both costs are positive, so the cost cannot fall without limit and a minimum exists at a corner. Find the candidate vertices.
- Intersection of and : from the second, . Substituting gives , so and . Check: and . Cost .
- On the -axis, requires and , so the corner is with cost .
- On the -axis, requires and , so the corner is with cost .
- The minimum over these corners is , at .
Interpretation: two servings of the first food and three of the second meet both requirements at the lowest cost. Covering problems have the same geometry as packing problems, only the feasible region is on the other side of the lines.
Tradeoffs and failure modes
Linear programming is fast and reliable when the model really is linear. The usual failures come from the model rather than the solver.
| Situation | Problem | Better choice |
|---|---|---|
| Objective or constraint is curved | The corner argument no longer holds | Convex optimization, or piecewise-linear approximation |
| Variables must be whole numbers | The LP optimum can be fractional, for example half a machine | Integer programming, which is much harder in general |
| Infeasible limits | The region is empty and the solver reports infeasibility | Relax the least important limit, or find the conflicting pair |
| Unbounded objective | Profit can grow forever because a limit is missing | Check that every real limit appears in the model |
| Very large sparse problems | Dense tableau methods are slow | Revised simplex on sparse matrices, or interior-point methods |
The simplex method moves from one vertex to a neighbouring vertex that improves the objective, and stops when no neighbour is better. In the worst case it can visit exponentially many vertices, but in practice it is fast on real problems. Interior-point methods travel through the middle of the region and have polynomial worst-case guarantees.
History
The ideas appeared in several places at once in the late 1930s and 1940s. Leonid Kantorovich studied production planning with linear objectives in the Soviet Union in the late 1930s. George Dantzig, working on US Air Force planning problems, developed the simplex method in 1947 and promoted linear programming as a general planning tool. Tjalling Koopmans, who worked on the transport problem, helped establish the field's economic applications. Kantorovich and Koopmans shared the 1975 Nobel Memorial Prize in Economic Sciences for work on optimal resource allocation.
It caught on because industries had many linear limits and needed a reliable way to plan with them. The advent of computers made large instances solvable. In 1984 Narendra Karmarkar's interior-point method showed a practical alternative to the simplex method, and modern solvers use both.
Check yourself
QuestionRecall: why is the best point of a linear program at a corner of the feasible region?Show answer
The objective is linear, so along any straight edge it increases or decreases monotonically. If the optimum were in the middle of an edge, you could slide along the edge to an endpoint that is at least as good. Repeating this brings you to a vertex. The region is a polygon with a finite number of corners, so the search space is finite in this sense.
QuestionComputation: evaluate the objective at the vertices , and of some feasible region. Which is the maximum?Show answer
At the value is . At it is . At it is . The maximum is at .
QuestionWhy does a feasible point of the dual give an upper bound on the primal maximum?Show answer
For any feasible primal and dual , we have because and . Then because and . Chaining gives , so no primal value can exceed any dual value.
QuestionApplied: a planner needs whole numbers of trucks, but the LP solution says 3.4 trucks. What is the right next step?Show answer
Dropping the whole-number requirement (the LP relaxation) gives an upper bound on the best integer profit (a lower bound for a cost minimisation), but not an integer solution. Round the variable carefully and check feasibility, or move to integer programming, which solves the discrete problem exactly but can be much slower. The planner should confirm which rounding still meets every constraint before committing.
Sources
- Linear programming (Wikipedia)
- Simplex algorithm (Wikipedia)
- Boyd and Vandenberghe, Convex Optimization, Chapter 4