Formulating a linear programme
The three components
- Every linear programme has exactly three parts, and writing them down separately is the first step of every answer.
- Decision variables — the quantities you get to choose.
- Define them in words, with units: "Let be the number of tonnes of Blend A produced per week."
- Ambiguity here poisons everything downstream. "Let be Blend A" is not a definition — is it tonnes, batches, or dollars?
- Constraints — the limits, written as linear inequalities.
- One per resource, plus non-negativity: , .
- Objective function — the thing to maximise or minimise, written as a formula:
- State whether you are maximising or minimising. A minimisation problem answered with a maximum is a complete answer to the wrong question.
Reading constraints out of a context
- Each limited resource gives one constraint. Build it in three steps:
- How much of the resource does one unit of each product use?
- Multiply by the number of units.
- Compare with the total available, using the right inequality.
- Worked through — "each tray of A needs 2 hours of oven time, each tray of B needs 1 hour, and there are 100 oven hours a week":
- A table keeps this organised, and is worth drawing every time:
| Product A () | Product B () | Available | |
|---|---|---|---|
| Oven hours | 2 | 1 | 100 |
| Labour hours | 1 | 1 | 80 |
| Storage (A only) | 1 | 0 | 40 |
| Profit each | $40 | $30 | maximise |
- The last row is the objective, not a constraint. Mixing them is a common error: profit is what you are optimising, not something you are limited to.
Getting the inequality direction right
| Wording | Inequality |
|---|---|
| "at most", "no more than", "available", "capacity of" | |
| "at least", "minimum of", "must supply", "contract requires" | |
| "exactly", "must use all of" | |
| "twice as many A as B" | — an equality constraint |
| "at least twice as many A as B" |
- Ratio constraints trip people up. "At least three times as many A as B" is . Test it with numbers: 9 of A and 2 of B satisfies ✓, and that is indeed more than three times as many.
- Rearrange ratio constraints into standard form before graphing: becomes , a line through the origin.
The assumptions built into the model
- Linear programming assumes four things, and naming them is worth real marks at Excellence:
- Proportionality — doubling production exactly doubles resource use and profit. No bulk discounts, no economies of scale.
- Additivity — the products do not interfere with each other; total usage is just the sum.
- Divisibility — fractional amounts are allowed. False whenever the products are discrete items, which is why whole-number answers need separate treatment.
- Certainty — every coefficient is known exactly. Real prices and yields vary.
- Say which assumption is shakiest in the given context. For a bakery, divisibility is fine for kilograms of dough and false for wedding cakes.
Writing the finished model
- Set it out in a standard block, so a reader can check it at a glance:
- Check the model before graphing by testing one sensible plan. If making 10 of each is obviously possible in the context, it must satisfy every constraint — and if it does not, a constraint is wrong.
Worked ExampleSetting up a full model
A small dairy company makes two cheeses. Each tray of Halloumi uses 2 hours of vat time, 1 hour of packing, and earns $40 profit. Each tray of Feta uses 1 hour of vat time, 1 hour of packing, and earns $30 profit. There are 100 vat hours and 80 packing hours available per week, and cold storage limits Halloumi to 40 trays a week. A supermarket contract requires at least 10 trays of Feta each week.
Formulate the linear programme completely, and check the model with a trial plan.
Step 1 — Define the decision variables
Both the unit (trays) and the period (per week) are stated, so every constraint that follows is measured consistently.
Step 2 — Build the resource table
| Halloumi () | Feta () | Available per week | |
|---|---|---|---|
| Vat hours | 2 | 1 | 100 |
| Packing hours | 1 | 1 | 80 |
| Cold storage | 1 | 0 | 40 (Halloumi only) |
| Contract | 0 | 1 | at least 10 (Feta) |
| Profit per tray | $40 | $30 | maximise |
Step 3 — Write the constraints
Vat time — 2 hours per Halloumi tray, 1 per Feta, at most 100 available:
Packing time — 1 hour each, at most 80:
Cold storage — Halloumi only, at most 40 trays:
Supermarket contract — at least 10 trays of Feta:
Non-negativity:
Step 4 — Write the objective function
Profit is $40 per Halloumi tray and $30 per Feta tray:
Step 5 — Set out the complete model
Step 6 — Check the model with a trial plan
Try 20 trays of each, which should obviously be possible:
| Constraint | Check | Result |
|---|---|---|
| Vat | ✓ | |
| Packing | ✓ | |
| Storage | ✓ | |
| Contract | ✓ |
Feasible, with profit .
Now try a plan that should FAIL — 50 trays of Halloumi:
- Storage: ✗ Infeasible, correctly caught by constraint (3).
Step 7 — State the assumptions
- Proportionality: 10 trays of Halloumi use exactly 20 vat hours and earn exactly $400 — no setup time per batch and no bulk savings. In a real dairy each vat run has a cleaning cost, so this is an approximation.
- Divisibility: the model will permit answers such as 20.5 trays. Trays are discrete, so the optimal corner may need adjusting to whole numbers.
- Certainty: profits of $40 and $30 are treated as fixed, though milk prices and demand both vary week to week.