Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Lecture 10: Multi-Period Inventory Planning

Open In Colab

This notebook covers multi-period inventory planning: deciding how much to order in each period so that all demand is met at the lowest total order and holding cost. It is our first multi-period model, in which a decision in one period affects all later periods, and it needs a new kind of variable, the state variable tracked over time. Like the applications of Lecture 9, the problem is introduced in the same steps: a practical motivation, the generic model built up with the four modeling steps, the model for a concrete example, its solution in pulp, and possible extensions.

Learning outcomes

On completion of this notebook, you will be able to:

  • formulate a multi-period inventory planning problem as an LO model;

  • use state variables and balance constraints to link consecutive periods;

  • extend the model with capacities, several products and fixed order costs.

Multi-Period Inventory Planning

Practical Motivation

A shop sells a product whose demand varies from week to week, and the purchase price varies as well (because of supplier promotions, or seasonal prices). Ordering a lot when the price is low saves money, but products that sit in stock cost money too: storage space, capital, insurance. When should the shop order, and how much, to meet all demand at the lowest total cost? This is an example of a multi-period model: a model in which the state of a system (here, the stock) is tracked over time, and a decision in one period affects all later periods.

Modeling

Problem Definition and Example

We hold a single product and plan for periods t=1,…,Tt = 1, \dots, T (the time horizon). At the start we have s0s_0 units in stock. For every period tt we know the demand dtd_t, the order cost ctc_t per unit ordered in period tt, and the holding cost hth_t per unit left in stock at the end of period tt. An order arrives immediately. The problem is to decide how much to order in each period, such that all demand is met from stock (no backorders) at minimal total order and holding cost. The parameters dtd_t, ctc_t and hth_t typically come from a forecast (predictive analytics).

As an example, take T=4T = 4 periods with an initial stock of s0=6s_0 = 6 and

period tt1234
demand dtd_t7958
order cost ctc_t811710
holding cost hth_t1111

Decision Variables

The decisions are the order quantities

xt=number of units ordered in period t,t=1,…,T.x_t = \text{number of units ordered in period } t, \quad t = 1, \dots, T.

We also introduce the stock at the end of each period as a decision variable,

st=number of units in stock at the end of period t,t=1,…,T.s_t = \text{number of units in stock at the end of period } t, \quad t = 1, \dots, T.

Strictly speaking, sts_t is not a free choice: once the orders are fixed, the stock follows from them. We could substitute st=s0+∑k≤t(xk−dk)s_t = s_0 + \sum_{k \le t} (x_k - d_k) everywhere, but that makes every constraint and the objective much longer. A variable like sts_t, which describes the state of the system in a period, is called a state variable; it keeps a multi-period model short and readable.

Objective

In period tt we pay ctxtc_t x_t for ordering and htsth_t s_t for holding stock, so the total cost is

∑t=1T(ctxt+htst).\sum_{t=1}^{T} (c_t x_t + h_t s_t).

Constraints

The stock at the end of period tt is the stock at the end of the previous period, plus what is ordered for period tt (assuming it arrives at start of that period), minus what is sold during that period:

st=st−1+xt−dt,t=1,…,T.s_t = s_{t-1} + x_t - d_t, \quad t = 1, \dots, T.

This balance constraint links each period to the previous one; for t=1t = 1, s0s_0 is the given initial stock. Orders cannot be negative, xt≥0x_t \ge 0. The requirement st≥0s_t \ge 0 is what forbids backorders: if demand in period tt were not met from stock, the balance constraint would give a negative sts_t.

Complete LO Model

min⁡∑t=1T(ctxt+htst)s.t.st=st−1+xt−dt,t=1,…,Txt,st≥0,t=1,…,T.\begin{aligned} \min \quad & \sum_{t=1}^{T} (c_t x_t + h_t s_t) \\ \text{s.t.} \quad & s_t = s_{t-1} + x_t - d_t, \quad t = 1, \dots, T \\ & x_t, s_t \ge 0, \quad t = 1, \dots, T. \end{aligned}

Modeling the Example

min⁡8x1+11x2+7x3+10x4+s1+s2+s3+s4s.t.s1=6+x1−7s2=s1+x2−9s3=s2+x3−5s4=s3+x4−8x1,x2,x3,x4,s1,s2,s3,s4≥0.\begin{aligned} \min \quad & 8x_1 + 11x_2 + 7x_3 + 10x_4 + s_1 + s_2 + s_3 + s_4 \\ \text{s.t.} \quad & s_1 = 6 + x_1 - 7 \\ & s_2 = s_1 + x_2 - 9 \\ & s_3 = s_2 + x_3 - 5 \\ & s_4 = s_3 + x_4 - 8 \\ & x_1, x_2, x_3, x_4, s_1, s_2, s_3, s_4 \ge 0. \end{aligned}

Solving the Example in pulp

The balance constraints are equalities, written with == in pulp. Python lists start at index 0, so period tt is t + 1 in the variable names, and the first period uses the initial stock s0 in place of the previous period’s stock variable.

status: Optimal
orders: [10.0, 0.0, 13.0, 0.0]
end-of-period stock: [9.0, 0.0, 8.0, 0.0]
total cost: 188.0

The optimal plan orders only in the two cheap periods, 1 and 3. Ordering period 2’s demand in period 1 costs 8+1=98 + 1 = 9 per unit (order plus one period of holding), which is less than the 11 of ordering it in period 2; period 4’s demand is ordered in period 3 for the same reason.

Extensions

Capacities

A storage capacity SS limits the stock, st≤Ss_t \le S, and if the product is made rather than bought, a production capacity PtP_t limits the amount made in period tt, xt≤Ptx_t \le P_t. Both are one extra constraint per period, without a new modeling trick.

Several Products

With several products, every variable and parameter gets a product index, and each product has its own balance constraints. Constraints for resources that the products share, such as storage space, link the products together.

Fixed Order Costs

Fixed order costs, which are paid in every period in which something is ordered, do need a new trick:

References

  • Koole, G. (2019). An Introduction to Business Analytics. §6.3 (multi-period). Spreadsheet material replaced with pulp.