FA-67991 / Traffic signal timing plans / Open access
Actuated phase gap-out and max-out: the max timer is started at the end of min green · case 01
Actuated phase gap-out and max-out returns a wrong result when the max timer is started at the end of min green.
ROOT CAUSE
Calls placed before or during min green start the max timer only at the end of min green, extending max-out.
VERIFIED REPAIR
Restore the call present at green start rule so that the step reads `tc = max(tc, 0)`.
Unsuccessful approach: Clamping to one second still shifts calls present at green start by one second.
Case contract
Input {min_green, gap, max_green, actuations: integer seconds since green start (any order), conflict_call: seconds or null}. Each actuation at a keeps the phase eligible until a+gap; an actuation exactly at expiry extends; actuations during min green always extend. Gap-out time = max(min_green, final expiry). With no conflicting call return ['rest', gap time]. The max timer starts at the call (a call before green start counts as 0); max-out at call+max_green. If gap time <= max-out the phase ends by 'gap-out' at max(gap time, call), else by 'max-out'.
Why this case matters
Signal timing arithmetic is exact and integer or rational; a wrong rule silently produces unsafe or inefficient timing plans.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
m, p, M = x['min_green'], x['gap'], x['max_green']
exp = 0
for a in sorted(x['actuations']):
if a > exp and a > m:
break
exp = max(exp, a + p)
gap_end = max(m, exp)
tc = x['conflict_call']
if tc is None:
return ['rest', gap_end]
tc = max(tc, m)
max_end = tc + M
if gap_end <= max_end:
return ['gap-out', max(gap_end, tc)]
return ['max-out', max_end]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'min_green': 4, 'gap': 5, 'max_green': 15, 'actuations': [0, 4, 5, 6, 7, 8, 10, 11, 14, 16, 17, 19, 22, 23, 24, 27, 30, 31, 33, 34, 37, 40, 41, 45, 48, 50, 52, 53, 54, 55, 56, 57, 59], 'conflict_call': -6}, ['max-out', 15]), ({'min_green': 6, 'gap': 2, 'max_green': 20, 'actuations': [2, 5, 6, 7, 8, 10, 11, 12, 13, 14, 21, 22, 23, 25, 27, 28, 31, 32, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 52, 53, 54, 55], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 7, 'gap': 5, 'max_green': 25, 'actuations': [27, 58, 3, 0, 12, 45, 1, 29, 44, 46, 47, 36, 18, 30, 7, 14, 24, 9, 35, 53, 11, 28, 20, 8, 39, 25, 13], 'conflict_call': 24}, ['max-out', 49]), ({'min_green': 8, 'gap': 5, 'max_green': 19, 'actuations': [6, 8, 10, 14, 16, 21, 24, 33, 42, 50, 52], 'conflict_call': 3}, ['max-out', 22]), ({'min_green': 8, 'gap': 5, 'max_green': 15, 'actuations': [0, 2, 4, 7, 11, 13, 14, 16, 19, 22, 24, 27, 28, 29, 31, 38, 39, 40, 44, 47, 50, 55, 58], 'conflict_call': None}, ['rest', 36]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7])], [({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 5, 'gap': 3, 'max_green': 17, 'actuations': [2, 8, 9, 15, 23, 26, 45, 46, 51, 54, 56, 57], 'conflict_call': 34}, ['gap-out', 34]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 6, 'gap': 5, 'max_green': 21, 'actuations': [35, 7, 25, 17, 53, 36, 23, 51, 21, 37, 2, 14, 19, 26, 47, 0, 48, 49, 9, 30, 28, 32, 3, 55, 54, 46, 45, 16, 6, 18, 12, 52, 58, 24, 10], 'conflict_call': -3}, ['max-out', 21]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 5, 'gap': 5, 'max_green': 17, 'actuations': [8, 11, 18, 21, 23, 27, 34, 36, 38, 39, 42, 43, 46, 48, 50, 55], 'conflict_call': -4}, ['gap-out', 5]), ({'min_green': 7, 'gap': 5, 'max_green': 30, 'actuations': [0, 4, 9, 11, 12, 13, 14, 17, 19, 20, 21, 24, 25, 30, 31, 32, 33, 34, 36, 39, 42, 45, 46, 47, 48, 56, 57], 'conflict_call': 5}, ['max-out', 35]), ({'min_green': 5, 'gap': 4, 'max_green': 31, 'actuations': [0, 3, 4, 7, 9, 11, 12, 14, 17, 18, 20, 21, 24, 25, 27, 29, 30, 31, 35, 37, 41, 45, 47, 49, 51, 52, 56, 58], 'conflict_call': 4}, ['max-out', 35])], [({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 7, 'gap': 4, 'max_green': 43, 'actuations': [0, 2, 9, 11, 12, 13, 15, 17, 23, 25, 29, 30, 31, 32, 33, 35, 36, 41, 42, 44, 46, 48, 59], 'conflict_call': None}, ['rest', 7]), ({'min_green': 5, 'gap': 3, 'max_green': 25, 'actuations': [9, 3, 6], 'conflict_call': None}, ['rest', 12]), ({'min_green': 5, 'gap': 5, 'max_green': 18, 'actuations': [5, 8, 9, 10, 11, 12, 14, 21, 25, 28], 'conflict_call': -2}, ['max-out', 18]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 8, 'gap': 5, 'max_green': 41, 'actuations': [0, 6, 7, 9, 13, 14, 17, 19, 20, 23, 24, 25, 27, 28, 29, 30, 31, 33, 36, 41, 43, 49, 50, 53, 54, 55, 56, 57, 58], 'conflict_call': 2}, ['max-out', 43]), ({'min_green': 6, 'gap': 5, 'max_green': 28, 'actuations': [0, 2, 5, 7, 8, 9, 10, 11, 13, 16, 18, 20, 22, 25, 27, 28, 29, 30, 31, 33, 36, 38, 39, 41, 42, 43, 46, 47, 49, 54, 56, 57], 'conflict_call': 3}, ['max-out', 31]), ({'min_green': 7, 'gap': 5, 'max_green': 45, 'actuations': [10, 21, 25, 34], 'conflict_call': 13}, ['gap-out', 13])], [({'min_green': 8, 'gap': 4, 'max_green': 21, 'actuations': [3, 6, 8, 9, 11, 12, 13, 16, 17, 18, 20, 21, 22, 24, 26, 28, 29, 32, 35, 38, 41, 42, 45, 50, 51, 53, 56, 59], 'conflict_call': -2}, ['max-out', 21]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 5, 'gap': 4, 'max_green': 25, 'actuations': [1, 2, 5, 8, 10, 13, 14, 15, 16, 17, 19, 23, 26, 28, 35, 36, 37, 38, 39, 40, 44, 45, 47, 50, 51, 53], 'conflict_call': 2}, ['max-out', 27]), ({'min_green': 4, 'gap': 5, 'max_green': 18, 'actuations': [1, 9, 12, 16, 22, 26, 33, 35, 39, 40, 47, 51, 52, 53, 54], 'conflict_call': 28}, ['gap-out', 28]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 4, 'gap': 5, 'max_green': 18, 'actuations': [1, 2, 4, 8, 12, 15, 18, 20, 23, 31, 34, 36, 39, 41, 43, 46, 49, 57, 59], 'conflict_call': -1}, ['max-out', 18]), ({'min_green': 10, 'gap': 5, 'max_green': 15, 'actuations': [32, 26, 7, 9, 53, 31, 27, 47, 16, 40, 45, 23, 54, 35, 20, 24, 1, 51, 21, 2, 57, 13, 44, 29, 4, 37, 50, 25, 52, 38], 'conflict_call': 9}, ['max-out', 24]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15])], [({'min_green': 10, 'gap': 4, 'max_green': 36, 'actuations': [1, 7, 29, 30, 40, 43, 48, 51, 54], 'conflict_call': 11}, ['gap-out', 11]), ({'min_green': 9, 'gap': 2, 'max_green': 40, 'actuations': [35, 47, 10, 53, 5, 59, 36], 'conflict_call': 22}, ['gap-out', 22]), ({'min_green': 9, 'gap': 3, 'max_green': 18, 'actuations': [2, 3, 4, 5, 6, 7, 9, 10, 13, 14, 15, 16, 17, 18, 21, 24, 25, 28, 29, 30, 32, 33, 39, 40, 41, 42, 47, 52, 56, 58], 'conflict_call': 1}, ['max-out', 19]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 10, 'gap': 3, 'max_green': 27, 'actuations': [0, 2, 4, 7, 13, 14, 15, 17, 21, 32, 34, 35, 36, 37, 38, 40, 41, 43, 49, 51, 54, 56, 57, 59], 'conflict_call': 5}, ['gap-out', 10]), ({'min_green': 6, 'gap': 4, 'max_green': 20, 'actuations': [3, 5, 6, 7, 8, 9, 10, 13, 16, 19, 22, 23, 24, 25, 30, 32, 36, 40, 41, 44, 45, 46, 48, 51, 57], 'conflict_call': -3}, ['max-out', 20])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing oracle' + ' %d' % i, 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 |
|---|---|---|---|
| timing oracle 0 | ['max-out', 19] | ['max-out', 15] | Failed |
| timing oracle 1 | ['gap-out', 20] | ['gap-out', 20] | Passed |
| timing oracle 2 | ['max-out', 49] | ['max-out', 49] | Passed |
| timing oracle 3 | ['max-out', 27] | ['max-out', 22] | Failed |
| timing oracle 4 | ['rest', 36] | ['rest', 36] | Passed |
| timing oracle 5 | ['max-out', 21] | ['max-out', 15] | Failed |
| timing oracle 6 | ['gap-out', 15] | ['gap-out', 15] | Passed |
| timing oracle 7 | ['gap-out', 12] | ['max-out', 7] | Failed |
SHA-256 / c6d029994c96f81eaae8329cf38dd584703af1e7675ebd5ffa1d3d17cf39fbc5
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
m, p, M = x['min_green'], x['gap'], x['max_green']
exp = 0
for a in sorted(x['actuations']):
if a > exp and a > m:
break
exp = max(exp, a + p)
gap_end = max(m, exp)
tc = x['conflict_call']
if tc is None:
return ['rest', gap_end]
tc = max(tc, 1)
max_end = tc + M
if gap_end <= max_end:
return ['gap-out', max(gap_end, tc)]
return ['max-out', max_end]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'min_green': 4, 'gap': 5, 'max_green': 15, 'actuations': [0, 4, 5, 6, 7, 8, 10, 11, 14, 16, 17, 19, 22, 23, 24, 27, 30, 31, 33, 34, 37, 40, 41, 45, 48, 50, 52, 53, 54, 55, 56, 57, 59], 'conflict_call': -6}, ['max-out', 15]), ({'min_green': 6, 'gap': 2, 'max_green': 20, 'actuations': [2, 5, 6, 7, 8, 10, 11, 12, 13, 14, 21, 22, 23, 25, 27, 28, 31, 32, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 52, 53, 54, 55], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 7, 'gap': 5, 'max_green': 25, 'actuations': [27, 58, 3, 0, 12, 45, 1, 29, 44, 46, 47, 36, 18, 30, 7, 14, 24, 9, 35, 53, 11, 28, 20, 8, 39, 25, 13], 'conflict_call': 24}, ['max-out', 49]), ({'min_green': 8, 'gap': 5, 'max_green': 19, 'actuations': [6, 8, 10, 14, 16, 21, 24, 33, 42, 50, 52], 'conflict_call': 3}, ['max-out', 22]), ({'min_green': 8, 'gap': 5, 'max_green': 15, 'actuations': [0, 2, 4, 7, 11, 13, 14, 16, 19, 22, 24, 27, 28, 29, 31, 38, 39, 40, 44, 47, 50, 55, 58], 'conflict_call': None}, ['rest', 36]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7])], [({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 5, 'gap': 3, 'max_green': 17, 'actuations': [2, 8, 9, 15, 23, 26, 45, 46, 51, 54, 56, 57], 'conflict_call': 34}, ['gap-out', 34]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 6, 'gap': 5, 'max_green': 21, 'actuations': [35, 7, 25, 17, 53, 36, 23, 51, 21, 37, 2, 14, 19, 26, 47, 0, 48, 49, 9, 30, 28, 32, 3, 55, 54, 46, 45, 16, 6, 18, 12, 52, 58, 24, 10], 'conflict_call': -3}, ['max-out', 21]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 5, 'gap': 5, 'max_green': 17, 'actuations': [8, 11, 18, 21, 23, 27, 34, 36, 38, 39, 42, 43, 46, 48, 50, 55], 'conflict_call': -4}, ['gap-out', 5]), ({'min_green': 7, 'gap': 5, 'max_green': 30, 'actuations': [0, 4, 9, 11, 12, 13, 14, 17, 19, 20, 21, 24, 25, 30, 31, 32, 33, 34, 36, 39, 42, 45, 46, 47, 48, 56, 57], 'conflict_call': 5}, ['max-out', 35]), ({'min_green': 5, 'gap': 4, 'max_green': 31, 'actuations': [0, 3, 4, 7, 9, 11, 12, 14, 17, 18, 20, 21, 24, 25, 27, 29, 30, 31, 35, 37, 41, 45, 47, 49, 51, 52, 56, 58], 'conflict_call': 4}, ['max-out', 35])], [({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 7, 'gap': 4, 'max_green': 43, 'actuations': [0, 2, 9, 11, 12, 13, 15, 17, 23, 25, 29, 30, 31, 32, 33, 35, 36, 41, 42, 44, 46, 48, 59], 'conflict_call': None}, ['rest', 7]), ({'min_green': 5, 'gap': 3, 'max_green': 25, 'actuations': [9, 3, 6], 'conflict_call': None}, ['rest', 12]), ({'min_green': 5, 'gap': 5, 'max_green': 18, 'actuations': [5, 8, 9, 10, 11, 12, 14, 21, 25, 28], 'conflict_call': -2}, ['max-out', 18]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 8, 'gap': 5, 'max_green': 41, 'actuations': [0, 6, 7, 9, 13, 14, 17, 19, 20, 23, 24, 25, 27, 28, 29, 30, 31, 33, 36, 41, 43, 49, 50, 53, 54, 55, 56, 57, 58], 'conflict_call': 2}, ['max-out', 43]), ({'min_green': 6, 'gap': 5, 'max_green': 28, 'actuations': [0, 2, 5, 7, 8, 9, 10, 11, 13, 16, 18, 20, 22, 25, 27, 28, 29, 30, 31, 33, 36, 38, 39, 41, 42, 43, 46, 47, 49, 54, 56, 57], 'conflict_call': 3}, ['max-out', 31]), ({'min_green': 7, 'gap': 5, 'max_green': 45, 'actuations': [10, 21, 25, 34], 'conflict_call': 13}, ['gap-out', 13])], [({'min_green': 8, 'gap': 4, 'max_green': 21, 'actuations': [3, 6, 8, 9, 11, 12, 13, 16, 17, 18, 20, 21, 22, 24, 26, 28, 29, 32, 35, 38, 41, 42, 45, 50, 51, 53, 56, 59], 'conflict_call': -2}, ['max-out', 21]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 5, 'gap': 4, 'max_green': 25, 'actuations': [1, 2, 5, 8, 10, 13, 14, 15, 16, 17, 19, 23, 26, 28, 35, 36, 37, 38, 39, 40, 44, 45, 47, 50, 51, 53], 'conflict_call': 2}, ['max-out', 27]), ({'min_green': 4, 'gap': 5, 'max_green': 18, 'actuations': [1, 9, 12, 16, 22, 26, 33, 35, 39, 40, 47, 51, 52, 53, 54], 'conflict_call': 28}, ['gap-out', 28]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 4, 'gap': 5, 'max_green': 18, 'actuations': [1, 2, 4, 8, 12, 15, 18, 20, 23, 31, 34, 36, 39, 41, 43, 46, 49, 57, 59], 'conflict_call': -1}, ['max-out', 18]), ({'min_green': 10, 'gap': 5, 'max_green': 15, 'actuations': [32, 26, 7, 9, 53, 31, 27, 47, 16, 40, 45, 23, 54, 35, 20, 24, 1, 51, 21, 2, 57, 13, 44, 29, 4, 37, 50, 25, 52, 38], 'conflict_call': 9}, ['max-out', 24]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15])], [({'min_green': 10, 'gap': 4, 'max_green': 36, 'actuations': [1, 7, 29, 30, 40, 43, 48, 51, 54], 'conflict_call': 11}, ['gap-out', 11]), ({'min_green': 9, 'gap': 2, 'max_green': 40, 'actuations': [35, 47, 10, 53, 5, 59, 36], 'conflict_call': 22}, ['gap-out', 22]), ({'min_green': 9, 'gap': 3, 'max_green': 18, 'actuations': [2, 3, 4, 5, 6, 7, 9, 10, 13, 14, 15, 16, 17, 18, 21, 24, 25, 28, 29, 30, 32, 33, 39, 40, 41, 42, 47, 52, 56, 58], 'conflict_call': 1}, ['max-out', 19]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 10, 'gap': 3, 'max_green': 27, 'actuations': [0, 2, 4, 7, 13, 14, 15, 17, 21, 32, 34, 35, 36, 37, 38, 40, 41, 43, 49, 51, 54, 56, 57, 59], 'conflict_call': 5}, ['gap-out', 10]), ({'min_green': 6, 'gap': 4, 'max_green': 20, 'actuations': [3, 5, 6, 7, 8, 9, 10, 13, 16, 19, 22, 23, 24, 25, 30, 32, 36, 40, 41, 44, 45, 46, 48, 51, 57], 'conflict_call': -3}, ['max-out', 20])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing oracle' + ' %d' % i, 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 |
|---|---|---|---|
| timing oracle 0 | ['max-out', 16] | ['max-out', 15] | Failed |
| timing oracle 1 | ['gap-out', 20] | ['gap-out', 20] | Passed |
| timing oracle 2 | ['max-out', 49] | ['max-out', 49] | Passed |
| timing oracle 3 | ['max-out', 22] | ['max-out', 22] | Passed |
| timing oracle 4 | ['rest', 36] | ['rest', 36] | Passed |
| timing oracle 5 | ['max-out', 16] | ['max-out', 15] | Failed |
| timing oracle 6 | ['gap-out', 15] | ['gap-out', 15] | Passed |
| timing oracle 7 | ['max-out', 7] | ['max-out', 7] | Passed |
SHA-256 / 2a6bf48d0ad2de919ab3a553510ad9383d874667b1c7106044b36aac9f2148ef
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
m, p, M = x['min_green'], x['gap'], x['max_green']
exp = 0
for a in sorted(x['actuations']):
if a > exp and a > m:
break
exp = max(exp, a + p)
gap_end = max(m, exp)
tc = x['conflict_call']
if tc is None:
return ['rest', gap_end]
tc = max(tc, 0)
max_end = tc + M
if gap_end <= max_end:
return ['gap-out', max(gap_end, tc)]
return ['max-out', max_end]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'min_green': 4, 'gap': 5, 'max_green': 15, 'actuations': [0, 4, 5, 6, 7, 8, 10, 11, 14, 16, 17, 19, 22, 23, 24, 27, 30, 31, 33, 34, 37, 40, 41, 45, 48, 50, 52, 53, 54, 55, 56, 57, 59], 'conflict_call': -6}, ['max-out', 15]), ({'min_green': 6, 'gap': 2, 'max_green': 20, 'actuations': [2, 5, 6, 7, 8, 10, 11, 12, 13, 14, 21, 22, 23, 25, 27, 28, 31, 32, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 52, 53, 54, 55], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 7, 'gap': 5, 'max_green': 25, 'actuations': [27, 58, 3, 0, 12, 45, 1, 29, 44, 46, 47, 36, 18, 30, 7, 14, 24, 9, 35, 53, 11, 28, 20, 8, 39, 25, 13], 'conflict_call': 24}, ['max-out', 49]), ({'min_green': 8, 'gap': 5, 'max_green': 19, 'actuations': [6, 8, 10, 14, 16, 21, 24, 33, 42, 50, 52], 'conflict_call': 3}, ['max-out', 22]), ({'min_green': 8, 'gap': 5, 'max_green': 15, 'actuations': [0, 2, 4, 7, 11, 13, 14, 16, 19, 22, 24, 27, 28, 29, 31, 38, 39, 40, 44, 47, 50, 55, 58], 'conflict_call': None}, ['rest', 36]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7])], [({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 5, 'gap': 3, 'max_green': 17, 'actuations': [2, 8, 9, 15, 23, 26, 45, 46, 51, 54, 56, 57], 'conflict_call': 34}, ['gap-out', 34]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 6, 'gap': 5, 'max_green': 21, 'actuations': [35, 7, 25, 17, 53, 36, 23, 51, 21, 37, 2, 14, 19, 26, 47, 0, 48, 49, 9, 30, 28, 32, 3, 55, 54, 46, 45, 16, 6, 18, 12, 52, 58, 24, 10], 'conflict_call': -3}, ['max-out', 21]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 5, 'gap': 5, 'max_green': 17, 'actuations': [8, 11, 18, 21, 23, 27, 34, 36, 38, 39, 42, 43, 46, 48, 50, 55], 'conflict_call': -4}, ['gap-out', 5]), ({'min_green': 7, 'gap': 5, 'max_green': 30, 'actuations': [0, 4, 9, 11, 12, 13, 14, 17, 19, 20, 21, 24, 25, 30, 31, 32, 33, 34, 36, 39, 42, 45, 46, 47, 48, 56, 57], 'conflict_call': 5}, ['max-out', 35]), ({'min_green': 5, 'gap': 4, 'max_green': 31, 'actuations': [0, 3, 4, 7, 9, 11, 12, 14, 17, 18, 20, 21, 24, 25, 27, 29, 30, 31, 35, 37, 41, 45, 47, 49, 51, 52, 56, 58], 'conflict_call': 4}, ['max-out', 35])], [({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 7, 'gap': 4, 'max_green': 43, 'actuations': [0, 2, 9, 11, 12, 13, 15, 17, 23, 25, 29, 30, 31, 32, 33, 35, 36, 41, 42, 44, 46, 48, 59], 'conflict_call': None}, ['rest', 7]), ({'min_green': 5, 'gap': 3, 'max_green': 25, 'actuations': [9, 3, 6], 'conflict_call': None}, ['rest', 12]), ({'min_green': 5, 'gap': 5, 'max_green': 18, 'actuations': [5, 8, 9, 10, 11, 12, 14, 21, 25, 28], 'conflict_call': -2}, ['max-out', 18]), ({'min_green': 6, 'gap': 2, 'max_green': 15, 'actuations': [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38], 'conflict_call': -3}, ['max-out', 15]), ({'min_green': 8, 'gap': 5, 'max_green': 41, 'actuations': [0, 6, 7, 9, 13, 14, 17, 19, 20, 23, 24, 25, 27, 28, 29, 30, 31, 33, 36, 41, 43, 49, 50, 53, 54, 55, 56, 57, 58], 'conflict_call': 2}, ['max-out', 43]), ({'min_green': 6, 'gap': 5, 'max_green': 28, 'actuations': [0, 2, 5, 7, 8, 9, 10, 11, 13, 16, 18, 20, 22, 25, 27, 28, 29, 30, 31, 33, 36, 38, 39, 41, 42, 43, 46, 47, 49, 54, 56, 57], 'conflict_call': 3}, ['max-out', 31]), ({'min_green': 7, 'gap': 5, 'max_green': 45, 'actuations': [10, 21, 25, 34], 'conflict_call': 13}, ['gap-out', 13])], [({'min_green': 8, 'gap': 4, 'max_green': 21, 'actuations': [3, 6, 8, 9, 11, 12, 13, 16, 17, 18, 20, 21, 22, 24, 26, 28, 29, 32, 35, 38, 41, 42, 45, 50, 51, 53, 56, 59], 'conflict_call': -2}, ['max-out', 21]), ({'min_green': 6, 'gap': 2, 'max_green': 12, 'actuations': [1, 3, 5, 7, 9, 11, 13], 'conflict_call': 3}, ['gap-out', 15]), ({'min_green': 5, 'gap': 4, 'max_green': 25, 'actuations': [1, 2, 5, 8, 10, 13, 14, 15, 16, 17, 19, 23, 26, 28, 35, 36, 37, 38, 39, 40, 44, 45, 47, 50, 51, 53], 'conflict_call': 2}, ['max-out', 27]), ({'min_green': 4, 'gap': 5, 'max_green': 18, 'actuations': [1, 9, 12, 16, 22, 26, 33, 35, 39, 40, 47, 51, 52, 53, 54], 'conflict_call': 28}, ['gap-out', 28]), ({'min_green': 5, 'gap': 3, 'max_green': 20, 'actuations': [1, 4, 7, 10, 13], 'conflict_call': 2}, ['gap-out', 16]), ({'min_green': 4, 'gap': 5, 'max_green': 18, 'actuations': [1, 2, 4, 8, 12, 15, 18, 20, 23, 31, 34, 36, 39, 41, 43, 46, 49, 57, 59], 'conflict_call': -1}, ['max-out', 18]), ({'min_green': 10, 'gap': 5, 'max_green': 15, 'actuations': [32, 26, 7, 9, 53, 31, 27, 47, 16, 40, 45, 23, 54, 35, 20, 24, 1, 51, 21, 2, 57, 13, 44, 29, 4, 37, 50, 25, 52, 38], 'conflict_call': 9}, ['max-out', 24]), ({'min_green': 5, 'gap': 3, 'max_green': 10, 'actuations': [0, 3, 6, 9, 12], 'conflict_call': 5}, ['gap-out', 15])], [({'min_green': 10, 'gap': 4, 'max_green': 36, 'actuations': [1, 7, 29, 30, 40, 43, 48, 51, 54], 'conflict_call': 11}, ['gap-out', 11]), ({'min_green': 9, 'gap': 2, 'max_green': 40, 'actuations': [35, 47, 10, 53, 5, 59, 36], 'conflict_call': 22}, ['gap-out', 22]), ({'min_green': 9, 'gap': 3, 'max_green': 18, 'actuations': [2, 3, 4, 5, 6, 7, 9, 10, 13, 14, 15, 16, 17, 18, 21, 24, 25, 28, 29, 30, 32, 33, 39, 40, 41, 42, 47, 52, 56, 58], 'conflict_call': 1}, ['max-out', 19]), ({'min_green': 10, 'gap': 2, 'max_green': 3, 'actuations': [], 'conflict_call': 0}, ['max-out', 3]), ({'min_green': 8, 'gap': 3, 'max_green': 30, 'actuations': [2, 6], 'conflict_call': 20}, ['gap-out', 20]), ({'min_green': 12, 'gap': 3, 'max_green': 5, 'actuations': [1], 'conflict_call': 2}, ['max-out', 7]), ({'min_green': 10, 'gap': 3, 'max_green': 27, 'actuations': [0, 2, 4, 7, 13, 14, 15, 17, 21, 32, 34, 35, 36, 37, 38, 40, 41, 43, 49, 51, 54, 56, 57, 59], 'conflict_call': 5}, ['gap-out', 10]), ({'min_green': 6, 'gap': 4, 'max_green': 20, 'actuations': [3, 5, 6, 7, 8, 9, 10, 13, 16, 19, 22, 23, 24, 25, 30, 32, 36, 40, 41, 44, 45, 46, 48, 51, 57], 'conflict_call': -3}, ['max-out', 20])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing oracle' + ' %d' % i, 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 |
|---|---|---|---|
| timing oracle 0 | ['max-out', 15] | ['max-out', 15] | Passed |
| timing oracle 1 | ['gap-out', 20] | ['gap-out', 20] | Passed |
| timing oracle 2 | ['max-out', 49] | ['max-out', 49] | Passed |
| timing oracle 3 | ['max-out', 22] | ['max-out', 22] | Passed |
| timing oracle 4 | ['rest', 36] | ['rest', 36] | Passed |
| timing oracle 5 | ['max-out', 15] | ['max-out', 15] | Passed |
| timing oracle 6 | ['gap-out', 15] | ['gap-out', 15] | Passed |
| timing oracle 7 | ['max-out', 7] | ['max-out', 7] | Passed |
SHA-256 / 0fef3ef3deb1e1e28862d8f63cd6f90f027153f826cd2eeaabcdcecc2628a24b
Verification & scope
A deterministic, bounded toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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:47:57.899113+00:00.
Case digest / 3f1734597bc32974af318e3298674a2b3ef28b1db34662792ba0e65b43742392