FAILURE MAP
← Case archive

FA-98101 / Sequence batch packing / Open access

Length bin packing uses next-fit instead of first-fit · case 01

Length bin packing uses next-fit instead of first-fit.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The heuristic checks only the newest bin, leaving earlier slack unused.

THE FAILURE

The heuristic checks only the newest bin, leaving earlier slack unused.

Unsuccessful approach: A strict comparison rejects exact fits and still changes valid allocations.

Case contract

Sort lengths descending with stable ties, then place each item into the first existing bin with enough remaining capacity; otherwise open a bin.

Why this case matters

This deterministic toy packing rule models a common boundary in preparing bounded training sequences.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(lengths, capacity):
    bins=[]
    for x in sorted(lengths,reverse=True):
        if bins and sum(bins[-1])+x<=capacity: bins[-1].append(x)
        else: bins.append([x])
    return bins
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
vals=[N+2,N+1,2,1]
check('reuse earlier bin', solve(vals,N+3), [[N+2,1],[N+1,2]])
check('exact fit', solve([N,1],N+1), [[N,1]])
check('empty', solve([],N), [])
check('single', solve([N],N), [[N]])
check('new bin', solve([N,N],N), [[N],[N]])
check('descending input order', solve([1,N],N+1), [[N,1]])
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 fixtureActualExpectedOutcome
reuse earlier bin[[3], [2, 2], [1]][[3, 1], [2, 2]]Failed
exact fit[[1, 1]][[1, 1]]Passed
empty[][]Passed
single[[1]][[1]]Passed
new bin[[1], [1]][[1], [1]]Passed
descending input order[[1, 1]][[1, 1]]Passed

SHA-256 / 2b1dd78269b284140fdd4d567093e6d534355883513ca426181278197bf0503d

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(lengths, capacity):
    bins=[]
    for x in sorted(lengths,reverse=True):
        i=next((i for i,b in enumerate(bins) if sum(b)+x<capacity),None)
        if i is None: bins.append([x])
        else: bins[i].append(x)
    return bins
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
vals=[N+2,N+1,2,1]
check('reuse earlier bin', solve(vals,N+3), [[N+2,1],[N+1,2]])
check('exact fit', solve([N,1],N+1), [[N,1]])
check('empty', solve([],N), [])
check('single', solve([N],N), [[N]])
check('new bin', solve([N,N],N), [[N],[N]])
check('descending input order', solve([1,N],N+1), [[N,1]])
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 fixtureActualExpectedOutcome
reuse earlier bin[[3], [2, 1], [2]][[3, 1], [2, 2]]Failed
exact fit[[1], [1]][[1, 1]]Failed
empty[][]Passed
single[[1]][[1]]Passed
new bin[[1], [1]][[1], [1]]Passed
descending input order[[1], [1]][[1, 1]]Failed

SHA-256 / 8fe8ac50e94ec9044b555e4f530ded9e259cf1b6f33aeac698907073fcd52cee

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Inputs are short integer-token lists under the stated toy contract; results do not claim compatibility with a specific training framework. 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-30T16:48:09.321515+00:00.

Case digest / 2d8488cf17b9acae816b48b4684b9cf9c680357cfb0aa2bf21de7870ba02c2b5