Technical

How much, and when

The newsvendor problem, the lead time and the MOQ. The difference between a domestic supplier and the Far East, and the cost of the "half the initial buy" rule.

Repeat Order (RPT) · 5 / 6

For a product we have decided is a candidate, two questions are left: how much do we order, and when? Banu’s rule gives both a fixed answer: half the initial buy, from the third Monday on. In this article we work both answers out from a sum.

The newsvendor

Picture a child who buys newspapers in the morning. The child does not know how many will sell by the evening. Buy too few and the papers run out and customers are turned away. Buy too many and the papers left over go in the bin. How many should the child buy?

The answer depends on the cost of the two mistakes. The cost of one paper too few is the profit missed; the cost of one paper too many is the cost price thrown away. The child should buy up to this point in the distribution of sales:

P(demand≤Q)=CuCu+CoP(\text{demand} \le Q) = \frac{C_u}{C_u + C_o}

CuC_u is the cost of one unit short, CoC_o the cost of one unit over. If the ratio is large you act boldly, if it is small, cautiously. This is called the critical ratio.

The RPT is the in-season version of the same problem, with three differences. The demand distribution comes from today’s estimate, not from the past. The stock does not arrive today but at the end of the lead time. And a surplus unit does not go in the bin; it is left first for markdown and, once the season closes, for the outlet.

Lumoda’s scales

The average figures for the Collection products of the two game seasons:

TRY
List price990
Cost price364
Expected price in the markdown period676

The cost of a unit short is the full-price profit missed: CuC_u = 990 − 364 ≈ TRY 626. A surplus unit can meet one of two fates. If it sells at markdown it brings in TRY 676: above the cost price. So even selling at markdown is profitable; the cost of a surplus unit turns negative, roughly TRY −312. If it never sells, its cost is the whole cost price, TRY 364.

The first case may look surprising, but in fashion retail it is common: with the list price at 2.72 times the cost price, even thirty or fifty per cent off stays above cost. For every one of the two seasons’ 420 Collection products, the expected markdown price is above cost. What makes an RPT dangerous is not selling at markdown, it is not selling at all. For the balance between full price and never selling alone, the critical ratio is 63.2%.

Nobody writes down the markdown period’s price in advance. At Lumoda markdowns are set not by a plan but by a rule, and the rule looks at how much a product has sold. So we learn the expectation from the past: in the seasons that closed before this one, how much markdown did Collection products that came in with the same wave see, on average, in the first week of markdown, the second, and after? We count the weeks not from launch but from the product’s own markdown start; otherwise two kinds of season, with markdowns starting in different weeks, would be mixed in the same average. A product’s expected markdown is the average of the weekly markdown rates, each week weighted by the share of demand falling in it, because markdown demand is concentrated in the first weeks. The game season’s own prices are not looked at. The expectation that comes out is, on average, 68.3% of the list price.

One more detail. The quantity sum counts a unit left over when the season closes at TRY 0. The games’ profit measure is a little more generous: when the season closes, the stock in the warehouse goes to the outlet and what sells there counts as revenue; only stock still unsold at the very end is TRY 0. So the quantity sum sees the cost of a surplus unit as slightly higher than it is. The error is on the cautious side.

Uncertainty

To order by the critical ratio you need not a single estimate but a distribution. That is what we said at the end of the third article: saying “season demand is 3,807” is not enough; you also need to know how far that number could move.

We learn that from the past too. We go back to every season that closed before this one and rebuild each product’s d estimate, at every decision Monday, with what was known that morning. Then we take its ratio to the season’s (launch to markdown) filled-in demand. Not to real demand, because in the field that does not exist; to the demand filled in with the same method after the season has closed. The standard deviation of the logarithm of this ratio:

Seasonh=2h=3h=4h=5h=6
Autumn-winter (from three past seasons)0.3970.3180.2750.2370.197
Spring-summer (from four past seasons)0.3720.3060.2660.2290.195

The distribution is wide. On the third Monday σ is 0.306; roughly, for one product in three, season demand comes out below three-quarters of the estimate or above it by more than a third. In past seasons the average error is very close to zero. In the third article we saw d run low in spring-summer; that slide did not show in past seasons, because the season’s curve did not resemble the past. Uncertainty learnt from the past does not know this season’s surprise in advance.

Every week you wait, the distribution narrows. That is the value of waiting. Its cost is the lead time: every week you wait, the stock arrives a week later, and another week of the curve slips away.

Quantity

Back to the jacket’s third Monday. The estimate and the life cycle curve split the remaining demand into three parts:

PeriodExpected demand
From today to the RPT’s arrival2,262
From arrival to markdown, at full price471
After arrival, the markdown period1,826

The first part is demand the RPT cannot reach in time. There are 777 units in the warehouse and the stores; they will cover only a third of the first part. The RPT is aimed at the second and third parts. The jacket came in with the third wave: when the RPT arrives the full-price window is narrow and the markdown period wide.

