FAILURE MAP
← Case archive

FA-93316 / EV charging session scheduling / Open access

Site power profile from charge plans: zero-length intervals · case 01

A zero-length placeholder interval inserts a spurious zero-power change point.

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

ROOT CAUSE

Breakpoints are collected from zero-length intervals.

VERIFIED REPAIR

Ignore intervals with end <= start when collecting breakpoints.

Unsuccessful approach: Filtering only negative lengths still admits zero-length placeholders.

Case contract

plan holds [start, end, kw] charging intervals ([start, end), zero-length ignored). Build the site profile as change points [[t, total_kw]] over the interval breakpoints, merging equal consecutive levels, and close with [last breakpoint, 0] unless the profile already ends at 0. Also return the start points of segments whose total exceeds site_max. Return [profile, overloads].

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(plan, site_max):
    pts = sorted({t for s, e, _ in plan for t in (s, e)})
    out = []
    over = []
    for a, b in zip(pts, pts[1:]):
        kw = sum(k for s, e, k in plan if s <= a and b <= e)
        if out and out[-1][1] == kw:
            continue
        out.append([a, kw])
        if kw > site_max:
            over.append(a)
    if pts:
        if not out or out[-1][1] != 0:
            out.append([pts[-1], 0])
    return [out, over]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[17, 17, 4]], 11], [[], []]],
  ['regression: zero-length intervals (partial repair)', [[[11, 11, 11]], 15], [[], []]],
  ['control 1', [[[23, 38, 0], [0, 5, 4], [18, 18, 11]], 15], [[[0, 4], [5, 0]], []]],
  ['control 2', [[[6, 8, 7]], 22], [[[6, 7], [8, 0]], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[29, 29, 0], [4, 4, 11], [10, 25, 0]], 18],
   [[[10, 0]], []]],
  ['regression: zero-length intervals (partial repair)', [[[7, 7, 7], [5, 5, 7]], 7], [[], []]],
  ['control 1', [[[12, 12, 4], [7, 12, 11], [27, 37, 4]], 22],
   [[[7, 11], [12, 0], [27, 4], [37, 0]], []]],
  ['control 2', [[], 18], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[9, 11, 0], [4, 4, 11]], 18], [[[9, 0]], []]],
  ['regression: zero-length intervals (partial repair)',
   [[[19, 19, 11], [6, 6, 7], [15, 25, 11], [8, 23, 0], [27, 32, 4]], 22],
   [[[8, 0], [15, 11], [25, 0], [27, 4], [32, 0]], []]],
  ['control 1', [[[21, 31, 11], [23, 33, 7], [0, 10, 7], [25, 25, 0], [28, 43, 7]], 15],
   [[[0, 7], [10, 0], [21, 11], [23, 18], [28, 25], [31, 14], [33, 7], [43, 0]], [23, 28]]],
  ['control 2', [[[17, 27, 11], [22, 37, 11], [10, 10, 7], [19, 29, 11]], 7],
   [[[17, 11], [19, 22], [22, 33], [27, 22], [29, 11], [37, 0]], [17, 19, 22, 27, 29]]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[8, 8, 11], [0, 0, 11], [7, 17, 7]], 7],
   [[[7, 7], [17, 0]], []]],
  ['regression: zero-length intervals (partial repair)',
   [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]],
  ['control 1', [[], 22], [[], []]], ['control 2', [[], 22], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals',
   [[[26, 36, 11], [11, 26, 11], [19, 24, 11], [13, 23, 11], [0, 0, 4]], 18],
   [[[11, 11], [13, 22], [19, 33], [23, 22], [24, 11], [36, 0]], [13, 19, 23]]],
  ['regression: zero-length intervals (partial repair)',
   [[[16, 26, 11], [10, 10, 4], [22, 22, 11], [19, 19, 4], [23, 33, 4]], 7],
   [[[16, 11], [23, 15], [26, 4], [33, 0]], [16, 23]]],
  ['control 1', [[[8, 8, 11], [0, 0, 11], [7, 17, 7]], 7], [[[7, 7], [17, 0]], []]],
  ['control 2', [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]]]]
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: zero-length interval before plan[[[5, 0], [10, 11], [20, 0]], []][[[10, 11], [20, 0]], []]Failed
boundary: exact site limit[[[0, 11], [10, 0]], []][[[0, 11], [10, 0]], []]Passed
boundary: empty plan[[], []][[], []]Passed
regression: zero-length intervals[[[17, 0]], []][[], []]Failed
regression: zero-length intervals (partial repair)[[[11, 0]], []][[], []]Failed
control 1[[[0, 4], [5, 0]], []][[[0, 4], [5, 0]], []]Passed
control 2[[[6, 7], [8, 0]], []][[[6, 7], [8, 0]], []]Passed

