FAILURE MAP
← Case archive

FA-93096 / EV charging session scheduling / Open access

Depot least-laxity-first charging: presence at departure slot · case 01

Energy is granted to vehicles in the slot at which they have already left the depot.

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

ROOT CAUSE

The presence test includes the departure slot itself.

VERIFIED REPAIR

A vehicle is present only while t < depart_slot.

Unsuccessful approach: Excluding the slot before departure as well starves vehicles of their last valid slot.

Case contract

fleet is [[id, need_units, depart_slot, max_units_per_slot]]. A vehicle is present in slots t < depart_slot. Each slot the site capacity site_units is granted in order of laxity (depart_slot - t - ceil(remaining/max_units)) ascending, ties by id; each vehicle gets min(max, remaining, capacity left). Return [[[id, remaining]] sorted by id, sorted ids with remaining > 0].

Why this case matters

Depot, workplace and public EV chargers schedule sessions against prices, circuit limits and departure deadlines; a wrong decision silently strands a driver or overloads a feeder.

1 / The failure

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

N = 1
observations = []
def solve(fleet, site_units, slots):
    rem = {v[0]: v[1] for v in fleet}
    for t in range(slots):
        present = [v for v in fleet if v[2] >= t and rem[v[0]] > 0]
        def lax(v):
            need_slots = -(-rem[v[0]] // v[3])
            return (v[2] - t) - need_slots
        present.sort(key=lambda v: (lax(v), v[0]))
        cap = site_units
        for v in present:
            give = min(v[3], rem[v[0]], cap)
            rem[v[0]] -= give
            cap -= give
            if cap == 0:
                break
    missed = sorted(v[0] for v in fleet if rem[v[0]] > 0)
    return [[[k, rem[k]] for k in sorted(rem)], missed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot',
   [[['B2', 8, 6, 4], ['B1', 3, 8, 3], ['B3', 8, 6, 3], ['B0', 8, 9, 2], ['B4', 10, 3, 1]], 8, 7],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0], ['B4', 7]], ['B4']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B2', 4, 8, 3], ['B0', 4, 7, 4], ['B1', 12, 4, 3]], 4, 4],
   [[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']]],
  ['control 1', [[['B0', 4, 10, 3], ['B1', 4, 9, 3], ['B2', 1, 7, 3]], 7, 7],
   [[['B0', 0], ['B1', 0], ['B2', 0]], []]],
  ['control 2', [[['B0', 1, 9, 4], ['B1', 13, 10, 4]], 7, 6], [[['B0', 0], ['B1', 0]], []]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot',
   [[['B0', 3, 5, 4], ['B1', 9, 3, 1], ['B2', 14, 7, 2], ['B3', 9, 6, 4], ['B4', 11, 5, 2]], 5, 5],
   [[['B0', 0], ['B1', 6], ['B2', 6], ['B3', 8], ['B4', 1]], ['B1', 'B2', 'B3', 'B4']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B4', 3, 10, 1], ['B3', 0, 8, 2], ['B1', 0, 9, 3], ['B2', 13, 3, 2], ['B0', 4, 3, 4]], 7, 7],
   [[['B0', 0], ['B1', 0], ['B2', 7], ['B3', 0], ['B4', 0]], ['B2']]],
  ['control 1', [[['B1', 9, 10, 4], ['B3', 1, 1, 4], ['B0', 4, 10, 3], ['B2', 6, 10, 3]], 6, 4],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0]], []]],
  ['control 2', [[['B0', 3, 6, 1]], 7, 10], [[['B0', 0]], []]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot', [[['B1', 7, 4, 3], ['B0', 14, 6, 2]], 3, 6],
   [[['B0', 2], ['B1', 3]], ['B0', 'B1']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B3', 8, 1, 1], ['B0', 9, 10, 3], ['B2', 9, 4, 3], ['B1', 2, 6, 4]], 2, 4],
   [[['B0', 9], ['B1', 2], ['B2', 2], ['B3', 7]], ['B0', 'B1', 'B2', 'B3']]],
  ['control 1', [[['B1', 10, 10, 4], ['B2', 9, 9, 4], ['B0', 9, 4, 1]], 6, 9],
   [[['B0', 5], ['B1', 0], ['B2', 0]], ['B0']]],
  ['control 2', [[['B0', 11, 5, 1]], 6, 4], [[['B0', 7]], ['B0']]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot',
   [[['B2', 6, 1, 2], ['B0', 6, 3, 3], ['B1', 8, 9, 4]], 3, 7],
   [[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B1', 7, 9, 4], ['B0', 13, 3, 1]], 3, 5], [[['B0', 10], ['B1', 0]], ['B0']]],
  ['control 1', [[['B2', 2, 6, 3], ['B1', 0, 4, 3], ['B0', 10, 8, 1]], 2, 9],
   [[['B0', 2], ['B1', 0], ['B2', 0]], ['B0']]],
  ['control 2', [[['B2', 11, 5, 4], ['B0', 8, 10, 3], ['B1', 5, 5, 4]], 6, 9],
   [[['B0', 0], ['B1', 0], ['B2', 0]], []]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot', [[['B0', 6, 9, 3], ['B1', 7, 3, 2]], 7, 7],
   [[['B0', 0], ['B1', 1]], ['B1']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B0', 1, 8, 3], ['B2', 1, 5, 4], ['B1', 0, 3, 1], ['B3', 12, 2, 1]], 5, 4],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 10]], ['B3']]],
  ['control 1', [[['B0', 14, 4, 4], ['B2', 2, 9, 3], ['B3', 2, 10, 2], ['B1', 6, 6, 4]], 8, 9],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0]], []]],
  ['control 2', [[['B1', 10, 5, 4], ['B0', 14, 10, 4], ['B2', 9, 3, 3], ['B3', 8, 10, 2]], 6, 7],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 1]], ['B3']]]]]
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 fixtureActualExpectedOutcome
boundary: departs at slot 1[[['A', 0], ['B', 0]], []][[['A', 2], ['B', 0]], ['A']]Failed
boundary: exact capacity fit[[['A', 0], ['B', 0]], []][[['A', 0], ['B', 0]], []]Passed
boundary: empty fleet[[], []][[], []]Passed
regression: presence at departure slot[[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0], ['B4', 6]], ['B4']][[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0], ['B4', 7]], ['B4']]Failed
regression: presence at departure slot (partial repair)[[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']][[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']]Passed
control 1[[['B0', 0], ['B1', 0], ['B2', 0]], []][[['B0', 0], ['B1', 0], ['B2', 0]], []]Passed
control 2[[['B0', 0], ['B1', 0]], []][[['B0', 0], ['B1', 0]], []]Passed