In code the sum is short. Each column is a scenario from the distribution, each row an order quantity:

def profit_curve(Q: np.ndarray, B, Xfp, Xmd, ip, p, p_md, c):
    """Expected (full-price sales, markdown sales, profit) for a grid of Q."""
    C0 = np.maximum(ip - B, 0.0)
    C1 = np.maximum(C0 - Xfp, 0.0)
    need_fp = np.maximum(Xfp - C0, 0.0)[None, :]
    need_md = np.maximum(Xmd - C1, 0.0)[None, :]
    Qm = Q[:, None].astype(float)
    fp = np.minimum(Qm, need_fp)
    md = np.minimum(Qm - fp, need_md)
    profit = p * fp + p_md * md - c * Qm
    return fp.mean(1), md.mean(1), profit.mean(1)

ip is the stock position: warehouse, stores, stock in transit and open orders. B is demand until arrival; C0 is what will be left on hand when the RPT arrives. The RPT first covers the part of full-price demand that the stock on hand cannot meet, then the markdown period’s demand. The average over the scenarios is the expected profit; the quantity with the largest expected profit is chosen. Then come two gates. If the quantity is below the supplier’s MOQMinimum order quantity; the smallest number of units a supplier accepts for an order. In a repeat order it is the gate the decision has to pass through., it either goes up to the MOQ or down to zero. And an order not expected to sell half the MOQ at full price is not placed at all; the fourth article’s label used the same threshold.

The jacket’s list price is TRY 2,130, its cost TRY 818, its expected markdown price TRY 1,463. What the methods say:

MethodWhenOrder
Banu: half the initial buythird Monday930
FRR rulethird Monday620
Newsvendorthird Monday2,090
Recommend: candidate model + newsvendorsecond Monday2,120
Oraclesecond Monday2,160

The newsvendor asks for more than twice Banu’s quantity. Its expected sales are 471 units at full price and 1,444 at markdown; its expected profit TRY 1,405,891. Most of the sales fall in the markdown period, and the newsvendor orders anyway, because even the markdown price is above cost.

The FRR rule asks for even less than Banu. It scales raw sales up with the raw curve; as we saw in the third article, that sum is censored in two places and goes most wrong on the biggest hit.

The last two rows are from the morning a week earlier. The recommend arm combines the fourth article’s candidate model with this sum; it finds the jacket a candidate on the second Monday and asks for 2,120 units. On a morning when the estimate is more uncertain, it is a number close to what the newsvendor will say a week later.

The oracle is a comparison arm in this series. It knows what demand will come in the future had no RPT been placed; as if it had seen the same customer stream without the RPT. It also knows how many days late the supplier will really be, while the other arms decide on the planned lead time. For each product it weighs every option between the second and the sixth Monday and picks the most profitable. But it thinks at chain level and does not know which store the stock will be left in. So it is not an upper bound but a pointer. For the jacket it says 2,160: almost the same number as the recommend arm, which does not know demand.

A belt from the Far East

Now let’s look at a product from the Far East. The Woven Belt, in black, that Veli mentioned at the end of the first article: it came in with the first wave, and its supplier, Tiruppur Ganga, is in India. It makes a repeat order in fourteen weeks and will not accept fewer than 600 units. Looking back once the season had closed, its real demand was 1.81 times its plan. It too is a hit.

On the third Monday the chain STR is 40.2%, below Banu’s threshold. The newsvendor says zero too; without the MOQ the best quantity would be 190. A week later the STR rises to 57.8% and the rule fires. That morning’s sum:

PeriodExpected demand
From today to the RPT’s arrival1,197
From arrival to markdown, at full price38
After arrival, the markdown period144

An order placed that morning will arrive in week eighteen, two weeks before markdown. All the demand left after arrival, full price and markdown together, does not come to even a third of the supplier’s MOQ. The newsvendor says zero again; even without the MOQ gate the best quantity is 170, an order the supplier would not accept. Neither the recommend arm nor FRR places an order.

Banu’s rule placed 600. The initial buy was 1,030, half of it 515; because the MOQ is 600, the order went up to 600. Pelin’s question from the first article is sharper here: 600 based on what? Not on demand, not even on the initial buy. On the supplier’s minimum quantity.

The oracle, on the other hand, does give this belt an RPT, but on another morning: the second Monday, at the MOQ, 600 units. With the supplier’s real delay the stock arrives 16.1 weeks after launch, nearly four weeks before markdown. What the same 600 belts earn when ordered two weeks earlier we will see in the last article.

When

Run every Monday, the recommend arm placed RPTs on 77 products in spring-summer, 70 of them on the second Monday. In autumn-winter it placed them on 72 products, all but one on the second Monday. The arms’ RPTs in spring-summer, by decision week:

