FAILURE MAP
← Case archive

FA-92916 / EV charging session scheduling / Open access

Shared circuit current allocation: priority ordering · case 01

Low-priority vehicles charge while high-priority vehicles are paused.

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

ROOT CAUSE

Eligible EVs are sorted by ascending priority.

VERIFIED REPAIR

Order by descending priority, ties by ascending id.

Unsuccessful approach: Correcting the direction but breaking ties by id length reorders equal-priority vehicles.

Case contract

evs is a list of [id, max_a, priority]. An EV with max_a < 6 cannot be served. Eligible EVs are ordered by priority descending then id; each is admitted while 6*(admitted+1) <= limit_a. Admitted EVs are water-filled: repeatedly give floor(remaining/open) amps, fixing EVs whose max_a <= share at their max. Leftover amps go one each in admission order to EVs below max. Return [[id, amps]] for every EV sorted by id (0 = paused).

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(limit_a, evs):
    elig = [e for e in evs if e[1] >= 6]
    elig.sort(key=lambda e: (e[2], e[0]))
    admitted = []
    for e in elig:
        if 6 * (len(admitted) + 1) <= limit_a:
            admitted.append(e)
    alloc = {e[0]: 0 for e in evs}
    remaining = limit_a
    open_ = list(admitted)
    while open_:
        share = remaining // len(open_)
        capped = [e for e in open_ if e[1] <= share]
        if not capped:
            for e in open_:
                alloc[e[0]] = share
            remaining -= share * len(open_)
            break
        for e in capped:
            alloc[e[0]] = e[1]
            remaining -= e[1]
            open_.remove(e)
    for e in admitted:
        if remaining <= 0:
            break
        if alloc[e[0]] < e[1]:
            alloc[e[0]] += 1
            remaining -= 1
    return [[k, alloc[k]] for k in sorted(alloc)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [10, [['EV2', 10, 0], ['EV0', 6, 2], ['EV1', 16, 2], ['EV3', 16, 1]]],
   [['EV0', 6], ['EV1', 0], ['EV2', 0], ['EV3', 0]]],
  ['regression: priority ordering (partial repair)',
   [16,
    [['EV5', 8, 0], ['EV2', 8, 3], ['EV4', 6, 1], ['EV3', 6, 1], ['EV1', 5, 1], ['EV0', 10, 0]]],
   [['EV0', 0], ['EV1', 0], ['EV2', 8], ['EV3', 6], ['EV4', 0], ['EV5', 0]]],
  ['control 1', [32, [['EV0', 32, 3], ['EV1', 24, 3]]], [['EV0', 16], ['EV1', 16]]],
  ['control 2', [24, [['EV0', 16, 2], ['EV1', 32, 2], ['EV2', 32, 0], ['EV3', 8, 1]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [32,
    [['EV2', 32, 1], ['EV4', 32, 0], ['EV3', 6, 2], ['EV1', 32, 2], ['EV5', 24, 1],
     ['EV0', 32, 3]]],
   [['EV0', 7], ['EV1', 7], ['EV2', 6], ['EV3', 6], ['EV4', 0], ['EV5', 6]]],
  ['regression: priority ordering (partial repair)',
   [16, [['EV2', 8, 2], ['EV1', 32, 2], ['EV0', 6, 3]]], [['EV0', 6], ['EV1', 10], ['EV2', 0]]],
  ['control 1',
   [30,
    [['EV1', 8, 3], ['EV4', 6, 2], ['EV0', 16, 0], ['EV2', 10, 3], ['EV3', 24, 1], ['EV5', 6, 2]]],
   [['EV0', 0], ['EV1', 6], ['EV2', 6], ['EV3', 6], ['EV4', 6], ['EV5', 6]]],
  ['control 2', [40, [['EV1', 5, 1], ['EV0', 32, 2]]], [['EV0', 32], ['EV1', 0]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [48, [['EV1', 16, 2], ['EV0', 16, 2], ['EV4', 32, 3], ['EV2', 24, 3], ['EV3', 24, 3]]],
   [['EV0', 9], ['EV1', 9], ['EV2', 10], ['EV3', 10], ['EV4', 10]]],
  ['regression: priority ordering (partial repair)',
   [12, [['EV0', 16, 0], ['EV2', 16, 0], ['EV1', 32, 0]]], [['EV0', 6], ['EV1', 6], ['EV2', 0]]],
  ['control 1', [18, [['EV2', 32, 0], ['EV0', 5, 2], ['EV1', 24, 3]]],
   [['EV0', 0], ['EV1', 9], ['EV2', 9]]],
  ['control 2', [16, [['EV0', 24, 3], ['EV1', 16, 0], ['EV2', 16, 2]]],
   [['EV0', 8], ['EV1', 0], ['EV2', 8]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [18, [['EV2', 6, 0], ['EV1', 24, 1], ['EV3', 24, 0], ['EV0', 32, 2]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 0]]],
  ['regression: priority ordering (partial repair)',
   [30,
    [['EV5', 24, 0], ['EV0', 6, 0], ['EV3', 10, 1], ['EV1', 8, 0], ['EV4', 6, 0], ['EV2', 6, 0]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6], ['EV4', 6], ['EV5', 0]]],
  ['control 1', [16, [['EV1', 16, 2], ['EV0', 32, 3]]], [['EV0', 8], ['EV1', 8]]],
  ['control 2',
   [48,
    [['EV3', 8, 0], ['EV1', 16, 0], ['EV4', 5, 0], ['EV2', 8, 0], ['EV5', 10, 0], ['EV0', 10, 3]]],
   [['EV0', 10], ['EV1', 12], ['EV2', 8], ['EV3', 8], ['EV4', 0], ['EV5', 10]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [40, [['EV1', 24, 3], ['EV0', 6, 0], ['EV2', 32, 1], ['EV3', 32, 3]]],
   [['EV0', 6], ['EV1', 12], ['EV2', 11], ['EV3', 11]]],
  ['regression: priority ordering (partial repair)',
   [24, [['EV4', 24, 2], ['EV0', 16, 3], ['EV2', 8, 2], ['EV3', 6, 2], ['EV1', 6, 2]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6], ['EV4', 0]]],
  ['control 1', [40, [['EV2', 5, 0], ['EV0', 6, 2], ['EV3', 24, 2], ['EV1', 10, 3]]],
   [['EV0', 6], ['EV1', 10], ['EV2', 0], ['EV3', 24]]],
  ['control 2', [10, [['EV0', 10, 0]]], [['EV0', 10]]]]]
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: exactly one minimum share[['A', 6], ['B', 0]][['A', 6], ['B', 0]]Passed
boundary: EV at 6 A maximum[['A', 6], ['B', 14]][['A', 6], ['B', 14]]Passed
boundary: no EVs[][]Passed
regression: priority ordering[['EV0', 0], ['EV1', 0], ['EV2', 10], ['EV3', 0]][['EV0', 6], ['EV1', 0], ['EV2', 0], ['EV3', 0]]Failed
regression: priority ordering (partial repair)[['EV0', 8], ['EV1', 0], ['EV2', 0], ['EV3', 0], ['EV4', 0], ['EV5', 8]][['EV0', 0], ['EV1', 0], ['EV2', 8], ['EV3', 6], ['EV4', 0], ['EV5', 0]]Failed
control 1[['EV0', 16], ['EV1', 16]][['EV0', 16], ['EV1', 16]]Passed
control 2[['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6]][['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6]]Passed

SHA-256 / 83606ff2d54875040e2cf2e02e521f25055cda51c2dcac73b9edf2ff67bc3958

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(limit_a, evs):
    elig = [e for e in evs if e[1] >= 6]
    elig.sort(key=lambda e: (-e[2], -len(e[0])))
    admitted = []
    for e in elig:
        if 6 * (len(admitted) + 1) <= limit_a:
            admitted.append(e)
    alloc = {e[0]: 0 for e in evs}
    remaining = limit_a
    open_ = list(admitted)
    while open_:
        share = remaining // len(open_)
        capped = [e for e in open_ if e[1] <= share]
        if not capped:
            for e in open_:
                alloc[e[0]] = share
            remaining -= share * len(open_)
            break
        for e in capped:
            alloc[e[0]] = e[1]
            remaining -= e[1]
            open_.remove(e)
    for e in admitted:
        if remaining <= 0:
            break
        if alloc[e[0]] < e[1]:
            alloc[e[0]] += 1
            remaining -= 1
    return [[k, alloc[k]] for k in sorted(alloc)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [10, [['EV2', 10, 0], ['EV0', 6, 2], ['EV1', 16, 2], ['EV3', 16, 1]]],
   [['EV0', 6], ['EV1', 0], ['EV2', 0], ['EV3', 0]]],
  ['regression: priority ordering (partial repair)',
   [16,
    [['EV5', 8, 0], ['EV2', 8, 3], ['EV4', 6, 1], ['EV3', 6, 1], ['EV1', 5, 1], ['EV0', 10, 0]]],
   [['EV0', 0], ['EV1', 0], ['EV2', 8], ['EV3', 6], ['EV4', 0], ['EV5', 0]]],
  ['control 1', [32, [['EV0', 32, 3], ['EV1', 24, 3]]], [['EV0', 16], ['EV1', 16]]],
  ['control 2', [24, [['EV0', 16, 2], ['EV1', 32, 2], ['EV2', 32, 0], ['EV3', 8, 1]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [32,
    [['EV2', 32, 1], ['EV4', 32, 0], ['EV3', 6, 2], ['EV1', 32, 2], ['EV5', 24, 1],
     ['EV0', 32, 3]]],
   [['EV0', 7], ['EV1', 7], ['EV2', 6], ['EV3', 6], ['EV4', 0], ['EV5', 6]]],
  ['regression: priority ordering (partial repair)',
   [16, [['EV2', 8, 2], ['EV1', 32, 2], ['EV0', 6, 3]]], [['EV0', 6], ['EV1', 10], ['EV2', 0]]],
  ['control 1',
   [30,
    [['EV1', 8, 3], ['EV4', 6, 2], ['EV0', 16, 0], ['EV2', 10, 3], ['EV3', 24, 1], ['EV5', 6, 2]]],
   [['EV0', 0], ['EV1', 6], ['EV2', 6], ['EV3', 6], ['EV4', 6], ['EV5', 6]]],
  ['control 2', [40, [['EV1', 5, 1], ['EV0', 32, 2]]], [['EV0', 32], ['EV1', 0]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [48, [['EV1', 16, 2], ['EV0', 16, 2], ['EV4', 32, 3], ['EV2', 24, 3], ['EV3', 24, 3]]],
   [['EV0', 9], ['EV1', 9], ['EV2', 10], ['EV3', 10], ['EV4', 10]]],
  ['regression: priority ordering (partial repair)',
   [12, [['EV0', 16, 0], ['EV2', 16, 0], ['EV1', 32, 0]]], [['EV0', 6], ['EV1', 6], ['EV2', 0]]],
  ['control 1', [18, [['EV2', 32, 0], ['EV0', 5, 2], ['EV1', 24, 3]]],
   [['EV0', 0], ['EV1', 9], ['EV2', 9]]],
  ['control 2', [16, [['EV0', 24, 3], ['EV1', 16, 0], ['EV2', 16, 2]]],
   [['EV0', 8], ['EV1', 0], ['EV2', 8]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [18, [['EV2', 6, 0], ['EV1', 24, 1], ['EV3', 24, 0], ['EV0', 32, 2]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 0]]],
  ['regression: priority ordering (partial repair)',
   [30,
    [['EV5', 24, 0], ['EV0', 6, 0], ['EV3', 10, 1], ['EV1', 8, 0], ['EV4', 6, 0], ['EV2', 6, 0]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6], ['EV4', 6], ['EV5', 0]]],
  ['control 1', [16, [['EV1', 16, 2], ['EV0', 32, 3]]], [['EV0', 8], ['EV1', 8]]],
  ['control 2',
   [48,
    [['EV3', 8, 0], ['EV1', 16, 0], ['EV4', 5, 0], ['EV2', 8, 0], ['EV5', 10, 0], ['EV0', 10, 3]]],
   [['EV0', 10], ['EV1', 12], ['EV2', 8], ['EV3', 8], ['EV4', 0], ['EV5', 10]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [40, [['EV1', 24, 3], ['EV0', 6, 0], ['EV2', 32, 1], ['EV3', 32, 3]]],
   [['EV0', 6], ['EV1', 12], ['EV2', 11], ['EV3', 11]]],
  ['regression: priority ordering (partial repair)',
   [24, [['EV4', 24, 2], ['EV0', 16, 3], ['EV2', 8, 2], ['EV3', 6, 2], ['EV1', 6, 2]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6], ['EV4', 0]]],
  ['control 1', [40, [['EV2', 5, 0], ['EV0', 6, 2], ['EV3', 24, 2], ['EV1', 10, 3]]],
   [['EV0', 6], ['EV1', 10], ['EV2', 0], ['EV3', 24]]],
  ['control 2', [10, [['EV0', 10, 0]]], [['EV0', 10]]]]]
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: exactly one minimum share[['A', 6], ['B', 0]][['A', 6], ['B', 0]]Passed
boundary: EV at 6 A maximum[['A', 6], ['B', 14]][['A', 6], ['B', 14]]Passed
boundary: no EVs[][]Passed
regression: priority ordering[['EV0', 6], ['EV1', 0], ['EV2', 0], ['EV3', 0]][['EV0', 6], ['EV1', 0], ['EV2', 0], ['EV3', 0]]Passed
regression: priority ordering (partial repair)[['EV0', 0], ['EV1', 0], ['EV2', 8], ['EV3', 0], ['EV4', 6], ['EV5', 0]][['EV0', 0], ['EV1', 0], ['EV2', 8], ['EV3', 6], ['EV4', 0], ['EV5', 0]]Failed
control 1[['EV0', 16], ['EV1', 16]][['EV0', 16], ['EV1', 16]]Passed
control 2[['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6]][['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6]]Passed

SHA-256 / 1b93228b70ea2791adf89b3b568a598ff2bd80b75df9d0934c995cd07fe7e911

3 / The verified repair

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

N = 1
observations = []
def solve(limit_a, evs):
    elig = [e for e in evs if e[1] >= 6]
    elig.sort(key=lambda e: (-e[2], e[0]))
    admitted = []
    for e in elig:
        if 6 * (len(admitted) + 1) <= limit_a:
            admitted.append(e)
    alloc = {e[0]: 0 for e in evs}
    remaining = limit_a
    open_ = list(admitted)
    while open_:
        share = remaining // len(open_)
        capped = [e for e in open_ if e[1] <= share]
        if not capped:
            for e in open_:
                alloc[e[0]] = share
            remaining -= share * len(open_)
            break
        for e in capped:
            alloc[e[0]] = e[1]
            remaining -= e[1]
            open_.remove(e)
    for e in admitted:
        if remaining <= 0:
            break
        if alloc[e[0]] < e[1]:
            alloc[e[0]] += 1
            remaining -= 1
    return [[k, alloc[k]] for k in sorted(alloc)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [10, [['EV2', 10, 0], ['EV0', 6, 2], ['EV1', 16, 2], ['EV3', 16, 1]]],
   [['EV0', 6], ['EV1', 0], ['EV2', 0], ['EV3', 0]]],
  ['regression: priority ordering (partial repair)',
   [16,
    [['EV5', 8, 0], ['EV2', 8, 3], ['EV4', 6, 1], ['EV3', 6, 1], ['EV1', 5, 1], ['EV0', 10, 0]]],
   [['EV0', 0], ['EV1', 0], ['EV2', 8], ['EV3', 6], ['EV4', 0], ['EV5', 0]]],
  ['control 1', [32, [['EV0', 32, 3], ['EV1', 24, 3]]], [['EV0', 16], ['EV1', 16]]],
  ['control 2', [24, [['EV0', 16, 2], ['EV1', 32, 2], ['EV2', 32, 0], ['EV3', 8, 1]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [32,
    [['EV2', 32, 1], ['EV4', 32, 0], ['EV3', 6, 2], ['EV1', 32, 2], ['EV5', 24, 1],
     ['EV0', 32, 3]]],
   [['EV0', 7], ['EV1', 7], ['EV2', 6], ['EV3', 6], ['EV4', 0], ['EV5', 6]]],
  ['regression: priority ordering (partial repair)',
   [16, [['EV2', 8, 2], ['EV1', 32, 2], ['EV0', 6, 3]]], [['EV0', 6], ['EV1', 10], ['EV2', 0]]],
  ['control 1',
   [30,
    [['EV1', 8, 3], ['EV4', 6, 2], ['EV0', 16, 0], ['EV2', 10, 3], ['EV3', 24, 1], ['EV5', 6, 2]]],
   [['EV0', 0], ['EV1', 6], ['EV2', 6], ['EV3', 6], ['EV4', 6], ['EV5', 6]]],
  ['control 2', [40, [['EV1', 5, 1], ['EV0', 32, 2]]], [['EV0', 32], ['EV1', 0]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [48, [['EV1', 16, 2], ['EV0', 16, 2], ['EV4', 32, 3], ['EV2', 24, 3], ['EV3', 24, 3]]],
   [['EV0', 9], ['EV1', 9], ['EV2', 10], ['EV3', 10], ['EV4', 10]]],
  ['regression: priority ordering (partial repair)',
   [12, [['EV0', 16, 0], ['EV2', 16, 0], ['EV1', 32, 0]]], [['EV0', 6], ['EV1', 6], ['EV2', 0]]],
  ['control 1', [18, [['EV2', 32, 0], ['EV0', 5, 2], ['EV1', 24, 3]]],
   [['EV0', 0], ['EV1', 9], ['EV2', 9]]],
  ['control 2', [16, [['EV0', 24, 3], ['EV1', 16, 0], ['EV2', 16, 2]]],
   [['EV0', 8], ['EV1', 0], ['EV2', 8]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [18, [['EV2', 6, 0], ['EV1', 24, 1], ['EV3', 24, 0], ['EV0', 32, 2]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 0]]],
  ['regression: priority ordering (partial repair)',
   [30,
    [['EV5', 24, 0], ['EV0', 6, 0], ['EV3', 10, 1], ['EV1', 8, 0], ['EV4', 6, 0], ['EV2', 6, 0]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6], ['EV4', 6], ['EV5', 0]]],
  ['control 1', [16, [['EV1', 16, 2], ['EV0', 32, 3]]], [['EV0', 8], ['EV1', 8]]],
  ['control 2',
   [48,
    [['EV3', 8, 0], ['EV1', 16, 0], ['EV4', 5, 0], ['EV2', 8, 0], ['EV5', 10, 0], ['EV0', 10, 3]]],
   [['EV0', 10], ['EV1', 12], ['EV2', 8], ['EV3', 8], ['EV4', 0], ['EV5', 10]]]],
 [['boundary: exactly one minimum share', [6, [['A', 32, 0], ['B', 32, 0]]], [['A', 6], ['B', 0]]],
  ['boundary: EV at 6 A maximum', [20, [['A', 6, 0], ['B', 32, 0]]], [['A', 6], ['B', 14]]],
  ['boundary: no EVs', [32, []], []],
  ['regression: priority ordering',
   [40, [['EV1', 24, 3], ['EV0', 6, 0], ['EV2', 32, 1], ['EV3', 32, 3]]],
   [['EV0', 6], ['EV1', 12], ['EV2', 11], ['EV3', 11]]],
  ['regression: priority ordering (partial repair)',
   [24, [['EV4', 24, 2], ['EV0', 16, 3], ['EV2', 8, 2], ['EV3', 6, 2], ['EV1', 6, 2]]],
   [['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6], ['EV4', 0]]],
  ['control 1', [40, [['EV2', 5, 0], ['EV0', 6, 2], ['EV3', 24, 2], ['EV1', 10, 3]]],
   [['EV0', 6], ['EV1', 10], ['EV2', 0], ['EV3', 24]]],
  ['control 2', [10, [['EV0', 10, 0]]], [['EV0', 10]]]]]
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: exactly one minimum share[['A', 6], ['B', 0]][['A', 6], ['B', 0]]Passed
boundary: EV at 6 A maximum[['A', 6], ['B', 14]][['A', 6], ['B', 14]]Passed
boundary: no EVs[][]Passed
regression: priority ordering[['EV0', 6], ['EV1', 0], ['EV2', 0], ['EV3', 0]][['EV0', 6], ['EV1', 0], ['EV2', 0], ['EV3', 0]]Passed
regression: priority ordering (partial repair)[['EV0', 0], ['EV1', 0], ['EV2', 8], ['EV3', 6], ['EV4', 0], ['EV5', 0]][['EV0', 0], ['EV1', 0], ['EV2', 8], ['EV3', 6], ['EV4', 0], ['EV5', 0]]Passed
control 1[['EV0', 16], ['EV1', 16]][['EV0', 16], ['EV1', 16]]Passed
control 2[['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6]][['EV0', 6], ['EV1', 6], ['EV2', 6], ['EV3', 6]]Passed

SHA-256 / 9e215f175bad78c9a190cf2f432d3896f7b0b2ff2fc4defef4e129896e7a85d0

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

Case digest / 03054c0369e9dd2804992d16ae6b6ef3e6621cadb645796755a77a58ce3c641c