Learn
Lesson · Linear Programming Models · The four model families

Multiperiod Planning and Balance Constraints

One equation per period, Iₜ = Iₜ₋₁ + Pₜ − Dₜ, is what ties a plan together: the stock carried out of a period is the stock carried in, plus what was made, minus what was sold. The inventory variable is the thing that carries the link, so it is a decision of the model rather than a formula, and one aggregate row about total production is not the same statement.

Iₜ = Iₜ₋₁ + Pₜ − Dₜ one equation for each period written for a solver: Pₜ + Iₜ₋₁ − Iₜ = Dₜ period 1 carries the opening stock: P₁ − I₁ = 20 − 5 Pₜ ≤ capacity, Pₜ ≥ 0, Iₜ ≥ 0 one aggregate row instead: P₁ + P₂ + P₃ + P₄ ≥ 105
The balance equation, and the row that is not the same thing

Core ideas

What this lesson establishes

The shape is one equality repeated. What makes it work is that the quantity linking two periods is a variable the model may choose.

1

Inventory is a decision variable, not a formula

Iₜ is the stock in the store at the end of period t, in units. The plan chooses it, subject to the balance equation and to Iₜ ≥ 0. Substituting a formula for it collapses the link into the objective and makes the constraint that forbids a negative store impossible to write.

2

One equation per period, the same shape every time

Pₜ + Iₜ₋₁ − Iₜ = Dₜ for each t, with the first period taking the opening stock as data. The rows are equalities: the stock does not merely satisfy an inequality, it is determined by where it came from, and it appears in exactly two of the rows — the period that carries it out and the period that carries it in.

3

The link is what forbids producing too late

Demand in the second period must be met by stock that exists in the second period. The balance rows say so, period by period. A single row about total production over the horizon says something strictly weaker and cannot see the difference.

The material

Balance equations, and the aggregate row that is not equivalent

The equation each period contributes, what the inventory variable carries, and the plan an aggregate constraint prefers instead.

A plant makes one product over four periods. Demand is 20, 35, 30 and 25 units; making one unit costs 9, 8, 7 and 6 as the periods go on; at most 60 units can be made in a period; carrying a unit into the next period costs 1; and there are 5 units in the store before the first period begins.

Definition · Balance constraint

For each period t, with Pₜ made, Dₜ demanded and Iₜ left in the store at the end, the balance constraint is Iₜ = Iₜ₋₁ + Pₜ − Dₜ, where I₀ is the opening stock. Rearranged for a solver, with the data on the right, it is Pₜ + Iₜ₋₁ − Iₜ = Dₜ.

With Iₜ ≥ 0 for every t, the family of equations says exactly that demand is met in the period it occurs, out of stock that exists by then. Allowing Iₜ to go negative is a modelling decision with a name — a backorder — and it has to be made deliberately.

period 1 period 2 period 3 period 4 demand 20 35 30 25 cost to make one 9 8 7 6 opening stock 5, capacity 60 a period, 1 to carry a unit onward minimise 9P₁ + 8P₂ + 7P₃ + 6P₄ + I₁ + I₂ + I₃ + I₄ P₁ − I₁ = 15 20 demanded, 5 already in the store P₂ + I₁ − I₂ = 35 P₃ + I₂ − I₃ = 30 P₄ + I₃ − I₄ = 25 P₁, …, P₄ ≤ 60 every P and every I ≥ 0

The cheapest plan makes 15, 35, 30 and 25 and carries nothing at any point, at a cost of 775. That is worth reading rather than accepting: making a unit gets cheaper every period and carrying one costs money, so there is no reason to build stock and every reason to make each unit as late as the balance rows allow — which is the period it is sold in.

Example · When the store earns its keep

Cut the capacity to 30 a period and raise the second period's demand to 40. Now the second period cannot make what it sells, so the plan makes 25 in the first period, carries 10 units forward, and makes 30, 30 and 25 after that, at a cost of 835. The first inventory variable is 10, and it is the only thing in the model that could have made the second period feasible at all.

The aggregate row, and the plan it prefers

The tempting simplification is one row instead of four: total production at least total demand. With 110 units demanded and 5 in the store that is P₁ + P₂ + P₃ + P₄ ≥ 105, and the inventory variables disappear along with the balance equations.

It solves, and it is cheaper: 675 against 775. The plan it prefers makes nothing at all in the first two periods and then 45 and 60 in the last two, because production is cheapest at the end and nothing in the model any longer says when a unit has to exist. Run that plan through the periods and 15 units of demand go unmet in the first period and 35 in the second: fifty units of demand unserved, by a plan the objective calls better.

