broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not x['route_set']:
        return 'none'
    if not x['ahead_occupied']:
        return 'main'
    if x['stand_s'] <= 120 or x['speed_kmh'] > 0:
        return 'none'
    if x['gap_m'] < 20:
        return 'none'
    if x['platform_train_moving']:
        return 'none'
    return 'call-on'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 70', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on'), ('control 27', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 1', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 60, 'platform_train_moving': False}, 'main'), ('control 4', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 7', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 12', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 15', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': True}, 'none'), ('control 18', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'none')], [('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 70', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on'), ('control 80', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 21, 'platform_train_moving': False}, 'none'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 23', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 15, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 26', {'route_set': False, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 29', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 27', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('control 34', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 20, 'gap_m': 60, 'platform_train_moving': False}, 'none'), ('control 37', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 40', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on')], [('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 70', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 45', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 48', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main')]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not x['route_set']:
        return 'none'
    if not x['ahead_occupied']:
        return 'main'
    if x['stand_s'] < 2 or x['speed_kmh'] > 0:
        return 'none'
    if x['gap_m'] < 20:
        return 'none'
    if x['platform_train_moving']:
        return 'none'
    return 'call-on'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 70', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on'), ('control 27', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 1', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 60, 'platform_train_moving': False}, 'main'), ('control 4', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 7', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 12', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 15', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': True}, 'none'), ('control 18', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'none')], [('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 70', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on'), ('control 80', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 21, 'platform_train_moving': False}, 'none'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 23', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 15, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 26', {'route_set': False, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 29', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 27', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('control 34', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 20, 'gap_m': 60, 'platform_train_moving': False}, 'none'), ('control 37', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 40', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on')], [('regression: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 70', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 45', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 48', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main')]]
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)

prompt:
A train that has stood exactly two minutes is refused the call-on.

Without a route the answer is none. With the section ahead clear the main aspect is given. Into an occupied section a call-on is given only if the train has stood at the signal for at least 120 s and is stationary (0 km/h), the gap to the standing train is at least 20 m and that train is not moving; otherwise none.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not x['route_set']:
        return 'none'
    if not x['ahead_occupied']:
        return 'main'
    if x['stand_s'] < 120 or x['speed_kmh'] > 15:
        return 'none'
    if x['gap_m'] < 20:
        return 'none'
    if x['platform_train_moving']:
        return 'none'
    return 'call-on'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 25', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 15, 'gap_m': 21, 'platform_train_moving': False}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('regression: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 1', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 60, 'platform_train_moving': False}, 'main'), ('control 4', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 7', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('control 12', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 15', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': True}, 'none'), ('control 18', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'none')], [('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 5', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 10, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('control 23', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 15, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 26', {'route_set': False, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 29', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 76', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 10, 'gap_m': 20, 'platform_train_moving': False}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('control 34', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 20, 'gap_m': 60, 'platform_train_moving': False}, 'none'), ('control 37', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 40', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on')], [('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('regression: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 45', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 48', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main')]]
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not x['route_set']:
        return 'none'
    if not x['ahead_occupied']:
        return 'main'
    if x['stand_s'] < 120 or x['speed_kmh'] >= 5:
        return 'none'
    if x['gap_m'] < 20:
        return 'none'
    if x['platform_train_moving']:
        return 'none'
    return 'call-on'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 25', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 15, 'gap_m': 21, 'platform_train_moving': False}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('regression: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 1', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 60, 'platform_train_moving': False}, 'main'), ('control 4', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 7', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('control 12', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 15', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': True}, 'none'), ('control 18', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'none')], [('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 5', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 10, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('control 23', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 15, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 26', {'route_set': False, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 29', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('sampled regression 76', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 10, 'gap_m': 20, 'platform_train_moving': False}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('control 34', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 20, 'gap_m': 60, 'platform_train_moving': False}, 'none'), ('control 37', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 40', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on')], [('regression: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('regression: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 45', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 48', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main')]]
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)

prompt:
A call-on is given to a train still rolling towards the signal.

Without a route the answer is none. With the section ahead clear the main aspect is given. Into an occupied section a call-on is given only if the train has stood at the signal for at least 120 s and is stationary (0 km/h), the gap to the standing train is at least 20 m and that train is not moving; otherwise none.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not x['route_set']:
        return 'none'
    if not x['ahead_occupied']:
        return 'main'
    if x['stand_s'] < 120 or x['speed_kmh'] > 0:
        return 'none'
    if x['gap_m'] < 20:
        return 'none'
    if False:
        return 'none'
    return 'call-on'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 1', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 60, 'platform_train_moving': False}, 'main'), ('control 4', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 7', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('control 12', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 15', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': True}, 'none'), ('control 18', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'none')], [('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 23', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 15, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 26', {'route_set': False, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 29', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 34', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 20, 'gap_m': 60, 'platform_train_moving': False}, 'none'), ('control 37', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 40', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on')], [('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 45', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 48', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main')]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not x['route_set']:
        return 'none'
    if not x['ahead_occupied']:
        return 'main'
    if x['stand_s'] < 120 or x['speed_kmh'] > 0:
        return 'none'
    if x['gap_m'] < 20:
        return 'none'
    if x['platform_train_moving'] and x['gap_m'] < 50:
        return 'none'
    return 'call-on'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 1', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 60, 'platform_train_moving': False}, 'main'), ('control 4', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 7', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('control 12', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 15', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': True}, 'none'), ('control 18', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'none')], [('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 23', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 15, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 26', {'route_set': False, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 29', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 34', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 20, 'gap_m': 60, 'platform_train_moving': False}, 'none'), ('control 37', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 40', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on')], [('regression: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('regression: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 45', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 48', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main')]]
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)

