FA-68001 / Traffic signal timing plans / Open access
Volume-density added initial and gap reduction: added initial is rounded per actuation instead of in total · case 01
Variable initial green is one second short whenever the accumulated added initial is fractional.
ROOT CAUSE
The accumulated added initial is truncated to whole seconds, so queues stored during red get too little initial green.
VERIFIED REPAIR
Restore the added initial rounding rule so that the step reads `-(-x['red_actuations'] * x['added_per_act_tenths'] // 10)`.
Unsuccessful approach: Rounding each actuation up to a whole second overstates the initial for fractional per-actuation increments.
Case contract
Input {min_green, added_per_act_tenths, max_initial, red_actuations, initial_gap_tenths, min_gap_tenths, time_before_reduction, time_to_reduce, call, t}. Variable initial = min(max_initial, max(min_green, ceil(actuations*added/10))) seconds. Gap reduction is timed from the conflicting call (a call before green start counts from 0): until time_before_reduction elapses the allowed gap is the initial gap; during time_to_reduce it falls linearly with the reduction amount truncated to whole tenths; afterwards it is the minimum gap. Return {initial, gap_tenths}.
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 = x['min_green']
initial = min(x['max_initial'], max(m, x['red_actuations'] * x['added_per_act_tenths'] // 10))
g0, gm = x['initial_gap_tenths'], x['min_gap_tenths']
el = x['t'] - max(x['call'], 0)
if el <= x['time_before_reduction']:
gap = g0
elif el >= x['time_before_reduction'] + x['time_to_reduce']:
gap = gm
else:
done = el - x['time_before_reduction']
gap = g0 - (g0 - gm) * done // x['time_to_reduce']
return {'initial': initial, 'gap_tenths': gap}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 6, 'added_per_act_tenths': 15, 'max_initial': 18, 'red_actuations': 20, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 2, 'time_to_reduce': 14, 'call': 3, 't': 42}, {'initial': 18, 'gap_tenths': 20}), ({'min_green': 4, 'added_per_act_tenths': 25, 'max_initial': 22, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 7, 'time_to_reduce': 18, 'call': 2, 't': 53}, {'initial': 18, 'gap_tenths': 20}), ({'min_green': 9, 'added_per_act_tenths': 20, 'max_initial': 24, 'red_actuations': 4, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 6, 'time_to_reduce': 24, 'call': 3, 't': 30}, {'initial': 9, 'gap_tenths': 18}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 4, 'added_per_act_tenths': 15, 'max_initial': 11, 'red_actuations': 0, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 5, 'time_to_reduce': 5, 'call': 13, 't': 52}, {'initial': 4, 'gap_tenths': 20}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20}), ({'min_green': 7, 'added_per_act_tenths': 10, 'max_initial': 11, 'red_actuations': 20, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 15, 'time_to_reduce': 12, 'call': -4, 't': 2}, {'initial': 11, 'gap_tenths': 35})], [({'min_green': 10, 'added_per_act_tenths': 20, 'max_initial': 14, 'red_actuations': 20, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 15, 'time_to_reduce': 24, 'call': 7, 't': 19}, {'initial': 14, 'gap_tenths': 35}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 9, 'added_per_act_tenths': 10, 'max_initial': 28, 'red_actuations': 15, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 2, 'time_to_reduce': 30, 'call': 12, 't': 47}, {'initial': 15, 'gap_tenths': 15}), ({'min_green': 10, 'added_per_act_tenths': 15, 'max_initial': 26, 'red_actuations': 9, 'initial_gap_tenths': 30, 'min_gap_tenths': 20, 'time_before_reduction': 11, 'time_to_reduce': 6, 'call': -4, 't': 39}, {'initial': 14, 'gap_tenths': 20}), ({'min_green': 10, 'added_per_act_tenths': 20, 'max_initial': 20, 'red_actuations': 1, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 8, 'time_to_reduce': 18, 'call': 12, 't': 3}, {'initial': 10, 'gap_tenths': 35}), ({'min_green': 7, 'added_per_act_tenths': 25, 'max_initial': 18, 'red_actuations': 5, 'initial_gap_tenths': 50, 'min_gap_tenths': 15, 'time_before_reduction': 6, 'time_to_reduce': 16, 'call': 5, 't': 55}, {'initial': 13, 'gap_tenths': 15}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31})], [({'min_green': 6, 'added_per_act_tenths': 15, 'max_initial': 21, 'red_actuations': 15, 'initial_gap_tenths': 40, 'min_gap_tenths': 10, 'time_before_reduction': 12, 'time_to_reduce': 15, 'call': 12, 't': 57}, {'initial': 21, 'gap_tenths': 10}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 4, 'added_per_act_tenths': 20, 'max_initial': 18, 'red_actuations': 14, 'initial_gap_tenths': 30, 'min_gap_tenths': 15, 'time_before_reduction': 4, 'time_to_reduce': 19, 'call': 11, 't': 17}, {'initial': 18, 'gap_tenths': 29}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 29, 'red_actuations': 7, 'initial_gap_tenths': 30, 'min_gap_tenths': 10, 'time_before_reduction': 6, 'time_to_reduce': 15, 'call': -3, 't': 18}, {'initial': 18, 'gap_tenths': 14}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 15, 'red_actuations': 13, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 2, 'time_to_reduce': 29, 'call': 9, 't': 16}, {'initial': 15, 'gap_tenths': 31}), ({'min_green': 8, 'added_per_act_tenths': 10, 'max_initial': 12, 'red_actuations': 17, 'initial_gap_tenths': 50, 'min_gap_tenths': 10, 'time_before_reduction': 10, 'time_to_reduce': 10, 'call': 14, 't': 25}, {'initial': 12, 'gap_tenths': 46}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20})], [({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 9, 'added_per_act_tenths': 15, 'max_initial': 19, 'red_actuations': 5, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 5, 'time_to_reduce': 7, 'call': 11, 't': 29}, {'initial': 9, 'gap_tenths': 20}), ({'min_green': 4, 'added_per_act_tenths': 15, 'max_initial': 27, 'red_actuations': 13, 'initial_gap_tenths': 30, 'min_gap_tenths': 15, 'time_before_reduction': 4, 'time_to_reduce': 27, 'call': 7, 't': 51}, {'initial': 20, 'gap_tenths': 15}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20}), ({'min_green': 5, 'added_per_act_tenths': 10, 'max_initial': 17, 'red_actuations': 0, 'initial_gap_tenths': 30, 'min_gap_tenths': 10, 'time_before_reduction': 6, 'time_to_reduce': 29, 'call': -1, 't': 9}, {'initial': 5, 'gap_tenths': 28}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 9, 'added_per_act_tenths': 10, 'max_initial': 17, 'red_actuations': 7, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 4, 'time_to_reduce': 15, 'call': 13, 't': 57}, {'initial': 9, 'gap_tenths': 10}), ({'min_green': 9, 'added_per_act_tenths': 10, 'max_initial': 21, 'red_actuations': 17, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 0, 'time_to_reduce': 13, 'call': 0, 't': 20}, {'initial': 17, 'gap_tenths': 10})], [({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 7, 'added_per_act_tenths': 25, 'max_initial': 17, 'red_actuations': 6, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 15, 'time_to_reduce': 22, 'call': 9, 't': 1}, {'initial': 15, 'gap_tenths': 35}), ({'min_green': 9, 'added_per_act_tenths': 25, 'max_initial': 19, 'red_actuations': 20, 'initial_gap_tenths': 35, 'min_gap_tenths': 20, 'time_before_reduction': 6, 'time_to_reduce': 8, 'call': 10, 't': 49}, {'initial': 19, 'gap_tenths': 20}), ({'min_green': 10, 'added_per_act_tenths': 25, 'max_initial': 10, 'red_actuations': 10, 'initial_gap_tenths': 40, 'min_gap_tenths': 15, 'time_before_reduction': 6, 'time_to_reduce': 28, 'call': 0, 't': 1}, {'initial': 10, 'gap_tenths': 40}), ({'min_green': 4, 'added_per_act_tenths': 15, 'max_initial': 17, 'red_actuations': 15, 'initial_gap_tenths': 50, 'min_gap_tenths': 15, 'time_before_reduction': 4, 'time_to_reduce': 26, 'call': 2, 't': 51}, {'initial': 17, 'gap_tenths': 15}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 24, 'red_actuations': 15, 'initial_gap_tenths': 50, 'min_gap_tenths': 15, 'time_before_reduction': 3, 'time_to_reduce': 18, 'call': 4, 't': 52}, {'initial': 23, 'gap_tenths': 15}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 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 | {'gap_tenths': 31, 'initial': 10} | {'gap_tenths': 31, 'initial': 11} | Failed |
| timing oracle 1 | {'gap_tenths': 20, 'initial': 18} | {'gap_tenths': 20, 'initial': 18} | Passed |
| timing oracle 2 | {'gap_tenths': 20, 'initial': 17} | {'gap_tenths': 20, 'initial': 18} | Failed |
| timing oracle 3 | {'gap_tenths': 18, 'initial': 9} | {'gap_tenths': 18, 'initial': 9} | Passed |
| timing oracle 4 | {'gap_tenths': 28, 'initial': 12} | {'gap_tenths': 28, 'initial': 12} | Passed |
| timing oracle 5 | {'gap_tenths': 20, 'initial': 4} | {'gap_tenths': 20, 'initial': 4} | Passed |
| timing oracle 6 | {'gap_tenths': 20, 'initial': 7} | {'gap_tenths': 20, 'initial': 8} | Failed |
| timing oracle 7 | {'gap_tenths': 35, 'initial': 11} | {'gap_tenths': 35, 'initial': 11} | Passed |
SHA-256 / 2647972c9af32670bc366baf6b74c804f6aa71976ebf81e69c49a357e8fd01cc
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
m = x['min_green']
initial = min(x['max_initial'], max(m, x['red_actuations'] * -(-x['added_per_act_tenths'] // 10)))
g0, gm = x['initial_gap_tenths'], x['min_gap_tenths']
el = x['t'] - max(x['call'], 0)
if el <= x['time_before_reduction']:
gap = g0
elif el >= x['time_before_reduction'] + x['time_to_reduce']:
gap = gm
else:
done = el - x['time_before_reduction']
gap = g0 - (g0 - gm) * done // x['time_to_reduce']
return {'initial': initial, 'gap_tenths': gap}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 6, 'added_per_act_tenths': 15, 'max_initial': 18, 'red_actuations': 20, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 2, 'time_to_reduce': 14, 'call': 3, 't': 42}, {'initial': 18, 'gap_tenths': 20}), ({'min_green': 4, 'added_per_act_tenths': 25, 'max_initial': 22, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 7, 'time_to_reduce': 18, 'call': 2, 't': 53}, {'initial': 18, 'gap_tenths': 20}), ({'min_green': 9, 'added_per_act_tenths': 20, 'max_initial': 24, 'red_actuations': 4, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 6, 'time_to_reduce': 24, 'call': 3, 't': 30}, {'initial': 9, 'gap_tenths': 18}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 4, 'added_per_act_tenths': 15, 'max_initial': 11, 'red_actuations': 0, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 5, 'time_to_reduce': 5, 'call': 13, 't': 52}, {'initial': 4, 'gap_tenths': 20}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20}), ({'min_green': 7, 'added_per_act_tenths': 10, 'max_initial': 11, 'red_actuations': 20, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 15, 'time_to_reduce': 12, 'call': -4, 't': 2}, {'initial': 11, 'gap_tenths': 35})], [({'min_green': 10, 'added_per_act_tenths': 20, 'max_initial': 14, 'red_actuations': 20, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 15, 'time_to_reduce': 24, 'call': 7, 't': 19}, {'initial': 14, 'gap_tenths': 35}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 9, 'added_per_act_tenths': 10, 'max_initial': 28, 'red_actuations': 15, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 2, 'time_to_reduce': 30, 'call': 12, 't': 47}, {'initial': 15, 'gap_tenths': 15}), ({'min_green': 10, 'added_per_act_tenths': 15, 'max_initial': 26, 'red_actuations': 9, 'initial_gap_tenths': 30, 'min_gap_tenths': 20, 'time_before_reduction': 11, 'time_to_reduce': 6, 'call': -4, 't': 39}, {'initial': 14, 'gap_tenths': 20}), ({'min_green': 10, 'added_per_act_tenths': 20, 'max_initial': 20, 'red_actuations': 1, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 8, 'time_to_reduce': 18, 'call': 12, 't': 3}, {'initial': 10, 'gap_tenths': 35}), ({'min_green': 7, 'added_per_act_tenths': 25, 'max_initial': 18, 'red_actuations': 5, 'initial_gap_tenths': 50, 'min_gap_tenths': 15, 'time_before_reduction': 6, 'time_to_reduce': 16, 'call': 5, 't': 55}, {'initial': 13, 'gap_tenths': 15}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31})], [({'min_green': 6, 'added_per_act_tenths': 15, 'max_initial': 21, 'red_actuations': 15, 'initial_gap_tenths': 40, 'min_gap_tenths': 10, 'time_before_reduction': 12, 'time_to_reduce': 15, 'call': 12, 't': 57}, {'initial': 21, 'gap_tenths': 10}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 4, 'added_per_act_tenths': 20, 'max_initial': 18, 'red_actuations': 14, 'initial_gap_tenths': 30, 'min_gap_tenths': 15, 'time_before_reduction': 4, 'time_to_reduce': 19, 'call': 11, 't': 17}, {'initial': 18, 'gap_tenths': 29}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 29, 'red_actuations': 7, 'initial_gap_tenths': 30, 'min_gap_tenths': 10, 'time_before_reduction': 6, 'time_to_reduce': 15, 'call': -3, 't': 18}, {'initial': 18, 'gap_tenths': 14}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 15, 'red_actuations': 13, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 2, 'time_to_reduce': 29, 'call': 9, 't': 16}, {'initial': 15, 'gap_tenths': 31}), ({'min_green': 8, 'added_per_act_tenths': 10, 'max_initial': 12, 'red_actuations': 17, 'initial_gap_tenths': 50, 'min_gap_tenths': 10, 'time_before_reduction': 10, 'time_to_reduce': 10, 'call': 14, 't': 25}, {'initial': 12, 'gap_tenths': 46}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20})], [({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 9, 'added_per_act_tenths': 15, 'max_initial': 19, 'red_actuations': 5, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 5, 'time_to_reduce': 7, 'call': 11, 't': 29}, {'initial': 9, 'gap_tenths': 20}), ({'min_green': 4, 'added_per_act_tenths': 15, 'max_initial': 27, 'red_actuations': 13, 'initial_gap_tenths': 30, 'min_gap_tenths': 15, 'time_before_reduction': 4, 'time_to_reduce': 27, 'call': 7, 't': 51}, {'initial': 20, 'gap_tenths': 15}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20}), ({'min_green': 5, 'added_per_act_tenths': 10, 'max_initial': 17, 'red_actuations': 0, 'initial_gap_tenths': 30, 'min_gap_tenths': 10, 'time_before_reduction': 6, 'time_to_reduce': 29, 'call': -1, 't': 9}, {'initial': 5, 'gap_tenths': 28}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 9, 'added_per_act_tenths': 10, 'max_initial': 17, 'red_actuations': 7, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 4, 'time_to_reduce': 15, 'call': 13, 't': 57}, {'initial': 9, 'gap_tenths': 10}), ({'min_green': 9, 'added_per_act_tenths': 10, 'max_initial': 21, 'red_actuations': 17, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 0, 'time_to_reduce': 13, 'call': 0, 't': 20}, {'initial': 17, 'gap_tenths': 10})], [({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 7, 'added_per_act_tenths': 25, 'max_initial': 17, 'red_actuations': 6, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 15, 'time_to_reduce': 22, 'call': 9, 't': 1}, {'initial': 15, 'gap_tenths': 35}), ({'min_green': 9, 'added_per_act_tenths': 25, 'max_initial': 19, 'red_actuations': 20, 'initial_gap_tenths': 35, 'min_gap_tenths': 20, 'time_before_reduction': 6, 'time_to_reduce': 8, 'call': 10, 't': 49}, {'initial': 19, 'gap_tenths': 20}), ({'min_green': 10, 'added_per_act_tenths': 25, 'max_initial': 10, 'red_actuations': 10, 'initial_gap_tenths': 40, 'min_gap_tenths': 15, 'time_before_reduction': 6, 'time_to_reduce': 28, 'call': 0, 't': 1}, {'initial': 10, 'gap_tenths': 40}), ({'min_green': 4, 'added_per_act_tenths': 15, 'max_initial': 17, 'red_actuations': 15, 'initial_gap_tenths': 50, 'min_gap_tenths': 15, 'time_before_reduction': 4, 'time_to_reduce': 26, 'call': 2, 't': 51}, {'initial': 17, 'gap_tenths': 15}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 24, 'red_actuations': 15, 'initial_gap_tenths': 50, 'min_gap_tenths': 15, 'time_before_reduction': 3, 'time_to_reduce': 18, 'call': 4, 't': 52}, {'initial': 23, 'gap_tenths': 15}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 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 | {'gap_tenths': 31, 'initial': 14} | {'gap_tenths': 31, 'initial': 11} | Failed |
| timing oracle 1 | {'gap_tenths': 20, 'initial': 18} | {'gap_tenths': 20, 'initial': 18} | Passed |
| timing oracle 2 | {'gap_tenths': 20, 'initial': 21} | {'gap_tenths': 20, 'initial': 18} | Failed |
| timing oracle 3 | {'gap_tenths': 18, 'initial': 9} | {'gap_tenths': 18, 'initial': 9} | Passed |
| timing oracle 4 | {'gap_tenths': 28, 'initial': 12} | {'gap_tenths': 28, 'initial': 12} | Passed |
| timing oracle 5 | {'gap_tenths': 20, 'initial': 4} | {'gap_tenths': 20, 'initial': 4} | Passed |
| timing oracle 6 | {'gap_tenths': 20, 'initial': 9} | {'gap_tenths': 20, 'initial': 8} | Failed |
| timing oracle 7 | {'gap_tenths': 35, 'initial': 11} | {'gap_tenths': 35, 'initial': 11} | Passed |
SHA-256 / 635e2de105534eecbeaef6d48e3931bb04d20d13866c1128430239b2bf652d2f
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
m = x['min_green']
initial = min(x['max_initial'], max(m, -(-x['red_actuations'] * x['added_per_act_tenths'] // 10)))
g0, gm = x['initial_gap_tenths'], x['min_gap_tenths']
el = x['t'] - max(x['call'], 0)
if el <= x['time_before_reduction']:
gap = g0
elif el >= x['time_before_reduction'] + x['time_to_reduce']:
gap = gm
else:
done = el - x['time_before_reduction']
gap = g0 - (g0 - gm) * done // x['time_to_reduce']
return {'initial': initial, 'gap_tenths': gap}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 6, 'added_per_act_tenths': 15, 'max_initial': 18, 'red_actuations': 20, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 2, 'time_to_reduce': 14, 'call': 3, 't': 42}, {'initial': 18, 'gap_tenths': 20}), ({'min_green': 4, 'added_per_act_tenths': 25, 'max_initial': 22, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 7, 'time_to_reduce': 18, 'call': 2, 't': 53}, {'initial': 18, 'gap_tenths': 20}), ({'min_green': 9, 'added_per_act_tenths': 20, 'max_initial': 24, 'red_actuations': 4, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 6, 'time_to_reduce': 24, 'call': 3, 't': 30}, {'initial': 9, 'gap_tenths': 18}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 4, 'added_per_act_tenths': 15, 'max_initial': 11, 'red_actuations': 0, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 5, 'time_to_reduce': 5, 'call': 13, 't': 52}, {'initial': 4, 'gap_tenths': 20}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20}), ({'min_green': 7, 'added_per_act_tenths': 10, 'max_initial': 11, 'red_actuations': 20, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 15, 'time_to_reduce': 12, 'call': -4, 't': 2}, {'initial': 11, 'gap_tenths': 35})], [({'min_green': 10, 'added_per_act_tenths': 20, 'max_initial': 14, 'red_actuations': 20, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 15, 'time_to_reduce': 24, 'call': 7, 't': 19}, {'initial': 14, 'gap_tenths': 35}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 9, 'added_per_act_tenths': 10, 'max_initial': 28, 'red_actuations': 15, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 2, 'time_to_reduce': 30, 'call': 12, 't': 47}, {'initial': 15, 'gap_tenths': 15}), ({'min_green': 10, 'added_per_act_tenths': 15, 'max_initial': 26, 'red_actuations': 9, 'initial_gap_tenths': 30, 'min_gap_tenths': 20, 'time_before_reduction': 11, 'time_to_reduce': 6, 'call': -4, 't': 39}, {'initial': 14, 'gap_tenths': 20}), ({'min_green': 10, 'added_per_act_tenths': 20, 'max_initial': 20, 'red_actuations': 1, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 8, 'time_to_reduce': 18, 'call': 12, 't': 3}, {'initial': 10, 'gap_tenths': 35}), ({'min_green': 7, 'added_per_act_tenths': 25, 'max_initial': 18, 'red_actuations': 5, 'initial_gap_tenths': 50, 'min_gap_tenths': 15, 'time_before_reduction': 6, 'time_to_reduce': 16, 'call': 5, 't': 55}, {'initial': 13, 'gap_tenths': 15}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31})], [({'min_green': 6, 'added_per_act_tenths': 15, 'max_initial': 21, 'red_actuations': 15, 'initial_gap_tenths': 40, 'min_gap_tenths': 10, 'time_before_reduction': 12, 'time_to_reduce': 15, 'call': 12, 't': 57}, {'initial': 21, 'gap_tenths': 10}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 4, 'added_per_act_tenths': 20, 'max_initial': 18, 'red_actuations': 14, 'initial_gap_tenths': 30, 'min_gap_tenths': 15, 'time_before_reduction': 4, 'time_to_reduce': 19, 'call': 11, 't': 17}, {'initial': 18, 'gap_tenths': 29}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 29, 'red_actuations': 7, 'initial_gap_tenths': 30, 'min_gap_tenths': 10, 'time_before_reduction': 6, 'time_to_reduce': 15, 'call': -3, 't': 18}, {'initial': 18, 'gap_tenths': 14}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 15, 'red_actuations': 13, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 2, 'time_to_reduce': 29, 'call': 9, 't': 16}, {'initial': 15, 'gap_tenths': 31}), ({'min_green': 8, 'added_per_act_tenths': 10, 'max_initial': 12, 'red_actuations': 17, 'initial_gap_tenths': 50, 'min_gap_tenths': 10, 'time_before_reduction': 10, 'time_to_reduce': 10, 'call': 14, 't': 25}, {'initial': 12, 'gap_tenths': 46}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20})], [({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 9, 'added_per_act_tenths': 15, 'max_initial': 19, 'red_actuations': 5, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 5, 'time_to_reduce': 7, 'call': 11, 't': 29}, {'initial': 9, 'gap_tenths': 20}), ({'min_green': 4, 'added_per_act_tenths': 15, 'max_initial': 27, 'red_actuations': 13, 'initial_gap_tenths': 30, 'min_gap_tenths': 15, 'time_before_reduction': 4, 'time_to_reduce': 27, 'call': 7, 't': 51}, {'initial': 20, 'gap_tenths': 15}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 20}), ({'min_green': 5, 'added_per_act_tenths': 10, 'max_initial': 17, 'red_actuations': 0, 'initial_gap_tenths': 30, 'min_gap_tenths': 10, 'time_before_reduction': 6, 'time_to_reduce': 29, 'call': -1, 't': 9}, {'initial': 5, 'gap_tenths': 28}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 9, 'added_per_act_tenths': 10, 'max_initial': 17, 'red_actuations': 7, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 4, 'time_to_reduce': 15, 'call': 13, 't': 57}, {'initial': 9, 'gap_tenths': 10}), ({'min_green': 9, 'added_per_act_tenths': 10, 'max_initial': 21, 'red_actuations': 17, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 0, 'time_to_reduce': 13, 'call': 0, 't': 20}, {'initial': 17, 'gap_tenths': 10})], [({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 20, 'red_actuations': 7, 'initial_gap_tenths': 40, 'min_gap_tenths': 20, 'time_before_reduction': 10, 'time_to_reduce': 15, 'call': 3, 't': 20}, {'initial': 11, 'gap_tenths': 31}), ({'min_green': 7, 'added_per_act_tenths': 25, 'max_initial': 17, 'red_actuations': 6, 'initial_gap_tenths': 35, 'min_gap_tenths': 10, 'time_before_reduction': 15, 'time_to_reduce': 22, 'call': 9, 't': 1}, {'initial': 15, 'gap_tenths': 35}), ({'min_green': 9, 'added_per_act_tenths': 25, 'max_initial': 19, 'red_actuations': 20, 'initial_gap_tenths': 35, 'min_gap_tenths': 20, 'time_before_reduction': 6, 'time_to_reduce': 8, 'call': 10, 't': 49}, {'initial': 19, 'gap_tenths': 20}), ({'min_green': 10, 'added_per_act_tenths': 25, 'max_initial': 10, 'red_actuations': 10, 'initial_gap_tenths': 40, 'min_gap_tenths': 15, 'time_before_reduction': 6, 'time_to_reduce': 28, 'call': 0, 't': 1}, {'initial': 10, 'gap_tenths': 40}), ({'min_green': 4, 'added_per_act_tenths': 15, 'max_initial': 17, 'red_actuations': 15, 'initial_gap_tenths': 50, 'min_gap_tenths': 15, 'time_before_reduction': 4, 'time_to_reduce': 26, 'call': 2, 't': 51}, {'initial': 17, 'gap_tenths': 15}), ({'min_green': 8, 'added_per_act_tenths': 20, 'max_initial': 12, 'red_actuations': 9, 'initial_gap_tenths': 35, 'min_gap_tenths': 15, 'time_before_reduction': 5, 'time_to_reduce': 20, 'call': -4, 't': 12}, {'initial': 12, 'gap_tenths': 28}), ({'min_green': 5, 'added_per_act_tenths': 15, 'max_initial': 24, 'red_actuations': 15, 'initial_gap_tenths': 50, 'min_gap_tenths': 15, 'time_before_reduction': 3, 'time_to_reduce': 18, 'call': 4, 't': 52}, {'initial': 23, 'gap_tenths': 15}), ({'min_green': 6, 'added_per_act_tenths': 25, 'max_initial': 25, 'red_actuations': 3, 'initial_gap_tenths': 50, 'min_gap_tenths': 20, 'time_before_reduction': 8, 'time_to_reduce': 12, 'call': 0, 't': 40}, {'initial': 8, 'gap_tenths': 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 | {'gap_tenths': 31, 'initial': 11} | {'gap_tenths': 31, 'initial': 11} | Passed |
| timing oracle 1 | {'gap_tenths': 20, 'initial': 18} | {'gap_tenths': 20, 'initial': 18} | Passed |
| timing oracle 2 | {'gap_tenths': 20, 'initial': 18} | {'gap_tenths': 20, 'initial': 18} | Passed |
| timing oracle 3 | {'gap_tenths': 18, 'initial': 9} | {'gap_tenths': 18, 'initial': 9} | Passed |
| timing oracle 4 | {'gap_tenths': 28, 'initial': 12} | {'gap_tenths': 28, 'initial': 12} | Passed |
| timing oracle 5 | {'gap_tenths': 20, 'initial': 4} | {'gap_tenths': 20, 'initial': 4} | Passed |
| timing oracle 6 | {'gap_tenths': 20, 'initial': 8} | {'gap_tenths': 20, 'initial': 8} | Passed |
| timing oracle 7 | {'gap_tenths': 35, 'initial': 11} | {'gap_tenths': 35, 'initial': 11} | Passed |
SHA-256 / 2c26079b272b1e47414e3397cf6e386496fee50de254af42ae4b783fa0eaed51
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:58.169688+00:00.
Case digest / 163804087da3bb25ca5c130e78d0df0c10a16f97533a2691d16b8fb29fb83369