Inventory Optimization
IISc SL 225, Lecture 15 · “Restock”

How much to order, and when

Lecture 15, one idea at a time: the costs of holding stock, the economic order quantity, Wagner–Whitin lot sizing as a shortest path, the newsvendor under uncertain demand, and (s, S) policies.

A companion to Lecture 15 of SL 225 Logistics and Freight Modelling at IISc.

Prerequisites: derivatives, and the linear and integer programming of the earlier lectures. Probability is introduced where Part 4 needs it. Underlined words show a definition when you hover or tap them; the Glossary · Check button on the right opens every term and a few questions on the chapter you are reading.

The route

    Before any formula: what inventory is, why every business keeps some, and the three costs that every inventory model trades against each other. A single running example, a campus stationery shop, carries through Parts 1 and 2.

    You need: nothing beyond arithmetic.

    Why hold stock at all

    Inventory is stock bought before it is needed, and it exists because buying exactly what is needed, exactly when it is needed, is either impossible or too expensive.

    Every model in this course answers one of two questions about it: how much to order at a time, and when to order.

    Your kitchen at home: you buy a 5 kg bag of rice once a month instead of 170 g every day, because each trip to the shop costs you time.

    Meet the Banyan Store, a stationery shop on a university campus. It sells about 200 notebooks a month, steadily, all year: 2400 notebooks per year. The notebooks come from a wholesaler in the city, by van.

    The shop could ask the van to bring 7 notebooks every day. It does not, because every delivery has a cost of its own: the van trip, the paperwork, someone at the counter to check and shelve the boxes. So the shop orders a bigger batch less often, and the notebooks sit on the shelf until students buy them. That shelf of notebooks is the shop's inventory.

    Four reasons to hold stock

    • Batching. Each order carries a fixed cost, so it pays to order many units at once. The stock that results is used up between orders; it is called cycle stock. This is the reason behind the EOQ (Part 2) and Wagner–Whitin (Part 3).
    • Uncertainty. Demand next week is not known exactly. Extra units kept against a surprise are safety stock. This is the world of the newsvendor (Part 4) and Part 5.
    • Seasons. A factory with limited capacity builds stock before a festival rush that it could not produce in the rush itself.
    • Lead time. Orders take time to arrive, so goods already ordered but still on the road are stock too.

    A bakery keeps 30 extra loaves every morning because it never knows whether a school will place a bulk order. Which reason for stock is this?

    Batching
    Batching is about a fixed cost per order. Here the loaves are kept because of something the bakery cannot predict.
    Uncertainty (safety stock)
    Yes. The extra loaves protect against demand that might come in higher than usual.
    Seasons
    Nothing here is about a predictable peak. Think about why the number 30 is "extra".

    The picture every model starts from

    Take the simplest possible world: demand is constant and known, an order arrives the moment it is placed, and the shop never runs out. Suppose the shop orders $Q = 400$ notebooks at a time. On delivery day the shelf jumps to 400. Students take 200 a month, so the shelf falls in a straight line and is empty after 2 months. At that instant the next 400 arrive, and the pattern repeats.

    Drawn over time, the stock level looks like the teeth of a saw: the sawtooth pattern. Three numbers describe it:

    Notation for Parts 1 and 2
    $D$
    demand rate: units per unit time (Banyan Store: 2400 notebooks per year, or 200 per month)
    $Q$
    order quantity: units in each delivery
    $T$
    cycle length: time between deliveries, $T = Q/D$

    Because the stock falls in a straight line from $Q$ to $0$, its average level over a cycle is halfway: the average inventory is $Q/2$. With $Q=400$ the shelf holds 200 notebooks on average. The shop places $D/Q = 2400/400 = 6$ orders a year.

    Try it

    Drag the slider to change the order quantity. Watch three things move together: the height of each tooth ($Q$), how many teeth fit in a year ($D/Q$ orders), and the dashed line of average stock ($Q/2$).

    The Banyan Store doubles its order size from 400 to 800 notebooks. What happens to the average number of notebooks on the shelf?

    It stays at 200, because demand did not change
    Demand sets how fast the shelf empties, not how full it starts. Look at the dashed line in the widget.
    It doubles to 400
    Right. Average stock is $Q/2$, so it moves in step with $Q$.
    It halves to 100
    Fewer orders, but each one is larger. Is the shelf fuller or emptier on average?

    The Banyan Store orders $Q=300$ notebooks at a time ($D = 2400$ per year, 52 weeks in a year). How many orders does it place per year, how long does each batch last, and how many notebooks are on the shelf on average?

    1. Orders per year: $D/Q = 2400/300 = 8$.

      Each order brings 300 and the year needs 2400, so it takes 8 deliveries to cover the year.

    2. Cycle length: $T = Q/D = 300/2400 = 1/8$ year, which is $52/8 = 6.5$ weeks.

      300 notebooks at 2400 per year last one eighth of a year.

    3. Average inventory: $Q/2 = 150$ notebooks.

      The stock falls in a straight line from 300 to 0, so its time average is the midpoint.

    A pharmacy sells 1200 boxes of a vitamin per year at a steady rate and orders 200 boxes at a time. How many orders does it place per year?

    Each order covers $Q$ boxes; the year needs $D$.

    $D/Q = 1200/200 = 6$ orders per year.

    Same pharmacy ($D=1200$ per year, $Q=200$). How many months does each batch last?

    $T = Q/D$ in years; then convert to months.

    $T = 200/1200 = 1/6$ year $= 12/6 = 2$ months.

    Same pharmacy. What is its average inventory, in boxes?

    The sawtooth falls in a straight line from $Q$ to 0.

    $Q/2 = 200/2 = 100$ boxes.

    In the sawtooth picture, what does the slope of each falling edge represent?

    The order quantity $Q$
    $Q$ is the height of the jump, not the slope of the fall.
    The demand rate $D$ (with a minus sign)
    Right. Stock falls by $D$ units per unit time, so each edge has slope $-D$.
    The cycle length $T$
    $T$ is the width of each tooth. The slope is a rate: units per unit time.

    Which of these holds in the basic sawtooth model?

    $T = D/Q$
    Check the units: $D/Q$ is (units per year) per unit, which is "per year". A cycle length should be in years.
    $T = Q \cdot D$
    A bigger demand rate should make a batch run out sooner, not later.
    $T = Q/D$
    Right. $Q$ units at $D$ units per unit time last $Q/D$.

    A shop orders twice as often but keeps the same yearly demand. What happens to its average inventory?

    It halves
    Right. Twice as many orders means each is half as big, and average stock is $Q/2$.
    It doubles
    More frequent orders mean each order is smaller.
    It does not change
    The yearly total is fixed, but the size of each batch is not.
    • Fix the time unit first (year, month, week) and express $D$ and every cost in that unit.
    • Read $Q/2$ as "the average shelf", and $D/Q$ as "how many deliveries".
    • Treating all stock as waste. Cycle stock exists because orders have a fixed cost, and safety stock because demand is uncertain; both can be worth paying for.
    • Mixing a yearly demand with a monthly cycle length.
    1. Stock exists for batching, uncertainty, seasons and lead time.
    2. Under constant demand the stock follows a sawtooth: height $Q$, slope $-D$, cycle length $T=Q/D$.
    3. Average inventory is $Q/2$; the number of orders per unit time is $D/Q$.

    Stock that exists because each order has a fixed cost is called…

    cycle stock
    Yes: it is used up during each cycle between orders.
    safety stock
    Safety stock protects against uncertainty.
    pipeline stock
    That is stock in transit.

    $D = 600$ per year and $Q = 150$. Orders per year?

    150
    That is $Q$ itself.
    4
    $600/150 = 4$.
    75
    That is $Q/2$, the average stock.

    Same numbers ($D = 600$ per year, $Q = 150$). Average stock?

    75
    $Q/2 = 75$.
    150
    That is the peak, reached only on delivery day.
    300
    Average stock does not depend on $D$ here.

    The three costs that pull against each other

    Every inventory decision balances a cost for placing orders against a cost for keeping stock, with a third cost lurking for running out.

    Once you can price each of them, "how much should we order?" stops being a matter of taste and becomes arithmetic.

    Shopping for groceries once a year would save trips but fill your flat with food that spoils; shopping every hour would keep the fridge empty but eat your whole day.

    1. The ordering cost $K$: paid per order

    Each time the Banyan Store orders, it pays for the van trip, the paperwork and an hour of staff time to receive the boxes: about ₹300, whether the order is for 50 notebooks or 2000. A cost paid once per order, independent of its size, is a fixed cost or ordering cost. In a factory the same role is played by the set-up cost of a production run.

    If the shop orders $Q$ at a time, it places $D/Q$ orders per year, so

    $$\text{ordering cost per year} = K\cdot\frac{D}{Q}.$$

    2. The holding cost $H$: paid per unit, per unit of time

    A notebook costs the shop $C=$ ₹40. While it sits on the shelf, that ₹40 is tied up instead of earning interest elsewhere; it also takes space, needs insurance, and may get damaged or go out of fashion. Shops usually express all of this as a percentage of the unit cost per year. At 10% per year, holding one notebook for a year costs

    $$H = 0.10 \times 40 = 4 \text{ rupees per notebook per year}.$$

    This is the holding cost. On average $Q/2$ notebooks sit on the shelf, so

    $$\text{holding cost per year} = H\cdot\frac{Q}{2}.$$

    Which change makes the holding cost per notebook larger?

    The van company raises its delivery fee
    The delivery fee is paid per order. It changes $K$, not $H$.
    Interest rates rise from 10% to 15% a year
    Right. Money tied up in stock now costs more, so $H$ rises from ₹4 to ₹6.
    The shop sells more notebooks per year
    That changes the demand rate $D$, not the cost of keeping one notebook for a year.

    3. The shortage cost: paid when you run out

    If a student asks for a notebook and the shelf is empty, two things can happen. The student may wait and be served when the next delivery comes (a backorder), which costs goodwill and perhaps a discount. Or the student may leave and buy elsewhere (a lost sale), and the shop loses the profit on that notebook. Either way, the price of being short is a shortage cost.

    In the EOQ of Part 2 demand is known exactly, so a sensible plan never runs out and this cost plays no role. It becomes central in Part 4, when demand is uncertain.

    And the unit cost $C$?

    The shop also pays ₹40 per notebook: $C\cdot D = 40 \times 2400 = 96{,}000$ rupees per year. As long as the price per notebook does not depend on the order size, this amount is the same for every $Q$, so it cannot change which $Q$ is best. Models keep it in the formula when it is convenient and drop it when it is not. (Quantity discounts, where the price does depend on $Q$, are in Part 5.)

    Large orders mean few deliveries (low ordering cost) but a full shelf (high holding cost). Small orders mean an emptier shelf (low holding cost) but many deliveries (high ordering cost). The yearly cost to minimise is

    $$\underbrace{K\frac{D}{Q}}_{\text{ordering}} + \underbrace{H\frac{Q}{2}}_{\text{holding}}.$$
    Order size $Q$Orders per yearOrdering ₹/yrAverage stockHolding ₹/yrTotal ₹/yr
    2001236001004004000
    400618002008002600
    6004120030012002400
    800390040016002500
    1200260060024003000
    Try it

    Move $Q$ and watch the two bars. Find the order size where the total is smallest, and look at the two bars when you are there.

    In the table, the cheapest order size was $Q=600$. Look at its ordering and holding columns. What do you notice?

    Holding is about twice the ordering cost
    Compare the two columns in the $Q=600$ row.
    The two costs are equal (₹1200 each)
    That is not a coincidence for this kind of cost curve, as Part 2 shows.
    Ordering cost is zero
    Every row places at least two orders a year.

    At the best order size, the yearly ordering cost and the yearly holding cost are equal. Part 2 proves that this always happens for the cost $KD/Q + HQ/2$, and turns it into a formula for the best $Q$.

    Compute the Banyan Store's yearly ordering-plus-holding cost if it orders $Q=400$ notebooks at a time ($D=2400$ per year, $K=$ ₹300, $H=$ ₹4 per notebook per year).

    1. Orders per year: $D/Q = 2400/400 = 6$, so ordering costs $6 \times 300 = ₹1800$.

      Each order costs $K$ regardless of its size.

    2. Average stock: $Q/2 = 200$ notebooks, so holding costs $200 \times 4 = ₹800$.

      On average 200 notebooks sit on the shelf all year, each costing ₹4 per year.

    3. Total: $1800 + 800 = ₹2600$ per year.

      Ordering is three times holding here, so orders are too small: the shop pays for too many trips.

    Banyan Store again ($D=2400$, $K=300$, $H=4$). What is the yearly ordering-plus-holding cost if it orders $Q=800$ at a time?

    Orders per year $D/Q$, average stock $Q/2$.

    Ordering: $3 \times 300 = 900$. Holding: $400 \times 4 = 1600$. Total ₹2500.

    Same shop, $Q = 200$. Yearly ordering-plus-holding cost?

    Twelve orders a year.

    Ordering $12\times300=3600$; holding $100\times4=400$; total ₹4000. Small orders make ordering dominate.

    If the shop's yearly holding rate rose from 10% to 15% of the ₹40 unit cost, what would $H$ be?

    $H$ = rate × unit cost.

    $0.15 \times 40 = ₹6$ per notebook per year.

    The van company starts charging ₹500 per delivery instead of ₹300. Which parameter changed?

    Is the new charge paid per delivery or per notebook?

    It is paid once per delivery whatever the size, so it is the ordering cost $K$.

    Why can the yearly purchase cost $C\cdot D$ be left out when choosing $Q$ in the basic model?

    Because it is small compared with the other costs
    ₹96,000 is far bigger than ₹2400. Size is not the reason.
    Because it is the same for every $Q$
    Right. A constant added to every option cannot change which option is cheapest.
    Because purchases are not a real cost
    They are very real, but they do not depend on the decision.

    As $Q$ grows, the yearly ordering cost $KD/Q$…

    grows in proportion to $Q$
    More notebooks per order means fewer orders.
    falls, like $1/Q$
    Right. Doubling $Q$ halves the number of orders.
    stays the same
    The cost per order is fixed, but the number of orders is not.

    A customer finds the shelf empty, leaves, and buys from a competitor. This is…

    a backorder
    A backorder waits to be served later.
    a holding cost
    Holding costs come from having stock, not from lacking it.
    a lost sale
    Right. The demand is gone, and so is its profit.
    • Ask of every cost: is it paid per order, per unit, or per unit per unit time? That decides where it goes in the formula.
    • Express $H$ in the same time unit as $D$.
    • Using the unit price $C$ as the holding cost. $H$ is a cost per unit per unit time, often a percentage of $C$.
    • Charging holding cost on the peak stock $Q$ instead of the average $Q/2$.
    1. Ordering cost $K$ is paid per order; yearly it is $KD/Q$.
    2. Holding cost $H$ is paid per unit per unit time; yearly it is $HQ/2$.
    3. The best $Q$ balances the two; the unit cost $C$ does not affect it when the price is fixed.

    Rent for the stockroom, charged per square metre of stock stored, belongs to…

    the holding cost
    It grows with how much is stored and for how long.
    the ordering cost
    It is not paid per order.
    the shortage cost
    It is paid for having stock, not lacking it.

    $K = 100$, $D = 1000$, $Q = 250$. Yearly ordering cost?

    ₹100
    That is one order. How many are placed per year?
    ₹400
    $1000/250 = 4$ orders × ₹100.
    ₹25,000
    That multiplies $K$ by $Q$.

    When ordering cost per year is larger than holding cost per year, the order size is probably…

    too small
    Too many orders: increase $Q$ to order less often.
    too large
    Large orders make holding dominate.
    optimal
    At the optimum the two are equal.

    A warehouse receives 900 units every 3 months and demand is steady. What is its yearly demand rate?

    900 per year
    900 arrive four times a year.
    3600 per year
    Right. Each 900 lasts 3 months, so 4 deliveries a year: $4\times900$.
    300 per year
    300 is the monthly rate.

    Same warehouse, $K =$ ₹500 per order and $H=$ ₹2 per unit per year. Yearly ordering plus holding cost?

    ₹2000
    That is the ordering part only.
    ₹3800
    That charges holding on the peak, 900, instead of the average 450.
    ₹2900
    Right. $4\times500 = 2000$ plus $450\times2=900$.

    In that warehouse, ordering costs ₹2000 a year and holding ₹900. To lower the total, it should…

    order larger batches, less often
    Right. Ordering dominates, so fewer orders help until the two balance.
    order smaller batches, more often
    That would raise the larger of the two costs.
    keep its order size
    The two costs are far from balanced.

    Which stock exists mainly because demand is uncertain?

    Cycle stock
    Cycle stock comes from ordering in batches.
    Safety stock
    Right.
    Seasonal stock
    Seasonal stock covers a peak you can predict.

    The first model of Lecture 15: constant, known demand, a fixed cost per order and a holding cost. From the sawtooth we build the yearly cost as a function of $Q$, minimise it with one derivative, and then solve the lecture's finite-horizon version, where a season of fixed length has to be covered.

    You need: Part 1 (the sawtooth and the three costs) and the derivative of $1/Q$.

    From one cycle to a cost per year

    Under constant demand every cycle is a copy of the first, so we can price one cycle exactly and then turn it into a cost per unit of time.

    The per-time version is the one to minimise; minimising the cost of a single cycle gives a misleading answer, and seeing why is half of understanding the EOQ.

    A monthly phone plan and a daily plan cannot be compared by their price tags; you divide each by the days it covers first.

    The lecture states the assumptions of the economic order quantity (EOQ) model:

    • time is continuous and the horizon is infinite (the business runs forever);
    • demand arrives at a constant rate $D$, known in advance;
    • each order costs $K$ and arrives instantly (zero lead time), so it is placed exactly when stock hits zero;
    • holding one unit for one unit of time costs $H$; inventory starts at zero.

    Because demand is uniform, the best policy repeats itself: the same $Q$ every time, a new order every $T = Q/D$. So deciding $Q$ fixes $T$, and the reverse.

    Step 1: the holding cost of one cycle is an area

    During a cycle that starts at time 0, the stock at time $t$ is $Q - Dt$. Holding costs $H$ per unit per unit time, so over a short moment $dt$ we pay $H(Q-Dt)\,dt$. Adding up over the cycle:

    $$\int_0^T H(Q - Dt)\,dt = HQT - \tfrac12 HDT^2.$$

    This is $H$ times the area of the triangle under one tooth: base $T$, height $Q$, area $\tfrac12 QT$. Substituting $T = Q/D$:

    $$\text{holding per cycle} = HQ\frac{Q}{D} - \frac12 HD\frac{Q^2}{D^2} = \frac{HQ^2}{2D}.$$

    Adding the one order, the cost of one cycle is $\;K + \dfrac{HQ^2}{2D}.$

    With $Q=400$, $D=2400$ per year and $H=$ ₹4 per notebook-year, the triangle under one tooth has base $T = 1/6$ year and height 400. What is the holding cost of that cycle?

    ₹1600
    That would be holding the peak, 400, for a whole year. The cycle lasts one sixth of a year and the stock falls to zero.
    ₹133.33
    Right. Area $\tfrac12 \cdot \tfrac16 \cdot 400 = 33.33$ notebook-years, times ₹4. Also $HQ^2/(2D) = 4\cdot160000/4800$.
    ₹800
    ₹800 is the holding cost for the whole year (six cycles).

    Step 2: why not minimise the cost of one cycle?

    The cycle cost $K + HQ^2/(2D)$ is smallest when $Q$ is as small as possible. But a tiny $Q$ makes cycles tiny too, and then there are very many of them: you pay $K$ over and over. The lecture asks exactly this ("optimizing this makes less sense, why?"). Cycles of different lengths are not comparable; costs per unit of time are.

    Step 3: divide by the cycle length

    Dividing the cycle cost by $T = Q/D$ gives the average cost per unit time:

    $$z(Q) = \frac{K + \frac{HQ^2}{2D}}{Q/D} = \underbrace{\frac{H}{2}Q}_{\text{holding}} + \underbrace{\frac{KD}{Q}}_{\text{ordering}}.$$

    These are the two yearly costs of Part 1, now derived from the cycle.

    Try it

    Move $Q$. The orange curve is the cost of one cycle; the blue curve is the cost per year. Notice that the orange curve keeps falling as $Q$ shrinks, while the blue one has a clear bottom.

    Check that the two routes agree for the Banyan Store with $Q=400$ ($D=2400$, $K=300$, $H=4$): price one cycle, then convert to a year.

    1. Cycle cost: $K + HQ^2/(2D) = 300 + 133.33 = ₹433.33$.

      One order plus the triangle's holding cost from the quick check above.

    2. Cycles per year: $1/T = D/Q = 6$.

      Each cycle lasts one sixth of a year.

    3. Per year: $6 \times 433.33 = ₹2600$, and $z(400) = 2\cdot400 + 300\cdot2400/400 = 800 + 1800 = ₹2600$.

      Both routes give the same number, matching the table in Part 1.

    Banyan Store, $Q = 800$. How long is one cycle, in years?

    $T = Q/D$.

    $T = 800/2400 = 1/3$ year (4 months).

    With $Q=800$, what is the holding cost of one cycle?

    $HQ^2/(2D)$, or $H$ times the triangle's area $\tfrac12 \cdot T \cdot Q$.

    $4 \cdot 800^2/(2\cdot 2400) = 2{,}560{,}000/4800 = 533.33$. Check: $\tfrac12\cdot\tfrac13\cdot800 = 133.33$ notebook-years, times 4.

    With $Q=800$, what is $z(Q)$, the average cost per year?

    Either $(K + \text{holding per cycle})/T$ or $HQ/2 + KD/Q$.

    $(300 + 533.33)\times 3 = 2500$, or $4\cdot400 + 300\cdot3 = 1600 + 900 = 2500$.

    Why is the cost of a single cycle the wrong thing to minimise?

    Because cycles have no holding cost
    Each cycle has a triangle of holding cost.
    Because smaller $Q$ gives cheaper but more frequent cycles; only cost per unit time compares them fairly
    Right. Minimising the cycle cost pushes $Q$ to zero and pays $K$ endlessly.
    Because the cycle cost does not depend on $Q$
    It does: $K + HQ^2/(2D)$.

    The integral $\int_0^T H(Q-Dt)\,dt$ equals $H$ times…

    the peak stock $Q$
    Holding cost depends on how long stock is held too.
    the rectangle $QT$
    The stock does not stay at $Q$; it falls to zero.
    the triangle under one tooth, $\tfrac12 QT$
    Right: unit-time of stock held during the cycle.

    In $z(Q) = \tfrac{H}{2}Q + \tfrac{KD}{Q}$, the term $KD/Q$ is…

    the ordering cost per unit time
    Right: $D/Q$ orders per unit time, each costing $K$.
    the holding cost per unit time
    Holding grows with $Q$; this term shrinks.
    the purchase cost per unit time
    The purchase cost $CD$ is left out because it does not depend on $Q$.
    • Draw the sawtooth first; the holding cost of a cycle is $H$ times the area under one tooth.
    • Compare plans by cost per unit time whenever their cycles differ in length.
    • Minimising the cost of one cycle instead of the cost per unit time.
    • Forgetting to substitute $T = Q/D$ and ending with a formula in two variables.
    1. Holding cost of one cycle $= H \times$ triangle area $= HQ^2/(2D)$.
    2. Cost per unit time $z(Q) = HQ/2 + KD/Q$, obtained by dividing the cycle cost by $T=Q/D$.
    3. Only cost per unit time is a fair basis for choosing $Q$.

    Which is the cost of one cycle?

    $K + HQ^2/(2D)$
    One order plus the triangle.
    $HQ/2 + KD/Q$
    That is per unit time.
    $KQ + HD$
    Units do not match.

    To get $z(Q)$ from the cycle cost you…

    multiply by $T$
    That gives cost × time.
    divide by $T = Q/D$
    Cost per cycle ÷ time per cycle.
    divide by $Q$
    That gives cost per unit, not per unit time.

    The cycle cost alone is minimised at…

    $Q \to 0$
    Which is why it is the wrong objective.
    $Q = \sqrt{2KD/H}$
    That minimises cost per unit time.
    $Q = D$
    No special role.

    The square-root formula, and why it forgives mistakes

    Setting the derivative of $z(Q)$ to zero gives the most famous formula in inventory theory, $Q^* = \sqrt{2KD/H}$.

    It tells you the best order size, the cost at that size, and, through its flat bottom, how much a rough estimate of the inputs will cost you.

    Like the speed at which a car uses the least fuel per kilometre: drive a bit faster or slower and you barely notice the difference.

    Minimise $z(Q)$ with one derivative

    The holding term $\tfrac H2 Q$ grows in a straight line; the ordering term $KD/Q$ falls like a hyperbola. Their sum is a bowl. Differentiate:

    $$z'(Q) = \frac{H}{2} - \frac{KD}{Q^2} = 0 \quad\Longrightarrow\quad Q^2 = \frac{2KD}{H}.$$

    The second derivative $z''(Q) = 2KD/Q^3$ is positive for every $Q>0$, so $z$ is convex and this stationary point is the global minimum.

    $$Q^* = \sqrt{\frac{2KD}{H}}, \qquad z(Q^*) = \sqrt{2HKD}, \qquad T^* = \frac{Q^*}{D}.$$

    At $Q^*$ the yearly holding cost and the yearly ordering cost are equal, each $\sqrt{HKD/2}$.

    Why equal? At $Q^*$, $z'(Q^*)=0$ says $\tfrac H2 = KD/Q^{*2}$; multiply both sides by $Q^*$ and you get $\tfrac H2 Q^* = KD/Q^*$: holding equals ordering. Each is half of the total, which is how $z^* = 2\sqrt{HKD/2} = \sqrt{2HKD}$ comes out.

    Banyan Store: $Q^* = \sqrt{2\cdot300\cdot2400/4} = \sqrt{360{,}000} = 600$ notebooks, $z^* = \sqrt{2\cdot4\cdot300\cdot2400} = 2400$ rupees a year, 4 orders a year, one every 3 months. Holding: $4\cdot300 = 1200$; ordering: $4 \cdot 300 = 1200$.

    Yearly demand quadruples, from 2400 to 9600 notebooks. What happens to $Q^*$?

    It quadruples to 2400
    $D$ sits under a square root.
    It doubles to 1200
    Right. $Q^* \propto \sqrt D$, and $\sqrt 4 = 2$. Orders become twice as frequent too: $9600/1200 = 8$ a year.
    It stays at 600
    More demand does change the balance between ordering and holding.
    Try it

    Drag the dot along the total-cost curve, or change $K$, $H$ and $D$. Watch the readout: the percentage above the minimum stays small even when $Q$ is far from $Q^*$.

    The flat bottom: how much does a wrong $Q$ cost?

    Divide $z(Q)$ by $z^*$. Using $\tfrac H2 = KD/Q^{*2}$, a few lines of algebra give a clean ratio that depends only on how far $Q$ is from $Q^*$:

    $$\frac{z(Q)}{z(Q^*)} = \frac12\left(\frac{Q}{Q^*} + \frac{Q^*}{Q}\right).$$

    Ordering 400 instead of 600 ($Q/Q^* = 2/3$): $\tfrac12(0.667 + 1.5) = 1.083$, only 8.3% above the minimum. Ordering double the best quantity, or half of it, costs 25% more. And because of the square root, a 50% error in estimating $K$ moves $Q^*$ by only about 22%. Practitioners rely on this: rough estimates of $K$ and $H$ are good enough.

    A hospital store uses 900 boxes of gloves a year. Each order costs ₹50 to place and holding a box costs ₹1 per year. Find $Q^*$, the yearly cost, and the cost if the store orders 600 at a time.

    1. $Q^* = \sqrt{2\cdot 50\cdot 900/1} = \sqrt{90{,}000} = 300$ boxes.

      Plug into $\sqrt{2KD/H}$, with all quantities in years.

    2. $z^* = \sqrt{2\cdot1\cdot50\cdot900} = 300$ rupees a year (holding 150, ordering 150).

      At the optimum the two parts are equal halves of the total.

    3. With $Q = 600 = 2Q^*$: ratio $\tfrac12(2 + \tfrac12) = 1.25$, so ₹375 a year. Directly: $\tfrac12\cdot600 + 50\cdot900/600 = 300 + 75 = 375$.

      Doubling the order size costs a quarter more, not double.

    $D=900$ per year, $K=$ ₹50, $H=$ ₹1 per unit-year. Enter $Q^*$ and $z^*$.

    $Q^* = \sqrt{2KD/H}$ and $z^* = \sqrt{2HKD}$.

    $Q^* = \sqrt{90000} = 300$; $z^* = \sqrt{90000} = 300$. (Here $H=1$, so the two square roots coincide.)

    Any EOQ setting: you order twice the optimal quantity. By what factor does the cost per unit time exceed the minimum?

    Use $\tfrac12(Q/Q^* + Q^*/Q)$ with $Q/Q^*=2$.

    $\tfrac12(2 + 0.5) = 1.25$: 25% more.

    The holding cost $H$ doubles; nothing else changes. By what factor is $Q^*$ multiplied?

    $H$ is in the denominator under the square root.

    $Q^* \propto 1/\sqrt H$, so the factor is $1/\sqrt2 \approx 0.7071$. Dearer storage means smaller, more frequent orders.

    Banyan Store ($D=2400$, $K=300$, $H=4$) finds that each delivery really costs ₹1200, four times the estimate. What is the new $Q^*$?

    $Q^* \propto \sqrt K$.

    $\sqrt{2\cdot1200\cdot2400/4} = \sqrt{1{,}440{,}000} = 1200$: twice the old 600.

    At the EOQ, which statement is always true?

    Holding cost is twice the ordering cost
    Set $z'(Q^*)=0$ and multiply by $Q^*$.
    Holding cost per year equals ordering cost per year
    Right: $\tfrac H2 Q^* = KD/Q^*$.
    The order quantity equals yearly demand
    That is one specific $Q$ with no special property.

    You use $Q = 0.5\,Q^*$. The cost is…

    double the minimum
    The cost curve is flat near its bottom.
    exactly the minimum
    Only $Q^*$ gives the minimum.
    25% above the minimum
    Right. $\tfrac12(0.5 + 2) = 1.25$, the same as for $2Q^*$.

    Why is $Q^* = \sqrt{2KD/H}$ a global minimum and not a maximum?

    $z''(Q) = 2KD/Q^3 > 0$, so $z$ is convex for $Q>0$
    Right. A convex function's stationary point is its global minimum.
    Because square roots are always minima
    The square root is the solution of the equation, not the reason it is a minimum.
    Because $z(0) = 0$
    $z(Q) \to \infty$ as $Q \to 0$, because of the ordering term.

    Demand doubles. The minimum yearly cost $z^*$…

    doubles
    $z^* = \sqrt{2HKD}$.
    grows by a factor $\sqrt2 \approx 1.41$
    Right. Twice the business, only 41% more inventory cost: an economy of scale.
    stays the same
    $D$ appears in $z^*$.
    • Check units: $D$ and $H$ must use the same time unit, or $Q^*$ comes out wrong.
    • Round $Q^*$ to a convenient pack size without worry: the flat bottom makes it cheap.
    • Writing $\sqrt{2KD}/H$ (the $H$ belongs under the root).
    • Thinking twice the demand needs twice the order size; it needs $\sqrt2$ times.
    1. $Q^* = \sqrt{2KD/H}$ and $z^* = \sqrt{2HKD}$; at $Q^*$ holding equals ordering.
    2. $z(Q)/z^* = \tfrac12(Q/Q^* + Q^*/Q)$: errors in $Q$ cost little.
    3. $Q^*$ grows like $\sqrt D$ and $\sqrt K$ and shrinks like $1/\sqrt H$.

    $K=200$, $D=400$, $H=4$. $Q^*$?

    100
    $2\cdot200\cdot400/4 = 40{,}000$; take its square root.
    200
    $\sqrt{40{,}000} = 200$.
    400
    That is $D$.

    If you order $1.5Q^*$, the cost is about…

    8% above the minimum
    $\tfrac12(1.5 + 0.667) = 1.083$.
    50% above
    The curve is much flatter than that.
    the same
    Only $Q^*$ is exactly optimal.

    Storage becomes cheaper. The optimal orders become…

    larger and less frequent
    Smaller $H$ → larger $Q^*$.
    smaller and more frequent
    That happens when $H$ rises.
    unchanged
    $H$ is in the formula.

    A season that ends: the finite-horizon EOQ

    When sales run only for a season of length $T$, we choose how many orders $n$ to place in it, and the best plan spaces them equally.

    This is the lecture's second EOQ model, and its answer is the EOQ again in disguise, plus one honest step the infinite model never needs: rounding $n$ to a whole number.

    Planning refuelling stops on a long drive: the number of stops is a whole number, and once you pick it, evenly spaced stops are the efficient choice.

    A shop sells festival lights for a 10-week season at a steady 200 boxes a week. Each order costs ₹500 and holding a box costs ₹2 a week. Nothing is sold after the season, and stock should be zero at the end. How many orders, and when?

    Set-up

    Suppose we place $n$ orders, and order $i$ covers an interval of length $T_i$, with $T_1 + \dots + T_n = T$. Order $i$ must bring $Q_i = DT_i$ units. Its holding cost is the triangle again, $\tfrac12 H D T_i^2$. The average cost per unit time over the season is

    $$\frac1T\left(nK + \sum_{i=1}^n \tfrac12 HD\,T_i^2\right).$$

    For a fixed $n$, only the sum of squares depends on the $T_i$, so we must solve

    $$\min \sum_{i=1}^n T_i^2 \quad\text{s.t.}\quad \sum_{i=1}^n T_i = T,\; T_i \ge 0.$$

    The minimum is at $T_i = T/n$ for every $i$.

    Why: if two intervals differ, say $a \ne b$, replace both by their average $\tfrac{a+b}{2}$. The total length is unchanged and $a^2 + b^2 - 2\left(\tfrac{a+b}2\right)^2 = \tfrac12(a-b)^2 > 0$, so the sum of squares drops. Any unequal plan can be improved, so the best plan has all intervals equal. (Equivalently: the objective is convex and symmetric, or use a Lagrange multiplier: $2T_i = \lambda$ for all $i$.)

    A 10-week season with 2 orders. Split A: intervals 5 and 5 weeks. Split B: 3 and 7 weeks. Compare $\sum T_i^2$.

    Both are 10, the same
    That is $\sum T_i$, which is fixed. Square each interval first.
    A gives 50, B gives 58, so A is cheaper
    Right. The difference is $\tfrac12(7-3)^2 = 8$.
    B is cheaper because one order is large
    Holding grows with the square of each interval, which punishes the long one.

    Choosing $n$

    With equal spacing, $\sum T_i^2 = n (T/n)^2 = T^2/n$, so the cost per unit time becomes

    $$z(n) = \frac{nK}{T} + \frac{HDT}{2n}.$$

    Treat $n$ as continuous for a moment and differentiate: $z'(n) = \dfrac{K}{T} - \dfrac{HDT}{2n^2} = 0$, so

    $$n^* = T\sqrt{\frac{HD}{2K}}\quad\text{(then compare } \lfloor n^*\rfloor \text{ and } \lceil n^*\rceil\text{)}.$$

    This is the season's demand divided by the EOQ: $n^* = DT/Q^*$.

    Careful: the lecture slide prints $n^* = T\sqrt{HD/K}$, without the 2. Differentiating $\frac{nK}{T} + \frac{HDT}{2n}$ gives $\frac{K}{T} = \frac{HDT}{2n^2}$, so the 2 belongs there; it also makes $n^* = DT/Q^*$ agree with the EOQ. For the lights example the slide's version would give 8.94 instead of 6.32.
    Try it

    Choose the number of orders $n$ for the 10-week lights season. The top shows the stock over the season; the dots below show $z(n)$ for every $n$. Which whole number is cheapest, and is it the nearest one to $n^*$?

    Festival lights: $T=10$ weeks, $D=200$ boxes per week, $K=₹500$, $H=₹2$ per box per week. Find the best number of orders and the order size.

    1. $n^* = 10\sqrt{2\cdot200/(2\cdot500)} = 10\sqrt{0.4} = 6.32$.

      Continuous optimum. It is not a whole number, so it is not a plan yet.

    2. $z(6) = \frac{6\cdot500}{10} + \frac{2\cdot200\cdot10}{12} = 300 + 333.33 = 633.33$ rupees per week; $z(7) = 350 + 285.71 = 635.71$.

      $z(n)$ is convex in $n$, so the best integer is one of the two neighbours of $n^*$.

    3. Choose $n = 6$: orders of $2000/6 = 333.33$ boxes, one every $10/6 = 1.67$ weeks. Season cost $10\times633.33 = ₹6333.3$.

      The lecture says "rounded up or down depending on the associated cost values": here rounding down wins, but only by ₹2.38 a week.

    A 12-month season, demand 100 units per month, $K=$ ₹200, $H=$ ₹1 per unit per month. Compute $n^*$.

    $n^* = T\sqrt{HD/(2K)}$.

    $12\sqrt{100/400} = 12 \times 0.5 = 6$ orders, every 2 months, 200 units each.

    Same season. Compute the cost per month $z(n)$ for $n=6$ and $n=5$.

    $z(n) = nK/T + HDT/(2n)$.

    $z(6) = 1200/12 + 1200/12 = 100 + 100 = 200$. $z(5) = 1000/12 + 1200/10 = 83.33 + 120 = 203.33$.

    A 5-week season, $D = 20$ per week, $K=$ ₹100, $H=$ ₹1 per unit-week. Then $n^* = 5\sqrt{20/200} = 1.58$. How many orders should you place?

    Compare $z(1)$ and $z(2)$.

    $z(1) = 100/5 + 20\cdot5/2 = 20 + 50 = 70$; $z(2) = 40 + 25 = 65$. Place 2 orders.

    Why are equal intervals optimal for a fixed number of orders?

    Because the lecture assumes it
    It is derived, not assumed.
    Holding cost grows with the square of each interval, and averaging two unequal intervals lowers the sum of squares
    Right. $a^2 + b^2 \ge 2\left(\tfrac{a+b}{2}\right)^2$.
    Because ordering cost is the same for every order
    That is true, but it does not explain the spacing.

    $n^* = 4.5$, and $z(n)$ is convex. The best whole number of orders is…

    always 5, by rounding half up
    The rule is to compare costs, not to round by convention.
    4 or 5, whichever has the lower $z(n)$
    Right. By convexity the best integer is next to $n^*$.
    any $n$ between 1 and 10
    Convexity narrows it to the two neighbours.

    How does the finite-horizon $n^*$ relate to the EOQ?

    $n^* = DT/Q^*$: the season's demand split into EOQ-sized orders
    Right. $DT/\sqrt{2KD/H} = T\sqrt{HD/(2K)}$.
    $n^* = Q^*/D$
    That is the EOQ cycle length.
    They are unrelated
    Divide the season's demand by $Q^*$ and compare.
    • Compute $n^*$, then evaluate $z$ at both neighbouring integers.
    • Sanity-check with $n^* = DT/Q^*$.
    • Rounding $n^*$ without comparing costs.
    • Copying the slide's $T\sqrt{HD/K}$ without the 2.
    1. Over a finite season, equal spacing $T_i = T/n$ is optimal for any $n$.
    2. $z(n) = nK/T + HDT/(2n)$, minimised at $n^* = T\sqrt{HD/(2K)} = DT/Q^*$.
    3. Orders are whole: compare $z(\lfloor n^*\rfloor)$ and $z(\lceil n^*\rceil)$.

    With 3 orders in a 9-week season, the intervals should be…

    3, 3 and 3 weeks
    Equal spacing.
    1, 3 and 5 weeks
    Unequal intervals cost more.
    it does not matter
    It does: holding grows with $T_i^2$.

    The 2 in $n^* = T\sqrt{HD/(2K)}$ comes from…

    the $\tfrac12$ in the triangle's area
    Holding per interval is $\tfrac12 HDT_i^2$.
    having two costs
    The factor comes from the area of a triangle.
    rounding
    Rounding comes later.

    $n^* = 3.2$. Which values of $n$ do you compare?

    3 and 4
    The two neighbours.
    only 3
    4 could be cheaper.
    1 to 10
    Convexity makes that unnecessary.

    A café uses 1000 kg of coffee a year; an order costs ₹80 and holding 1 kg for a year costs ₹4. What is $Q^*$?

    100 kg
    Check: $2\cdot80\cdot1000/4 = 40{,}000$, and take the square root.
    200 kg
    Right: $\sqrt{40{,}000} = 200$, so 5 orders a year.
    40,000 kg
    Do not forget the square root.

    For that café, what is the yearly ordering cost at $Q^*$?

    ₹800
    That is the total, $\sqrt{2\cdot4\cdot80\cdot1000}$.
    ₹400
    Right: 5 orders × ₹80, half of the ₹800 total.
    ₹80
    That is one order.

    The EOQ divides the cycle cost by the cycle length because…

    cycles of different lengths can only be compared per unit of time
    Right.
    it makes the formula shorter
    It changes the answer, not only the look.
    holding cost is zero at the end of a cycle
    True, but not the reason.

    Over a 20-week season with demand 50 per week, $K=$ ₹400 and $H=$ ₹1 per unit-week, $n^*$ is…

    10
    $20\sqrt{50/800} = 20 \times 0.25$.
    5
    Right. Also $Q^* = \sqrt{2\cdot400\cdot50} = 200$ and $DT/Q^* = 1000/200 = 5$.
    7.07
    That uses the slide's formula without the 2.

    When demand differs from period to period, the sawtooth breaks and the EOQ no longer applies. The lecture's second model, Wagner–Whitin lot sizing, still has a clean exact answer: one structural fact turns the integer program into a shortest path, solved by dynamic programming in a small table.

    You need: Part 1 (the three costs), integer programming with binary variables and big-M constraints, and shortest paths in a graph.

    Lot sizing as an integer program

    With demand that changes from period to period, we must decide in which periods to order and how much, trading the fixed cost of each order against the cost of carrying stock forward.

    Writing it as a mixed-integer program makes every cost and constraint explicit, and it is the model the rest of this part simplifies.

    A school canteen that serves 60 lunches on Monday, 100 on Tuesday and 10 on Wednesday has to decide which mornings the supplier's truck should come.

    Time is now divided into periods $t = 1, \dots, n$ (weeks, say). The demand of each period, $D_t$, is known in advance but changes. The canteen above has five periods:

    Period $t$12345
    Demand $D_t$60100105020

    Each order costs $K = ₹100$ to place, each unit costs $C = ₹2$, and a unit carried from one period to the next costs $H = ₹1$. Orders arrive at the start of a period, before that period's demand is served (zero lead time).

    There is no single order size to pick any more: ordering 60 in week 1 and 110 in week 2 is very different from ordering 170 in week 1. The question becomes a choice among plans.

    Notation for Part 3
    $x_t$
    units ordered (or produced) in period $t$
    $s_t$
    stock at the end of period $t$, carried into $t+1$; $s_0 = 0$
    $y_t$
    1 if an order is placed in period $t$, else 0
    $K, C, H$
    fixed cost per order, cost per unit, holding cost per unit carried one period

    $$\begin{aligned}\min\;& \sum_{t=1}^n \left(K y_t + C x_t + H s_t\right)\\ \text{s.t.}\;& s_{t-1} + x_t = D_t + s_t && \forall t \quad\text{(stock in + arrivals = demand + stock out)}\\ & x_t \le M_t\, y_t && \forall t \quad\text{(no order without paying } K\text{)}\\ & s_0 = 0,\; s_t, x_t \ge 0,\; y_t \in \{0,1\}.\end{aligned}$$

    The lecture writes the same objective as $\sum_t \big(K\delta(x_t) + Cx_t + Hs_t\big)$ with $\delta(x_t) = 1$ when $x_t > 0$; the binary $y_t$ and the big-M constraint are how a solver sees $\delta$. The previous lecture allowed costs $f_t, p_t, h_t$ that change with $t$; here they are time-invariant.

    What is a good $M$?

    The lecture asks this directly. $M_t$ must be large enough never to cut off a sensible plan, and small enough to keep the LP relaxation tight. In an optimal plan nothing is ordered that is never used, so period $t$ never orders more than all the remaining demand:

    $$M_t = D_t + D_{t+1} + \dots + D_n.$$

    For the canteen: $M_1 = 240$, $M_2 = 180$, $M_3 = 80$, $M_4 = 70$, $M_5 = 20$. A huge $M$ such as $10^6$ is also valid, but the LP relaxation then sets $y_t = x_t/10^6$, almost zero, and branch and bound gets a very weak bound.

    What does the constraint $s_{t-1} + x_t = D_t + s_t$ say in words?

    Each period orders exactly its own demand
    Then $s_t$ would always be zero. The constraint allows carrying stock.
    Stock never changes
    Stock rises with orders and falls with demand.
    What comes in (carried stock plus the order) equals what goes out (demand plus stock carried on)
    Right. It is a flow-balance constraint, one per period.
    Try it

    You are the planner. Toggle the periods in which the canteen orders (period 1 must order: nothing is in stock yet). Each order covers demand up to the next order. Try to beat ₹850. The cheapest plan is in Chapter 3.3.

    Cost the plan "order in periods 1 and 4": the first order covers periods 1–3, the second covers 4–5.

    1. Order sizes: $x_1 = 60 + 100 + 10 = 170$, $x_4 = 50 + 20 = 70$.

      Each order brings exactly what is needed until the next order.

    2. End-of-period stock: $s_1 = 110$, $s_2 = 10$, $s_3 = 0$, $s_4 = 20$, $s_5 = 0$, so holding costs $H(110 + 10 + 20) = ₹140$.

      Flow balance, period by period: $s_1 = 0 + 170 - 60$, $s_2 = 110 - 100$, and so on.

    3. Total: $2K + C\cdot240 + 140 = 200 + 480 + 140 = ₹820$.

      The unit cost adds $2 \times 240 = 480$ to every plan that meets all demand, so it cannot change which plan is best.

    Cost the plan that orders in every period (lot-for-lot), with the canteen data.

    No stock is ever carried, so holding is zero.

    $5K + C\cdot240 = 500 + 480 = ₹980$.

    Cost the plan that orders everything (240 units) in period 1.

    Demand of period $k$ is carried $k-1$ periods.

    Holding: $100\cdot1 + 10\cdot2 + 50\cdot3 + 20\cdot4 = 350$. Total $100 + 480 + 350 = ₹930$.

    What is the tightest valid big-M for period 3, $M_3$?

    Period 3 never needs to order more than the demand that is still to come.

    $M_3 = D_3 + D_4 + D_5 = 10 + 50 + 20 = 80$.

    Why does the EOQ formula not apply here?

    Because there is a fixed ordering cost
    The EOQ has one too.
    Because demand changes from period to period, so no single repeating $Q$ fits
    Right. The EOQ needs a constant demand rate.
    Because holding cost is charged per period
    That changes units, not the logic.

    Setting $M_t = 10^6$ instead of the remaining demand…

    makes the model infeasible
    It is still a valid upper bound.
    changes the optimal integer solution
    The integer optimum is the same; something else gets worse.
    keeps the model correct but weakens the LP relaxation
    Right. $y_t = x_t/M_t$ becomes tiny, so the relaxation barely pays $K$.

    Every feasible plan for the canteen pays the same amount for…

    the units themselves, $C \sum_t D_t = ₹480$
    Right. All demand is met, each unit at the same price.
    holding
    Holding depends on when you order.
    fixed costs
    That depends on how many orders the plan places.
    • Write the flow balance for every period, including $s_0 = 0$.
    • Use the remaining demand $\sum_{k\ge t} D_k$ as big-M.
    • Taking $M$ "as large as possible to be safe": it is valid but weakens the bound.
    • Forgetting that an order arrives before the period's demand, so the stock carried out of period $t$ is $s_t$, not $s_{t-1}$.
    1. Lot sizing chooses order periods and amounts for known, changing demand.
    2. MIP: flow balance $s_{t-1} + x_t = D_t + s_t$ and $x_t \le M_t y_t$ with $M_t$ = remaining demand.
    3. With a constant unit cost, $C\sum D_t$ is the same for every plan.

    $y_t$ in the model means…

    whether an order is placed in period $t$
    It switches on the fixed cost $K$.
    how much is ordered
    That is $x_t$.
    the stock at the end of $t$
    That is $s_t$.

    Demands 30, 20, 40. Tightest $M_2$?

    90
    That is $M_1$.
    60
    $20 + 40$.
    20
    Period 2 may also cover period 3.

    Lot-for-lot (order every period) has zero…

    holding cost
    Nothing is carried.
    fixed cost
    It pays $K$ in every period.
    unit cost
    Units are always paid for.

    Order only when the shelf is empty

    With time-invariant costs, there is an optimal plan that never orders while stock is still on hand: $x_t\, s_{t-1} = 0$ for every $t$.

    This one fact shrinks the decision from "how much in each period" to "in which periods", and turns lot sizing into a shortest path.

    If you are going to the shop on Thursday anyway, it is pointless to have bought Thursday's milk on Monday and paid to keep it cold for three days.

    When $K$, $C$ and $H$ do not change over time, some optimal plan satisfies the complementarity condition

    $$x_t\, s_{t-1} = 0 \qquad \forall\, t = 1, \dots, n.$$

    In words: order only in a period that starts with an empty shelf. Each order then covers the demand of a block of consecutive periods exactly.

    Why is it true? Take any plan that orders in period $t$ while also carrying stock in from earlier ($x_t > 0$ and $s_{t-1} > 0$), and improve it.

    1. Some of the $s_{t-1}$ units were bought in an earlier period $i < t$ and carried to $t$. Buy those units in period $t$ instead, adding them to $x_t$.

      The plan still meets every demand: the units arrive in period $t$, which is when they are needed.

    2. Fixed cost: unchanged or lower. Period $t$ already pays $K$; period $i$ orders less, and may not need to order at all.

      This is where "period $t$ already orders" matters: moving units into a period that pays $K$ anyway costs no extra $K$.

    3. Unit cost: unchanged, because $C$ is the same in every period. Holding: each moved unit is no longer carried from $i$ to $t$, saving $H(t-i) > 0$ per unit.

      So the new plan costs no more. Repeating the move removes every violation, and we end with an optimal plan where $x_t s_{t-1} = 0$.

    Careful: the argument used "$C$ is the same in every period". If units were much cheaper in an early period, buying early and carrying could pay off, and the property can fail. That is why the lecture states it for time-invariant parameters.

    A plan orders 60 in period 1 and 110 in period 2 for demands 60, 100, 10. Does it satisfy $x_t s_{t-1} = 0$?

    Yes: period 2 orders, and the stock carried into period 2 is $s_1 = 0$
    Right. Period 1's order covered only period 1.
    No: period 2 orders more than its own demand
    Ordering for later periods is allowed. The condition is about stock carried into an ordering period.
    No: period 3 has stock
    Period 3 does not order, so $x_3 s_2 = 0$ holds.

    From plans to paths

    Because every order covers a block of whole periods, a plan is fully described by its order periods. Draw one node for each period, $1, 2, \dots, n$, plus an end node $n+1$. An edge $i \to j$ (with $i \lt j$) means "order in period $i$ to cover periods $i, \dots, j-1$". A plan is then a path from node 1 to node $n+1$; the canteen plan "order in 1, 2 and 4" is the path $1 \to 2 \to 4 \to 6$.

    Edge $i \to j$ costs one fixed cost, the units, and the holding: the demand of period $k$ is carried $k - i$ periods.

    $$w_{ij} = K + \sum_{k=i}^{j-1} C D_k + \sum_{k=i+1}^{j-1} (k - i)\, H D_k.$$

    The holding sum starts at $k = i+1$ because period $i$'s own demand is served on arrival.

    Try it

    Pick an edge $i \to j$. The readout breaks its weight into fixed, unit and holding cost, and the arc is highlighted on the graph of all 15 possible orders.

    Compute $w_{24}$ for the canteen ($D = 60, 100, 10, 50, 20$; $K=100$, $C=2$, $H=1$).

    1. The order is placed in period 2 and covers periods 2 and 3: $x_2 = 100 + 10 = 110$.

      Edge $2 \to 4$ stops before period 4.

    2. Fixed: $K = 100$. Units: $C(D_2 + D_3) = 2 \times 110 = 220$.

      One order; every unit costs $C$.

    3. Holding: period 3's demand waits $3 - 2 = 1$ period: $1 \times 1 \times 10 = 10$. So $w_{24} = 100 + 220 + 10 = 330$.

      Period 2's own 100 units are used on arrival and are never carried.

    Canteen data. Compute $w_{13}$.

    One order in period 1 covering periods 1 and 2.

    $100 + 2(60 + 100) + 1\cdot1\cdot100 = 100 + 320 + 100 = 520$.

    Compute $w_{35}$.

    Covers periods 3 and 4; period 4's demand is held one period.

    $100 + 2(10 + 50) + 1\cdot50 = 100 + 120 + 50 = 270$.

    With $n = 5$ periods and period 1 forced to order, how many plans satisfy the zero-inventory property?

    Each of periods 2 to 5 either orders or not.

    $2^{4} = 16$: one per subset of $\{2,3,4,5\}$, and one path from node 1 to node 6 for each.

    Which assumption does the exchange argument rely on most?

    Demand is the same every period
    Demand may change; that is the point of this model.
    There is no holding cost
    The saving comes from holding cost.
    The unit cost $C$ (and $K$) are the same in every period
    Right. Then buying later never costs more per unit.

    In the graph, the path $1 \to 3 \to 6$ means…

    order in period 1 for periods 1–2, and in period 3 for periods 3–5
    Right. Edge $i \to j$ covers $i, \dots, j-1$.
    order in periods 1, 3 and 6
    Node 6 is the end node; nothing is ordered there.
    order 3 units, then 6 units
    Nodes are periods, not quantities.

    Why does the holding sum in $w_{ij}$ start at $k = i+1$?

    Because the first period has no demand
    It has demand; it is served on arrival.
    Because period $i$'s demand is used the moment the order arrives, so it is never carried
    Right: carried for $k - i = 0$ periods.
    To avoid counting $K$ twice
    $K$ is outside the sums.
    • Name each edge by the periods it covers: $i \to j$ covers $i, \dots, j-1$.
    • Count holding as (periods waited) × $H$ × (that period's demand).
    • Charging holding on period $i$'s own demand.
    • Applying the zero-inventory property when unit costs differ by period.
    1. Time-invariant costs ⇒ an optimal plan with $x_t s_{t-1} = 0$: order only on an empty shelf.
    2. Each order covers whole consecutive periods, so a plan is a path $1 \to \dots \to n+1$.
    3. $w_{ij} = K + C\sum_{k=i}^{j-1} D_k + H\sum_{k=i+1}^{j-1}(k-i)D_k$.

    $x_t s_{t-1} = 0$ means…

    never order while carrying stock in
    Order only on an empty shelf.
    never hold stock
    Stock can be held between orders.
    order every period
    That is one plan, not the property.

    $K=50$, $C=0$, $H=1$, demands 10, 20. $w_{13}$?

    50
    Period 2's 20 units are carried one period.
    70
    $50 + 1\cdot20$.
    80
    Period 1's demand is not carried.

    With $n$ periods the graph has how many edges?

    $n(n+1)/2$
    One for each pair $i \lt j$ among $n+1$ nodes.
    $2^n$
    That counts plans, roughly.
    $n$
    Each node has edges to every later node.

    Solving it: the shortest path, one column at a time

    The cheapest plan is the shortest path from node 1 to node $n+1$, and dynamic programming finds it by computing the cheapest way to cover periods $1, \dots, j-1$ for each $j$ in turn.

    It replaces a MIP with a table of $n(n+1)/2$ additions, small enough to fill by hand in an exam.

    Planning the cheapest train journey across five cities: once you know the cheapest way to reach each city, the cheapest way to the next one only needs those numbers.

    Let $f(j)$ be the minimum cost of meeting the demand of periods $1, \dots, j-1$ (so $f(1) = 0$). Then, for $j = 2, \dots, n+1$,

    $$f(j) = \min_{1 \le i \lt j}\; \big( f(i) + w_{ij} \big),$$

    and $f(n+1)$ is the optimal cost. Record which $i$ achieves each minimum; following these back from $n+1$ gives the order periods.

    Why is this right? The last order before the end node is placed in some period $i$ and covers $i, \dots, j-1$. Whatever it is, everything before it must be the cheapest way to cover $1, \dots, i-1$, which is $f(i)$. Trying every $i$ and keeping the best gives $f(j)$. This is exactly the shortest-path recursion on an acyclic graph whose nodes are visited in time order.

    In words, what is $f(4)$?

    The cost of ordering in period 4
    $f(4)$ is about everything before period 4.
    The cheapest cost of meeting the demand of periods 1, 2 and 3
    Right. Node 4 is reached once periods 1–3 are covered.
    The demand of period 4
    $f$ is a cost, not a demand.
    Try it

    Press Next column to compute $f(2), f(3), \dots$ one at a time. Each column lists every candidate $f(i) + w_{ij}$; the smallest is circled. After the last column the optimal plan is traced back. Then raise $K$ and watch the plan switch to fewer, bigger orders.

    Solve the canteen problem ($D = 60, 100, 10, 50, 20$; $K = 100$, $C = 2$, $H = 1$) by hand.

    1. $f(2) = f(1) + w_{12} = 0 + 220 = 220$.

      Only one way to cover period 1: order 60 in period 1, cost $100 + 120$.

    2. $f(3) = \min\{f(1) + w_{13},\; f(2) + w_{23}\} = \min\{0 + 520,\; 220 + 300\} = 520$.

      A tie: covering periods 1–2 with one order or two costs the same. Either predecessor works; we record $i = 1$.

    3. $f(4) = \min\{0 + 560,\; 220 + 330,\; 520 + 120\} = \min\{560, 550, 640\} = 550$, from $i = 2$.

      Covering 1–3 is cheapest as "order for 1, then order in 2 for periods 2–3".

    4. $f(5) = \min\{0 + 810,\; 220 + 530,\; 520 + 270,\; 550 + 200\} = \min\{810, 750, 790, 750\} = 750$.

      Another tie (from $i = 2$ or $i = 4$). Ties do not matter for the final cost.

    5. $f(6) = \min\{0 + 930,\; 220 + 630,\; 520 + 350,\; 550 + 260,\; 750 + 140\} = \min\{930, 850, 870, 810, 890\} = 810$, from $i = 4$.

      This is the optimal cost of the whole problem.

    6. Trace back: $6 \leftarrow 4 \leftarrow 2 \leftarrow 1$. Order 60 in period 1, 110 in period 2 (for 2–3), 70 in period 4 (for 4–5). Cost ₹810: fixed 300, units 480, holding 30.

      Holding: 10 units carried from period 2 to 3, and 20 from 4 to 5.

    How much work is this?

    Column $j$ looks at $j - 1$ candidates, so the whole table takes $1 + 2 + \dots + n = n(n+1)/2$ comparisons: 15 for the canteen, 1378 for a year of weeks. Listing all plans would mean $2^{n-1}$ of them: 16 here, but about $2 \times 10^{15}$ for 52 weeks. This is the lecture's question, "can we do better than solving this as a MIP?", answered: yes, in polynomial time, because of the zero-inventory structure.

    Three periods with demands $40, 30, 80$, $K = 90$, $H = 1$, $C = 0$. Compute $f(3)$ and $f(4)$.

    First the weights: $w_{12} = 90$, $w_{13} = 90 + 30$, $w_{23} = 90$, $w_{14} = 90 + 30 + 2\cdot80$, $w_{24} = 90 + 80$, $w_{34} = 90$.

    $f(2) = 90$. $f(3) = \min\{0 + 120, 90 + 90\} = 120$. $f(4) = \min\{0 + 280, 90 + 170, 120 + 90\} = \min\{280, 260, 210\} = 210$.

    For the same problem, in which periods should you order?

    Trace back from $f(4) = 210$: which $i$ gave it?

    $f(4)$ came from $i = 3$, and $f(3)$ from $i = 1$. Order 70 in period 1 (for periods 1–2) and 80 in period 3.

    How many candidate sums $f(i) + w_{ij}$ does the DP evaluate for $n = 52$ weekly periods?

    $n(n+1)/2$.

    $52 \cdot 53 / 2 = 1378$.

    Two candidates in a column tie for the minimum. What should you do?

    Stop: the problem has no optimal solution
    Ties mean several optimal plans, not none.
    Record either one; both lead to plans with the same optimal cost
    Right.
    Always pick the larger $i$
    Any tie-break rule works.

    The DP needs about how many operations for $n$ periods?

    $2^{n}$
    That is complete enumeration of plans.
    $n$
    Each column compares several predecessors.
    $n(n+1)/2$, so $O(n^2)$
    Right.

    If $K$ grows a lot, the optimal plan tends to…

    place fewer, larger orders
    Right. Each order is dearer, so carrying stock becomes the cheaper option.
    place more, smaller orders
    That happens when $H$ grows.
    stay the same, because $K$ is in every edge
    Plans with fewer edges pay $K$ fewer times.
    • Fill the table column by column, writing every $f(i) + w_{ij}$, and mark the minimum.
    • Keep a predecessor for each column so the plan can be traced back.
    • Forgetting the end node $n+1$; the answer is $f(n+1)$, not $f(n)$.
    • Reporting the cost without the plan, or the plan without the order quantities.
    1. $f(1)=0$, $f(j) = \min_{i \lt j} \{f(i) + w_{ij}\}$; the optimum is $f(n+1)$.
    2. Trace predecessors back from $n+1$ to read off the order periods.
    3. $O(n^2)$ work instead of a MIP or $2^{n-1}$ plans.

    $f(1)$ equals…

    0
    Nothing to cover yet.
    $K$
    No order is needed before period 1.
    $D_1$
    $f$ is a cost.

    $f(2)=100$, $f(3)=180$, $w_{24}=150$, $w_{34}=90$, $w_{14}=300$. $f(4)$?

    300
    Check the other two candidates.
    250
    $\min\{300, 250, 270\}$.
    270
    $100 + 150$ is smaller.

    The optimal cost of an $n$-period problem is…

    $f(n+1)$
    The end node.
    $f(n)$
    That leaves period $n$ uncovered.
    $\sum_j f(j)$
    $f(n+1)$ already includes everything.

    Demands 20, 0, 30 with $K = 40$, $C = 0$, $H = 1$. What is $w_{14}$ (one order in period 1 for all three periods)?

    40
    Period 3's demand is carried two periods.
    100
    Right. $40 + 2\cdot30 = 100$.
    70
    Period 3's 30 units wait two periods, not one.

    For that problem, is one order (100) better than ordering in periods 1 and 3?

    Yes, one order saves a fixed cost
    Compare the totals.
    No: two orders cost $40 + 40 = 80 \lt 100$
    Right. Carrying 30 units for two periods (60) costs more than a second order (40).
    They cost the same
    Compute both totals.

    Which model fits "weekly demand forecasts of 300, 120, 0, 450, 80 for the next five weeks"?

    EOQ
    EOQ needs a constant demand rate.
    Finite-horizon EOQ
    That also assumes a constant rate within the season.
    Wagner–Whitin lot sizing
    Right: known, changing demand per period.

    Unit cost is ₹10 in period 1 but ₹20 afterwards. The zero-inventory property…

    may fail: buying early and holding can now pay off
    Right. The exchange argument needed equal unit costs.
    still holds
    Revisit step 3 of the exchange argument.
    holds only if $K = 0$
    The issue is the unit cost, not $K$.

    So far demand was known. The third model of Lecture 15 drops that: demand is a random variable, and we must commit to a quantity before seeing it. The answer is a single probability, the critical ratio. The lecture then adds a set-up cost and starting stock, which leads to the $(s,S)$ policy.

    You need: Part 1 (costs), and the idea of a probability. Expected value, the CDF and densities are explained here as they come up.

    One shot at the order: the critical ratio by intuition

    When demand is uncertain and there is one chance to order, every extra unit is a bet: it earns a profit if someone buys it and loses money if it is left over.

    Keep adding units while the bet is favourable, and you land on the newsvendor rule without any calculus.

    Like deciding how many samosas to fry before a cricket match at the canteen: too few and hungry fans leave, too many and the rest go cold.

    A sweet shop prepares gift boxes for Diwali. Each box costs $C = ₹20$ to make and sells for $R = ₹50$. Boxes left after the festival go to a caterer at $V = ₹5$, the salvage value. All boxes must be made before the festival, and demand is uncertain:

    Demand $D$100200300
    Probability0.20.50.3
    $F(d) = P(D \le d)$0.20.71.0

    Demand $D$ is a random variable: its value is unknown until the festival, but we know how likely each value is. The last row is its cumulative distribution function (CDF), $F(d) = P(D \le d)$, the chance that demand is at most $d$.

    The profit of one choice, in every scenario

    Suppose the shop makes $x = 200$ boxes (cost ₹4000).

    • If $D = 100$: sells 100 (₹5000), salvages 100 (₹500). Profit $5000 + 500 - 4000 = ₹1500$.
    • If $D = 200$: sells all 200 (₹10,000). Profit ₹6000.
    • If $D = 300$: sells 200; 100 customers leave. Profit ₹6000.

    Weighting by the probabilities gives the expected value of the profit, what the shop earns on average over many festivals: $0.2(1500) + 0.5(6000) + 0.3(6000) = ₹5100$. The same calculation gives ₹3000 for $x = 100$ and ₹4950 for $x = 300$. So 200 is best of the three.

    The shop makes 150 boxes. If demand is 100, what is its profit?

    ₹2000
    Remember the 50 leftover boxes are salvaged at ₹5 each.
    ₹4500
    That is the profit when all 150 sell.
    ₹2250
    Right. $100 \times 50 + 50 \times 5 - 150 \times 20 = 5000 + 250 - 3000$.

    Thinking one box at a time

    There is a faster way that does not need every scenario. Look at a single extra box, the $(x{+}1)$-th. It sells only if demand exceeds $x$.

    • If it sells, the shop gains $R - C = ₹30$. This is the underage cost $c_u$: the profit lost on each customer we could not serve because we made too few.
    • If it is left over, the shop loses $C - V = ₹15$. This is the overage cost $c_o$: the loss on each box we made too many.

    So the extra box is worth making when $P(D \gt x)\,c_u \ge P(D \le x)\,c_o$, that is, when $(1 - F(x))\,c_u \ge F(x)\,c_o$. Rearranged: keep adding boxes while

    $$F(x) \le \frac{c_u}{c_u + c_o} = \frac{R - C}{R - V}.$$

    Stock up to the smallest quantity $x$ whose CDF reaches the critical ratio:

    $$F(x^*) \ge \frac{c_u}{c_u+c_o} = \frac{R - C}{R - V}.$$

    For the sweets: $\frac{30}{45} = \frac23$. $F(100) = 0.2$ is below it, $F(200) = 0.7$ reaches it, so make 200 boxes.

    The ratio is the probability of not running out that you should aim for. A cheap leftover (small $c_o$) and a large lost profit (large $c_u$) push it towards 1: stock generously. An expensive leftover pushes it down: stock cautiously. Check with the marginal box: box 101 sells with probability $P(D \ge 101) = 0.8$, worth $0.8(30) - 0.2(15) = +₹21$. Box 201 sells with probability $0.3$: $0.3(30) - 0.7(15) = -₹1.50$. Stop at 200.

    Try it

    Move the order quantity and watch the expected profit. Then change the salvage value $V$: the critical ratio moves, and so does the best quantity.

    Same sweets, but now a better outlet buys leftovers at $V = ₹14$. How many boxes?

    1. $c_u = 50 - 20 = 30$, $c_o = 20 - 14 = 6$.

      Underage: profit lost per missed sale. Overage: loss per leftover box.

    2. Critical ratio $= 30/36 = 0.833$.

      Leftovers hurt much less now, so we aim for a higher chance of not running out.

    3. $F(200) = 0.7 \lt 0.833 \le F(300) = 1$, so make 300.

      The smallest quantity whose CDF reaches the ratio.

    Original sweets data ($C=20$, $R=50$, $V=5$; demand 100, 200, 300 with probabilities 0.2, 0.5, 0.3). Expected profit if the shop makes 150 boxes?

    Two cases: demand 100 (profit 2250), or demand at least 150 (all sell).

    If $D=100$: 2250. If $D \ge 200$ (prob. 0.8): $150 \times 30 = 4500$. Expected: $0.2(2250) + 0.8(4500) = 450 + 3600 = ₹4050$.

    A kiosk buys umbrellas at ₹6, sells at ₹10, and returns unsold ones for ₹2. What is the critical ratio?

    $(R - C)/(R - V)$.

    $(10 - 6)/(10 - 2) = 4/8 = 0.5$: aim for an even chance of selling out, the median of demand.

    Sweets with an emergency option (from the exam notes): if the shop runs short it can buy extra boxes late at ₹35 each. Now a missing box costs only $c_u = 35 - 20 = 15$, while $c_o = 15$. How many boxes should it make in advance?

    The ratio is $15/30$. Find the smallest $x$ with $F(x) \ge 0.5$.

    Ratio 0.5. $F(100) = 0.2 \lt 0.5 \le F(200) = 0.7$, so 200. (If late boxes cost only ₹22, $c_u = 2$, ratio $2/17 = 0.12 \le F(100)$, and 100 would do: a cheap backup lets you hold less.)

    What is the underage cost $c_u$?

    $C - V$, the loss on a leftover unit
    That is the overage cost.
    $R - C$, the profit lost on a customer you could not serve
    Right.
    $R$, the selling price
    You would have paid $C$ for the unit, so the loss is $R - C$.

    Leftovers become worthless ($V$ falls to 0). The optimal quantity…

    falls or stays the same
    Right. $c_o$ rises, so the ratio $(R-C)/R$ is smaller.
    rises
    Leftovers are now more costly. Would you stock more of them?
    is unaffected, since salvage is rare
    Salvage enters the ratio directly.

    The critical ratio is 0.9. In words, the shop should…

    sell out 90% of the time
    Selling out means running out. Think about $F(x) = P(D \le x)$.
    stock enough that demand is at most the stock 90% of the time
    Right: a 90% chance of not running out.
    order 90% of the expected demand
    The rule is about probabilities, not a fraction of the mean.
    • Name $c_u$ and $c_o$ in words before computing: "one too few costs…", "one too many costs…".
    • With discrete demand, take the smallest $x$ whose $F(x)$ reaches the ratio.
    • Ordering the expected demand by default. The best quantity depends on the costs, not only on the mean.
    • Using $R$ as the underage cost: the unit would have cost $C$.
    1. $c_u = R - C$ (one too few), $c_o = C - V$ (one too many).
    2. Add units while $(1 - F(x))c_u \ge F(x)c_o$, which gives $F(x^*) \ge c_u/(c_u + c_o)$.
    3. The critical ratio is the target probability of not running out.

    $R = 100$, $C = 40$, $V = 10$. Critical ratio?

    0.4
    That is $C/R$.
    $60/90 = 0.667$
    $(R-C)/(R-V)$.
    0.6
    That divides by $R$ and ignores salvage.

    An extra unit should be stocked when…

    $P(\text{it sells})\,c_u \ge P(\text{left over})\,c_o$
    The marginal bet is favourable.
    it is cheaper than average
    Every unit costs $C$.
    demand is above the mean
    Demand is not known when ordering.

    $F(50)=0.3$, $F(60)=0.55$, $F(70)=0.8$; ratio 0.6. Order?

    60
    $F(60) = 0.55$ is still below 0.6.
    70
    The first $F$ to reach 0.6.
    50
    Too few.

    The newsvendor formula, derived as in the lecture

    With continuous demand, the expected cost $z(x)$ is a convex function of the order quantity, and its derivative is $(C - R) + (R - V)F(x)$.

    Setting it to zero gives $x^* = F^{-1}\!\left(\frac{R - C}{R - V}\right)$, the formula you will use for uniform and normal demand.

    The same rule as before, now read off a smooth curve instead of a short table.

    A little probability

    For continuous demand, the density $f(y)$ describes how probability is spread: the area under $f$ between two values is the probability that demand falls between them. The CDF is the area to the left: $F(x) = \int_0^x f(y)\,dy$, also written $\int_0^x dF(y)$. The expected value of any function $g(D)$ is $E[g(D)] = \int g(y)\,dF(y)$: each possible value weighted by its probability.

    The objective

    The lecture minimises expected cost (the negative of expected profit). We buy $x$ units at $C$, sell $\min(x, D)$ of them at $R$, and salvage the leftover $\max(0, x - D)$ at $V$:

    $$z(x) = Cx - R\,E[\min(x, D)] - V\,E[\max(0, x - D)].$$

    Step 1: the two expectations

    Sales equal demand when $D \le x$, and equal $x$ when $D \gt x$:

    $$E[\min(x, D)] = \int_0^x y\,dF(y) + \int_x^\infty x\,dF(y).$$

    Leftovers are $x - D$ when $D \le x$, else zero:

    $$E[\max(0, x - D)] = \int_0^x (x - y)\,dF(y).$$

    Step 2: rewrite around the mean

    Add and subtract $R\int_x^\infty y\,dF(y)$. The two integrals of $y$ combine into $E[D]$:

    $$z(x) = Cx - R\,E[D] + R\int_x^\infty (y - x)\,dF(y) - V\int_0^x (x - y)\,dF(y).$$

    The first integral is the expected shortfall, the second the expected leftover.

    Step 3: differentiate with the Leibniz rule

    Both integrals have $x$ in a limit and in the integrand, so we need the Leibniz rule:

    $$\frac{d}{dx}\int_{a(x)}^{b(x)} g(x, y)\,dy = g\big(x, b(x)\big)\,b'(x) - g\big(x, a(x)\big)\,a'(x) + \int_{a(x)}^{b(x)} \frac{\partial g}{\partial x}\,dy.$$

    For the shortfall, $g = (y - x)f(y)$: the boundary term at $y = x$ is $(x - x)f(x) = 0$, and $\partial g/\partial x = -f(y)$, so the derivative is $-\int_x^\infty f(y)\,dy = -(1 - F(x))$. For the leftover, $g = (x - y)f(y)$: the boundary term vanishes again and the derivative is $\int_0^x f(y)\,dy = F(x)$. Therefore

    $$z'(x) = C - R\big(1 - F(x)\big) - V F(x) = (C - R) + (R - V)F(x).$$

    And $z''(x) = (R - V)f(x) \ge 0$ since $R \gt V$: $z$ is convex, so the stationary point is the minimum.

    $$F(x^*) = \frac{R - C}{R - V} \qquad\Longrightarrow\qquad x^* = F^{-1}\!\left(\frac{R - C}{R - V}\right).$$

    Uniform demand on $[a, b]$: $x^* = a + \alpha(b - a)$. Normal demand with mean $\mu$ and standard deviation $\sigma$: $x^* = \mu + z_\alpha \sigma$, where $\alpha$ is the critical ratio and $z_\alpha$ its standard normal quantile.

    At some $x$, $z'(x) = (C - R) + (R - V)F(x)$ is negative. What should you do?

    Order more: the expected cost still falls as $x$ grows
    Right. A negative slope means you are left of the minimum.
    Order less
    Negative slope: increasing $x$ lowers $z$.
    Nothing; negative cost means profit
    The sign is of the slope, not of the cost.
    Try it

    Drag the order quantity $x$ across the demand density. The shaded area left of $x$ is $F(x)$. The best $x$ is where that area equals the critical ratio; the expected-profit curve below peaks at the same spot. Switch between uniform and normal demand.

    Sweets again ($C = 20$, $R = 50$, $V = 5$), but demand is now uniform on $[100, 300]$, and then normal with mean 200 and standard deviation 50. Find $x^*$ in both cases.

    1. Critical ratio $\alpha = 30/45 = 2/3$.

      The same costs as before.

    2. Uniform: $F(x) = (x - 100)/200$. Solve $F(x) = 2/3$: $x^* = 100 + \tfrac23 \cdot 200 = 233.33$. Expected profit there: ₹5000 (it is ₹4875 at $x = 200$).

      For a uniform distribution the quantile is a straight-line interpolation between $a$ and $b$.

    3. Normal: $z_{2/3} = 0.4307$, so $x^* = 200 + 0.4307 \times 50 = 221.54$.

      $\alpha \gt 0.5$, so we stock above the mean, by 0.43 standard deviations.

    A bakery sells loaves at ₹12 that cost ₹3 to bake; unsold loaves are thrown away ($V = 0$). Daily demand is normal with mean 1000 and standard deviation 200. How many loaves? (Use $z_{0.75} = 0.6745$.)

    $\alpha = (12-3)/(12-0)$.

    $\alpha = 9/12 = 0.75$, so $x^* = 1000 + 0.6745 \times 200 = 1134.9$.

    Demand is uniform on $[0, 80]$, $R = 8$, $C = 5$, $V = 1$. Find $x^*$.

    $\alpha = 3/7$; then $x^* = a + \alpha(b - a)$.

    $\alpha = (8-5)/(8-1) = 3/7 = 0.4286$; $x^* = 80 \times 3/7 = 34.29$. A low margin and a big overage loss: stock below the median of 40.

    Sweets with uniform demand on $[100, 300]$. Compute $z'(180) = (C - R) + (R - V)F(180)$.

    $F(180) = (180 - 100)/200$.

    $F(180) = 0.4$, so $z'(180) = -30 + 45 \times 0.4 = -12$. Negative: 180 is too few.

    Why does $z''(x) = (R - V)f(x) \ge 0$ matter?

    It shows demand is normal
    It holds for any demand distribution.
    It shows $z$ is convex, so $F(x^*) = \frac{R-C}{R-V}$ gives the minimum, not a maximum
    Right.
    It gives the value of $x^*$
    The first derivative gives $x^*$; the second confirms it is a minimum.

    In the Leibniz step, the boundary terms vanish because…

    the density is zero at $x$
    $f(x)$ need not be zero.
    the limits do not depend on $x$
    One limit is $x$ in both integrals.
    the integrands $(y - x)$ and $(x - y)$ are zero at $y = x$
    Right. Only the integral of $\partial g/\partial x$ remains.

    Normal demand, critical ratio 0.3. The optimal order is…

    below the mean
    Right. $z_{0.3} \lt 0$.
    at the mean
    Only when the ratio is 0.5.
    above the mean
    That needs a ratio above 0.5.
    • Write $z(x)$ from "buy, sell, salvage", then differentiate; the derivative is worth remembering: $(C-R) + (R-V)F(x)$.
    • Check the sign of $\alpha - 0.5$ to know if you stock above or below the median.
    • Dropping a boundary term in the Leibniz rule without checking that it is zero.
    • Using $z_\alpha$ for the wrong tail ($z_{1-\alpha}$).
    1. $z(x) = Cx - R\,E[\min(x,D)] - V\,E[(x - D)^+]$ is convex.
    2. $z'(x) = (C - R) + (R - V)F(x)$, so $F(x^*) = (R - C)/(R - V)$.
    3. Uniform: $a + \alpha(b-a)$. Normal: $\mu + z_\alpha\sigma$.

    $E[\max(0, x - D)]$ is the expected…

    leftover
    Units made but not sold.
    shortfall
    That is $E[\max(0, D - x)]$.
    sales
    That is $E[\min(x, D)]$.

    Uniform on $[0, 100]$, ratio 0.8. $x^*$?

    20
    That uses $1 - \alpha$.
    80
    $0 + 0.8 \times 100$.
    50
    That is the median.

    $z'(x) = 0$ means…

    $F(x) = (R - C)/(R - V)$
    Rearrange $(C - R) + (R - V)F(x) = 0$.
    $F(x) = C/R$
    Salvage is missing.
    $x = E[D]$
    Only by coincidence.

    Add a set-up cost: the $(s, S)$ policy

    If every production run costs $K$ and some stock $x_0$ is already on hand, it is not worth topping up a nearly full shelf: you order only when stock is low enough.

    The result is the $(s, S)$ policy: when stock is at or below $s$, order up to $S$; otherwise do nothing.

    You refill a car's tank to full when the gauge drops to a quarter, not every time it shows less than full, because each stop costs time.

    The lecture's extension: we start with $x_0$ units and may produce more, bringing stock up to $x \ge x_0$. Producing costs $K$ (if we produce at all) plus $C$ per unit, so producing $x - x_0$ units and then facing demand costs

    $$K + C(x - x_0) + \big(z(x) - Cx\big) = K + z(x) - Cx_0,$$

    where $z(x)$ is the newsvendor expected cost from Chapter 4.2 (it already contains $Cx$). Not producing costs $z(x_0) - Cx_0$. The term $-Cx_0$ appears in both, so it never affects the choice.

    Two cases

    Let $S$ minimise $z(x)$: this is the newsvendor quantity $x^*$, now called the order-up-to level.

    • Case I: $x_0 \ge S$. Producing can only move us further from the bottom of $z$. Do nothing.
    • Case II: $x_0 \lt S$. If we produce, we go all the way to $S$, the best level, at cost $K + z(S)$. If not, we pay $z(x_0)$. Produce when $z(x_0) \gt K + z(S)$.

    Let $S = \arg\min z(x)$ and let $s \lt S$ satisfy $z(s) = K + z(S)$. Then the optimal rule is

    $$\text{if } x_0 \le s:\ \text{produce } S - x_0; \qquad \text{if } x_0 \gt s:\ \text{produce nothing.}$$

    $S$ is the order-up-to level and $s$ the reorder point (the slide calls $s$ a reorder quantity, but it is a stock level). With $K = 0$, $s = S$ and the rule is "always top up to $S$".

    Why does the policy order up to $S$ rather than some smaller amount?

    Because $S$ is the largest possible stock
    $S$ is the minimiser of $z$, not a capacity.
    Because once $K$ is paid, the best level to reach is the one that minimises $z(x)$, which is $S$
    Right. $K$ does not depend on how much we produce.
    Because ordering less would cost $K$ twice
    There is only one decision here; the reason is simpler.
    Try it

    The curve is the expected cost $z(x)$ for the sweets with uniform demand on $[100, 300]$. Raise $K$ and watch $s$ move left: the band where "do nothing" is best widens. Drag the starting stock $x_0$ to see the decision.

    Sweets with uniform demand on $[100, 300]$ ($C = 20$, $R = 50$, $V = 5$) and a set-up cost $K = ₹200$ per production run. Find $S$ and $s$, and decide for $x_0 = 150$ and $x_0 = 210$.

    1. $S$ is the newsvendor quantity: $S = 233.33$.

      From Chapter 4.2; $K$ does not change where the bottom of $z$ is.

    2. On $[100, 300]$, $z''(x) = (R - V)f(x) = 45/200 = 0.225$ is constant, so $z$ is a parabola: $z(x) - z(S) = \tfrac12(0.225)(x - S)^2$.

      Uniform density is constant, and $z'(S) = 0$.

    3. Solve $\tfrac12(0.225)(S - s)^2 = 200$: $S - s = \sqrt{2 \cdot 200/0.225} = 42.16$, so $s = 191.17$.

      $z(s) = K + z(S)$ by definition. In general here $S - s = \sqrt{2K(b - a)/(R - V)}$: a square root, as in the EOQ.

    4. $x_0 = 150 \le s$: produce $233.33 - 150 = 83.33$. $x_0 = 210 \gt s$: produce nothing, since $z(210) - z(S) = 61.25 \lt 200$.

      At 210 the expected loss from being below $S$ is smaller than the set-up cost.

    Same sweets and uniform demand, but $K = ₹90$. Find $S - s$ and $s$.

    $S - s = \sqrt{2K(b - a)/(R - V)}$ with $S = 233.33$.

    $\sqrt{2 \cdot 90 \cdot 200/45} = \sqrt{800} = 28.28$, so $s = 233.33 - 28.28 = 205.05$.

    With $K = 200$ ($s = 191.17$, $S = 233.33$), the shop starts with $x_0 = 200$. What should it do?

    Compare $x_0$ with $s$, or compare $z(200) - z(S)$ with $K$.

    $200 \gt s$; equivalently $z(200) - z(S) = \tfrac12(0.225)(33.33)^2 = 125 \lt 200$. Producing would save 125 in expected cost but cost 200 to set up.

    How much higher is the expected cost at $x_0 = 200$ than at $S$ (no set-up cost included)?

    $\tfrac12 \cdot 0.225 \cdot (S - 200)^2$.

    $0.1125 \times 33.33^2 = 125$.

    If $K = 0$, the $(s, S)$ policy becomes…

    never order
    Free set-ups make ordering more attractive.
    order up to $S$ whenever stock is below $S$ ($s = S$)
    Right. With no set-up cost any shortfall below $S$ is worth fixing.
    order exactly $s$ units
    $s$ is a stock level, not an order size.

    As $K$ grows, $s$…

    moves towards $S$
    A larger set-up cost needs a bigger gap to be worth paying.
    stays fixed
    $s$ is defined through $K$.
    moves further below $S$
    Right. $z(s) = K + z(S)$ needs a larger rise of $z$.

    Does $K$ change the order-up-to level $S$?

    No: $S$ minimises $z(x)$, which does not contain $K$
    Right. $K$ only decides whether to order.
    Yes, $S$ rises with $K$
    Look at what $S$ minimises.
    Yes, $S$ falls with $K$
    Look at what $S$ minimises.
    • Find $S$ first (the newsvendor), then $s$ from $z(s) = K + z(S)$ on the left of $S$.
    • Read $s$ as a stock level that triggers an order.
    • Ordering $S$ units instead of $S - x_0$.
    • Taking the root of $z(s) = K + z(S)$ to the right of $S$: we need $s \lt S$.
    1. With a set-up cost $K$, order only if $z(x_0) \gt K + z(S)$.
    2. $(s, S)$: if $x_0 \le s$ order up to $S$; else nothing. $S$ = newsvendor quantity.
    3. Uniform demand: $S - s = \sqrt{2K(b-a)/(R-V)}$.

    $s = 40$, $S = 100$, stock $x_0 = 30$. Order…

    70 units
    Up to $S$: $100 - 30$.
    100 units
    That overshoots $S$.
    nothing
    $30 \le s$.

    $s = 40$, $S = 100$, $x_0 = 55$. Order…

    45 units
    $55 \gt s$.
    nothing
    Above the reorder point.
    15 units
    The policy never orders up to $s$.

    $s$ is defined by…

    $z(s) = K + z(S)$, $s \lt S$
    Indifference between ordering and not.
    $F(s) = \alpha$
    That defines $S$.
    $s = S - K$
    The gap depends on the shape of $z$.

    Programme booklets for a one-day event cost ₹30, sell for ₹80 and are worthless afterwards. Critical ratio?

    0.375
    That is $C/R$, the overage share.
    0.625
    Right. $(80-30)/(80-0) = 50/80$.
    0.5
    Only when $c_u = c_o$.

    Demand for those booklets is uniform on $[200, 600]$. How many should be printed?

    400
    That is the mean; the ratio is not 0.5.
    450
    Right. $200 + 0.625 \times 400$.
    250
    That uses $1 - \alpha$.

    What do the EOQ and the $(s,S)$ gap for uniform demand have in common?

    Both grow like the square root of the fixed cost $K$
    Right: $\sqrt{2KD/H}$ and $\sqrt{2K(b-a)/(R-V)}$.
    Both ignore holding cost
    Holding (or leftover) cost appears in both.
    Both need integer variables
    Neither does.

    Which feature separates the newsvendor from Wagner–Whitin?

    A fixed ordering cost
    Wagner–Whitin has one; the basic newsvendor does not, but that is not the main difference.
    Holding cost
    Both price leftover stock in some way.
    Demand is random and must be committed to before it is seen
    Right.

    Lecture 15 assumes orders arrive instantly. Real orders take time, and demand during that time is uncertain. This part, which goes beyond the slides, adds lead time and safety stock, the $(Q, r)$ policy, three standard EOQ variants (backorders, gradual production, quantity discounts), and ends with a map of which model fits which situation.

    You need: Part 2 (EOQ) and Part 4 (critical ratio, normal quantiles).

    Lead times, reorder points and safety stock

    When an order takes $L$ days to arrive, you must order before the shelf is empty, at a reorder point that covers demand during those $L$ days, plus a cushion if that demand is uncertain.

    The EOQ answers "how much", the reorder point answers "when", and the cushion, safety stock, is where uncertainty costs money every day.

    You start boiling water for tea a few minutes before you want it, and a little earlier if the kettle is unpredictable.

    Known lead time, known demand

    Suppose a warehouse uses 50 units a week, steadily, and the supplier takes $L = 2$ weeks to deliver. If it orders when the shelf hits zero, it waits two weeks with nothing. Instead it orders when the stock falls to the demand during the lead time:

    $$r = D \cdot L = 50 \times 2 = 100 \text{ units}.$$

    When the shelf reaches 100, an order goes out; two weeks and 100 units later, the shelf is empty exactly as the order arrives. The sawtooth is unchanged; only the timing of the order moved earlier. The order size is still the EOQ.

    If the lead time is longer than a cycle, several orders are in transit at once. Then the rule uses the inventory position (on hand plus on order) instead of the shelf: order when the position falls to $r$.

    Demand is a steady 30 units a day and the lead time is 4 days. With no uncertainty, at what stock level should you order?

    30
    That covers one day of the four.
    120
    Right. $30 \times 4$: what will be used while the order travels.
    0
    Then you wait four days with an empty shelf.

    Uncertain demand during the lead time

    Now say weekly demand has mean 50 and standard deviation 10, independently from week to week. Over $L = 2$ weeks, demand has mean $50 \times 2 = 100$, and variances add: the variance is $2 \times 10^2$, so the standard deviation is $10\sqrt{2} = 14.14$. Ordering at $r = 100$ runs out in about half of all cycles, whenever lead-time demand comes in above average.

    To run out less often, order earlier: add safety stock $SS$ on top of the mean, $r = \mu_L + SS$. The probability of not running out during a lead time is the cycle service level. With normal lead-time demand, a service level $\alpha$ needs

    $$r = \mu_L + z_\alpha\, \sigma_L, \qquad \mu_L = \mu L, \qquad \sigma_L = \sigma\sqrt{L},$$

    where $\mu$ and $\sigma$ are the mean and standard deviation of demand per period. The safety stock is $z_\alpha \sigma\sqrt L$.

    For 95% service: $z_{0.95} = 1.645$, $SS = 1.645 \times 14.14 = 23.26$, $r = 123.26$. For 99%: $z_{0.99} = 2.326$, $SS = 32.9$. Those last few percentage points are expensive: the safety stock sits on the shelf all year, costing $H \cdot SS$ every year.

    This is the newsvendor idea again. Each lead time is a one-shot bet: the reorder point is a quantile of lead-time demand, and the service level plays the role of the critical ratio.

    Watch the inventory position continuously (continuous review). Whenever it falls to $r$, order $Q$. A simple, near-optimal way to set the two numbers: $Q$ from the EOQ, $r = \mu_L + z_\alpha\sigma_L$ from the chosen service level. Compare the $(s, S)$ policy of Part 4: there the order size varies ($S - x_0$); here it is fixed.

    Try it

    A year of random weekly demand (mean 50, standard deviation 10) under a $(Q, r)$ policy with $Q = 200$. Raise the safety stock and count the cycles that run out. Then lengthen the lead time and see how much more safety stock the same service needs.

    Weekly demand has mean 50 and standard deviation 10; the lead time is 4 weeks. Find the reorder point for 95% cycle service.

    1. $\mu_L = 50 \times 4 = 200$, $\sigma_L = 10\sqrt4 = 20$.

      Means add over weeks; variances add, so standard deviations grow with $\sqrt L$.

    2. $SS = 1.645 \times 20 = 32.9$.

      $z_{0.95} = 1.645$.

    3. $r = 200 + 32.9 = 232.9$.

      Doubling the lead time from 2 to 4 weeks raised the safety stock from 23.26 to 32.9: by $\sqrt2$, not 2.

    Demand is a steady 50 units a week and the lead time is 2 weeks. What is the reorder point with no uncertainty?

    $r = D \cdot L$.

    $50 \times 2 = 100$.

    Weekly demand mean 50, standard deviation 10, $L = 2$ weeks, 95% service ($z = 1.645$). Enter the safety stock and the reorder point.

    $\sigma_L = 10\sqrt2$.

    $SS = 1.645 \times 14.142 = 23.26$; $r = 100 + 23.26 = 123.26$.

    The lead time quadruples, everything else fixed. The safety stock for the same service level…

    $SS = z\sigma\sqrt L$.

    $\sqrt4 = 2$: it doubles.

    Holding costs ₹4 per unit per year. What does the 95% safety stock of 23.26 units cost per year?

    Safety stock is on the shelf all the time.

    $4 \times 23.26 = ₹93.05$ a year.

    Why use the inventory position rather than the stock on the shelf to trigger orders?

    Because the shelf count is often wrong
    Counting errors are a separate issue.
    Because units already ordered will arrive; ignoring them would trigger duplicate orders
    Right. It matters when the lead time exceeds the cycle.
    Because backorders do not exist
    The position subtracts backorders when they exist.

    Standard deviation of demand over 9 days, if one day's is 4 and days are independent?

    36
    Standard deviations do not add; variances do.
    12
    Right. $4\sqrt9$.
    4
    More days, more uncertainty in total.

    The reorder point is to a lead time what the newsvendor quantity is to a season, because…

    both pick a quantile of uncertain demand that must be covered before it is seen
    Right.
    both use the EOQ
    Neither quantile comes from the EOQ.
    both ignore holding cost
    Holding cost is what makes too much stock expensive in both.
    • Convert demand to the lead-time scale first: mean × $L$, standard deviation × $\sqrt L$.
    • Price the safety stock: $H \cdot SS$ per year.
    • Multiplying the standard deviation by $L$ instead of $\sqrt L$.
    • Ignoring stock already on order when lead times are long.
    1. Order at $r = \mu_L + z_\alpha\sigma_L$; with no uncertainty, $r = DL$.
    2. Safety stock $z_\alpha \sigma\sqrt L$ grows with the square root of the lead time.
    3. $(Q, r)$: $Q$ from the EOQ, $r$ from the service level.

    $\mu = 20$ per day, $L = 5$ days, no uncertainty. $r$?

    100
    $20 \times 5$.
    25
    That adds instead of multiplies.
    4
    $\mu/L$ has no meaning here.

    Moving from 95% to 99% service…

    raises safety stock from $1.645\sigma_L$ to $2.326\sigma_L$
    The z-value grows.
    doubles the reorder point
    Only the safety part changes.
    does not change $r$
    $z_\alpha$ changes.

    In a $(Q, r)$ policy, the order size is…

    fixed at $Q$
    Unlike $(s, S)$.
    $S - x_0$
    That is $(s, S)$.
    the reorder point
    $r$ decides when.

    Three EOQ variants: backorders, gradual production, discounts

    Each variant changes one assumption of the EOQ and keeps the same method: draw the inventory picture, write the cost per unit time, differentiate.

    Knowing them lets you adapt the EOQ when an exam or a real problem bends one assumption.

    A recipe you know well can be adjusted for fewer eggs or a smaller oven; the method stays, the quantities shift.

    All three use the Banyan Store: $D = 2400$ per year, $K = 300$, $H = 4$, with EOQ $Q^* = 600$ and yearly cost ₹2400.

    1. Planned backorders

    Suppose students accept waiting for a notebook, at a cost of $p$ per notebook per year of waiting. Then it pays to let the stock dip below zero before each delivery: the delivery first clears the waiting list. Holding less stock saves $H$; making customers wait costs $p$. The results:

    $$Q^* = \sqrt{\frac{2KD}{H}}\sqrt{\frac{H + p}{p}}, \qquad \text{maximum backorder } B^* = Q^*\frac{H}{H + p}.$$

    With $p = 16$: $Q^* = 600\sqrt{20/16} = 670.82$, $B^* = 134.16$, and the yearly cost falls to $2400\sqrt{16/20} = ₹2146.6$. As $p \to \infty$ (waiting is unacceptable), the factor goes to 1 and we are back at the EOQ.

    2. Gradual production (finite production rate)

    If the shop makes its own notebooks at $P = 9600$ a year while selling 2400 a year, stock builds up at $P - D$ during a run instead of jumping by $Q$. The peak is only $Q(1 - D/P)$, so holding is cheaper and runs can be longer:

    $$Q^* = \sqrt{\frac{2KD}{H(1 - D/P)}} = \frac{600}{\sqrt{0.75}} = 692.82, \qquad \text{peak stock } 519.6, \qquad \text{cost } ₹2078.5.$$

    This is the economic production quantity (EPQ). As $P \to \infty$, it becomes the EOQ.

    In both variants above, $Q^*$ is larger than the EOQ. Why?

    Because demand is higher
    $D$ is unchanged.
    Because each unit of $Q$ now costs less to hold on average, so larger batches pay off
    Right. Backorders and gradual production both lower the average stock per unit of $Q$.
    Because ordering costs more
    $K$ is unchanged.

    3. Quantity discounts (all-units)

    Now the price depends on $Q$, so the purchase cost $CD$ can no longer be ignored. Suppose the wholesaler charges ₹40 per notebook below 1000, and ₹38.40 (4% off) for every notebook in an order of 1000 or more; holding stays at 10% of the price.

    • At ₹40: EOQ 600 is allowed. Yearly cost $96{,}000 + 2400 = ₹98{,}400$.
    • At ₹38.40: $H = 3.84$, EOQ $= \sqrt{2 \cdot 300 \cdot 2400/3.84} = 612.4$, which is below 1000 and so does not qualify. The best allowed size is the threshold, 1000: purchase $92{,}160$, ordering $300 \times 2.4 = 720$, holding $3.84 \times 500 = 1920$, total ₹94,800.

    Take the discount: order 1000. The rule: for each price, find the EOQ, move it up to the price's threshold if it falls below, compute the total including $CD$, and pick the cheapest.

    Try it

    Switch between the basic EOQ, planned backorders and gradual production. Drag the slider for the waiting cost $p$ or the production rate $P$ and compare the inventory pictures and the best order size.

    Should the Banyan Store order a whole year's supply (2400) at the discounted price of ₹38.40?

    1. Purchase: $2400 \times 38.40 = 92{,}160$.

      The same price as for 1000, since both qualify.

    2. Ordering: one order, ₹300. Holding: $3.84 \times 1200 = 4608$.

      Average stock is $Q/2 = 1200$.

    3. Total ₹97,068, which is more than ₹94,800 at $Q = 1000$. Do not.

      Above the threshold the price no longer falls, and every extra unit of $Q$ only adds holding cost.

    With planned backorders, by what factor does $Q^*$ exceed the EOQ when the backorder cost $p$ equals $H$?

    $\sqrt{(H + p)/p}$.

    $\sqrt{2H/H} = \sqrt2 = 1.4142$.

    In the EPQ, by what factor does $Q^*$ exceed the EOQ when the production rate is twice the demand rate?

    $1/\sqrt{1 - D/P}$.

    $1/\sqrt{1 - 1/2} = \sqrt2 = 1.4142$.

    Yearly total cost (purchase + ordering + holding) of ordering 1000 at ₹38.40, with $H = 3.84$?

    $92{,}160 + 300 \cdot 2400/1000 + 3.84 \cdot 500$.

    $92{,}160 + 720 + 1920 = ₹94{,}800$.

    Why can the purchase cost not be dropped with quantity discounts?

    Because it is large
    Size was never the reason it could be dropped.
    Because it now depends on $Q$
    Right. The argument "constant for every $Q$" no longer holds.
    Because holding cost is zero
    Holding is still charged.

    Planned backorders with $p \to \infty$ give…

    $Q^* \to \infty$
    The factor $\sqrt{(H+p)/p}$ goes to 1.
    the basic EOQ
    Right. Infinitely costly waiting means no waiting.
    $Q^* = 0$
    The factor goes to 1, not 0.

    In the EPQ the peak stock is $Q(1 - D/P)$ because…

    during a run stock rises at $P - D$, not at $P$, since selling continues
    Right. The run lasts $Q/P$, so the peak is $(P - D)Q/P$.
    part of production is lost
    Nothing is lost.
    demand stops during production
    Demand continues, which is the point.
    • Draw the new inventory picture first; the cost formula follows from its areas.
    • With discounts, compare total cost including purchases at each price break.
    • Using an EOQ that falls below a discount threshold as if it qualified.
    • Forgetting that each variant reduces to the EOQ in its limit ($p \to \infty$, $P \to \infty$).
    1. Backorders: $Q^* = \text{EOQ}\cdot\sqrt{(H+p)/p}$.
    2. Gradual production: $Q^* = \text{EOQ}/\sqrt{1 - D/P}$.
    3. Discounts: evaluate each price at its best allowed $Q$, including the purchase cost.

    EPQ with $P = 4D$. Peak stock as a fraction of $Q$?

    0.75
    $1 - 1/4$.
    0.25
    That is $D/P$.
    1
    That is instant delivery.

    The EOQ at a discount price is 400, but the discount needs 500. You should consider…

    ordering 500 at that price
    Move up to the threshold.
    ordering 400 at that price
    400 does not qualify.
    ignoring that price
    It may still be cheapest at 500.

    Allowing backorders makes the yearly cost…

    lower (or equal)
    More options can only help.
    higher
    You may always choose not to backorder.
    unpredictable
    The formula gives it exactly.

    Which model, when

    Every model in this course is the answer to a short list of questions about the situation: is demand known, is it steady, is there one chance or many, is there a fixed cost?

    Recognising the situation is most of the work; the formulas follow.

    A doctor's first job is the diagnosis; the prescription is standard once the diagnosis is right.

    SituationModelDecision rule
    Known, constant demand; fixed cost per order; runs indefinitelyEOQ (Part 2)$Q^* = \sqrt{2KD/H}$
    Known, constant demand over a season of length $T$Finite-horizon EOQ (2.3)$n^* = T\sqrt{HD/(2K)}$, compare neighbours
    Known demand that changes by period; fixed cost per orderWagner–Whitin (Part 3)Shortest path, $f(j) = \min_i f(i) + w_{ij}$
    Random demand, one chance to order, no set-up costNewsvendor (4.1–4.2)$F(x^*) = (R - C)/(R - V)$
    Random demand, starting stock, set-up cost$(s, S)$ (4.3)Order up to $S$ if $x_0 \le s$, with $z(s) = K + z(S)$
    Ongoing random demand with a lead time$(Q, r)$ (5.1)$Q$ = EOQ, $r = \mu_L + z_\alpha\sigma_L$

    A school orders exam answer booklets once, before exam week; the number of students sitting is uncertain; unused booklets are recycled for a little money. Which model?

    EOQ
    Demand is not steady and known.
    Wagner–Whitin
    Demand is not known.
    Newsvendor
    Right: one order, random demand, salvage value.
    Try it

    Answer three questions about a situation; the widget names the model and its rule.

    A fuel station receives a tanker delivery; each delivery costs ₹4000 regardless of size, pumps sell a steady 3000 litres a day, and the station plans for the long run. Which model, and what is the first quantity to compute?

    1. Demand is known and steady, there is a fixed cost per delivery, and the horizon is long.

      These three facts point to the EOQ.

    2. Compute $Q^* = \sqrt{2KD/H}$ with $D$ in litres per day and $H$ in rupees per litre per day.

      Units of $D$ and $H$ must match.

    3. If the tanker takes 2 days to arrive, add the reorder point $r = 3000 \times 2 = 6000$ litres.

      Lead time changes when to order, not how much.

    A factory has firm orders for the next 8 weeks (different every week), pays a set-up cost per production run, and a holding cost per unit per week. Which model?

    Known but changing demand per period.

    Wagner–Whitin: known, time-varying demand with a fixed set-up cost.

    A hospital pharmacy restocks an antibiotic continuously; daily use is random; deliveries take 3 days. Which policy?

    Ongoing demand, uncertainty, and a lead time.

    $(Q, r)$: $Q$ from the EOQ, $r$ from lead-time demand and a service level.

    A publisher prints a one-off commemorative calendar; demand is uncertain and unsold copies are pulped. Which model?

    One chance, random demand.

    Newsvendor with $V = 0$.

    What single feature sends you from the EOQ to Wagner–Whitin?

    A holding cost
    Both have one.
    Demand that changes from period to period
    Right.
    A fixed order cost
    Both have one.

    What sends you from the newsvendor to $(s, S)$?

    Random demand
    Both have it.
    A salvage value
    Both can have one.
    A set-up cost and stock already on hand
    Right.

    Which quantity is a quantile of demand?

    The newsvendor $x^*$ and the reorder point $r$
    Right. Both are $F^{-1}$ of a target probability.
    The EOQ
    The EOQ has no randomness.
    The Wagner–Whitin $f(n+1)$
    That is a cost.
    • Ask first: known or random demand? Steady or changing? One shot or ongoing? Fixed cost?
    • State the assumptions you are using when you name a model.
    • Applying the EOQ to lumpy, time-varying demand.
    • Using the newsvendor for ongoing replenishment without thinking about lead time.
    1. Known and steady: EOQ. Known and changing: Wagner–Whitin.
    2. Random, one shot: newsvendor; add a set-up cost and starting stock: $(s, S)$.
    3. Random and ongoing with a lead time: $(Q, r)$ with safety stock.

    Steady known demand, fixed cost, forever.

    EOQ
    The classic case.
    Newsvendor
    Demand is known.
    Wagner–Whitin
    Demand is steady.

    Random demand, one order before a festival.

    EOQ
    Demand is random.
    Newsvendor
    One shot, uncertainty.
    (Q, r)
    There is no ongoing replenishment.

    Firm weekly orders that differ week to week.

    Wagner–Whitin
    Known, changing demand.
    EOQ
    Demand is not steady.
    Newsvendor
    Demand is known.

    Holding cost falls by 75% (to a quarter). The EOQ…

    quadruples
    $H$ is under a square root.
    doubles
    Right. $1/\sqrt{1/4} = 2$.
    falls
    Cheaper holding favours larger orders.

    The zero-inventory property lets Wagner–Whitin be solved as…

    an LP with no integer variables
    The reduction is to a graph problem.
    a shortest path over $n+1$ period nodes
    Right.
    an EOQ with average demand
    That would ignore the changes in demand.

    Normal demand, $\mu = 500$, $\sigma = 80$, critical ratio 0.95 ($z = 1.645$). Order quantity?

    500
    That is the mean; the ratio is not 0.5.
    368.4
    That subtracts.
    631.6
    Right. $500 + 1.645 \times 80$.

    $(s, S)$ and $(Q, r)$ differ mainly in…

    the order size: $S - x_0$ varies, $Q$ is fixed
    Right. Both order when stock is low.
    whether demand is random
    Both assume random demand.
    whether there is a fixed cost
    Both make sense with a fixed cost.
    Every question, answered right

    You made it all the way down.

    You worked through every quiz and every practice problem in Inventory Optimization. That took real effort, and the understanding is yours to keep. Add your name to make a certificate.