FA-94641 / Exam timetabling constraints / Open access
Overlap detected only when the second booking starts inside the first · case 01
A later-listed booking that starts earlier and overlaps is missed.
ROOT CAUSE
The overlap test checks only whether b starts inside a.
VERIFIED REPAIR
Use the symmetric interval overlap test.
Unsuccessful approach: Allowing equal starts still misses bookings listed in the other order.
Case contract
bookings [room, exam, start, end, setup minutes]; each booking occupies [start - setup, end + cleanup). Two bookings in the same room conflict if their occupied intervals overlap (touching is fine). Return sorted [room, exam, exam] rows with the exam pair sorted.
Why this case matters
Exam rooms need setup and clearance time; conflicts must account for both buffers.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(bookings, cleanup):
by = {}
for r, ex, s, e, setup in bookings:
by.setdefault(r, []).append((s - setup, e + cleanup, ex))
out = []
for r in sorted(by):
bs = by[r]
for i in range(len(bs)):
for j in range(i + 1, len(bs)):
a, b = bs[i], bs[j]
if a[0] < b[0] < a[1]:
out.append([r] + sorted([a[2], b[2]]))
return sorted(out)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: containment overlap 1',
[[['R2', 'LAW', 660, 780, 45], ['R1', 'CS', 780, 870, 0], ['R2', 'MED', 660, 750, 45]], 10],
[['R2', 'LAW', 'MED']]),
('regression variant: containment overlap 2',
[[['R1', 'PHYS', 600, 720, 30], ['R1', 'ENG', 540, 630, 30], ['R2', 'ART', 720, 780, 15]], 10],
[['R1', 'ENG', 'PHYS']]),
('partial repair guard 3', [[['R1', 'ART', 720, 840, 45], ['R1', 'CS', 660, 780, 15]], 30],
[['R1', 'ART', 'CS']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R2', 'GEO', 600, 720, 45], ['R2', 'LAW', 660, 780, 45], ['R1', 'ART', 780, 900, 45]], 10],
[['R2', 'GEO', 'LAW']]),
('normal control 7',
[[['R2', 'PHYS', 780, 840, 30], ['R2', 'ENG', 660, 780, 15], ['R2', 'MED', 600, 720, 45],
['R2', 'GEO', 720, 810, 15]],
10],
[['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'MED'], ['R2', 'ENG', 'PHYS'], ['R2', 'GEO', 'MED'],
['R2', 'GEO', 'PHYS']]),
('normal control 8', [[['R2', 'LAW', 720, 840, 30], ['R1', 'ENG', 720, 840, 15]], 10], [])],
[('regression: containment overlap 1',
[[['R1', 'ENG', 660, 750, 15], ['R2', 'LAW', 660, 750, 0], ['R2', 'PHYS', 780, 900, 0],
['R1', 'ART', 540, 660, 15]],
10],
[['R1', 'ART', 'ENG']]),
('regression variant: containment overlap 2',
[[['R2', 'LAW', 720, 840, 15], ['R2', 'MED', 660, 780, 30], ['R2', 'GEO', 660, 780, 0],
['R2', 'CS', 840, 930, 30], ['R2', 'PHYS', 840, 930, 0]],
10],
[['R2', 'CS', 'LAW'], ['R2', 'CS', 'PHYS'], ['R2', 'GEO', 'LAW'], ['R2', 'GEO', 'MED'],
['R2', 'LAW', 'MED'], ['R2', 'LAW', 'PHYS']]),
('partial repair guard 3',
[[['R1', 'ART', 660, 750, 45], ['R1', 'CS', 840, 900, 30], ['R2', 'ENG', 540, 600, 30],
['R2', 'GEO', 600, 660, 45], ['R2', 'LAW', 540, 630, 45]],
15],
[['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'LAW'], ['R2', 'GEO', 'LAW']]),
('boundary control 4', [[['R1', 'A', 540, 600, 30], ['R1', 'B', 645, 700, 30]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 600, 45], ['R1', 'A', 610, 700, 0]], 15], [['R1', 'A', 'B']]),
('normal control 6', [[['R1', 'LAW', 600, 720, 45], ['R2', 'ART', 780, 900, 0]], 15], []),
('normal control 7',
[[['R2', 'ART', 840, 930, 45], ['R1', 'GEO', 600, 660, 45], ['R1', 'CS', 720, 810, 15],
['R1', 'MED', 720, 840, 15], ['R2', 'ENG', 840, 960, 15]],
10],
[['R1', 'CS', 'MED'], ['R2', 'ART', 'ENG']]),
('normal control 8',
[[['R1', 'MED', 720, 780, 0], ['R2', 'ART', 780, 900, 15], ['R1', 'PHYS', 720, 780, 15],
['R1', 'LAW', 540, 630, 30]],
15],
[['R1', 'MED', 'PHYS']])],
[('regression: containment overlap 1',
[[['R2', 'CS', 840, 930, 15], ['R2', 'PHYS', 720, 780, 15], ['R2', 'GEO', 660, 720, 15],
['R1', 'ENG', 780, 900, 45], ['R2', 'LAW', 840, 900, 30]],
15],
[['R2', 'CS', 'LAW'], ['R2', 'GEO', 'PHYS']]),
('regression variant: containment overlap 2',
[[['R2', 'PHYS', 720, 810, 15], ['R1', 'MED', 840, 930, 15], ['R1', 'ART', 780, 870, 0],
['R1', 'CS', 840, 960, 15], ['R1', 'ENG', 540, 630, 0]],
15],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'MED'], ['R1', 'CS', 'MED']]),
('partial repair guard 3',
[[['R2', 'ART', 720, 840, 15], ['R2', 'ENG', 600, 660, 30], ['R1', 'MED', 780, 870, 45],
['R1', 'LAW', 720, 840, 45], ['R1', 'PHYS', 660, 720, 30]],
30],
[['R1', 'LAW', 'MED'], ['R1', 'LAW', 'PHYS'], ['R1', 'MED', 'PHYS']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R1', 'GEO', 540, 660, 15], ['R1', 'PHYS', 600, 660, 15], ['R2', 'LAW', 600, 720, 45],
['R2', 'CS', 660, 720, 0]],
30],
[['R1', 'GEO', 'PHYS'], ['R2', 'CS', 'LAW']]),
('normal control 7', [[['R2', 'PHYS', 720, 780, 15], ['R2', 'LAW', 540, 630, 30]], 30], []),
('normal control 8',
[[['R1', 'MED', 720, 780, 0], ['R2', 'ART', 780, 900, 15], ['R1', 'PHYS', 720, 780, 15],
['R1', 'LAW', 540, 630, 30]],
15],
[['R1', 'MED', 'PHYS']])],
[('regression: containment overlap 1',
[[['R1', 'CS', 840, 960, 0], ['R2', 'PHYS', 540, 600, 45], ['R2', 'GEO', 720, 780, 0],
['R2', 'ART', 600, 690, 0], ['R2', 'MED', 720, 810, 15]],
10],
[['R2', 'ART', 'PHYS'], ['R2', 'GEO', 'MED']]),
('regression variant: containment overlap 2',
[[['R2', 'ART', 540, 600, 0], ['R2', 'ENG', 840, 900, 45], ['R2', 'GEO', 720, 810, 15]], 30],
[['R2', 'ENG', 'GEO']]),
('partial repair guard 3', [[['R2', 'CS', 720, 810, 0], ['R2', 'LAW', 720, 810, 15]], 30],
[['R2', 'CS', 'LAW']]),
('boundary control 4', [[['R1', 'A', 540, 600, 30], ['R1', 'B', 645, 700, 30]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 600, 45], ['R1', 'A', 610, 700, 0]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R1', 'GEO', 540, 630, 15], ['R1', 'ART', 540, 630, 30], ['R2', 'PHYS', 840, 960, 0],
['R1', 'ENG', 840, 960, 15], ['R2', 'MED', 780, 900, 45]],
15],
[['R1', 'ART', 'GEO'], ['R2', 'MED', 'PHYS']]),
('normal control 7',
[[['R2', 'LAW', 660, 720, 30], ['R1', 'PHYS', 840, 930, 45], ['R2', 'ENG', 780, 870, 45],
['R1', 'GEO', 660, 720, 30]],
10],
[]),
('normal control 8',
[[['R2', 'CS', 600, 660, 15], ['R2', 'ART', 720, 810, 45], ['R1', 'GEO', 600, 720, 30],
['R2', 'PHYS', 660, 780, 45], ['R2', 'MED', 600, 660, 0]],
10],
[['R2', 'ART', 'PHYS'], ['R2', 'CS', 'MED'], ['R2', 'CS', 'PHYS'], ['R2', 'MED', 'PHYS']])],
[('regression: containment overlap 1',
[[['R2', 'CS', 840, 930, 30], ['R1', 'ART', 600, 690, 15], ['R2', 'GEO', 840, 960, 0],
['R2', 'PHYS', 840, 960, 45]],
30],
[['R2', 'CS', 'GEO'], ['R2', 'CS', 'PHYS'], ['R2', 'GEO', 'PHYS']]),
('regression variant: containment overlap 2',
[[['R2', 'ART', 720, 780, 45], ['R1', 'LAW', 660, 750, 0], ['R1', 'CS', 720, 840, 0],
['R1', 'MED', 720, 810, 45]],
30],
[['R1', 'CS', 'LAW'], ['R1', 'CS', 'MED'], ['R1', 'LAW', 'MED']]),
('partial repair guard 3',
[[['R1', 'PHYS', 840, 960, 15], ['R1', 'LAW', 780, 840, 30], ['R2', 'MED', 540, 660, 45],
['R2', 'GEO', 840, 900, 30], ['R2', 'ENG', 720, 840, 0]],
30],
[['R1', 'LAW', 'PHYS'], ['R2', 'ENG', 'GEO']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R2', 'ART', 540, 600, 0], ['R2', 'ENG', 840, 900, 45], ['R2', 'GEO', 720, 810, 15]], 30],
[['R2', 'ENG', 'GEO']]),
('normal control 7', [[['R1', 'PHYS', 720, 840, 45], ['R1', 'ART', 840, 960, 30]], 15],
[['R1', 'ART', 'PHYS']]),
('normal control 8', [[['R1', 'ENG', 720, 840, 30], ['R2', 'MED', 780, 840, 45]], 30], [])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: containment overlap 1 | [] | [['R2', 'LAW', 'MED']] | Failed |
| regression variant: containment overlap 2 | [] | [['R1', 'ENG', 'PHYS']] | Failed |
| partial repair guard 3 | [] | [['R1', 'ART', 'CS']] | Failed |
| boundary control 4 | [] | [] | Passed |
| boundary control 5 | [['R1', 'A', 'B']] | [['R1', 'A', 'B']] | Passed |
| normal control 6 | [['R2', 'GEO', 'LAW']] | [['R2', 'GEO', 'LAW']] | Passed |
| normal control 7 | [['R2', 'ENG', 'GEO'], ['R2', 'GEO', 'MED']] | [['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'MED'], ['R2', 'ENG', 'PHYS'], ['R2', 'GEO', 'MED'], ['R2', 'GEO', 'PHYS']] | Failed |
| normal control 8 | [] | [] | Passed |
SHA-256 / da90d51110ddd4b8f82a7ea7aefd0f111c3c56ed1330a3964ca894bd3ff8929d
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(bookings, cleanup):
by = {}
for r, ex, s, e, setup in bookings:
by.setdefault(r, []).append((s - setup, e + cleanup, ex))
out = []
for r in sorted(by):
bs = by[r]
for i in range(len(bs)):
for j in range(i + 1, len(bs)):
a, b = bs[i], bs[j]
if a[0] <= b[0] < a[1]:
out.append([r] + sorted([a[2], b[2]]))
return sorted(out)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: containment overlap 1',
[[['R2', 'LAW', 660, 780, 45], ['R1', 'CS', 780, 870, 0], ['R2', 'MED', 660, 750, 45]], 10],
[['R2', 'LAW', 'MED']]),
('regression variant: containment overlap 2',
[[['R1', 'PHYS', 600, 720, 30], ['R1', 'ENG', 540, 630, 30], ['R2', 'ART', 720, 780, 15]], 10],
[['R1', 'ENG', 'PHYS']]),
('partial repair guard 3', [[['R1', 'ART', 720, 840, 45], ['R1', 'CS', 660, 780, 15]], 30],
[['R1', 'ART', 'CS']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R2', 'GEO', 600, 720, 45], ['R2', 'LAW', 660, 780, 45], ['R1', 'ART', 780, 900, 45]], 10],
[['R2', 'GEO', 'LAW']]),
('normal control 7',
[[['R2', 'PHYS', 780, 840, 30], ['R2', 'ENG', 660, 780, 15], ['R2', 'MED', 600, 720, 45],
['R2', 'GEO', 720, 810, 15]],
10],
[['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'MED'], ['R2', 'ENG', 'PHYS'], ['R2', 'GEO', 'MED'],
['R2', 'GEO', 'PHYS']]),
('normal control 8', [[['R2', 'LAW', 720, 840, 30], ['R1', 'ENG', 720, 840, 15]], 10], [])],
[('regression: containment overlap 1',
[[['R1', 'ENG', 660, 750, 15], ['R2', 'LAW', 660, 750, 0], ['R2', 'PHYS', 780, 900, 0],
['R1', 'ART', 540, 660, 15]],
10],
[['R1', 'ART', 'ENG']]),
('regression variant: containment overlap 2',
[[['R2', 'LAW', 720, 840, 15], ['R2', 'MED', 660, 780, 30], ['R2', 'GEO', 660, 780, 0],
['R2', 'CS', 840, 930, 30], ['R2', 'PHYS', 840, 930, 0]],
10],
[['R2', 'CS', 'LAW'], ['R2', 'CS', 'PHYS'], ['R2', 'GEO', 'LAW'], ['R2', 'GEO', 'MED'],
['R2', 'LAW', 'MED'], ['R2', 'LAW', 'PHYS']]),
('partial repair guard 3',
[[['R1', 'ART', 660, 750, 45], ['R1', 'CS', 840, 900, 30], ['R2', 'ENG', 540, 600, 30],
['R2', 'GEO', 600, 660, 45], ['R2', 'LAW', 540, 630, 45]],
15],
[['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'LAW'], ['R2', 'GEO', 'LAW']]),
('boundary control 4', [[['R1', 'A', 540, 600, 30], ['R1', 'B', 645, 700, 30]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 600, 45], ['R1', 'A', 610, 700, 0]], 15], [['R1', 'A', 'B']]),
('normal control 6', [[['R1', 'LAW', 600, 720, 45], ['R2', 'ART', 780, 900, 0]], 15], []),
('normal control 7',
[[['R2', 'ART', 840, 930, 45], ['R1', 'GEO', 600, 660, 45], ['R1', 'CS', 720, 810, 15],
['R1', 'MED', 720, 840, 15], ['R2', 'ENG', 840, 960, 15]],
10],
[['R1', 'CS', 'MED'], ['R2', 'ART', 'ENG']]),
('normal control 8',
[[['R1', 'MED', 720, 780, 0], ['R2', 'ART', 780, 900, 15], ['R1', 'PHYS', 720, 780, 15],
['R1', 'LAW', 540, 630, 30]],
15],
[['R1', 'MED', 'PHYS']])],
[('regression: containment overlap 1',
[[['R2', 'CS', 840, 930, 15], ['R2', 'PHYS', 720, 780, 15], ['R2', 'GEO', 660, 720, 15],
['R1', 'ENG', 780, 900, 45], ['R2', 'LAW', 840, 900, 30]],
15],
[['R2', 'CS', 'LAW'], ['R2', 'GEO', 'PHYS']]),
('regression variant: containment overlap 2',
[[['R2', 'PHYS', 720, 810, 15], ['R1', 'MED', 840, 930, 15], ['R1', 'ART', 780, 870, 0],
['R1', 'CS', 840, 960, 15], ['R1', 'ENG', 540, 630, 0]],
15],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'MED'], ['R1', 'CS', 'MED']]),
('partial repair guard 3',
[[['R2', 'ART', 720, 840, 15], ['R2', 'ENG', 600, 660, 30], ['R1', 'MED', 780, 870, 45],
['R1', 'LAW', 720, 840, 45], ['R1', 'PHYS', 660, 720, 30]],
30],
[['R1', 'LAW', 'MED'], ['R1', 'LAW', 'PHYS'], ['R1', 'MED', 'PHYS']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R1', 'GEO', 540, 660, 15], ['R1', 'PHYS', 600, 660, 15], ['R2', 'LAW', 600, 720, 45],
['R2', 'CS', 660, 720, 0]],
30],
[['R1', 'GEO', 'PHYS'], ['R2', 'CS', 'LAW']]),
('normal control 7', [[['R2', 'PHYS', 720, 780, 15], ['R2', 'LAW', 540, 630, 30]], 30], []),
('normal control 8',
[[['R1', 'MED', 720, 780, 0], ['R2', 'ART', 780, 900, 15], ['R1', 'PHYS', 720, 780, 15],
['R1', 'LAW', 540, 630, 30]],
15],
[['R1', 'MED', 'PHYS']])],
[('regression: containment overlap 1',
[[['R1', 'CS', 840, 960, 0], ['R2', 'PHYS', 540, 600, 45], ['R2', 'GEO', 720, 780, 0],
['R2', 'ART', 600, 690, 0], ['R2', 'MED', 720, 810, 15]],
10],
[['R2', 'ART', 'PHYS'], ['R2', 'GEO', 'MED']]),
('regression variant: containment overlap 2',
[[['R2', 'ART', 540, 600, 0], ['R2', 'ENG', 840, 900, 45], ['R2', 'GEO', 720, 810, 15]], 30],
[['R2', 'ENG', 'GEO']]),
('partial repair guard 3', [[['R2', 'CS', 720, 810, 0], ['R2', 'LAW', 720, 810, 15]], 30],
[['R2', 'CS', 'LAW']]),
('boundary control 4', [[['R1', 'A', 540, 600, 30], ['R1', 'B', 645, 700, 30]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 600, 45], ['R1', 'A', 610, 700, 0]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R1', 'GEO', 540, 630, 15], ['R1', 'ART', 540, 630, 30], ['R2', 'PHYS', 840, 960, 0],
['R1', 'ENG', 840, 960, 15], ['R2', 'MED', 780, 900, 45]],
15],
[['R1', 'ART', 'GEO'], ['R2', 'MED', 'PHYS']]),
('normal control 7',
[[['R2', 'LAW', 660, 720, 30], ['R1', 'PHYS', 840, 930, 45], ['R2', 'ENG', 780, 870, 45],
['R1', 'GEO', 660, 720, 30]],
10],
[]),
('normal control 8',
[[['R2', 'CS', 600, 660, 15], ['R2', 'ART', 720, 810, 45], ['R1', 'GEO', 600, 720, 30],
['R2', 'PHYS', 660, 780, 45], ['R2', 'MED', 600, 660, 0]],
10],
[['R2', 'ART', 'PHYS'], ['R2', 'CS', 'MED'], ['R2', 'CS', 'PHYS'], ['R2', 'MED', 'PHYS']])],
[('regression: containment overlap 1',
[[['R2', 'CS', 840, 930, 30], ['R1', 'ART', 600, 690, 15], ['R2', 'GEO', 840, 960, 0],
['R2', 'PHYS', 840, 960, 45]],
30],
[['R2', 'CS', 'GEO'], ['R2', 'CS', 'PHYS'], ['R2', 'GEO', 'PHYS']]),
('regression variant: containment overlap 2',
[[['R2', 'ART', 720, 780, 45], ['R1', 'LAW', 660, 750, 0], ['R1', 'CS', 720, 840, 0],
['R1', 'MED', 720, 810, 45]],
30],
[['R1', 'CS', 'LAW'], ['R1', 'CS', 'MED'], ['R1', 'LAW', 'MED']]),
('partial repair guard 3',
[[['R1', 'PHYS', 840, 960, 15], ['R1', 'LAW', 780, 840, 30], ['R2', 'MED', 540, 660, 45],
['R2', 'GEO', 840, 900, 30], ['R2', 'ENG', 720, 840, 0]],
30],
[['R1', 'LAW', 'PHYS'], ['R2', 'ENG', 'GEO']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R2', 'ART', 540, 600, 0], ['R2', 'ENG', 840, 900, 45], ['R2', 'GEO', 720, 810, 15]], 30],
[['R2', 'ENG', 'GEO']]),
('normal control 7', [[['R1', 'PHYS', 720, 840, 45], ['R1', 'ART', 840, 960, 30]], 15],
[['R1', 'ART', 'PHYS']]),
('normal control 8', [[['R1', 'ENG', 720, 840, 30], ['R2', 'MED', 780, 840, 45]], 30], [])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: containment overlap 1 | [['R2', 'LAW', 'MED']] | [['R2', 'LAW', 'MED']] | Passed |
| regression variant: containment overlap 2 | [] | [['R1', 'ENG', 'PHYS']] | Failed |
| partial repair guard 3 | [] | [['R1', 'ART', 'CS']] | Failed |
| boundary control 4 | [] | [] | Passed |
| boundary control 5 | [['R1', 'A', 'B']] | [['R1', 'A', 'B']] | Passed |
| normal control 6 | [['R2', 'GEO', 'LAW']] | [['R2', 'GEO', 'LAW']] | Passed |
| normal control 7 | [['R2', 'ENG', 'GEO'], ['R2', 'GEO', 'MED']] | [['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'MED'], ['R2', 'ENG', 'PHYS'], ['R2', 'GEO', 'MED'], ['R2', 'GEO', 'PHYS']] | Failed |
| normal control 8 | [] | [] | Passed |
SHA-256 / a5336639d49054a7290d2615b488bc070b1b88aa440246416e487c9561dada4d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(bookings, cleanup):
by = {}
for r, ex, s, e, setup in bookings:
by.setdefault(r, []).append((s - setup, e + cleanup, ex))
out = []
for r in sorted(by):
bs = by[r]
for i in range(len(bs)):
for j in range(i + 1, len(bs)):
a, b = bs[i], bs[j]
if a[0] < b[1] and b[0] < a[1]:
out.append([r] + sorted([a[2], b[2]]))
return sorted(out)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: containment overlap 1',
[[['R2', 'LAW', 660, 780, 45], ['R1', 'CS', 780, 870, 0], ['R2', 'MED', 660, 750, 45]], 10],
[['R2', 'LAW', 'MED']]),
('regression variant: containment overlap 2',
[[['R1', 'PHYS', 600, 720, 30], ['R1', 'ENG', 540, 630, 30], ['R2', 'ART', 720, 780, 15]], 10],
[['R1', 'ENG', 'PHYS']]),
('partial repair guard 3', [[['R1', 'ART', 720, 840, 45], ['R1', 'CS', 660, 780, 15]], 30],
[['R1', 'ART', 'CS']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R2', 'GEO', 600, 720, 45], ['R2', 'LAW', 660, 780, 45], ['R1', 'ART', 780, 900, 45]], 10],
[['R2', 'GEO', 'LAW']]),
('normal control 7',
[[['R2', 'PHYS', 780, 840, 30], ['R2', 'ENG', 660, 780, 15], ['R2', 'MED', 600, 720, 45],
['R2', 'GEO', 720, 810, 15]],
10],
[['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'MED'], ['R2', 'ENG', 'PHYS'], ['R2', 'GEO', 'MED'],
['R2', 'GEO', 'PHYS']]),
('normal control 8', [[['R2', 'LAW', 720, 840, 30], ['R1', 'ENG', 720, 840, 15]], 10], [])],
[('regression: containment overlap 1',
[[['R1', 'ENG', 660, 750, 15], ['R2', 'LAW', 660, 750, 0], ['R2', 'PHYS', 780, 900, 0],
['R1', 'ART', 540, 660, 15]],
10],
[['R1', 'ART', 'ENG']]),
('regression variant: containment overlap 2',
[[['R2', 'LAW', 720, 840, 15], ['R2', 'MED', 660, 780, 30], ['R2', 'GEO', 660, 780, 0],
['R2', 'CS', 840, 930, 30], ['R2', 'PHYS', 840, 930, 0]],
10],
[['R2', 'CS', 'LAW'], ['R2', 'CS', 'PHYS'], ['R2', 'GEO', 'LAW'], ['R2', 'GEO', 'MED'],
['R2', 'LAW', 'MED'], ['R2', 'LAW', 'PHYS']]),
('partial repair guard 3',
[[['R1', 'ART', 660, 750, 45], ['R1', 'CS', 840, 900, 30], ['R2', 'ENG', 540, 600, 30],
['R2', 'GEO', 600, 660, 45], ['R2', 'LAW', 540, 630, 45]],
15],
[['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'LAW'], ['R2', 'GEO', 'LAW']]),
('boundary control 4', [[['R1', 'A', 540, 600, 30], ['R1', 'B', 645, 700, 30]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 600, 45], ['R1', 'A', 610, 700, 0]], 15], [['R1', 'A', 'B']]),
('normal control 6', [[['R1', 'LAW', 600, 720, 45], ['R2', 'ART', 780, 900, 0]], 15], []),
('normal control 7',
[[['R2', 'ART', 840, 930, 45], ['R1', 'GEO', 600, 660, 45], ['R1', 'CS', 720, 810, 15],
['R1', 'MED', 720, 840, 15], ['R2', 'ENG', 840, 960, 15]],
10],
[['R1', 'CS', 'MED'], ['R2', 'ART', 'ENG']]),
('normal control 8',
[[['R1', 'MED', 720, 780, 0], ['R2', 'ART', 780, 900, 15], ['R1', 'PHYS', 720, 780, 15],
['R1', 'LAW', 540, 630, 30]],
15],
[['R1', 'MED', 'PHYS']])],
[('regression: containment overlap 1',
[[['R2', 'CS', 840, 930, 15], ['R2', 'PHYS', 720, 780, 15], ['R2', 'GEO', 660, 720, 15],
['R1', 'ENG', 780, 900, 45], ['R2', 'LAW', 840, 900, 30]],
15],
[['R2', 'CS', 'LAW'], ['R2', 'GEO', 'PHYS']]),
('regression variant: containment overlap 2',
[[['R2', 'PHYS', 720, 810, 15], ['R1', 'MED', 840, 930, 15], ['R1', 'ART', 780, 870, 0],
['R1', 'CS', 840, 960, 15], ['R1', 'ENG', 540, 630, 0]],
15],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'MED'], ['R1', 'CS', 'MED']]),
('partial repair guard 3',
[[['R2', 'ART', 720, 840, 15], ['R2', 'ENG', 600, 660, 30], ['R1', 'MED', 780, 870, 45],
['R1', 'LAW', 720, 840, 45], ['R1', 'PHYS', 660, 720, 30]],
30],
[['R1', 'LAW', 'MED'], ['R1', 'LAW', 'PHYS'], ['R1', 'MED', 'PHYS']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R1', 'GEO', 540, 660, 15], ['R1', 'PHYS', 600, 660, 15], ['R2', 'LAW', 600, 720, 45],
['R2', 'CS', 660, 720, 0]],
30],
[['R1', 'GEO', 'PHYS'], ['R2', 'CS', 'LAW']]),
('normal control 7', [[['R2', 'PHYS', 720, 780, 15], ['R2', 'LAW', 540, 630, 30]], 30], []),
('normal control 8',
[[['R1', 'MED', 720, 780, 0], ['R2', 'ART', 780, 900, 15], ['R1', 'PHYS', 720, 780, 15],
['R1', 'LAW', 540, 630, 30]],
15],
[['R1', 'MED', 'PHYS']])],
[('regression: containment overlap 1',
[[['R1', 'CS', 840, 960, 0], ['R2', 'PHYS', 540, 600, 45], ['R2', 'GEO', 720, 780, 0],
['R2', 'ART', 600, 690, 0], ['R2', 'MED', 720, 810, 15]],
10],
[['R2', 'ART', 'PHYS'], ['R2', 'GEO', 'MED']]),
('regression variant: containment overlap 2',
[[['R2', 'ART', 540, 600, 0], ['R2', 'ENG', 840, 900, 45], ['R2', 'GEO', 720, 810, 15]], 30],
[['R2', 'ENG', 'GEO']]),
('partial repair guard 3', [[['R2', 'CS', 720, 810, 0], ['R2', 'LAW', 720, 810, 15]], 30],
[['R2', 'CS', 'LAW']]),
('boundary control 4', [[['R1', 'A', 540, 600, 30], ['R1', 'B', 645, 700, 30]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 600, 45], ['R1', 'A', 610, 700, 0]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R1', 'GEO', 540, 630, 15], ['R1', 'ART', 540, 630, 30], ['R2', 'PHYS', 840, 960, 0],
['R1', 'ENG', 840, 960, 15], ['R2', 'MED', 780, 900, 45]],
15],
[['R1', 'ART', 'GEO'], ['R2', 'MED', 'PHYS']]),
('normal control 7',
[[['R2', 'LAW', 660, 720, 30], ['R1', 'PHYS', 840, 930, 45], ['R2', 'ENG', 780, 870, 45],
['R1', 'GEO', 660, 720, 30]],
10],
[]),
('normal control 8',
[[['R2', 'CS', 600, 660, 15], ['R2', 'ART', 720, 810, 45], ['R1', 'GEO', 600, 720, 30],
['R2', 'PHYS', 660, 780, 45], ['R2', 'MED', 600, 660, 0]],
10],
[['R2', 'ART', 'PHYS'], ['R2', 'CS', 'MED'], ['R2', 'CS', 'PHYS'], ['R2', 'MED', 'PHYS']])],
[('regression: containment overlap 1',
[[['R2', 'CS', 840, 930, 30], ['R1', 'ART', 600, 690, 15], ['R2', 'GEO', 840, 960, 0],
['R2', 'PHYS', 840, 960, 45]],
30],
[['R2', 'CS', 'GEO'], ['R2', 'CS', 'PHYS'], ['R2', 'GEO', 'PHYS']]),
('regression variant: containment overlap 2',
[[['R2', 'ART', 720, 780, 45], ['R1', 'LAW', 660, 750, 0], ['R1', 'CS', 720, 840, 0],
['R1', 'MED', 720, 810, 45]],
30],
[['R1', 'CS', 'LAW'], ['R1', 'CS', 'MED'], ['R1', 'LAW', 'MED']]),
('partial repair guard 3',
[[['R1', 'PHYS', 840, 960, 15], ['R1', 'LAW', 780, 840, 30], ['R2', 'MED', 540, 660, 45],
['R2', 'GEO', 840, 900, 30], ['R2', 'ENG', 720, 840, 0]],
30],
[['R1', 'LAW', 'PHYS'], ['R2', 'ENG', 'GEO']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('boundary control 5', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15], [['R1', 'A', 'B']]),
('normal control 6',
[[['R2', 'ART', 540, 600, 0], ['R2', 'ENG', 840, 900, 45], ['R2', 'GEO', 720, 810, 15]], 30],
[['R2', 'ENG', 'GEO']]),
('normal control 7', [[['R1', 'PHYS', 720, 840, 45], ['R1', 'ART', 840, 960, 30]], 15],
[['R1', 'ART', 'PHYS']]),
('normal control 8', [[['R1', 'ENG', 720, 840, 30], ['R2', 'MED', 780, 840, 45]], 30], [])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: containment overlap 1 | [['R2', 'LAW', 'MED']] | [['R2', 'LAW', 'MED']] | Passed |
| regression variant: containment overlap 2 | [['R1', 'ENG', 'PHYS']] | [['R1', 'ENG', 'PHYS']] | Passed |
| partial repair guard 3 | [['R1', 'ART', 'CS']] | [['R1', 'ART', 'CS']] | Passed |
| boundary control 4 | [] | [] | Passed |
| boundary control 5 | [['R1', 'A', 'B']] | [['R1', 'A', 'B']] | Passed |
| normal control 6 | [['R2', 'GEO', 'LAW']] | [['R2', 'GEO', 'LAW']] | Passed |
| normal control 7 | [['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'MED'], ['R2', 'ENG', 'PHYS'], ['R2', 'GEO', 'MED'], ['R2', 'GEO', 'PHYS']] | [['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'MED'], ['R2', 'ENG', 'PHYS'], ['R2', 'GEO', 'MED'], ['R2', 'GEO', 'PHYS']] | Passed |
| normal control 8 | [] | [] | Passed |
SHA-256 / b3474c14f3651505c9b5a7f48e3f3de47d770806b6a45431024abc14b1bc6b6a
Verification & scope
Stipulated toy exam-timetabling rule set for a bounded model; it does not claim conformance with any institution's regulations or a benchmark specification, and it performs no search or optimisation. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:52:06.298988+00:00.
Case digest / eee2104687ff9c80d4382026576176198ce2d98bc636ec77874932c531696646