{"abstract":"A length-capped authority is shortened by the safety margin.","category":"Railway interlocking logic","checks":8,"contract":"Sections have lengths and states locked, occupied or unlocked; the train front is offset_m into section train_sec (which it occupies itself). Scan the following sections; the end of authority is the start of the first section that is not locked (reason = its state) or the end of the last section (end-of-route). If that exceeds max_ma_m ahead of the train front, the authority is cut to front + max_ma_m (reason max-length). The margin is subtracted from the end except for a max-length cut.","contract_signature":"x","evaluation_group":"w2-railway_interlocking_logic-movement-authority-end","failed_approach":"Subtracting only before occupied sections omits the margin at unlocked sections and route ends.","family":"w2-railway_interlocking_logic-movement-authority-end-margin-application","id":"FA-67101","implementations":{"attempt":{"sha256":"0535fe122ee0d2fad5b75d4c45ab478a1c97b210ea54b6e82b5f59c66f28fd37","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    secs = x['sections']\n    bounds = []\n    acc = 0\n    for s in secs:\n        bounds.append(acc)\n        acc += s['len']\n    k = x['train_sec']\n    eoa = acc\n    reason = 'end-of-route'\n    for j in range(k + 1, len(secs)):\n        if secs[j]['state'] != 'locked':\n            eoa = bounds[j]\n            reason = secs[j]['state']\n            break\n    front = bounds[k] + x['offset_m']\n    if eoa - front > x['max_ma_m']:\n        eoa = front + x['max_ma_m']\n        reason = 'max-length'\n    if reason == 'occupied':\n        eoa -= x['margin_m']\n    return {'eoa_m': eoa, 'reason': reason}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: own section occupied', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 50, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 675, 'reason': 'end-of-route'}), ('sampled regression 24', {'sections': [{'len': 350, 'state': 'unlocked'}, {'len': 500, 'state': 'occupied'}, {'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 350, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 3, 'offset_m': 108, 'max_ma_m': 1000, 'margin_m': 50}, {'eoa_m': 2308, 'reason': 'max-length'}), ('boundary: unlocked section next', {'sections': [{'len': 200, 'state': 'locked'}, {'len': 200, 'state': 'occupied'}, {'len': 300, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 10, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 375, 'reason': 'unlocked'}), ('boundary: occupied section two ahead', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 100, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 375, 'reason': 'occupied'}), ('control 1', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 100, 'state': 'unlocked'}, {'len': 200, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 69, 'max_ma_m': 5000, 'margin_m': 50}, {'eoa_m': 150, 'reason': 'unlocked'}), ('control 4', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 206, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 1325, 'reason': 'end-of-route'}), ('control 7', {'sections': [{'len': 350, 'state': 'locked'}, {'len': 200, 'state': 'occupied'}, {'len': 350, 'state': 'unlocked'}, {'len': 500, 'state': 'unlocked'}, {'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 108, 'max_ma_m': 5000, 'margin_m': 0}, {'eoa_m': 550, 'reason': 'unlocked'})], [('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: unlocked section next', {'sections': [{'len': 200, 'state': 'locked'}, {'len': 200, 'state': 'occupied'}, {'len': 300, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 10, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 375, 'reason': 'unlocked'}), ('sampled regression 63', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'unlocked'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 197, 'max_ma_m': 300, 'margin_m': 25}, {'eoa_m': 497, 'reason': 'max-length'}), ('control 3', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}, {'len': 100, 'state': 'unlocked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 1, 'offset_m': 141, 'max_ma_m': 1000, 'margin_m': 50}, {'eoa_m': 450, 'reason': 'unlocked'}), ('boundary: cap exactly at the obstacle', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 975, 'reason': 'occupied'}), ('sampled regression 12', {'sections': [{'len': 200, 'state': 'unlocked'}, {'len': 350, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}, {'len': 200, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 2, 'offset_m': 34, 'max_ma_m': 300, 'margin_m': 50}, {'eoa_m': 884, 'reason': 'max-length'}), ('control 15', {'sections': [{'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'locked'}, {'len': 200, 'state': 'locked'}, {'len': 350, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 100, 'state': 'locked'}], 'train_sec': 4, 'offset_m': 137, 'max_ma_m': 5000, 'margin_m': 0}, {'eoa_m': 2100, 'reason': 'end-of-route'}), ('control 18', {'sections': [{'len': 200, 'state': 'unlocked'}, {'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'unlocked'}, {'len': 200, 'state': 'occupied'}, {'len': 100, 'state': 'occupied'}, {'len': 100, 'state': 'unlocked'}], 'train_sec': 3, 'offset_m': 181, 'max_ma_m': 1000, 'margin_m': 0}, {'eoa_m': 1250, 'reason': 'occupied'})], [('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: end of route with margin', {'sections': [{'len': 100, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 0, 'max_ma_m': 5000, 'margin_m': 50}, {'eoa_m': 150, 'reason': 'end-of-route'}), ('sampled regression 26', {'sections': [{'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}], 'train_sec': 1, 'offset_m': 9, 'max_ma_m': 300, 'margin_m': 25}, {'eoa_m': 409, 'reason': 'max-length'}), ('control 19', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'unlocked'}, {'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}], 'train_sec': 0, 'offset_m': 103, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 925, 'reason': 'unlocked'}), ('boundary: cap exactly at the obstacle', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 975, 'reason': 'occupied'}), ('control 23', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'locked'}, {'len': 100, 'state': 'unlocked'}], 'train_sec': 0, 'offset_m': 20, 'max_ma_m': 5000, 'margin_m': 50}, {'eoa_m': 1100, 'reason': 'unlocked'}), ('control 29', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 500, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 100, 'state': 'occupied'}, {'len': 100, 'state': 'occupied'}, {'len': 350, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 288, 'max_ma_m': 600, 'margin_m': 50}, {'eoa_m': 1000, 'reason': 'occupied'}), ('control 32', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}, {'len': 350, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 344, 'max_ma_m': 600, 'margin_m': 50}, {'eoa_m': 400, 'reason': 'occupied'})], [('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: unlocked section margin', {'sections': [{'len': 100, 'state': 'occupied'}, {'len': 150, 'state': 'locked'}, {'len': 100, 'state': 'unlocked'}], 'train_sec': 0, 'offset_m': 20, 'max_ma_m': 5000, 'margin_m': 30}, {'eoa_m': 220, 'reason': 'unlocked'}), ('sampled regression 75', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}, {'len': 350, 'state': 'unlocked'}, {'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 3, 'offset_m': 339, 'max_ma_m': 300, 'margin_m': 25}, {'eoa_m': 1439, 'reason': 'max-length'}), ('control 41', {'sections': [{'len': 350, 'state': 'locked'}, {'len': 100, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}], 'train_sec': 1, 'offset_m': 4, 'max_ma_m': 1000, 'margin_m': 50}, {'eoa_m': 750, 'reason': 'end-of-route'}), ('boundary: own section occupied', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 50, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 675, 'reason': 'end-of-route'}), ('control 34', {'sections': [{'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 222, 'max_ma_m': 600, 'margin_m': 0}, {'eoa_m': 850, 'reason': 'unlocked'}), ('sampled regression 37', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 200, 'state': 'unlocked'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 2, 'max_ma_m': 600, 'margin_m': 50}, {'eoa_m': 602, 'reason': 'max-length'}), ('control 40', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 350, 'state': 'unlocked'}, {'len': 200, 'state': 'locked'}, {'len': 500, 'state': 'unlocked'}, {'len': 100, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 25, 'max_ma_m': 1000, 'margin_m': 0}, {'eoa_m': 500, 'reason': 'unlocked'})], [('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: own section occupied', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 50, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 675, 'reason': 'end-of-route'}), ('sampled regression 33', {'sections': [{'len': 100, 'state': 'locked'}, {'len': 100, 'state': 'locked'}, {'len': 100, 'state': 'locked'}, {'len': 100, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 3, 'offset_m': 33, 'max_ma_m': 600, 'margin_m': 50}, {'eoa_m': 933, 'reason': 'max-length'}), ('control 62', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 100, 'state': 'unlocked'}], 'train_sec': 0, 'offset_m': 203, 'max_ma_m': 1000, 'margin_m': 50}, {'eoa_m': 650, 'reason': 'unlocked'}), ('boundary: occupied section two ahead', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 100, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 375, 'reason': 'occupied'}), ('sampled regression 45', {'sections': [{'len': 350, 'state': 'unlocked'}, {'len': 200, 'state': 'locked'}, {'len': 350, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 200, 'state': 'locked'}, {'len': 200, 'state': 'locked'}, {'len': 200, 'state': 'locked'}], 'train_sec': 2, 'offset_m': 348, 'max_ma_m': 300, 'margin_m': 25}, {'eoa_m': 1198, 'reason': 'max-length'}), ('control 48', {'sections': [{'len': 500, 'state': 'unlocked'}, {'len': 200, 'state': 'unlocked'}, {'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 2, 'offset_m': 200, 'max_ma_m': 1000, 'margin_m': 25}, {'eoa_m': 1725, 'reason': 'end-of-route'}), ('control 51', {'sections': [{'len': 500, 'state': 'locked'}, {'len': 100, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}], 'train_sec': 1, 'offset_m': 18, 'max_ma_m': 600, 'margin_m': 0}, {'eoa_m': 1100, 'reason': 'occupied'})]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"be488c702d151de586633ecc1c02c678f8d6ab95f707ec6b7193e2ffa3ac023a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    secs = x['sections']\n    bounds = []\n    acc = 0\n    for s in secs:\n        bounds.append(acc)\n        acc += s['len']\n    k = x['train_sec']\n    eoa = acc\n    reason = 'end-of-route'\n    for j in range(k + 1, len(secs)):\n        if secs[j]['state'] != 'locked':\n            eoa = bounds[j]\n            reason = secs[j]['state']\n            break\n    front = bounds[k] + x['offset_m']\n    if eoa - front > x['max_ma_m']:\n        eoa = front + x['max_ma_m']\n        reason = 'max-length'\n    eoa -= x['margin_m']\n    return {'eoa_m': eoa, 'reason': reason}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: own section occupied', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 50, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 675, 'reason': 'end-of-route'}), ('sampled regression 24', {'sections': [{'len': 350, 'state': 'unlocked'}, {'len': 500, 'state': 'occupied'}, {'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 350, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 3, 'offset_m': 108, 'max_ma_m': 1000, 'margin_m': 50}, {'eoa_m': 2308, 'reason': 'max-length'}), ('boundary: unlocked section next', {'sections': [{'len': 200, 'state': 'locked'}, {'len': 200, 'state': 'occupied'}, {'len': 300, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 10, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 375, 'reason': 'unlocked'}), ('boundary: occupied section two ahead', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 100, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 375, 'reason': 'occupied'}), ('control 1', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 100, 'state': 'unlocked'}, {'len': 200, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 69, 'max_ma_m': 5000, 'margin_m': 50}, {'eoa_m': 150, 'reason': 'unlocked'}), ('control 4', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 206, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 1325, 'reason': 'end-of-route'}), ('control 7', {'sections': [{'len': 350, 'state': 'locked'}, {'len': 200, 'state': 'occupied'}, {'len': 350, 'state': 'unlocked'}, {'len': 500, 'state': 'unlocked'}, {'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 108, 'max_ma_m': 5000, 'margin_m': 0}, {'eoa_m': 550, 'reason': 'unlocked'})], [('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: unlocked section next', {'sections': [{'len': 200, 'state': 'locked'}, {'len': 200, 'state': 'occupied'}, {'len': 300, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 10, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 375, 'reason': 'unlocked'}), ('sampled regression 63', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'unlocked'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 197, 'max_ma_m': 300, 'margin_m': 25}, {'eoa_m': 497, 'reason': 'max-length'}), ('control 3', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}, {'len': 100, 'state': 'unlocked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 1, 'offset_m': 141, 'max_ma_m': 1000, 'margin_m': 50}, {'eoa_m': 450, 'reason': 'unlocked'}), ('boundary: cap exactly at the obstacle', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 975, 'reason': 'occupied'}), ('sampled regression 12', {'sections': [{'len': 200, 'state': 'unlocked'}, {'len': 350, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}, {'len': 200, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 2, 'offset_m': 34, 'max_ma_m': 300, 'margin_m': 50}, {'eoa_m': 884, 'reason': 'max-length'}), ('control 15', {'sections': [{'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'locked'}, {'len': 200, 'state': 'locked'}, {'len': 350, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 100, 'state': 'locked'}], 'train_sec': 4, 'offset_m': 137, 'max_ma_m': 5000, 'margin_m': 0}, {'eoa_m': 2100, 'reason': 'end-of-route'}), ('control 18', {'sections': [{'len': 200, 'state': 'unlocked'}, {'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'unlocked'}, {'len': 200, 'state': 'occupied'}, {'len': 100, 'state': 'occupied'}, {'len': 100, 'state': 'unlocked'}], 'train_sec': 3, 'offset_m': 181, 'max_ma_m': 1000, 'margin_m': 0}, {'eoa_m': 1250, 'reason': 'occupied'})], [('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: end of route with margin', {'sections': [{'len': 100, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 0, 'max_ma_m': 5000, 'margin_m': 50}, {'eoa_m': 150, 'reason': 'end-of-route'}), ('sampled regression 26', {'sections': [{'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}], 'train_sec': 1, 'offset_m': 9, 'max_ma_m': 300, 'margin_m': 25}, {'eoa_m': 409, 'reason': 'max-length'}), ('control 19', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'unlocked'}, {'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}], 'train_sec': 0, 'offset_m': 103, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 925, 'reason': 'unlocked'}), ('boundary: cap exactly at the obstacle', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'occupied'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 975, 'reason': 'occupied'}), ('control 23', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 100, 'state': 'locked'}, {'len': 500, 'state': 'locked'}, {'len': 100, 'state': 'unlocked'}], 'train_sec': 0, 'offset_m': 20, 'max_ma_m': 5000, 'margin_m': 50}, {'eoa_m': 1100, 'reason': 'unlocked'}), ('control 29', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 500, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 100, 'state': 'occupied'}, {'len': 100, 'state': 'occupied'}, {'len': 350, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 288, 'max_ma_m': 600, 'margin_m': 50}, {'eoa_m': 1000, 'reason': 'occupied'}), ('control 32', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}, {'len': 350, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 344, 'max_ma_m': 600, 'margin_m': 50}, {'eoa_m': 400, 'reason': 'occupied'})], [('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: unlocked section margin', {'sections': [{'len': 100, 'state': 'occupied'}, {'len': 150, 'state': 'locked'}, {'len': 100, 'state': 'unlocked'}], 'train_sec': 0, 'offset_m': 20, 'max_ma_m': 5000, 'margin_m': 30}, {'eoa_m': 220, 'reason': 'unlocked'}), ('sampled regression 75', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}, {'len': 350, 'state': 'unlocked'}, {'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 3, 'offset_m': 339, 'max_ma_m': 300, 'margin_m': 25}, {'eoa_m': 1439, 'reason': 'max-length'}), ('control 41', {'sections': [{'len': 350, 'state': 'locked'}, {'len': 100, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}], 'train_sec': 1, 'offset_m': 4, 'max_ma_m': 1000, 'margin_m': 50}, {'eoa_m': 750, 'reason': 'end-of-route'}), ('boundary: own section occupied', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 50, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 675, 'reason': 'end-of-route'}), ('control 34', {'sections': [{'len': 500, 'state': 'locked'}, {'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'unlocked'}], 'train_sec': 1, 'offset_m': 222, 'max_ma_m': 600, 'margin_m': 0}, {'eoa_m': 850, 'reason': 'unlocked'}), ('sampled regression 37', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 200, 'state': 'unlocked'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 2, 'max_ma_m': 600, 'margin_m': 50}, {'eoa_m': 602, 'reason': 'max-length'}), ('control 40', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 350, 'state': 'unlocked'}, {'len': 200, 'state': 'locked'}, {'len': 500, 'state': 'unlocked'}, {'len': 100, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 25, 'max_ma_m': 1000, 'margin_m': 0}, {'eoa_m': 500, 'reason': 'unlocked'})], [('regression: length cap from the front', {'sections': [{'len': 500, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 400, 'max_ma_m': 600, 'margin_m': 25}, {'eoa_m': 1000, 'reason': 'max-length'}), ('boundary: own section occupied', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 50, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 675, 'reason': 'end-of-route'}), ('sampled regression 33', {'sections': [{'len': 100, 'state': 'locked'}, {'len': 100, 'state': 'locked'}, {'len': 100, 'state': 'locked'}, {'len': 100, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 500, 'state': 'locked'}], 'train_sec': 3, 'offset_m': 33, 'max_ma_m': 600, 'margin_m': 50}, {'eoa_m': 933, 'reason': 'max-length'}), ('control 62', {'sections': [{'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 100, 'state': 'unlocked'}], 'train_sec': 0, 'offset_m': 203, 'max_ma_m': 1000, 'margin_m': 50}, {'eoa_m': 650, 'reason': 'unlocked'}), ('boundary: occupied section two ahead', {'sections': [{'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}, {'len': 300, 'state': 'occupied'}, {'len': 100, 'state': 'locked'}], 'train_sec': 0, 'offset_m': 100, 'max_ma_m': 5000, 'margin_m': 25}, {'eoa_m': 375, 'reason': 'occupied'}), ('sampled regression 45', {'sections': [{'len': 350, 'state': 'unlocked'}, {'len': 200, 'state': 'locked'}, {'len': 350, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 200, 'state': 'locked'}, {'len': 200, 'state': 'locked'}, {'len': 200, 'state': 'locked'}], 'train_sec': 2, 'offset_m': 348, 'max_ma_m': 300, 'margin_m': 25}, {'eoa_m': 1198, 'reason': 'max-length'}), ('control 48', {'sections': [{'len': 500, 'state': 'unlocked'}, {'len': 200, 'state': 'unlocked'}, {'len': 350, 'state': 'occupied'}, {'len': 350, 'state': 'locked'}, {'len': 350, 'state': 'locked'}], 'train_sec': 2, 'offset_m': 200, 'max_ma_m': 1000, 'margin_m': 25}, {'eoa_m': 1725, 'reason': 'end-of-route'}), ('control 51', {'sections': [{'len': 500, 'state': 'locked'}, {'len': 100, 'state': 'occupied'}, {'len': 500, 'state': 'locked'}, {'len': 200, 'state': 'occupied'}, {'len': 200, 'state': 'locked'}], 'train_sec': 1, 'offset_m': 18, 'max_ma_m': 600, 'margin_m': 0}, {'eoa_m': 1100, 'reason': 'occupied'})]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"Stipulated toy interlocking contract for a bounded teaching model; it makes no claim of conformance to any railway signalling standard and omits real safety cases. 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-railway_interlocking_logic-movement-authority-end-margin-application","generated_at":"2026-09-29T14:47:49.821507+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Interlocking logic decides whether trains may be given authority; a wrong decision at this point either grants unsafe movements or strands traffic.","root_cause":"The margin is subtracted even from the artificial max-length limit.","sha256":"556f6cc1d7f037f2eb14b89f67b9d66bd66081944c721dabca05d1ac86ce1ab2","title":"Movement authority end computation: margin application · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":37.421,"exit_code":1,"observations":[{"actual":{"eoa_m":1000,"reason":"max-length"},"check":"regression: length cap from the front","expected":{"eoa_m":1000,"reason":"max-length"},"passed":true},{"actual":{"eoa_m":700,"reason":"end-of-route"},"check":"boundary: own section occupied","expected":{"eoa_m":675,"reason":"end-of-route"},"passed":false},{"actual":{"eoa_m":2308,"reason":"max-length"},"check":"sampled regression 24","expected":{"eoa_m":2308,"reason":"max-length"},"passed":true},{"actual":{"eoa_m":400,"reason":"unlocked"},"check":"boundary: unlocked section next","expected":{"eoa_m":375,"reason":"unlocked"},"passed":false},{"actual":{"eoa_m":375,"reason":"occupied"},"check":"boundary: occupied section two ahead","expected":{"eoa_m":375,"reason":"occupied"},"passed":true},{"actual":{"eoa_m":200,"reason":"unlocked"},"check":"control 1","expected":{"eoa_m":150,"reason":"unlocked"},"passed":false},{"actual":{"eoa_m":1350,"reason":"end-of-route"},"check":"control 4","expected":{"eoa_m":1325,"reason":"end-of-route"},"passed":false},{"actual":{"eoa_m":550,"reason":"unlocked"},"check":"control 7","expected":{"eoa_m":550,"reason":"unlocked"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: length cap from the front\", \"actual\": {\"eoa_m\": 1000, \"reason\": \"max-length\"}, \"expected\": {\"eoa_m\": 1000, \"reason\": \"max-length\"}, \"passed\": true}, {\"check\": \"boundary: own section occupied\", \"actual\": {\"eoa_m\": 700, \"reason\": \"end-of-route\"}, \"expected\": {\"eoa_m\": 675, \"reason\": \"end-of-route\"}, \"passed\": false}, {\"check\": \"sampled regression 24\", \"actual\": {\"eoa_m\": 2308, \"reason\": \"max-length\"}, \"expected\": {\"eoa_m\": 2308, \"reason\": \"max-length\"}, \"passed\": true}, {\"check\": \"boundary: unlocked section next\", \"actual\": {\"eoa_m\": 400, \"reason\": \"unlocked\"}, \"expected\": {\"eoa_m\": 375, \"reason\": \"unlocked\"}, \"passed\": false}, {\"check\": \"boundary: occupied section two ahead\", \"actual\": {\"eoa_m\": 375, \"reason\": \"occupied\"}, \"expected\": {\"eoa_m\": 375, \"reason\": \"occupied\"}, \"passed\": true}, {\"check\": \"control 1\", \"actual\": {\"eoa_m\": 200, \"reason\": \"unlocked\"}, \"expected\": {\"eoa_m\": 150, \"reason\": \"unlocked\"}, \"passed\": false}, {\"check\": \"control 4\", \"actual\": {\"eoa_m\": 1350, \"reason\": \"end-of-route\"}, \"expected\": {\"eoa_m\": 1325, \"reason\": \"end-of-route\"}, \"passed\": false}, {\"check\": \"control 7\", \"actual\": {\"eoa_m\": 550, \"reason\": \"unlocked\"}, \"expected\": {\"eoa_m\": 550, \"reason\": \"unlocked\"}, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.316,"exit_code":1,"observations":[{"actual":{"eoa_m":975,"reason":"max-length"},"check":"regression: length cap from the front","expected":{"eoa_m":1000,"reason":"max-length"},"passed":false},{"actual":{"eoa_m":675,"reason":"end-of-route"},"check":"boundary: own section occupied","expected":{"eoa_m":675,"reason":"end-of-route"},"passed":true},{"actual":{"eoa_m":2258,"reason":"max-length"},"check":"sampled regression 24","expected":{"eoa_m":2308,"reason":"max-length"},"passed":false},{"actual":{"eoa_m":375,"reason":"unlocked"},"check":"boundary: unlocked section next","expected":{"eoa_m":375,"reason":"unlocked"},"passed":true},{"actual":{"eoa_m":375,"reason":"occupied"},"check":"boundary: occupied section two ahead","expected":{"eoa_m":375,"reason":"occupied"},"passed":true},{"actual":{"eoa_m":150,"reason":"unlocked"},"check":"control 1","expected":{"eoa_m":150,"reason":"unlocked"},"passed":true},{"actual":{"eoa_m":1325,"reason":"end-of-route"},"check":"control 4","expected":{"eoa_m":1325,"reason":"end-of-route"},"passed":true},{"actual":{"eoa_m":550,"reason":"unlocked"},"check":"control 7","expected":{"eoa_m":550,"reason":"unlocked"},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: length cap from the front\", \"actual\": {\"eoa_m\": 975, \"reason\": \"max-length\"}, \"expected\": {\"eoa_m\": 1000, \"reason\": \"max-length\"}, \"passed\": false}, {\"check\": \"boundary: own section occupied\", \"actual\": {\"eoa_m\": 675, \"reason\": \"end-of-route\"}, \"expected\": {\"eoa_m\": 675, \"reason\": \"end-of-route\"}, \"passed\": true}, {\"check\": \"sampled regression 24\", \"actual\": {\"eoa_m\": 2258, \"reason\": \"max-length\"}, \"expected\": {\"eoa_m\": 2308, \"reason\": \"max-length\"}, \"passed\": false}, {\"check\": \"boundary: unlocked section next\", \"actual\": {\"eoa_m\": 375, \"reason\": \"unlocked\"}, \"expected\": {\"eoa_m\": 375, \"reason\": \"unlocked\"}, \"passed\": true}, {\"check\": \"boundary: occupied section two ahead\", \"actual\": {\"eoa_m\": 375, \"reason\": \"occupied\"}, \"expected\": {\"eoa_m\": 375, \"reason\": \"occupied\"}, \"passed\": true}, {\"check\": \"control 1\", \"actual\": {\"eoa_m\": 150, \"reason\": \"unlocked\"}, \"expected\": {\"eoa_m\": 150, \"reason\": \"unlocked\"}, \"passed\": true}, {\"check\": \"control 4\", \"actual\": {\"eoa_m\": 1325, \"reason\": \"end-of-route\"}, \"expected\": {\"eoa_m\": 1325, \"reason\": \"end-of-route\"}, \"passed\": true}, {\"check\": \"control 7\", \"actual\": {\"eoa_m\": 550, \"reason\": \"unlocked\"}, \"expected\": {\"eoa_m\": 550, \"reason\": \"unlocked\"}, \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}