FAILURE MAP
← Case archive

FA-93101 / EV charging session scheduling / Open access

Depot least-laxity-first charging: laxity slot rounding · case 01

A vehicle needing a partial final slot is treated as having spare time and misses its target.

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

ROOT CAUSE

The slots still needed are floored, overstating laxity.

THE FAILURE

The slots still needed are floored, overstating laxity.

Unsuccessful approach: Nearest rounding still overstates laxity for small remainders.

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: laxity slot rounding',
   [[['B0', 4, 2, 3], ['B2', 9, 8, 2], ['B1', 8, 2, 2], ['B3', 11, 3, 4]], 3, 5],
   [[['B0', 3], ['B1', 4], ['B2', 5], ['B3', 7]], ['B0', 'B1', 'B2', 'B3']]],
  ['regression: laxity slot rounding (partial repair)',
   [[['B1', 2, 8, 4], ['B0', 10, 6, 4], ['B2', 14, 4, 2], ['B3', 13, 6, 4]], 3, 9],
   [[['B0', 5], ['B1', 0], ['B2', 6], ['B3', 8]], ['B0', 'B2', 'B3']]],
  ['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: laxity slot rounding',
   [[['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: laxity slot rounding (partial repair)',
   [[['B4', 1, 9, 2], ['B2', 11, 10, 2], ['B3', 8, 3, 3], ['B0', 12, 4, 4], ['B1', 5, 10, 1]], 2,
    7],
   [[['B0', 6], ['B1', 3], ['B2', 7], ['B3', 6], ['B4', 1]], ['B0', 'B1', 'B2', 'B3', 'B4']]],
  ['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: laxity slot rounding',
   [[['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']]],
  ['regression: laxity slot rounding (partial repair)',
   [[['B1', 13, 3, 4], ['B0', 4, 6, 4], ['B2', 3, 1, 2]], 5, 9],
   [[['B0', 0], ['B1', 1], ['B2', 2]], ['B1', 'B2']]],
  ['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: laxity slot rounding',
   [[['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']]],
  ['regression: laxity slot rounding (partial repair)',
   [[['B1', 1, 2, 1], ['B2', 12, 5, 3], ['B0', 1, 2, 2], ['B3', 14, 3, 1]], 2, 8],
   [[['B0', 0], ['B1', 0], ['B2', 7], ['B3', 11]], ['B2', 'B3']]],
  ['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: laxity slot rounding',
   [[['B0', 10, 8, 2], ['B1', 1, 2, 2], ['B2', 13, 3, 4], ['B4', 9, 8, 1], ['B3', 11, 8, 3]], 2,
    10],
   [[['B0', 6], ['B1', 1], ['B2', 8], ['B3', 9], ['B4', 4]], ['B0', 'B1', 'B2', 'B3', 'B4']]],
  ['regression: laxity slot rounding (partial repair)',
   [[['B1', 14, 10, 4], ['B2', 8, 7, 4], ['B0', 8, 7, 2]], 7, 4],
   [[['B0', 0], ['B1', 3], ['B2', 0]], ['B1']]],
  ['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: laxity slot rounding[[['B0', 2], ['B1', 4], ['B2', 5], ['B3', 8]], ['B0', 'B1', 'B2', 'B3']][[['B0', 3], ['B1', 4], ['B2', 5], ['B3', 7]], ['B0', 'B1', 'B2', 'B3']]Failed
regression: laxity slot rounding (partial repair)[[['B0', 5], ['B1', 0], ['B2', 6], ['B3', 8]], ['B0', 'B2', 'B3']][[['B0', 5], ['B1', 0], ['B2', 6], ['B3', 8]], ['B0', 'B2', 'B3']]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 / 133749cdd6d98399636878b56f36fe640aa0c4fb253b63f5153c992428d9122f

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 and rem[v[0]] > 0]
        def lax(v):
            need_slots = round(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: laxity slot rounding',
   [[['B0', 4, 2, 3], ['B2', 9, 8, 2], ['B1', 8, 2, 2], ['B3', 11, 3, 4]], 3, 5],
   [[['B0', 3], ['B1', 4], ['B2', 5], ['B3', 7]], ['B0', 'B1', 'B2', 'B3']]],
  ['regression: laxity slot rounding (partial repair)',
   [[['B1', 2, 8, 4], ['B0', 10, 6, 4], ['B2', 14, 4, 2], ['B3', 13, 6, 4]], 3, 9],
   [[['B0', 5], ['B1', 0], ['B2', 6], ['B3', 8]], ['B0', 'B2', 'B3']]],
  ['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: laxity slot rounding',
   [[['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: laxity slot rounding (partial repair)',
   [[['B4', 1, 9, 2], ['B2', 11, 10, 2], ['B3', 8, 3, 3], ['B0', 12, 4, 4], ['B1', 5, 10, 1]], 2,
    7],
   [[['B0', 6], ['B1', 3], ['B2', 7], ['B3', 6], ['B4', 1]], ['B0', 'B1', 'B2', 'B3', 'B4']]],
  ['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: laxity slot rounding',
   [[['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']]],
  ['regression: laxity slot rounding (partial repair)',
   [[['B1', 13, 3, 4], ['B0', 4, 6, 4], ['B2', 3, 1, 2]], 5, 9],
   [[['B0', 0], ['B1', 1], ['B2', 2]], ['B1', 'B2']]],
  ['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: laxity slot rounding',
   [[['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']]],
  ['regression: laxity slot rounding (partial repair)',
   [[['B1', 1, 2, 1], ['B2', 12, 5, 3], ['B0', 1, 2, 2], ['B3', 14, 3, 1]], 2, 8],
   [[['B0', 0], ['B1', 0], ['B2', 7], ['B3', 11]], ['B2', 'B3']]],
  ['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: laxity slot rounding',
   [[['B0', 10, 8, 2], ['B1', 1, 2, 2], ['B2', 13, 3, 4], ['B4', 9, 8, 1], ['B3', 11, 8, 3]], 2,
    10],
   [[['B0', 6], ['B1', 1], ['B2', 8], ['B3', 9], ['B4', 4]], ['B0', 'B1', 'B2', 'B3', 'B4']]],
  ['regression: laxity slot rounding (partial repair)',
   [[['B1', 14, 10, 4], ['B2', 8, 7, 4], ['B0', 8, 7, 2]], 7, 4],
   [[['B0', 0], ['B1', 3], ['B2', 0]], ['B1']]],
  ['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: laxity slot rounding[[['B0', 3], ['B1', 4], ['B2', 5], ['B3', 7]], ['B0', 'B1', 'B2', 'B3']][[['B0', 3], ['B1', 4], ['B2', 5], ['B3', 7]], ['B0', 'B1', 'B2', 'B3']]Passed
regression: laxity slot rounding (partial repair)[[['B0', 3], ['B1', 0], ['B2', 6], ['B3', 10]], ['B0', 'B2', 'B3']][[['B0', 5], ['B1', 0], ['B2', 6], ['B3', 8]], ['B0', 'B2', 'B3']]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 / 2fd81cd39a276938ec86cfe6e8795e449d9826d9d74dc2c2f6c37218490f1c3a

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 7 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

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:52.017935+00:00.

Case digest / a28d71f79faab2d392d729ecbeb5952d4d3f88c30c60eef2a733c00b3f09c0ff