This is the sharpest example on the course of a model being exactly wrong. Nothing is infeasible, no arithmetic is off, and the reported cost is a real number about a plan nobody would run. The aggregate row is a true statement about the plan; it is simply a much weaker one than the four rows it replaced, and the cost cannot show what was lost.

The same weakening is available inside the balance rows themselves. Drop I₂ ≥ 0 and the second period's row is satisfied by I₂ = −35 with nothing made, which reads as thirty-five units promised and not delivered. If backorders are what the situation allows, that is a variable to introduce and price on purpose; if they are not, the sign restriction is the row that says so.

Interactive

Planning over periods, linked by one balance equation

Inventory is the variable that carries one period into the next

Planning over periods, linked by one balance equationInventory is the variable that carries one period into the next
made in the periodcarried into the nextdemand that went unmet

Method

Writing a plan over periods

The variables come in two families and the rows come one per period. Doing the first period separately is what keeps the opening stock honest.

1

Two variables per period, with units

Pₜ is units made in period t and Iₜ is units in the store at the end of it. A four-period plan therefore has eight decisions, not four, and the second family is the one that carries the link.

2

Write the balance equation for a middle period first

Pₜ + Iₜ₋₁ − Iₜ = Dₜ. Get the signs right where the pattern is plain: what was carried in is added, what is carried out is subtracted, and the demand is on the right with the data.

3

Then do the first period by hand

There is no I₀ variable: the opening stock is data, so the first row is P₁ − I₁ = D₁ − (opening stock). Copying the middle pattern into the first period is the error this step exists to prevent.

4

Solve, then read both paths and the store

Report Pₜ and Iₜ for every period, not just the total cost. A plan is a path through the horizon, and whether it ever holds stock is the thing the balance rows were written to decide.

Balance, inventory and aggregation

Score 0 / 0

The aggregate plan, run through the periods one at a time

The aggregate row's plan costs less than the balance plan. Running it forward period by period is what shows why the number is not the answer.

aggregate row P₁ + P₂ + P₃ + P₄ ≥ 105 cost 675 the plan it picks P = (0, 0, 45, 60) period opening made available demand sold short closing 1 5 0 5 20 5 15 0 2 0 0 0 35 0 35 0 3 0 45 45 30 30 0 15 4 15 60 75 25 25 0 50 demand unserved 15 + 35 = 50 units left in the store 50 units, made too late to sell balance rows P = (15, 35, 30, 25), I = (0, 0, 0, 0) cost 775 demand unserved 0

The aggregate plan satisfies its one row exactly — 105 units made — and misses fifty units of demand, then finishes with fifty units in the store. Both facts follow from the same thing: the row counts units over the whole horizon and says nothing about when they exist.

For a faded rehearsal, keep the balance rows and cut the capacity to 30 a period. The supplied first move is where the trouble must be: the second period demands 35 and can make at most 30, so its row can only be satisfied with stock carried in. Predict P₁ and I₁, then the rest of both paths and the cost, and check them against the lab — and say what happens to the model when the capacity goes to 20.

Common mistakes

1
Replacing the balance rows with one aggregate row“Total production at least total demand” sounds equivalent and is strictly weaker: it is satisfied by making everything in the last period, after every earlier demand has already gone unmet. Here it is 100 pounds cheaper and misses fifty units, and the objective cannot show either fact.
2
Copying the middle-period pattern into the first periodThe first row has no Iₜ₋₁ variable in it, because the opening stock is data. Writing P₁ + I₀ − I₁ = D₁ with I₀ as a variable hands the plan a free store to draw on, and the symptom is a first period that makes suspiciously little.
3
Treating the store as something that can go negativeWithout Iₜ ≥ 0, a balance equation is satisfied by unmet demand recorded as negative stock, and the plan that results looks cheap. Backorders may well be what the situation allows — then they get their own variable and their own cost, on purpose.

Check your understanding

✓
Finish when you write the middle period first and the first period by hand.

You should be able to declare two variables per period with units, write one balance equality per period with the opening stock handled separately, read the production and inventory paths off the solution, and say what an aggregate row would fail to say.

Note: That is the four families, and every row in them was linear as written or after one multiplication. The rest of the course is about requirements that are not: an absolute value, a largest-of-several cost, a price that changes at a break point, a variable allowed to go negative. One of the four is legal whichever way the objective is pushed and the other three are not, which is what “Reformulations That Keep Linearity” is about.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.