Armh=2h=3h=4h=5h=6
Banu020402320
FRR, third Monday019000
Recommend705200
Oracle1290000

Banu’s rule first looks at a product on the third Monday and places most of its orders on the fourth Monday and after. The oracle weighs all five weeks for every product and places all 129 of its orders on the second Monday; in autumn-winter, all 116 too. Even if you know demand, the best week is the earliest week you can choose.

This is another face of the previous article’s window. For a domestic product the estimate is still uncertain on the second Monday, but the cost of waiting is bigger. Waiting a week reduces the uncertainty a little; it makes you miss the top of the curve. Fisher, Rajaram and Raman found the best ordering week at their retailer to be the second. At Lumoda the result is the same.

By origin

Let’s run the arms on the same demand and measure the difference in gross profit against a season in which no RPT is placed. In all of them the incoming stock goes to the stores under allocation rule b, which we describe in the sixth article; so the difference comes only from the decision. The tables add up the profit difference only for the products that got an RPT; the recommend arm was run with the LightGBM candidate model.

The autumn-winter season (number of products given an RPT, and profit difference, TRY):

ArmDomesticDomestic Δ profitEgyptEgypt Δ profitFar EastFar East Δ profit
Banu6420,473,55411−1,531,07721−10,899,477
FRR, third Monday1710,473,9061166,6722−970,373
Recommend5131,111,55110−660,419112,738,794
Oracle6152,048,202131,809,1914212,920,614

The spring-summer season:

ArmDomesticDomestic Δ profitEgyptEgypt Δ profitFar EastFar East Δ profit
Banu7541,052,6991221,499,381168,661
FRR, third Monday1726,369,73617,439,748141,431
Recommend6270,921,395921,201,40865,382,253
Oracle6991,418,6751438,907,0044610,139,345

In autumn-winter Banu’s 21 Far East RPTs, 53,840 units in total, brought in only 431 units of extra full-price sales after arrival, and lost TRY 10,899,477. In spring-summer the 16 Far East RPTs broke even: TRY 8,661. In these tables the stock is allocated with rule b. With today’s allocation, that is, in the world Banu actually lived in, the same orders lose money in both seasons: TRY 19,697,766 in autumn-winter, TRY 5,405,735 in spring-summer.

The recommend arm and the oracle, on the other hand, make money from the Far East. The recommend arm placed RPTs on 11 Far East products in autumn-winter and 6 in spring-summer; the oracle on 42 and 46. The difference is in the timing and size of the order. Both order almost always on the second Monday and, per Far East product, smaller than Banu. Banu’s rule first looks at a Far East product on the third Monday and asks for half the initial buy, at least the MOQ.

On the domestic side Banu’s rule makes money in both seasons, but in autumn-winter two-thirds of what the recommend arm makes, and in spring-summer a little over half. It places RPTs on more domestic products than the recommend arm and makes less: because the quantity is fixed it orders too little on the hits, and, as we saw in the fourth article, its real loss is on the products it misses. For products from Egypt the result changes with the season: in autumn-winter both Banu and the recommend arm lose a little; in spring-summer the two make almost the same amount.

The FRR rule is cautious: 20 and 19 RPTs in the two seasons, and it makes money on its domestic orders. Because it scales with censored data it underestimates demand and leaves part of what it could have made on the hits.

The sixth article’s tables will add up the whole Collection. Those totals will not come out the same as the ones here; we explain why there.

What is hard in your data

The markdown price. Lumoda’s markdown rule is the same from season to season, so learning the expectation from the past works. If your chain’s markdown policy has changed, past prices do not represent the future. There is one more thing: if markdown looks at sales, the surplus stock an RPT brings in can deepen the markdown. The sum does not see that; the expected price is an average independent of the product’s own order.

Uncertainty. We measured σ against demand filled in at the end of the season, because in the field there is no other answer key. The error of the filling-in itself is not inside this distribution. At Lumoda we can measure it with a referee; in your data you cannot.

Supply terms. The MOQ and the repeat-order lead time are fixed in this sum. In reality they change through negotiation, and the Far East’s answer is sometimes not an RPT but a shorter lead time, or fabric reserved in advance.

Summary

  • The RPT quantity is a newsvendor problem. This season’s estimate, the uncertainty the past teaches, and the cost of the two mistakes are enough.
  • If the markdown price is above cost, an RPT’s real risk is not selling at all. So if the full-price demand left after arrival does not reach half the MOQ, no order is placed.
  • The best week is the second Monday. Even the oracle, which knows demand, goes there.
  • In the Far East an RPT makes a profit only if it is placed early and small. Placed like Banu’s rule, on the third Monday or later and at half the initial buy, it mostly does not. The other answers are a shorter lead time, or the initial order itself.

In the last article we go back to Veli’s woven belt: the RPT has arrived, and the stores’ sales are zero. How will the stock go out?

By Sabri Suyunu