impera Open Impera

A levels Further Mathematics · Decision mathematics

Linear programming

1Formulating a problem

A linear programming problem asks you to maximise or minimise an objective function subject to constraints that are linear inequalities.

To formulate:

  1. Define the decision variables clearly (e.g. "$x$ = number of chairs made per day").
  2. Write the objective: "maximise $P = \ldots$" or "minimise $C = \ldots$".
  3. Write each constraint as an inequality, including non-negativity ($x, y \geq 0$).
Worked example

A workshop

  1. Chairs ($x$) and tables ($y$) earn £30 and £50 profit. A chair takes 1 hour of carpentry and 3 hours of finishing; a table 2 hours and 2 hours. There are 16 carpentry hours and 24 finishing hours a day.
  2. Maximise $P = 30x + 50y$.
  3. Subject to $x + 2y \leq 16$, $3x + 2y \leq 24$, $x \geq 0$, $y \geq 0$.
Check yourself

What is the objective function?

  • The expression to be maximised or minimised

  • The number of decision variables

  • One of the constraints on the variables

  • The feasible region on the graph

Show the answer

The expression to be maximised or minimised

For example, profit.

2The feasible region

Draw each constraint as a line and shade the side that is not wanted (unless told otherwise). The region left is the feasible region: every point in it satisfies all the constraints.

The objective line (dashed) slid outwards last touches the feasible region at (4, 6): 4 chairs and 6 tables.

Worked example

Drawing the region

  1. $x + 2y \leq 16$: line through $(16, 0)$ and $(0, 8)$.
  2. $3x + 2y \leq 24$: line through $(8, 0)$ and $(0, 12)$.
  3. The feasible region has vertices $(0, 0)$, $(8, 0)$, $(4, 6)$ and $(0, 8)$.
  4. $(4, 6)$ comes from solving $x + 2y = 16$ and $3x + 2y = 24$: subtracting gives $2x = 8$.
Check yourself

What is the feasible region?

  • The region where profit is zero

  • The largest triangle on the graph

  • The set of points satisfying every constraint

  • The region below the objective line

Show the answer

The set of points satisfying every constraint

Each point is a possible plan.

3Finding the optimal point

The optimal solution lies at a vertex of the feasible region. Two methods:

  • Vertex testing: evaluate the objective at every vertex.
  • Objective line: draw a line $30x + 50y = k$ and slide it parallel across the region; the last vertex it touches is optimal.
Worked example

Vertex testing

  1. $(8, 0)$: $P = 240$. $(0, 8)$: $P = 400$. $(4, 6)$: $P = 120 + 300 = 420$.
  2. Maximum profit £420, making 4 chairs and 6 tables.

For a minimisation problem, the optimum is the first vertex the objective line meets.

Check yourself

Where does the optimal solution of a linear programme lie?

  • At a vertex of the feasible region

  • Outside the region

  • At the origin

  • At the centre of the region

Show the answer

At a vertex of the feasible region

The objective is linear, so it is extreme at a corner.

4Integer solutions

Often the variables must be whole numbers (you cannot make 2.5 tables). If the optimal vertex is not at integer values, test the integer points near it that lie inside the feasible region.

Worked example

Rounding with care

  1. Suppose the optimal vertex were $(3.6, 5.2)$.
  2. Test nearby integer points such as $(3, 5)$, $(4, 5)$, $(3, 6)$ and $(4, 4)$, checking each one satisfies every constraint.
  3. Choose the one giving the best value of the objective.

Simply rounding the vertex can give a point outside the feasible region.

Check yourself

Why can't you simply round a non-integer optimal vertex?

  • The objective function is not linear in the variables

  • The rounded point might break a constraint, or not be the best integer point

  • Rounding always gives the best integer answer available

  • Integer points are never in the feasible region

Show the answer

The rounded point might break a constraint, or not be the best integer point

Check each nearby point.

5The simplex method

For problems with more variables, the simplex algorithm is used. Each inequality $\leq$ is turned into an equation using a slack variable.

Worked example

Setting up a tableau

  1. Maximise $P = 2x + 3y$ subject to $x + y \leq 4$, $x + 3y \leq 6$.
  2. With slack variables $s, t \geq 0$: $x + y + s = 4$, $x + 3y + t = 6$, and $P - 2x - 3y = 0$.
  3. Initial tableau rows: $s$: 1, 1, 1, 0 | 4; $t$: 1, 3, 0, 1 | 6; $P$: −2, −3, 0, 0 | 0.

Slack variables measure unused resources, such as spare hours.

Check yourself

What does a slack variable represent?

  • A variable that is always negative

  • The profit made from each product sold

  • The unused amount of a resource in a constraint

  • The gradient of the objective line

Show the answer

The unused amount of a resource in a constraint

It turns ≤ into =.

6Pivoting

Each iteration of simplex:

  1. Pivot column: the most negative value in the objective row.
  2. Pivot row: the smallest non-negative ratio of value to pivot column entry ($\theta$ values).
  3. Divide the pivot row by the pivot, then use row operations to make every other entry in the pivot column zero.
  4. Stop when there are no negative values in the objective row.
Worked example

Solving

  1. Pivot column $y$ ($-3$). Ratios: $4 \div 1 = 4$, $6 \div 3 = 2$, so pivot on the $t$ row.
  2. After one iteration the objective row is $-1, 0, 0, 1 \mid 6$: still a negative, so pivot on $x$.
  3. After the second iteration: $P + 1.5s + 0.5t = 9$, with $x = 3$, $y = 1$.
  4. Maximum $P = 9$ at $(3, 1)$. Both slacks are 0, so both resources are fully used.
Check yourself

How is the pivot row chosen in the simplex method?

  • Smallest non-negative ratio of value to pivot column entry

  • Any row, as long as its value is positive

  • The largest value in the pivot column

  • The most negative entry in the objective row

Show the answer

Smallest non-negative ratio of value to pivot column entry

It keeps all variables non-negative.

Now test yourself

This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.

Practise in Impera