SHA-256 / b5975a878e049305a24416cc08370cd6812e6af81f75aaf42aa373db13c01f6e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(fleet, site_units, slots):
    rem = {v[0]: v[1] for v in fleet}
    for t in range(slots):
        present = [v for v in fleet if v[2] > t + 1 and rem[v[0]] > 0]
        def lax(v):
            need_slots = -(-rem[v[0]] // v[3])
            return (v[2] - t) - need_slots
        present.sort(key=lambda v: (lax(v), v[0]))
        cap = site_units
        for v in present:
            give = min(v[3], rem[v[0]], cap)
            rem[v[0]] -= give
            cap -= give
            if cap == 0:
                break
    missed = sorted(v[0] for v in fleet if rem[v[0]] > 0)
    return [[[k, rem[k]] for k in sorted(rem)], missed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot',
   [[['B2', 8, 6, 4], ['B1', 3, 8, 3], ['B3', 8, 6, 3], ['B0', 8, 9, 2], ['B4', 10, 3, 1]], 8, 7],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0], ['B4', 7]], ['B4']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B2', 4, 8, 3], ['B0', 4, 7, 4], ['B1', 12, 4, 3]], 4, 4],
   [[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']]],
  ['control 1', [[['B0', 4, 10, 3], ['B1', 4, 9, 3], ['B2', 1, 7, 3]], 7, 7],
   [[['B0', 0], ['B1', 0], ['B2', 0]], []]],
  ['control 2', [[['B0', 1, 9, 4], ['B1', 13, 10, 4]], 7, 6], [[['B0', 0], ['B1', 0]], []]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot',
   [[['B0', 3, 5, 4], ['B1', 9, 3, 1], ['B2', 14, 7, 2], ['B3', 9, 6, 4], ['B4', 11, 5, 2]], 5, 5],
   [[['B0', 0], ['B1', 6], ['B2', 6], ['B3', 8], ['B4', 1]], ['B1', 'B2', 'B3', 'B4']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B4', 3, 10, 1], ['B3', 0, 8, 2], ['B1', 0, 9, 3], ['B2', 13, 3, 2], ['B0', 4, 3, 4]], 7, 7],
   [[['B0', 0], ['B1', 0], ['B2', 7], ['B3', 0], ['B4', 0]], ['B2']]],
  ['control 1', [[['B1', 9, 10, 4], ['B3', 1, 1, 4], ['B0', 4, 10, 3], ['B2', 6, 10, 3]], 6, 4],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0]], []]],
  ['control 2', [[['B0', 3, 6, 1]], 7, 10], [[['B0', 0]], []]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot', [[['B1', 7, 4, 3], ['B0', 14, 6, 2]], 3, 6],
   [[['B0', 2], ['B1', 3]], ['B0', 'B1']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B3', 8, 1, 1], ['B0', 9, 10, 3], ['B2', 9, 4, 3], ['B1', 2, 6, 4]], 2, 4],
   [[['B0', 9], ['B1', 2], ['B2', 2], ['B3', 7]], ['B0', 'B1', 'B2', 'B3']]],
  ['control 1', [[['B1', 10, 10, 4], ['B2', 9, 9, 4], ['B0', 9, 4, 1]], 6, 9],
   [[['B0', 5], ['B1', 0], ['B2', 0]], ['B0']]],
  ['control 2', [[['B0', 11, 5, 1]], 6, 4], [[['B0', 7]], ['B0']]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot',
   [[['B2', 6, 1, 2], ['B0', 6, 3, 3], ['B1', 8, 9, 4]], 3, 7],
   [[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B1', 7, 9, 4], ['B0', 13, 3, 1]], 3, 5], [[['B0', 10], ['B1', 0]], ['B0']]],
  ['control 1', [[['B2', 2, 6, 3], ['B1', 0, 4, 3], ['B0', 10, 8, 1]], 2, 9],
   [[['B0', 2], ['B1', 0], ['B2', 0]], ['B0']]],
  ['control 2', [[['B2', 11, 5, 4], ['B0', 8, 10, 3], ['B1', 5, 5, 4]], 6, 9],
   [[['B0', 0], ['B1', 0], ['B2', 0]], []]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot', [[['B0', 6, 9, 3], ['B1', 7, 3, 2]], 7, 7],
   [[['B0', 0], ['B1', 1]], ['B1']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B0', 1, 8, 3], ['B2', 1, 5, 4], ['B1', 0, 3, 1], ['B3', 12, 2, 1]], 5, 4],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 10]], ['B3']]],
  ['control 1', [[['B0', 14, 4, 4], ['B2', 2, 9, 3], ['B3', 2, 10, 2], ['B1', 6, 6, 4]], 8, 9],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0]], []]],
  ['control 2', [[['B1', 10, 5, 4], ['B0', 14, 10, 4], ['B2', 9, 3, 3], ['B3', 8, 10, 2]], 6, 7],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 1]], ['B3']]]]]
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 fixtureActualExpectedOutcome
boundary: departs at slot 1[[['A', 4], ['B', 0]], ['A']][[['A', 2], ['B', 0]], ['A']]Failed
boundary: exact capacity fit[[['A', 1], ['B', 1]], ['A', 'B']][[['A', 0], ['B', 0]], []]Failed
boundary: empty fleet[[], []][[], []]Passed
regression: presence at departure slot[[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0], ['B4', 8]], ['B4']][[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0], ['B4', 7]], ['B4']]Failed
regression: presence at departure slot (partial repair)[[['B0', 0], ['B1', 3], ['B2', 1]], ['B1', 'B2']][[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']]Failed
control 1[[['B0', 0], ['B1', 0], ['B2', 0]], []][[['B0', 0], ['B1', 0], ['B2', 0]], []]Passed
control 2[[['B0', 0], ['B1', 0]], []][[['B0', 0], ['B1', 0]], []]Passed

SHA-256 / d56d5ae62883a6ccdb7e12af39541f350973467644dce8e526d495ee3468cab6

3 / The verified repair

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

N = 1
observations = []
def solve(fleet, site_units, slots):
    rem = {v[0]: v[1] for v in fleet}
    for t in range(slots):
        present = [v for v in fleet if v[2] > t and rem[v[0]] > 0]
        def lax(v):
            need_slots = -(-rem[v[0]] // v[3])
            return (v[2] - t) - need_slots
        present.sort(key=lambda v: (lax(v), v[0]))
        cap = site_units
        for v in present:
            give = min(v[3], rem[v[0]], cap)
            rem[v[0]] -= give
            cap -= give
            if cap == 0:
                break
    missed = sorted(v[0] for v in fleet if rem[v[0]] > 0)
    return [[[k, rem[k]] for k in sorted(rem)], missed]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot',
   [[['B2', 8, 6, 4], ['B1', 3, 8, 3], ['B3', 8, 6, 3], ['B0', 8, 9, 2], ['B4', 10, 3, 1]], 8, 7],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0], ['B4', 7]], ['B4']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B2', 4, 8, 3], ['B0', 4, 7, 4], ['B1', 12, 4, 3]], 4, 4],
   [[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']]],
  ['control 1', [[['B0', 4, 10, 3], ['B1', 4, 9, 3], ['B2', 1, 7, 3]], 7, 7],
   [[['B0', 0], ['B1', 0], ['B2', 0]], []]],
  ['control 2', [[['B0', 1, 9, 4], ['B1', 13, 10, 4]], 7, 6], [[['B0', 0], ['B1', 0]], []]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot',
   [[['B0', 3, 5, 4], ['B1', 9, 3, 1], ['B2', 14, 7, 2], ['B3', 9, 6, 4], ['B4', 11, 5, 2]], 5, 5],
   [[['B0', 0], ['B1', 6], ['B2', 6], ['B3', 8], ['B4', 1]], ['B1', 'B2', 'B3', 'B4']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B4', 3, 10, 1], ['B3', 0, 8, 2], ['B1', 0, 9, 3], ['B2', 13, 3, 2], ['B0', 4, 3, 4]], 7, 7],
   [[['B0', 0], ['B1', 0], ['B2', 7], ['B3', 0], ['B4', 0]], ['B2']]],
  ['control 1', [[['B1', 9, 10, 4], ['B3', 1, 1, 4], ['B0', 4, 10, 3], ['B2', 6, 10, 3]], 6, 4],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0]], []]],
  ['control 2', [[['B0', 3, 6, 1]], 7, 10], [[['B0', 0]], []]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot', [[['B1', 7, 4, 3], ['B0', 14, 6, 2]], 3, 6],
   [[['B0', 2], ['B1', 3]], ['B0', 'B1']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B3', 8, 1, 1], ['B0', 9, 10, 3], ['B2', 9, 4, 3], ['B1', 2, 6, 4]], 2, 4],
   [[['B0', 9], ['B1', 2], ['B2', 2], ['B3', 7]], ['B0', 'B1', 'B2', 'B3']]],
  ['control 1', [[['B1', 10, 10, 4], ['B2', 9, 9, 4], ['B0', 9, 4, 1]], 6, 9],
   [[['B0', 5], ['B1', 0], ['B2', 0]], ['B0']]],
  ['control 2', [[['B0', 11, 5, 1]], 6, 4], [[['B0', 7]], ['B0']]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot',
   [[['B2', 6, 1, 2], ['B0', 6, 3, 3], ['B1', 8, 9, 4]], 3, 7],
   [[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B1', 7, 9, 4], ['B0', 13, 3, 1]], 3, 5], [[['B0', 10], ['B1', 0]], ['B0']]],
  ['control 1', [[['B2', 2, 6, 3], ['B1', 0, 4, 3], ['B0', 10, 8, 1]], 2, 9],
   [[['B0', 2], ['B1', 0], ['B2', 0]], ['B0']]],
  ['control 2', [[['B2', 11, 5, 4], ['B0', 8, 10, 3], ['B1', 5, 5, 4]], 6, 9],
   [[['B0', 0], ['B1', 0], ['B2', 0]], []]]],
 [['boundary: departs at slot 1', [[['A', 4, 1, 2], ['B', 2, 5, 2]], 2, 3],
   [[['A', 2], ['B', 0]], ['A']]],
  ['boundary: exact capacity fit', [[['A', 2, 2, 1], ['B', 2, 2, 1]], 2, 3],
   [[['A', 0], ['B', 0]], []]],
  ['boundary: empty fleet', [[], 5, 3], [[], []]],
  ['regression: presence at departure slot', [[['B0', 6, 9, 3], ['B1', 7, 3, 2]], 7, 7],
   [[['B0', 0], ['B1', 1]], ['B1']]],
  ['regression: presence at departure slot (partial repair)',
   [[['B0', 1, 8, 3], ['B2', 1, 5, 4], ['B1', 0, 3, 1], ['B3', 12, 2, 1]], 5, 4],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 10]], ['B3']]],
  ['control 1', [[['B0', 14, 4, 4], ['B2', 2, 9, 3], ['B3', 2, 10, 2], ['B1', 6, 6, 4]], 8, 9],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0]], []]],
  ['control 2', [[['B1', 10, 5, 4], ['B0', 14, 10, 4], ['B2', 9, 3, 3], ['B3', 8, 10, 2]], 6, 7],
   [[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 1]], ['B3']]]]]
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 fixtureActualExpectedOutcome
boundary: departs at slot 1[[['A', 2], ['B', 0]], ['A']][[['A', 2], ['B', 0]], ['A']]Passed
boundary: exact capacity fit[[['A', 0], ['B', 0]], []][[['A', 0], ['B', 0]], []]Passed
boundary: empty fleet[[], []][[], []]Passed
regression: presence at departure slot[[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0], ['B4', 7]], ['B4']][[['B0', 0], ['B1', 0], ['B2', 0], ['B3', 0], ['B4', 7]], ['B4']]Passed
regression: presence at departure slot (partial repair)[[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']][[['B0', 0], ['B1', 0], ['B2', 4]], ['B2']]Passed
control 1[[['B0', 0], ['B1', 0], ['B2', 0]], []][[['B0', 0], ['B1', 0], ['B2', 0]], []]Passed
control 2[[['B0', 0], ['B1', 0]], []][[['B0', 0], ['B1', 0]], []]Passed

SHA-256 / 362f3a501aa367c723211d07bec07f877dcb52d199229b2bb485aaf49ed5d3c8

Verification & scope

Deterministic stipulated toy contract for teaching; no claim of conformance with any standard, vendor protocol or production controller. 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:51:51.933410+00:00.

Case digest / 895f372ad5e9ac5f391c0118951119f6682bf46107346a1a2aa006b01554edfb