A cabinet shop builds standard and deluxe units, S and D, both counted in units a week. Its one hard constraint is 60 machine hours: 2S + 3D ≤ 60. It also has three things it would like: 60 pounds of profit at 3 and 4 a unit, no more than 30 hours of overtime at 3 and 6 a unit, and 12 deluxe units built.
Written as constraints, those three are infeasible together, and “infeasible” is a much worse answer than “missed by 12 units” when the numbers were aspirations in the first place. The point of a goal programme is to keep the model answerable and make the compromise visible.
Definition · Deviation variablesA target a·x = b is written a·x + u − o = b with u ≥ 0 and o ≥ 0, where u is the amount by which the plan falls short and o the amount by which it overshoots. The objective penalises whichever of the two the situation minds.
At most one of u and o is positive at an optimum: the penalised one is pushed to zero if it can be, and the unpenalised one only grows when the row forces it. That is the same direction argument the rewrites lesson made, which is why this lesson sits beside it.
2S + 3D ≤ 60 machine hours, a hard constraint
3S + 4D + u₁ − o₁ = 60 pounds of profit; u₁ is minded
3S + 6D + u₂ − o₂ = 30 hours of overtime; o₂ is minded
D + u₃ − o₃ = 12 deluxe units; u₃ is minded
S, D, and every u and o ≥ 0
One programme per level
Take the goals in the order profit, overtime, deluxe run. Level one minimises u₁ and achieves 0: a plan of no standard units and 15 deluxe ones reaches the profit target exactly. Level two adds the row u₁ = 0 and minimises o₂, which comes out at 30 hours — the profit target, now frozen, is what makes that overtime unavoidable. Level three adds o₂ = 30 and minimises u₃, which comes out at 12: the deluxe run is what pays.
Reorder and everything moves. Overtime first: o₂ = 0 with a plan of five deluxe units, then profit misses by 30 and the deluxe run still misses by 12. Deluxe run first: it is met, profit is met as well, and overtime is 54 hours over its limit. Three orderings, three different sacrifices, all of them optimal for the priorities they were given.
Example · The frozen row is what makes it a sequenceAt level two of the profit-first ordering the model contains u₁ = 0 as an equality. Without it, minimising o₂ would simply abandon the profit target — the second level would undo the first. With it, the second level searches only among the plans that already achieve what the first level achieved, which is what “preemptive” means.
The other way this goes wrong, and it is silent
The tempting alternative is one objective: minimise u₁ + o₂ + u₃. It solves, and it reports a total of 42. But u₁ is in pounds, o₂ is in hours and u₃ is in units, and nothing in the arithmetic objects to adding pounds to hours. The plan it returns is 10 standard units and no deluxe ones, with a profit shortfall of 30, no overtime and a deluxe shortfall of 12 — which is the answer to the overtime-first ordering, arrived at without anyone choosing that ordering.
That is the failure mode to watch: a weighted objective always produces a number, and the number encodes an exchange rate between pounds and hours that nobody wrote down. Weights can be made to work, but only by scaling each deviation into a common currency on purpose. Raise the weight on a pound of profit to 4 and the weighted answer switches to the profit-first plan, which shows how little the unscaled version was saying.
None of this leaves the linear class. Every row is linear, the deviations are ordinary non-negative variables, and each level is an ordinary linear programme. What is new is that the answer is a sequence of solves and a sentence: which goal was sacrificed, at which level, and by how much in its own unit.