Technical

Testing the packs in the initial allocation

The same stock, the same stores, only different packs: how much do availability, size loss and broken size sets change in the first four weeks? Two pack types beat Lumoda by a small margin. The real difference comes from the twelve-unit pack; not from its size, but from how fine its content is.

Size and Pack · 5 / 6

In the last article we designed the packsA sealed pack of sizes mixed in a fixed ratio. At Lumoda seven units, 1-2-2-1-1 in size order; six for one-size accessories. Cheap to pick, but it does not fit size needs exactly.. With the seven-unit pack two types came out, with the twelve-unit pack three; not even a store-specific pack went beyond them. But all those designs were good by a single measure: the units sitting in the wrong size in the pack. We never looked at the rail itself.

In this article we send the packs into the world of the Initial Allocation series. The same stock goes to the same stores; only the inside of the pack changes. Then we play the season from start to finish and look at the rail.

The code is from the working code under cases/size-and-pack/, the numbers from the case’s report. The simulation is Initial Allocation’s engine: the same warehouse, the same replenishment, the same customers. The case only adds new pack types to a copy of the world’s pack table and changes the rule that says which pack goes to which store.

The same stock

The only honest way to compare two packs is to send the same stock with both. If one arm sends more stock its rails are fuller; but that has nothing to do with the pack.

In Initial Allocation, Lumoda’s rule said how many packs of each option go to each store. The engine cannot always send that number. We saw it in the second article: Lumoda’s pack asks for exactly as much of the first size as the warehouse holds. In some options the warehouse falls short and the engine trims the number of packs; in 177 options, 14,357 units in all.

So we give the arms not the number of packs Lumoda asked for but the number actually shipped: 118,003 packs across 5,351 store–option pairs. When the engine asks how many packs of an option go to the stores, the answer comes from that table:

# size_and_pack/policy.py (ShippedInitialAllocation)
    def __call__(self, view, o: int) -> np.ndarray:
        w = view.world
        oid = str(w.options.at[o, "option_id"])
        if oid not in self.options:
            return self.base(view, o)
        d = self._ns.get(oid, {})
        return w.stores["store_id"].astype(str).map(d).fillna(0).to_numpy(dtype=np.int64)

In the options of the new season’s first allocation, a store gets the number of packs Lumoda sent it. In the other options Lumoda’s own rule runs unchanged.

If the number of packs is the same and the pack is still seven units, every store gets the same units of every option. One condition remains: the engine must not trim the new packs. The warehouse limit from the fourth article sees to that; no design goes over the warehouse in any size. After the run a check counts it per store and option:

# size_and_pack/runner.py (docstring left out)
def conservation(run_, reference_units: dict) -> dict[str, int]:
    ref = {(str(o), str(m)): int(v) for (o, m), v in reference_units.items()}
    selected = {o for o, _ in ref}
    arm = {a: v for a, v in shipped_units(run_).items() if a[0] in selected}
    keys = set(ref) | set(arm)
    diff = [arm.get(a, 0) - ref.get(a, 0) for a in keys]
    return {"cells": len(keys), "diff_cells": int(sum(f != 0 for f in diff)),
            "diff_units": int(sum(abs(f) for f in diff)), "net_diff_units": int(sum(diff))}

In every seven-unit arm the units trimmed are 0, and the units shipped in the first allocation are the same as Lumoda’s: 824,165.

Validation

The engine needs testing too. The arm run with Lumoda’s pack, with no pack added, should reproduce Initial Allocation’s Lumoda run. It does: all 51 of Initial Allocation’s 51 measures are identical. The Lumoda row in the tables is this arm.

The twelve-unit pack

With the twelve-unit pack the same stock cannot be built exactly. If a store gets a single seven-unit pack of an option, you cannot send seven units with a twelve-unit pack: it is either none or twelve. So the code keeps the units at option level:

# size_and_pack/runner.py (convert_ns; check lines left out)
    ns = {}
    for o in ordering.sort_values(option, "option_id"):
        d = option[o]
        stores = ordering.sort_values(d, "store_id")
        units = np.array([d[m] for m in stores], dtype=np.int64)
        total = (int((2 * int(units.sum()) + a) // (2 * a)) if rounding == "nearest"   # ⌊Σ/a + ½⌋, in integers
                 else int(units.sum()) // a)
        for m, n in zip(stores, simulation.largest_remainder(total, units)):
            if n > 0:
                ns[(o, m)] = int(n)
    return ns

The total units Lumoda sent in an option are divided by twelve and rounded to the nearest whole pack. These packs are spread over the stores in proportion to the units they got from Lumoda; the store with the largest remainder gets one pack more. An option’s total moves by six units at most. Across the 193 five-size options Lumoda sends 813,029 units, the twelve-unit arms 813,132: 103 units more. Of the 4,952 store–option pairs in the five-size options, 3 get no pack at all.

At store level the difference can be bigger. A store that got seven units may get twelve, or none. For the twelve-unit arms the same stock is therefore approximate: almost the same in total, not in the store. In these arms too trimming is 0.

The arms

Let us give the arms short names. P1 is a single pack type for every store, P2 two types, P3 three types. The number after the dash is the pack’s units.

ArmPackPatterns (stores)
Lumoda7 units1-2-2-1-1 (69)
P17 units1-1-2-2-1 (69)
P27 units1-1-2-2-1 (50) · 1-2-2-1-1 (19)
P1-1212 units1-3-4-3-1 (69)
P2-1212 units1-2-4-3-2 (50) · 2-3-4-2-1 (19)
P3-1212 units1-2-3-4-2 (28) · 1-3-4-3-1 (22) · 2-3-4-2-1 (19)
P1-1414 units2-2-4-4-2 (69)

The last arm is a control; we come back to it below.

The arms in the table are simulations run separately. Some arms were not run, because they give the same patterns and the same assignment as another arm. With the seven-unit pack, three types, four types and the store-specific pack are the same as P2. With the twelve-unit pack, four types and the store-specific pack are the same as P3. P2 built with the raw curve, read without correcting the days the rails stood empty, is also the same as the one built with the corrected curve. Nor did we run an arm assigned by the answer key: we saw in the last article that the assignment changes only in Izmir 2.

The first four weeks

The measures are the three we defined in the second article. Availability: the share of days on which the customer found the size they were looking for on the rail. The size-loss share: the part of the demand that could not be met that was lost while other sizes of the product were on the rail. Broken size sets: the share of days on which, while the product was on the rail, one of its three middle sizes was missing; in the glossary, a broken size setAn option's size set breaking up; its main measure is the net broken-size rate, the number of broken sizes divided by the number of sizes.. All three are measured over the 28 days after the first allocation arrives.

Why the first four weeks? In the data’s design Lumoda’s replenishment knows the store’s size curve; we said so in the third article. Our expectation was this: replenishment tops up during the season the size the pack got wrong, and the gap between the arms stays in the first weeks. With that expectation we put the headline on the first four weeks. We will see below that the expectation did not hold.

ArmAvailabilitySize-loss shareBroken size setsGross profit (season)
Lumoda 1-2-2-1-196.47%58.06%2.37%TRY 534,433,105
P196.51%58.38%2.20%TRY 535,940,376
P296.64%56.48%1.89%TRY 540,277,650
P1-1496.53%58.33%2.19%TRY 536,348,012
P1-1297.09%48.46%1.79%TRY 541,634,844
P2-1297.08%48.83%1.66%TRY 545,457,931
P3-1297.06%49.37%1.70%TRY 545,511,071

The first three columns are the first four weeks, gross profit the whole season. The differences are easier to read against Lumoda:

Arm − LumodaAvailabilitySize-loss shareBroken size setsGross profit
P10.0 pts+0.3 pts−0.2 pts+TRY 1,507,271
P2+0.2 pts−1.6 pts−0.5 pts+TRY 5,844,545
P1-14+0.1 pts+0.3 pts−0.2 pts+TRY 1,914,907
P1-12+0.6 pts−9.6 pts−0.6 pts+TRY 7,201,739
P2-12+0.6 pts−9.2 pts−0.7 pts+TRY 11,024,826
P3-12+0.6 pts−8.7 pts−0.7 pts+TRY 11,077,966

In size loss and broken size sets, lower is better.

The two-type seven-unit pack is ahead of Lumoda on all four measures, but by a small margin. Availability is 0.2 points higher, size loss 1.6 points lower; over the season gross profit is TRY 5,844,545 higher. Stores leaning towards small sizes, such as Istanbul 18, still get Lumoda’s pack in this design; what changes is the other two profiles’ pack.

The single-type P1 cannot be summed up in a word.

“We found the best one for a single pack,” says Pelin. “Isn’t it better?”

“On which measure?” says Pars. “Broken size sets are 0.2 points lower, gross profit TRY 1,507,271 higher. But in the first four weeks the size loss went up by 0.3 points. Availability didn’t move. Over the whole season the size loss falls by 0.7 points; but the headline is the first four weeks.”

Our reading is this: P1 moves one unit from the second size to the fourth. We saw it in the first article: this pack moves closer to the curve of the stores leaning towards large sizes and further from that of those leaning towards small sizes. That was Ali’s objection, “my second size sells out already”. In P1 the size that most often sells out first in a store is also the second size: in 27.3% of the pairs in which a size sold out.

The twelve-unit arms are on another level. All three are 0.6 points ahead on availability and cut the size loss of the first four weeks by between 8.7 and 9.6 points. The design measure of the fourth article was misleading here: by that measure two seven-unit types fitted much better than a single twelve-unit type. On the rail the ranking is reversed; P1-12 is ahead of the seven-unit P2 on all four measures. The design measure looks only inside the pack going to the store, not at what is left in the warehouse or what replenishment will do. We will come back to this shortly.

With the twelve-unit pack the effect of the number of types does not run one way either. I said it in the fourth article: against a single type, three pack types do not reduce the size loss of the first four weeks; they raise it slightly. The difference between P3-12 and P1-12 is +0.9 points in size loss, 0.0 points in availability, −0.1 points in broken size sets. In gross profit, though, three types are TRY 3,876,227 ahead. Two types and three types land almost in the same place on gross profit: TRY 545,457,931 and TRY 545,511,071.

The whole season

By our expectation, since replenishment knows the curve, the gap should have closed by the end of the season. It does not.

ArmAvailabilitySize-loss shareBroken size setsLeft at season endFull-price STR
Lumoda 1-2-2-1-168.98%42.31%25.27%19.77%52.69%
P169.05%41.58%23.53%19.45%53.06%
P269.24%39.98%21.76%19.21%53.28%
P1-1469.09%41.47%23.40%19.42%53.09%
P1-1269.49%30.41%19.17%18.98%53.74%
P2-1269.75%28.76%18.04%18.46%54.09%
P3-1269.68%27.76%17.31%18.46%54.11%

Over the season the gap in size loss is even bigger than in the first four weeks. Against Lumoda, P3-12 is −8.7 points in the first four weeks and −14.6 points over the whole season. In broken size sets, −0.7 and −8.0 points. With the two-type seven-unit pack too the season’s gaps are bigger than the first weeks’: −2.3 points in size loss, −3.5 points in broken size sets. The stock left at the end of the season is lower than Lumoda’s in every arm, and the share sold at full price higher in every arm.

In the Initial Allocation series we saw that a large part of Lumoda’s loss was size loss. None of the arms that split the stock across the stores in other shares reduced that share; what reduced it was holding part of the stock back in the warehouse. Changing the pack’s content reduces it too: in this series’ measurement Lumoda’s share over the season is 42.31%, with the three-type twelve-unit pack 27.76%.

Replenishment knows the size; so why does the gap not close? We did not measure this with a separate arm; but we can suggest a reading: replenishment can only send the stock that is in the warehouse.

What is left in the warehouse

The share of each size left in the warehouse after the first allocation, against that size’s warehouse stock:

Arm12345
Lumoda 1-2-2-1-10.0%9.1%37.5%58.3%16.6%
P10.0%54.5%37.5%16.7%16.6%
P20.0%36.5%37.5%33.2%16.6%
P1-1241.6%20.4%27.1%27.1%51.4%
P3-1218.4%30.6%34.1%27.4%32.7%

In every seven-unit arm no stock of the first size is left in the warehouse. We saw it in the fourth article: every pack has one unit of the first size, and the warehouse holds exactly that much of that size. When the first size sells out in a store, there is no first size left in the warehouse for replenishment to send. With Lumoda’s pack, at the other end, 58.3% of the fourth size waits in the warehouse. P1 moves that waiting stock to the second size: 54.5%.

In most of the twelve-unit packs the first size gets one in twelve, and stock of that size is left in the warehouse. In these arms the size that most often sells out first in a store is the first size: in 36.5% of the pairs in which a size sold out in P1-12, in 36.6% in P3-12. At Lumoda the size that most often sold out first was the fourth (31.1%). With the twelve-unit pack, when the first size sells out, there is stock in the warehouse to top it up.

The limit of our reading is in this table too. At Lumoda 58.3% of the fourth size waits in the warehouse, yet the size that most often sells out first in a store is still the fourth. Stock in the warehouse does not stop a size selling out on the rail. What is left in the warehouse may explain part of the gap; it does not explain all of it. We did not run an arm that separates the effect of the pack’s content from that of the stock left in the warehouse.

Size or content

In the second article Ali asked: would it be better if we made the pack bigger? Pars said a big pack changes two things at once: how fine the content is and how coarse the units going to the store are. The twelve-unit arms change both at once. Separating which one does the work takes a control: keeping the content the same and only making the pack bigger.

The cleanest control would have been the twelve-unit counterpart of Lumoda’s pack. We saw it in the fourth article: that pack asks for two in twelve in the first size, 0.1667; the warehouse gives 0.1428. It cannot be built. Instead we doubled P1: 2-2-4-4-2. Fourteen units, size shares identical to P1’s, and it fits the warehouse as well as P1 does.

In this arm the units are divided by fourteen and rounded down; rounded to the nearest, the first size went over the warehouse in some options. The cost: 812,308 units instead of Lumoda’s 813,029, 721 units fewer. So the control arm sends almost the same stock.

DifferenceAvailabilitySize-loss shareBroken size setsGross profit
Size alone: P1-14 − P10.0 pts−0.1 pts0.0 pts+TRY 407,636
Content and size: P1-12 − P1+0.6 pts−9.9 pts−0.4 pts+TRY 5,694,468

The first three columns are again the first four weeks. Making the pack bigger on its own changes almost nothing. Over the whole season too: −0.1 points in size loss. What changes things is the finer share in the bigger pack. In a seven-unit pack a size gets at least 14.3%; in a twelve-unit pack it can get 8.3%. The chain wants 10.2% in the first size. Seven units have to send that size more than it wants; twelve units can send less and leave stock in the warehouse.

“So the twelve-unit pack is good not because it’s big but because it’s fine,” says Ali.

“In this data, yes,” says Pars. “The fourteen-unit control sends 721 units fewer and still doesn’t fall behind P1. The difference comes not from the size but from the finer content.”

In other customer streams

All of this comes from a single customer stream. As in Initial Allocation, the same world has four more streams. We reran Lumoda, P1, P2 and P3-12 on every path. The curve, the profiles, κ and the designs were also relearnt on every path from that path’s published tables. On all five paths the result came out the same: profiles large 28, small 19, medium 22; κ 12,800; the same patterns for P2 and for P3-12; 118,003 packs going to the stores.

The three measures of the first four weeks and gross profit, five paths:

ComparisonAvailabilitySize-loss shareBroken size setsGross profit
P1 − Lumoda5/5 · +0.11/5 · +0.35/5 · −0.25/5 · +TRY 1,062,047
P2 − Lumoda5/5 · +0.25/5 · −1.15/5 · −0.55/5 · +TRY 5,607,497
P2 − P15/5 · +0.25/5 · −1.25/5 · −0.45/5 · +TRY 4,207,519
P3-12 − Lumoda5/5 · +0.65/5 · −8.75/5 · −0.75/5 · +TRY 10,842,933
P3-12 − P25/5 · +0.45/5 · −7.45/5 · −0.15/5 · +TRY 5,396,035

In every cell, first the number of paths on which the arm is ahead, then the path median of the difference; in points for the percentage measures.

P1’s lag in size loss is not a fluke of a single stream: it is lower than Lumoda’s on only one of the five paths. P2’s gain is small but does not change direction. Its gap in size loss moves from path to path, between −0.4 and −2.0 points; the −1.6 in the published stream is on the good side of that range. The three-type twelve-unit pack is ahead on all five paths, on every measure.

What is hard in your data

The first is sending the same stock. Here we could run every arm in the same world, with the same stock and the same customers. In a real chain the season is played once, with one pack. You can try a pack in some stores, but those stores’ customers, products and season are not the same as the other stores’.

The second is the size of the pack. The twelve-unit pack makes the biggest difference in this data. But we did not measure whether the supplier would agree to twelve units, or what it would cost a small store to take twelve units in a single pack. At store level the same stock is already lost.

The third is the warehouse. The pack’s content also decides which size is left in the warehouse. If your warehouse stock depends on the buy, and the buy on past packs, the two decisions should be thought through together. Here the buy stayed fixed.

The fourth is replenishment. Lumoda’s replenishment knows the store’s size and still did not close the pack’s gap. What would happen if yours does not know it we did not measure; we did not run an arm with replenishment working from the chain curve.

In the last article we add up the account: how do we tell that a size curve and a pack design are good, and what is a number of pack types worth?

By Sabri Suyunu