FA-95156 / Warehouse slotting and bin packing / Open access
Nested bin fill: empty lines consume volume · case 01
A zero-quantity order line adds negative or phantom volume and uses a SKU slot.
ROOT CAUSE
Zero-quantity SKUs are not skipped before volume and SKU count are accumulated.
VERIFIED REPAIR
Skip SKUs whose merged quantity is zero before counting them.
Unsuccessful approach: Skipping only the volume still counts the empty SKU against the SKU limit.
Case contract
lines [[sku, qty, unit_volume, nest_increment]]. Lines for the same SKU are merged. A nesting SKU (increment > 0) occupies unit_volume + (qty-1)*increment; others qty*unit_volume; qty 0 contributes nothing and is not counted. Bin fits when total <= bin_vol and distinct stocked SKUs <= max_skus. Return [total, fits].
Why this case matters
Nesting products such as cups and trays occupy far less space than unit cube suggests.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(lines, bin_vol, max_skus):
merged = {}
for sku, qty, uv, nv in lines:
if sku in merged:
merged[sku][0] += qty
else:
merged[sku] = [qty, uv, nv]
total = 0
count = 0
for sku, (qty, uv, nv) in merged.items():
count += 1
if nv > 0:
total += uv + (qty - 1) * nv
else:
total += qty * uv
return [total, total <= bin_vol and count <= max_skus]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['zero line', [[['CUP', 1, 10, 2], ['BOX', 0, 40, 0]], 30, 1], [10, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['nesting', [[['CUP', 10, 10, 2]], 30, 1], [28, True]], ['merged lines nest together', [[['CUP', 5, 10, 2], ['CUP', 5, 10, 2]], 30, 1], [28, True]], ['sku limit', [[['CUP', 1, 10, 2], ['LID', 1, 4, 0]], 100, 1], [14, False]], ['capacity equal', [[['CUP', 11, 10, 2]], 30, 1], [30, True]], ['non nesting', [[['BOX', 2, 40, 0]], 80, 1], [80, True]], ['generated mix 9', [[['CUP', 10, 10, 2], ['TRY', 10, 25, 5], ['BOX', 5, 40, 0], ['LID', 10, 4, 0], ['BWL', 2, 30, 6]], 80, 1], [374, False]]], [['generated mix 28', [[['TRY', 0, 25, 5]], 120, 1], [0, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['zero line', [[['CUP', 1, 10, 2], ['BOX', 0, 40, 0]], 30, 1], [10, True]], ['sku limit', [[['CUP', 1, 10, 2], ['LID', 1, 4, 0]], 100, 1], [14, False]], ['capacity equal', [[['CUP', 11, 10, 2]], 30, 1], [30, True]], ['generated mix 10', [[['CUP', 10, 10, 2], ['BOX', 0, 40, 0], ['BOX', 1, 40, 0]], 80, 1], [68, False]], ['generated mix 18', [[['CUP', 10, 10, 2]], 150, 2], [28, True]], ['generated mix 26', [[['CUP', 5, 10, 2], ['BOX', 1, 40, 0], ['BOX', 2, 40, 0]], 50, 3], [138, False]]], [['generated mix 57', [[['BWL', 0, 30, 6]], 120, 3], [0, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['nesting', [[['CUP', 10, 10, 2]], 30, 1], [28, True]], ['merged lines nest together', [[['CUP', 5, 10, 2], ['CUP', 5, 10, 2]], 30, 1], [28, True]], ['non nesting', [[['BOX', 2, 40, 0]], 80, 1], [80, True]], ['generated mix 21', [[['BWL', 1, 30, 6], ['CUP', 5, 10, 2], ['BOX', 0, 40, 0], ['TRY', 5, 25, 5], ['BWL', 2, 30, 6]], 100, 2], [105, False]], ['generated mix 29', [[['TRY', 0, 25, 5], ['LID', 2, 4, 0], ['BOX', 5, 40, 0]], 150, 2], [208, False]], ['generated mix 37', [[['BWL', 5, 30, 6], ['BOX', 5, 40, 0], ['LID', 1, 4, 0], ['LID', 2, 4, 0]], 100, 2], [266, False]]], [['generated mix 19', [[['BOX', 2, 40, 0], ['TRY', 0, 25, 5]], 80, 3], [80, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['zero line', [[['CUP', 1, 10, 2], ['BOX', 0, 40, 0]], 30, 1], [10, True]], ['sku limit', [[['CUP', 1, 10, 2], ['LID', 1, 4, 0]], 100, 1], [14, False]], ['capacity equal', [[['CUP', 11, 10, 2]], 30, 1], [30, True]], ['generated mix 33', [[['LID', 5, 4, 0], ['CUP', 1, 10, 2], ['TRY', 0, 25, 5], ['BWL', 10, 30, 6]], 50, 3], [114, False]], ['generated mix 41', [[['BOX', 2, 40, 0]], 120, 2], [80, True]], ['generated mix 49', [[['BWL', 0, 30, 6], ['LID', 1, 4, 0], ['LID', 10, 4, 0], ['BWL', 10, 30, 6]], 120, 1], [128, False]]], [['generated mix 51', [[['LID', 10, 4, 0], ['TRY', 0, 25, 5], ['BWL', 10, 30, 6]], 150, 2], [124, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['nesting', [[['CUP', 10, 10, 2]], 30, 1], [28, True]], ['merged lines nest together', [[['CUP', 5, 10, 2], ['CUP', 5, 10, 2]], 30, 1], [28, True]], ['non nesting', [[['BOX', 2, 40, 0]], 80, 1], [80, True]], ['generated mix 43', [[['LID', 2, 4, 0], ['TRY', 5, 25, 5]], 100, 2], [53, True]], ['generated mix 52', [[['CUP', 1, 10, 2]], 120, 3], [10, True]], ['generated mix 60', [[['LID', 1, 4, 0], ['BWL', 10, 30, 6]], 120, 2], [88, True]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| zero line | [10, False] | [10, True] | Failed |
| generated mix 5 | [70, False] | [70, True] | Failed |
| nesting | [28, True] | [28, True] | Passed |
| merged lines nest together | [28, True] | [28, True] | Passed |
| sku limit | [14, False] | [14, False] | Passed |
| capacity equal | [30, True] | [30, True] | Passed |
| non nesting | [80, True] | [80, True] | Passed |
| generated mix 9 | [374, False] | [374, False] | Passed |
SHA-256 / e38274241999214b8367462a09ae4ffe1069e7b828347ca47d9b9f8d7ff8da0e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(lines, bin_vol, max_skus):
merged = {}
for sku, qty, uv, nv in lines:
if sku in merged:
merged[sku][0] += qty
else:
merged[sku] = [qty, uv, nv]
total = 0
count = 0
for sku, (qty, uv, nv) in merged.items():
count += 1
if qty <= 0:
continue
if nv > 0:
total += uv + (qty - 1) * nv
else:
total += qty * uv
return [total, total <= bin_vol and count <= max_skus]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['zero line', [[['CUP', 1, 10, 2], ['BOX', 0, 40, 0]], 30, 1], [10, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['nesting', [[['CUP', 10, 10, 2]], 30, 1], [28, True]], ['merged lines nest together', [[['CUP', 5, 10, 2], ['CUP', 5, 10, 2]], 30, 1], [28, True]], ['sku limit', [[['CUP', 1, 10, 2], ['LID', 1, 4, 0]], 100, 1], [14, False]], ['capacity equal', [[['CUP', 11, 10, 2]], 30, 1], [30, True]], ['non nesting', [[['BOX', 2, 40, 0]], 80, 1], [80, True]], ['generated mix 9', [[['CUP', 10, 10, 2], ['TRY', 10, 25, 5], ['BOX', 5, 40, 0], ['LID', 10, 4, 0], ['BWL', 2, 30, 6]], 80, 1], [374, False]]], [['generated mix 28', [[['TRY', 0, 25, 5]], 120, 1], [0, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['zero line', [[['CUP', 1, 10, 2], ['BOX', 0, 40, 0]], 30, 1], [10, True]], ['sku limit', [[['CUP', 1, 10, 2], ['LID', 1, 4, 0]], 100, 1], [14, False]], ['capacity equal', [[['CUP', 11, 10, 2]], 30, 1], [30, True]], ['generated mix 10', [[['CUP', 10, 10, 2], ['BOX', 0, 40, 0], ['BOX', 1, 40, 0]], 80, 1], [68, False]], ['generated mix 18', [[['CUP', 10, 10, 2]], 150, 2], [28, True]], ['generated mix 26', [[['CUP', 5, 10, 2], ['BOX', 1, 40, 0], ['BOX', 2, 40, 0]], 50, 3], [138, False]]], [['generated mix 57', [[['BWL', 0, 30, 6]], 120, 3], [0, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['nesting', [[['CUP', 10, 10, 2]], 30, 1], [28, True]], ['merged lines nest together', [[['CUP', 5, 10, 2], ['CUP', 5, 10, 2]], 30, 1], [28, True]], ['non nesting', [[['BOX', 2, 40, 0]], 80, 1], [80, True]], ['generated mix 21', [[['BWL', 1, 30, 6], ['CUP', 5, 10, 2], ['BOX', 0, 40, 0], ['TRY', 5, 25, 5], ['BWL', 2, 30, 6]], 100, 2], [105, False]], ['generated mix 29', [[['TRY', 0, 25, 5], ['LID', 2, 4, 0], ['BOX', 5, 40, 0]], 150, 2], [208, False]], ['generated mix 37', [[['BWL', 5, 30, 6], ['BOX', 5, 40, 0], ['LID', 1, 4, 0], ['LID', 2, 4, 0]], 100, 2], [266, False]]], [['generated mix 19', [[['BOX', 2, 40, 0], ['TRY', 0, 25, 5]], 80, 3], [80, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['zero line', [[['CUP', 1, 10, 2], ['BOX', 0, 40, 0]], 30, 1], [10, True]], ['sku limit', [[['CUP', 1, 10, 2], ['LID', 1, 4, 0]], 100, 1], [14, False]], ['capacity equal', [[['CUP', 11, 10, 2]], 30, 1], [30, True]], ['generated mix 33', [[['LID', 5, 4, 0], ['CUP', 1, 10, 2], ['TRY', 0, 25, 5], ['BWL', 10, 30, 6]], 50, 3], [114, False]], ['generated mix 41', [[['BOX', 2, 40, 0]], 120, 2], [80, True]], ['generated mix 49', [[['BWL', 0, 30, 6], ['LID', 1, 4, 0], ['LID', 10, 4, 0], ['BWL', 10, 30, 6]], 120, 1], [128, False]]], [['generated mix 51', [[['LID', 10, 4, 0], ['TRY', 0, 25, 5], ['BWL', 10, 30, 6]], 150, 2], [124, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['nesting', [[['CUP', 10, 10, 2]], 30, 1], [28, True]], ['merged lines nest together', [[['CUP', 5, 10, 2], ['CUP', 5, 10, 2]], 30, 1], [28, True]], ['non nesting', [[['BOX', 2, 40, 0]], 80, 1], [80, True]], ['generated mix 43', [[['LID', 2, 4, 0], ['TRY', 5, 25, 5]], 100, 2], [53, True]], ['generated mix 52', [[['CUP', 1, 10, 2]], 120, 3], [10, True]], ['generated mix 60', [[['LID', 1, 4, 0], ['BWL', 10, 30, 6]], 120, 2], [88, True]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| zero line | [10, False] | [10, True] | Failed |
| generated mix 5 | [70, False] | [70, True] | Failed |
| nesting | [28, True] | [28, True] | Passed |
| merged lines nest together | [28, True] | [28, True] | Passed |
| sku limit | [14, False] | [14, False] | Passed |
| capacity equal | [30, True] | [30, True] | Passed |
| non nesting | [80, True] | [80, True] | Passed |
| generated mix 9 | [374, False] | [374, False] | Passed |
SHA-256 / 1309da36c4dae33b81b03d933b16f0fa51c760436085c8f6e9a95a8a8d897a80
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(lines, bin_vol, max_skus):
merged = {}
for sku, qty, uv, nv in lines:
if sku in merged:
merged[sku][0] += qty
else:
merged[sku] = [qty, uv, nv]
total = 0
count = 0
for sku, (qty, uv, nv) in merged.items():
if qty <= 0:
continue
count += 1
if nv > 0:
total += uv + (qty - 1) * nv
else:
total += qty * uv
return [total, total <= bin_vol and count <= max_skus]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['zero line', [[['CUP', 1, 10, 2], ['BOX', 0, 40, 0]], 30, 1], [10, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['nesting', [[['CUP', 10, 10, 2]], 30, 1], [28, True]], ['merged lines nest together', [[['CUP', 5, 10, 2], ['CUP', 5, 10, 2]], 30, 1], [28, True]], ['sku limit', [[['CUP', 1, 10, 2], ['LID', 1, 4, 0]], 100, 1], [14, False]], ['capacity equal', [[['CUP', 11, 10, 2]], 30, 1], [30, True]], ['non nesting', [[['BOX', 2, 40, 0]], 80, 1], [80, True]], ['generated mix 9', [[['CUP', 10, 10, 2], ['TRY', 10, 25, 5], ['BOX', 5, 40, 0], ['LID', 10, 4, 0], ['BWL', 2, 30, 6]], 80, 1], [374, False]]], [['generated mix 28', [[['TRY', 0, 25, 5]], 120, 1], [0, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['zero line', [[['CUP', 1, 10, 2], ['BOX', 0, 40, 0]], 30, 1], [10, True]], ['sku limit', [[['CUP', 1, 10, 2], ['LID', 1, 4, 0]], 100, 1], [14, False]], ['capacity equal', [[['CUP', 11, 10, 2]], 30, 1], [30, True]], ['generated mix 10', [[['CUP', 10, 10, 2], ['BOX', 0, 40, 0], ['BOX', 1, 40, 0]], 80, 1], [68, False]], ['generated mix 18', [[['CUP', 10, 10, 2]], 150, 2], [28, True]], ['generated mix 26', [[['CUP', 5, 10, 2], ['BOX', 1, 40, 0], ['BOX', 2, 40, 0]], 50, 3], [138, False]]], [['generated mix 57', [[['BWL', 0, 30, 6]], 120, 3], [0, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['nesting', [[['CUP', 10, 10, 2]], 30, 1], [28, True]], ['merged lines nest together', [[['CUP', 5, 10, 2], ['CUP', 5, 10, 2]], 30, 1], [28, True]], ['non nesting', [[['BOX', 2, 40, 0]], 80, 1], [80, True]], ['generated mix 21', [[['BWL', 1, 30, 6], ['CUP', 5, 10, 2], ['BOX', 0, 40, 0], ['TRY', 5, 25, 5], ['BWL', 2, 30, 6]], 100, 2], [105, False]], ['generated mix 29', [[['TRY', 0, 25, 5], ['LID', 2, 4, 0], ['BOX', 5, 40, 0]], 150, 2], [208, False]], ['generated mix 37', [[['BWL', 5, 30, 6], ['BOX', 5, 40, 0], ['LID', 1, 4, 0], ['LID', 2, 4, 0]], 100, 2], [266, False]]], [['generated mix 19', [[['BOX', 2, 40, 0], ['TRY', 0, 25, 5]], 80, 3], [80, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['zero line', [[['CUP', 1, 10, 2], ['BOX', 0, 40, 0]], 30, 1], [10, True]], ['sku limit', [[['CUP', 1, 10, 2], ['LID', 1, 4, 0]], 100, 1], [14, False]], ['capacity equal', [[['CUP', 11, 10, 2]], 30, 1], [30, True]], ['generated mix 33', [[['LID', 5, 4, 0], ['CUP', 1, 10, 2], ['TRY', 0, 25, 5], ['BWL', 10, 30, 6]], 50, 3], [114, False]], ['generated mix 41', [[['BOX', 2, 40, 0]], 120, 2], [80, True]], ['generated mix 49', [[['BWL', 0, 30, 6], ['LID', 1, 4, 0], ['LID', 10, 4, 0], ['BWL', 10, 30, 6]], 120, 1], [128, False]]], [['generated mix 51', [[['LID', 10, 4, 0], ['TRY', 0, 25, 5], ['BWL', 10, 30, 6]], 150, 2], [124, True]], ['generated mix 5', [[['TRY', 10, 25, 5], ['LID', 0, 4, 0]], 120, 1], [70, True]], ['nesting', [[['CUP', 10, 10, 2]], 30, 1], [28, True]], ['merged lines nest together', [[['CUP', 5, 10, 2], ['CUP', 5, 10, 2]], 30, 1], [28, True]], ['non nesting', [[['BOX', 2, 40, 0]], 80, 1], [80, True]], ['generated mix 43', [[['LID', 2, 4, 0], ['TRY', 5, 25, 5]], 100, 2], [53, True]], ['generated mix 52', [[['CUP', 1, 10, 2]], 120, 3], [10, True]], ['generated mix 60', [[['LID', 1, 4, 0], ['BWL', 10, 30, 6]], 120, 2], [88, True]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| zero line | [10, True] | [10, True] | Passed |
| generated mix 5 | [70, True] | [70, True] | Passed |
| nesting | [28, True] | [28, True] | Passed |
| merged lines nest together | [28, True] | [28, True] | Passed |
| sku limit | [14, False] | [14, False] | Passed |
| capacity equal | [30, True] | [30, True] | Passed |
| non nesting | [80, True] | [80, True] | Passed |
| generated mix 9 | [374, False] | [374, False] | Passed |
SHA-256 / 07b4c772fa4a2221e3b1d5b998be18ea6ac14d11594e88e1bae428f861817e7f
Verification & scope
Stipulated linear nesting model; no orientation or partial stacks. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:52:11.081547+00:00.
Case digest / 91ebf18c4742169bc337bef3c1ff59ed088df1a6985c7e00bc63ae08c1036441