prompt:
A call-on is given towards a train that is moving in the platform.

Without a route the answer is none. With the section ahead clear the main aspect is given. Into an occupied section a call-on is given only if the train has stood at the signal for at least 120 s and is stationary (0 km/h), the gap to the standing train is at least 20 m and that train is not moving; otherwise none.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not x['route_set']:
        return 'none'
    if x['stand_s'] < 120 or x['speed_kmh'] > 0:
        return 'none'
    if not x['ahead_occupied']:
        return 'main'
    if x['gap_m'] < 20:
        return 'none'
    if x['platform_train_moving']:
        return 'none'
    return 'call-on'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 24', {'route_set': True, 'ahead_occupied': False, 'stand_s': 30, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main'), ('sampled regression 2', {'route_set': True, 'ahead_occupied': False, 'stand_s': 30, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'main'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 1', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 60, 'platform_train_moving': False}, 'main'), ('control 4', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 7', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main'), ('sampled regression 50', {'route_set': True, 'ahead_occupied': False, 'stand_s': 119, 'speed_kmh': 10, 'gap_m': 21, 'platform_train_moving': False}, 'main'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 12', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 15', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': True}, 'none'), ('control 18', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'none')], [('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 75', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'main'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('control 23', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 15, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 26', {'route_set': False, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 29', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 44', {'route_set': True, 'ahead_occupied': False, 'stand_s': 121, 'speed_kmh': 10, 'gap_m': 200, 'platform_train_moving': False}, 'main'), ('sampled regression 36', {'route_set': True, 'ahead_occupied': False, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 5, 'platform_train_moving': True}, 'main'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 34', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 20, 'gap_m': 60, 'platform_train_moving': False}, 'none'), ('control 37', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 40', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on')], [('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 71', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': False}, 'main'), ('sampled regression 57', {'route_set': True, 'ahead_occupied': False, 'stand_s': 30, 'speed_kmh': 10, 'gap_m': 21, 'platform_train_moving': False}, 'main'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('control 45', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 48', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('sampled regression 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main')]]
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    if not x['route_set']:
        return 'none'
    if not x['ahead_occupied'] and x['stand_s'] >= 120:
        return 'main'
    if x['stand_s'] < 120 or x['speed_kmh'] > 0:
        return 'none'
    if x['gap_m'] < 20:
        return 'none'
    if x['platform_train_moving']:
        return 'none'
    return 'call-on'
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 24', {'route_set': True, 'ahead_occupied': False, 'stand_s': 30, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main'), ('sampled regression 2', {'route_set': True, 'ahead_occupied': False, 'stand_s': 30, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'main'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('boundary: stood one second short', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 1', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 60, 'platform_train_moving': False}, 'main'), ('control 4', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('control 7', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 3, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main'), ('sampled regression 50', {'route_set': True, 'ahead_occupied': False, 'stand_s': 119, 'speed_kmh': 10, 'gap_m': 21, 'platform_train_moving': False}, 'main'), ('boundary: creeping at walking pace', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 3, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: rolling at call-on speed', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 12, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 12', {'route_set': True, 'ahead_occupied': True, 'stand_s': 300, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 15', {'route_set': True, 'ahead_occupied': True, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': True}, 'none'), ('control 18', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': True}, 'none')], [('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 75', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': True}, 'main'), ('boundary: platform train moving far away', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': True}, 'none'), ('boundary: platform train moving close by', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 30, 'platform_train_moving': True}, 'none'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('control 23', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 15, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('control 26', {'route_set': False, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 29', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none')], [('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 44', {'route_set': True, 'ahead_occupied': False, 'stand_s': 121, 'speed_kmh': 10, 'gap_m': 200, 'platform_train_moving': False}, 'main'), ('sampled regression 36', {'route_set': True, 'ahead_occupied': False, 'stand_s': 119, 'speed_kmh': 20, 'gap_m': 5, 'platform_train_moving': True}, 'main'), ('boundary: gap exactly at the minimum', {'route_set': True, 'ahead_occupied': True, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 20, 'platform_train_moving': False}, 'call-on'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('control 34', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 20, 'gap_m': 60, 'platform_train_moving': False}, 'none'), ('control 37', {'route_set': True, 'ahead_occupied': True, 'stand_s': 0, 'speed_kmh': 20, 'gap_m': 19, 'platform_train_moving': False}, 'none'), ('control 40', {'route_set': True, 'ahead_occupied': True, 'stand_s': 121, 'speed_kmh': 0, 'gap_m': 200, 'platform_train_moving': False}, 'call-on')], [('regression: clear platform for a moving train', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 40, 'gap_m': 100, 'platform_train_moving': False}, 'main'), ('sampled regression 71', {'route_set': True, 'ahead_occupied': False, 'stand_s': 0, 'speed_kmh': 3, 'gap_m': 200, 'platform_train_moving': False}, 'main'), ('sampled regression 57', {'route_set': True, 'ahead_occupied': False, 'stand_s': 30, 'speed_kmh': 10, 'gap_m': 21, 'platform_train_moving': False}, 'main'), ('boundary: no route', {'route_set': False, 'ahead_occupied': False, 'stand_s': 200, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'none'), ('boundary: stood exactly two minutes', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 100, 'platform_train_moving': False}, 'call-on'), ('control 45', {'route_set': True, 'ahead_occupied': True, 'stand_s': 120, 'speed_kmh': 0, 'gap_m': 5, 'platform_train_moving': False}, 'none'), ('control 48', {'route_set': True, 'ahead_occupied': True, 'stand_s': 30, 'speed_kmh': 20, 'gap_m': 200, 'platform_train_moving': False}, 'none'), ('sampled regression 51', {'route_set': True, 'ahead_occupied': False, 'stand_s': 300, 'speed_kmh': 3, 'gap_m': 20, 'platform_train_moving': False}, 'main')]]
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)

prompt:
A train approaching a clear platform is refused a main aspect because it has not stood at the signal.

Without a route the answer is none. With the section ahead clear the main aspect is given. Into an occupied section a call-on is given only if the train has stood at the signal for at least 120 s and is stationary (0 km/h), the gap to the standing train is at least 20 m and that train is not moving; otherwise none.

split: open-access