SHA-256 / e4684ad3dddcc41ce887cccd94163c9de652729745afd4d0a3693ebdcde326cb

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(plan, site_max):
    pts = sorted({t for s, e, _ in plan for t in (s, e) if e >= s})
    out = []
    over = []
    for a, b in zip(pts, pts[1:]):
        kw = sum(k for s, e, k in plan if s <= a and b <= e)
        if out and out[-1][1] == kw:
            continue
        out.append([a, kw])
        if kw > site_max:
            over.append(a)
    if pts:
        if not out or out[-1][1] != 0:
            out.append([pts[-1], 0])
    return [out, over]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[17, 17, 4]], 11], [[], []]],
  ['regression: zero-length intervals (partial repair)', [[[11, 11, 11]], 15], [[], []]],
  ['control 1', [[[23, 38, 0], [0, 5, 4], [18, 18, 11]], 15], [[[0, 4], [5, 0]], []]],
  ['control 2', [[[6, 8, 7]], 22], [[[6, 7], [8, 0]], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[29, 29, 0], [4, 4, 11], [10, 25, 0]], 18],
   [[[10, 0]], []]],
  ['regression: zero-length intervals (partial repair)', [[[7, 7, 7], [5, 5, 7]], 7], [[], []]],
  ['control 1', [[[12, 12, 4], [7, 12, 11], [27, 37, 4]], 22],
   [[[7, 11], [12, 0], [27, 4], [37, 0]], []]],
  ['control 2', [[], 18], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[9, 11, 0], [4, 4, 11]], 18], [[[9, 0]], []]],
  ['regression: zero-length intervals (partial repair)',
   [[[19, 19, 11], [6, 6, 7], [15, 25, 11], [8, 23, 0], [27, 32, 4]], 22],
   [[[8, 0], [15, 11], [25, 0], [27, 4], [32, 0]], []]],
  ['control 1', [[[21, 31, 11], [23, 33, 7], [0, 10, 7], [25, 25, 0], [28, 43, 7]], 15],
   [[[0, 7], [10, 0], [21, 11], [23, 18], [28, 25], [31, 14], [33, 7], [43, 0]], [23, 28]]],
  ['control 2', [[[17, 27, 11], [22, 37, 11], [10, 10, 7], [19, 29, 11]], 7],
   [[[17, 11], [19, 22], [22, 33], [27, 22], [29, 11], [37, 0]], [17, 19, 22, 27, 29]]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[8, 8, 11], [0, 0, 11], [7, 17, 7]], 7],
   [[[7, 7], [17, 0]], []]],
  ['regression: zero-length intervals (partial repair)',
   [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]],
  ['control 1', [[], 22], [[], []]], ['control 2', [[], 22], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals',
   [[[26, 36, 11], [11, 26, 11], [19, 24, 11], [13, 23, 11], [0, 0, 4]], 18],
   [[[11, 11], [13, 22], [19, 33], [23, 22], [24, 11], [36, 0]], [13, 19, 23]]],
  ['regression: zero-length intervals (partial repair)',
   [[[16, 26, 11], [10, 10, 4], [22, 22, 11], [19, 19, 4], [23, 33, 4]], 7],
   [[[16, 11], [23, 15], [26, 4], [33, 0]], [16, 23]]],
  ['control 1', [[[8, 8, 11], [0, 0, 11], [7, 17, 7]], 7], [[[7, 7], [17, 0]], []]],
  ['control 2', [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]]]]
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: zero-length interval before plan[[[5, 0], [10, 11], [20, 0]], []][[[10, 11], [20, 0]], []]Failed
boundary: exact site limit[[[0, 11], [10, 0]], []][[[0, 11], [10, 0]], []]Passed
boundary: empty plan[[], []][[], []]Passed
regression: zero-length intervals[[[17, 0]], []][[], []]Failed
regression: zero-length intervals (partial repair)[[[11, 0]], []][[], []]Failed
control 1[[[0, 4], [5, 0]], []][[[0, 4], [5, 0]], []]Passed
control 2[[[6, 7], [8, 0]], []][[[6, 7], [8, 0]], []]Passed

SHA-256 / 75117016b7d5839b609456491864790d66881791977d2e80970b22b19e48d959

3 / The verified repair

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

