Salick Academy

Linear Programming

No calculator

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 xx be the number of tables and yy the number of chairs produced per week.

2. Write the objective function — the quantity to be optimised.

Maximise P=4x+3yP = 4x + 3y (profit in dollars).

3. Write the constraints as inequalities, including non-negativity.

Wording Inequality
"at most 10 hours available" x+y10x + y \le 10
"at least 8 units required" x+y8x + y \ge 8
"at least twice as many xx as yy" x2yx \ge 2y
"cannot produce a negative amount" x0x \ge 0, y0y \ge 0

Graphing the constraints

Each linear inequality is a half-plane.

  1. Draw the boundary line by replacing the inequality with an equals sign. The intercepts are quickest: for x+y=10x + y = 10, plot (10,0)(10, 0) and (0,10)(0, 10).
  2. Decide which side to keep by testing a point — usually the origin. For x+y10x + y \le 10, the origin gives 0100 \le 10 ✓, so keep the side containing the origin.
  3. Shade consistently: either shade the region you want or shade out the region you do not, but say which.

Use a solid line for \le or \ge (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

P=4x+3yP = 4x + 3y

Lines of constant PP are parallel — P=12P = 12, P=24P = 24, P=36P = 36 all have gradient 43-\frac43. 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 P=4x+3yP = 4x + 3y subject to x+y10x + y \le 10, 2x+y162x + y \le 16, x,y0x, y \ge 0.

Find the vertices:

  • (0,0)(0,0) — the origin.
  • (0,10)(0,10) — where x+y=10x + y = 10 meets the yy-axis. Check: 2(0)+10=10162(0) + 10 = 10 \le 16
  • (8,0)(8,0) — where 2x+y=162x + y = 16 meets the xx-axis. Check: 8+0108 + 0 \le 10
  • The intersection of the two lines: subtracting x+y=10x + y = 10 from 2x+y=162x + y = 16 gives x=6x = 6, so y=4y = 4.

Evaluate:

Vertex P=4x+3yP = 4x + 3y
(0,0)(0,0) 00
(0,10)(0,10) 3030
(8,0)(8,0) 3232
(6,4)(6,4) 36\mathbf{36}

Maximum profit 3636 at x=6x = 6, y=4y = 4.

A minimisation. Minimise C=3x+2yC = 3x + 2y subject to x+y8x + y \ge 8, 3x+y123x + y \ge 12, x,y0x, y \ge 0. The vertices are (0,12)(0,12), (2,6)(2,6) and (8,0)(8,0):

Vertex C=3x+2yC = 3x + 2y
(0,12)(0,12) 2424
(2,6)(2,6) 18\mathbf{18}
(8,0)(8,0) 2424

Minimum cost 1818 at x=2x = 2, y=6y = 6.

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:

  1. Find the optimal vertex.
  2. List the integer points nearby that lie inside the feasible region.
  3. Evaluate the objective at each and take the best.