Linear programming maximises or minimises a quantity subject to limits on resources. Every problem has the same shape: constraints define a region, and the best point is always at one of its corners.
Formulating a problem
Three steps, in order.
1. Define the variables explicitly, with units.
Let be the number of tables and the number of chairs produced per week.
2. Write the objective function — the quantity to be optimised.
Maximise (profit in dollars).
3. Write the constraints as inequalities, including non-negativity.
| Wording | Inequality |
|---|---|
| "at most 10 hours available" | |
| "at least 8 units required" | |
| "at least twice as many as " | |
| "cannot produce a negative amount" | , |
Graphing the constraints
Each linear inequality is a half-plane.
- Draw the boundary line by replacing the inequality with an equals sign. The intercepts are quickest: for , plot and .
- Decide which side to keep by testing a point — usually the origin. For , the origin gives ✓, so keep the side containing the origin.
- Shade consistently: either shade the region you want or shade out the region you do not, but say which.
Use a solid line for or (the boundary is included) and a dashed line for or (it is not).
The feasible region
The feasible region is the set of points satisfying every constraint at once — the overlap of all the half-planes. Label it clearly on the diagram.
Two situations to recognise:
- Empty region — the constraints contradict each other and no solution exists.
- Unbounded region — it extends to infinity. A minimum may still exist, but a maximum may not.
The objective function
Lines of constant are parallel — , , all have gradient . Optimising means sliding that line as far as possible in the improving direction while still touching the feasible region.
The last point it touches is the optimum, and because the region is a polygon, that point is always a vertex (or, if the objective line is parallel to an edge, the whole of that edge).
The vertex method
Since the optimum is at a corner, evaluate the objective at every vertex and compare.
Maximise subject to , , .
Find the vertices:
- — the origin.
- — where meets the -axis. Check: ✓
- — where meets the -axis. Check: ✓
- The intersection of the two lines: subtracting from gives , so .
Evaluate:
| Vertex | |
|---|---|
Maximum profit at , .
A minimisation. Minimise subject to , , . The vertices are , and :
| Vertex | |
|---|---|
Minimum cost at , .
Integer solutions
Many problems count indivisible things: chairs, buses, staff. The graphical optimum may then be fractional.
Rounding is not reliable. The rounded point may lie outside the feasible region, and even when it is inside it may not be the best integer point.
The safe procedure:
- Find the optimal vertex.
- List the integer points nearby that lie inside the feasible region.
- Evaluate the objective at each and take the best.