N = 1
observations = []
def solve(plan, site_max):
    pts = sorted({t for s, e, _ in plan for t in (s, e) if e > s})
    out = []
    over = []
    for a, b in zip(pts, pts[1:]):
        kw = sum(k for s, e, k in plan if s <= a and b <= e)
        if out and out[-1][1] == kw:
            continue
        out.append([a, kw])
        if kw > site_max:
            over.append(a)
    if pts:
        if not out or out[-1][1] != 0:
            out.append([pts[-1], 0])
    return [out, over]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[17, 17, 4]], 11], [[], []]],
  ['regression: zero-length intervals (partial repair)', [[[11, 11, 11]], 15], [[], []]],
  ['control 1', [[[23, 38, 0], [0, 5, 4], [18, 18, 11]], 15], [[[0, 4], [5, 0]], []]],
  ['control 2', [[[6, 8, 7]], 22], [[[6, 7], [8, 0]], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[29, 29, 0], [4, 4, 11], [10, 25, 0]], 18],
   [[[10, 0]], []]],
  ['regression: zero-length intervals (partial repair)', [[[7, 7, 7], [5, 5, 7]], 7], [[], []]],
  ['control 1', [[[12, 12, 4], [7, 12, 11], [27, 37, 4]], 22],
   [[[7, 11], [12, 0], [27, 4], [37, 0]], []]],
  ['control 2', [[], 18], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[9, 11, 0], [4, 4, 11]], 18], [[[9, 0]], []]],
  ['regression: zero-length intervals (partial repair)',
   [[[19, 19, 11], [6, 6, 7], [15, 25, 11], [8, 23, 0], [27, 32, 4]], 22],
   [[[8, 0], [15, 11], [25, 0], [27, 4], [32, 0]], []]],
  ['control 1', [[[21, 31, 11], [23, 33, 7], [0, 10, 7], [25, 25, 0], [28, 43, 7]], 15],
   [[[0, 7], [10, 0], [21, 11], [23, 18], [28, 25], [31, 14], [33, 7], [43, 0]], [23, 28]]],
  ['control 2', [[[17, 27, 11], [22, 37, 11], [10, 10, 7], [19, 29, 11]], 7],
   [[[17, 11], [19, 22], [22, 33], [27, 22], [29, 11], [37, 0]], [17, 19, 22, 27, 29]]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals', [[[8, 8, 11], [0, 0, 11], [7, 17, 7]], 7],
   [[[7, 7], [17, 0]], []]],
  ['regression: zero-length intervals (partial repair)',
   [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]],
  ['control 1', [[], 22], [[], []]], ['control 2', [[], 22], [[], []]]],
 [['boundary: zero-length interval before plan', [[[5, 5, 7], [10, 20, 11]], 11],
   [[[10, 11], [20, 0]], []]],
  ['boundary: exact site limit', [[[0, 10, 7], [0, 10, 4]], 11], [[[0, 11], [10, 0]], []]],
  ['boundary: empty plan', [[], 11], [[], []]],
  ['regression: zero-length intervals',
   [[[26, 36, 11], [11, 26, 11], [19, 24, 11], [13, 23, 11], [0, 0, 4]], 18],
   [[[11, 11], [13, 22], [19, 33], [23, 22], [24, 11], [36, 0]], [13, 19, 23]]],
  ['regression: zero-length intervals (partial repair)',
   [[[16, 26, 11], [10, 10, 4], [22, 22, 11], [19, 19, 4], [23, 33, 4]], 7],
   [[[16, 11], [23, 15], [26, 4], [33, 0]], [16, 23]]],
  ['control 1', [[[8, 8, 11], [0, 0, 11], [7, 17, 7]], 7], [[[7, 7], [17, 0]], []]],
  ['control 2', [[[22, 22, 11], [5, 5, 4], [10, 15, 11], [22, 32, 11], [14, 14, 0]], 11],
   [[[10, 11], [15, 0], [22, 11], [32, 0]], []]]]]
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: zero-length interval before plan[[[10, 11], [20, 0]], []][[[10, 11], [20, 0]], []]Passed
boundary: exact site limit[[[0, 11], [10, 0]], []][[[0, 11], [10, 0]], []]Passed
boundary: empty plan[[], []][[], []]Passed
regression: zero-length intervals[[], []][[], []]Passed
regression: zero-length intervals (partial repair)[[], []][[], []]Passed
control 1[[[0, 4], [5, 0]], []][[[0, 4], [5, 0]], []]Passed
control 2[[[6, 7], [8, 0]], []][[[6, 7], [8, 0]], []]Passed

SHA-256 / fbc40f965c0ce79db0ad3a4d93c62320023d5041a9c1ec988c0e6b90db34e4f0

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

Case digest / f67f3b7589bb9f32faa54ff667ebbd84eb846077e1bf9d7b3b81e3d8ce78e4fe