FA-93321 / EV charging session scheduling / Open access
Site power profile from charge plans: segment coverage · case 01
The final segment of every charging interval drops out of the site profile.
ROOT CAUSE
The coverage test requires the segment to end strictly before the interval end.
VERIFIED REPAIR
An interval covers segment [a, b) when s <= a and b <= e.
Unsuccessful approach: Requiring s < a drops the first segment instead.
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) 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: segment coverage',
[[[23, 28, 11], [8, 13, 0], [15, 20, 0], [24, 24, 4], [16, 16, 0]], 15],
[[[8, 0], [23, 11], [28, 0]], []]],
['regression: segment coverage (partial repair)', [[[4, 14, 11], [0, 2, 0], [16, 18, 0]], 11],
[[[0, 0], [4, 11], [14, 0]], []]],
['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: segment coverage', [[[11, 13, 4], [13, 28, 0], [17, 22, 0], [9, 11, 4]], 22],
[[[9, 4], [13, 0]], []]],
['regression: segment coverage (partial repair)',
[[[11, 16, 0], [11, 16, 7], [19, 21, 11], [8, 18, 11], [16, 16, 0]], 15],
[[[8, 11], [11, 18], [16, 11], [18, 0], [19, 11], [21, 0]], [11]]],
['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: segment coverage', [[[2, 17, 7]], 11], [[[2, 7], [17, 0]], []]],
['regression: segment coverage (partial repair)', [[[9, 14, 0], [6, 8, 7]], 7],
[[[6, 7], [8, 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: segment coverage',
[[[10, 12, 7], [3, 8, 0], [29, 39, 11], [6, 11, 7], [13, 23, 7]], 11],
[[[3, 0], [6, 7], [10, 14], [11, 7], [12, 0], [13, 7], [23, 0], [29, 11], [39, 0]], [10]]],
['regression: segment coverage (partial repair)', [[[19, 21, 11], [15, 30, 7], [30, 45, 11]], 22],
[[[15, 7], [19, 18], [21, 7], [30, 11], [45, 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: segment coverage', [[[15, 25, 11], [27, 27, 0], [26, 26, 11]], 22],
[[[15, 11], [25, 0]], []]],
['regression: segment coverage (partial repair)',
[[[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]]],
['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary: zero-length interval before plan | [[[10, 0]], []] | [[[10, 11], [20, 0]], []] | Failed |
| boundary: exact site limit | [[[0, 0]], []] | [[[0, 11], [10, 0]], []] | Failed |
| boundary: empty plan | [[], []] | [[], []] | Passed |
| regression: segment coverage | [[[8, 0]], []] | [[[8, 0], [23, 11], [28, 0]], []] | Failed |
| regression: segment coverage (partial repair) | [[[0, 0]], []] | [[[0, 0], [4, 11], [14, 0]], []] | Failed |
| control 1 | [[[0, 0]], []] | [[[0, 4], [5, 0]], []] | Failed |
| control 2 | [[[6, 0]], []] | [[[6, 7], [8, 0]], []] | Failed |
SHA-256 / f84ff99a37d94a994202cb5d06bf462cdb42c194c148ffaaa4ca3f376a15f2bc
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: segment coverage',
[[[23, 28, 11], [8, 13, 0], [15, 20, 0], [24, 24, 4], [16, 16, 0]], 15],
[[[8, 0], [23, 11], [28, 0]], []]],
['regression: segment coverage (partial repair)', [[[4, 14, 11], [0, 2, 0], [16, 18, 0]], 11],
[[[0, 0], [4, 11], [14, 0]], []]],
['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: segment coverage', [[[11, 13, 4], [13, 28, 0], [17, 22, 0], [9, 11, 4]], 22],
[[[9, 4], [13, 0]], []]],
['regression: segment coverage (partial repair)',
[[[11, 16, 0], [11, 16, 7], [19, 21, 11], [8, 18, 11], [16, 16, 0]], 15],
[[[8, 11], [11, 18], [16, 11], [18, 0], [19, 11], [21, 0]], [11]]],
['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: segment coverage', [[[2, 17, 7]], 11], [[[2, 7], [17, 0]], []]],
['regression: segment coverage (partial repair)', [[[9, 14, 0], [6, 8, 7]], 7],
[[[6, 7], [8, 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: segment coverage',
[[[10, 12, 7], [3, 8, 0], [29, 39, 11], [6, 11, 7], [13, 23, 7]], 11],
[[[3, 0], [6, 7], [10, 14], [11, 7], [12, 0], [13, 7], [23, 0], [29, 11], [39, 0]], [10]]],
['regression: segment coverage (partial repair)', [[[19, 21, 11], [15, 30, 7], [30, 45, 11]], 22],
[[[15, 7], [19, 18], [21, 7], [30, 11], [45, 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: segment coverage', [[[15, 25, 11], [27, 27, 0], [26, 26, 11]], 22],
[[[15, 11], [25, 0]], []]],
['regression: segment coverage (partial repair)',
[[[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]]],
['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary: zero-length interval before plan | [[[10, 0]], []] | [[[10, 11], [20, 0]], []] | Failed |
| boundary: exact site limit | [[[0, 0]], []] | [[[0, 11], [10, 0]], []] | Failed |
| boundary: empty plan | [[], []] | [[], []] | Passed |
| regression: segment coverage | [[[8, 0]], []] | [[[8, 0], [23, 11], [28, 0]], []] | Failed |
| regression: segment coverage (partial repair) | [[[0, 0]], []] | [[[0, 0], [4, 11], [14, 0]], []] | Failed |
| control 1 | [[[0, 0]], []] | [[[0, 4], [5, 0]], []] | Failed |
| control 2 | [[[6, 0]], []] | [[[6, 7], [8, 0]], []] | Failed |
SHA-256 / f98c77be2cceccf1547911cbe7e3f3207feb8df9fea36edd8c06aa297cfb8eef
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: segment coverage',
[[[23, 28, 11], [8, 13, 0], [15, 20, 0], [24, 24, 4], [16, 16, 0]], 15],
[[[8, 0], [23, 11], [28, 0]], []]],
['regression: segment coverage (partial repair)', [[[4, 14, 11], [0, 2, 0], [16, 18, 0]], 11],
[[[0, 0], [4, 11], [14, 0]], []]],
['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: segment coverage', [[[11, 13, 4], [13, 28, 0], [17, 22, 0], [9, 11, 4]], 22],
[[[9, 4], [13, 0]], []]],
['regression: segment coverage (partial repair)',
[[[11, 16, 0], [11, 16, 7], [19, 21, 11], [8, 18, 11], [16, 16, 0]], 15],
[[[8, 11], [11, 18], [16, 11], [18, 0], [19, 11], [21, 0]], [11]]],
['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: segment coverage', [[[2, 17, 7]], 11], [[[2, 7], [17, 0]], []]],
['regression: segment coverage (partial repair)', [[[9, 14, 0], [6, 8, 7]], 7],
[[[6, 7], [8, 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: segment coverage',
[[[10, 12, 7], [3, 8, 0], [29, 39, 11], [6, 11, 7], [13, 23, 7]], 11],
[[[3, 0], [6, 7], [10, 14], [11, 7], [12, 0], [13, 7], [23, 0], [29, 11], [39, 0]], [10]]],
['regression: segment coverage (partial repair)', [[[19, 21, 11], [15, 30, 7], [30, 45, 11]], 22],
[[[15, 7], [19, 18], [21, 7], [30, 11], [45, 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: segment coverage', [[[15, 25, 11], [27, 27, 0], [26, 26, 11]], 22],
[[[15, 11], [25, 0]], []]],
['regression: segment coverage (partial repair)',
[[[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]]],
['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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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: segment coverage | [[[8, 0], [23, 11], [28, 0]], []] | [[[8, 0], [23, 11], [28, 0]], []] | Passed |
| regression: segment coverage (partial repair) | [[[0, 0], [4, 11], [14, 0]], []] | [[[0, 0], [4, 11], [14, 0]], []] | 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 / 8c02e729e67a3aca477ac960c3566c4c528103267868f6e0aecd84b0d7f130e3
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.232043+00:00.
Case digest / 9b351213aaaf795cde6aac4c60c8187a00107cc6c4e59a55828499fe1568bf47