FA-94646 / Exam timetabling constraints / Open access
Conflict pair reported in booking order · case 01
The same conflict appears under different pair orders.
ROOT CAUSE
Exam pairs are not normalised.
VERIFIED REPAIR
Report the two exams in ascending id order.
Unsuccessful approach: Descending order is not the contract 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[1] and b[0] < a[1]:
out.append([r, 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: pair normalisation 1', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15],
[['R1', 'A', 'B']]),
('regression variant: pair normalisation 2',
[[['R2', 'PHYS', 720, 780, 15], ['R2', 'GEO', 720, 810, 30], ['R2', 'CS', 540, 630, 30]], 15],
[['R2', 'GEO', 'PHYS']]),
('partial repair guard 3',
[[['R1', 'ART', 600, 660, 45], ['R1', 'GEO', 840, 930, 15], ['R2', 'MED', 840, 900, 30],
['R1', 'LAW', 600, 720, 0]],
15],
[['R1', 'ART', 'LAW']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('normal control 5',
[[['R2', 'PHYS', 840, 930, 45], ['R1', 'ART', 780, 870, 15], ['R1', 'CS', 840, 960, 0]], 15],
[['R1', 'ART', 'CS']]),
('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',
[[['R1', 'ENG', 660, 720, 15], ['R2', 'GEO', 720, 780, 15], ['R2', 'MED', 780, 870, 45]], 15],
[['R2', 'GEO', 'MED']]),
('normal control 8',
[[['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']])],
[('regression: pair normalisation 1', [[['R1', 'B', 540, 600, 45], ['R1', 'A', 610, 700, 0]], 15],
[['R1', 'A', 'B']]),
('regression variant: pair normalisation 2',
[[['R2', 'PHYS', 540, 630, 0], ['R1', 'CS', 600, 720, 45], ['R2', 'ENG', 600, 720, 0]], 30],
[['R2', 'ENG', 'PHYS']]),
('partial repair guard 3',
[[['R2', 'GEO', 720, 780, 45], ['R1', 'MED', 660, 720, 30], ['R2', 'CS', 780, 840, 15],
['R2', 'LAW', 780, 900, 30]],
10],
[['R2', 'CS', 'GEO'], ['R2', 'CS', 'LAW'], ['R2', 'GEO', 'LAW']]),
('boundary control 4', [[['R1', 'A', 540, 600, 30], ['R1', 'B', 645, 700, 30]], 15], []),
('normal control 5', [[['R2', 'PHYS', 720, 780, 30], ['R2', 'GEO', 600, 690, 0]], 30],
[['R2', 'GEO', 'PHYS']]),
('normal control 6',
[[['R2', 'GEO', 540, 630, 0], ['R1', 'ART', 660, 780, 45], ['R2', 'PHYS', 840, 900, 0],
['R1', 'ENG', 720, 780, 0]],
30],
[['R1', 'ART', 'ENG']]),
('normal control 7',
[[['R2', 'CS', 540, 630, 45], ['R1', 'LAW', 600, 660, 45], ['R2', 'MED', 540, 600, 0],
['R2', 'ENG', 780, 900, 30]],
15],
[['R2', 'CS', 'MED']]),
('normal control 8',
[[['R2', 'GEO', 840, 900, 15], ['R1', 'MED', 780, 900, 30], ['R1', 'CS', 540, 630, 15],
['R2', 'ENG', 540, 600, 45], ['R2', 'ART', 840, 900, 15]],
30],
[['R2', 'ART', 'GEO']])],
[('regression: pair normalisation 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: pair normalisation 2',
[[['R2', 'ART', 540, 660, 0], ['R1', 'PHYS', 660, 720, 0], ['R1', 'ENG', 600, 720, 30],
['R2', 'GEO', 540, 600, 30]],
15],
[['R1', 'ENG', 'PHYS'], ['R2', 'ART', 'GEO']]),
('partial repair guard 3',
[[['R2', 'PHYS', 720, 780, 15], ['R2', 'GEO', 720, 810, 30], ['R2', 'CS', 540, 630, 30]], 15],
[['R2', 'GEO', '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',
[[['R2', 'LAW', 780, 900, 15], ['R2', 'CS', 540, 630, 15], ['R1', 'GEO', 840, 960, 45],
['R1', 'ART', 780, 840, 45]],
10],
[['R1', 'ART', 'GEO']]),
('normal control 7',
[[['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']]),
('normal control 8',
[[['R1', 'CS', 780, 900, 15], ['R2', 'ENG', 720, 780, 15], ['R2', 'GEO', 600, 660, 45],
['R2', 'MED', 600, 720, 15], ['R1', 'PHYS', 600, 690, 30]],
10],
[['R2', 'ENG', 'MED'], ['R2', 'GEO', 'MED']])],
[('regression: pair normalisation 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: pair normalisation 2',
[[['R2', 'GEO', 540, 600, 45], ['R2', 'ENG', 660, 780, 15], ['R1', 'PHYS', 780, 870, 0],
['R2', 'CS', 600, 660, 0], ['R1', 'ART', 660, 750, 30]],
30],
[['R2', 'CS', 'ENG'], ['R2', 'CS', 'GEO']]),
('partial repair guard 3',
[[['R1', 'GEO', 540, 600, 45], ['R1', 'MED', 540, 600, 45], ['R2', 'LAW', 780, 900, 45]], 30],
[['R1', 'GEO', 'MED']]),
('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', 'PHYS', 840, 930, 0], ['R2', 'ENG', 600, 720, 30], ['R2', 'CS', 600, 720, 15]], 15],
[['R2', 'CS', 'ENG']]),
('normal control 7',
[[['R2', 'GEO', 720, 840, 0], ['R1', 'LAW', 840, 930, 0], ['R2', 'PHYS', 540, 660, 0],
['R1', 'ART', 540, 630, 30]],
15],
[]),
('normal control 8',
[[['R2', 'CS', 840, 900, 30], ['R1', 'LAW', 840, 960, 30], ['R2', 'ART', 660, 780, 45]], 10], [])],
[('regression: pair normalisation 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: pair normalisation 2',
[[['R2', 'ART', 840, 900, 30], ['R1', 'ENG', 840, 900, 0], ['R2', 'PHYS', 840, 930, 0],
['R1', 'MED', 540, 630, 30], ['R2', 'LAW', 840, 900, 15]],
10],
[['R2', 'ART', 'LAW'], ['R2', 'ART', 'PHYS'], ['R2', 'LAW', 'PHYS']]),
('partial repair guard 3',
[[['R2', 'ART', 660, 720, 45], ['R2', 'PHYS', 720, 840, 30], ['R1', 'ENG', 840, 930, 0],
['R1', 'GEO', 780, 900, 0], ['R1', 'CS', 720, 780, 45]],
10],
[['R1', 'CS', 'GEO'], ['R1', 'ENG', 'GEO'], ['R2', 'ART', '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', [[['R2', 'MED', 540, 630, 0], ['R1', 'GEO', 660, 750, 45]], 15], []),
('normal control 7',
[[['R2', 'ENG', 720, 810, 15], ['R2', 'CS', 780, 900, 0], ['R2', 'GEO', 540, 630, 45],
['R1', 'PHYS', 600, 660, 30], ['R1', 'LAW', 600, 720, 0]],
30],
[['R1', 'LAW', 'PHYS'], ['R2', 'CS', 'ENG']]),
('normal control 8', [[['R1', 'LAW', 600, 660, 30], ['R1', 'PHYS', 600, 660, 45]], 30],
[['R1', 'LAW', 'PHYS']])]]
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: pair normalisation 1 | [['R1', 'B', 'A']] | [['R1', 'A', 'B']] | Failed |
| regression variant: pair normalisation 2 | [['R2', 'PHYS', 'GEO']] | [['R2', 'GEO', 'PHYS']] | Failed |
| partial repair guard 3 | [['R1', 'ART', 'LAW']] | [['R1', 'ART', 'LAW']] | Passed |
| boundary control 4 | [] | [] | Passed |
| normal control 5 | [['R1', 'ART', 'CS']] | [['R1', 'ART', 'CS']] | Passed |
| normal control 6 | [['R2', 'GEO', 'LAW']] | [['R2', 'GEO', 'LAW']] | Passed |
| normal control 7 | [['R2', 'GEO', 'MED']] | [['R2', 'GEO', 'MED']] | Passed |
| normal control 8 | [['R1', 'CS', 'MED'], ['R1', 'LAW', 'CS'], ['R1', 'LAW', 'MED']] | [['R1', 'CS', 'LAW'], ['R1', 'CS', 'MED'], ['R1', 'LAW', 'MED']] | Failed |
SHA-256 / a3a5c34d8489b00cd2efc827fb5b78e40ba40f36622fb24976b552684e334a31
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[1] and b[0] < a[1]:
out.append([r] + sorted([a[2], b[2]], reverse=True))
return sorted(out)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: pair normalisation 1', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15],
[['R1', 'A', 'B']]),
('regression variant: pair normalisation 2',
[[['R2', 'PHYS', 720, 780, 15], ['R2', 'GEO', 720, 810, 30], ['R2', 'CS', 540, 630, 30]], 15],
[['R2', 'GEO', 'PHYS']]),
('partial repair guard 3',
[[['R1', 'ART', 600, 660, 45], ['R1', 'GEO', 840, 930, 15], ['R2', 'MED', 840, 900, 30],
['R1', 'LAW', 600, 720, 0]],
15],
[['R1', 'ART', 'LAW']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('normal control 5',
[[['R2', 'PHYS', 840, 930, 45], ['R1', 'ART', 780, 870, 15], ['R1', 'CS', 840, 960, 0]], 15],
[['R1', 'ART', 'CS']]),
('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',
[[['R1', 'ENG', 660, 720, 15], ['R2', 'GEO', 720, 780, 15], ['R2', 'MED', 780, 870, 45]], 15],
[['R2', 'GEO', 'MED']]),
('normal control 8',
[[['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']])],
[('regression: pair normalisation 1', [[['R1', 'B', 540, 600, 45], ['R1', 'A', 610, 700, 0]], 15],
[['R1', 'A', 'B']]),
('regression variant: pair normalisation 2',
[[['R2', 'PHYS', 540, 630, 0], ['R1', 'CS', 600, 720, 45], ['R2', 'ENG', 600, 720, 0]], 30],
[['R2', 'ENG', 'PHYS']]),
('partial repair guard 3',
[[['R2', 'GEO', 720, 780, 45], ['R1', 'MED', 660, 720, 30], ['R2', 'CS', 780, 840, 15],
['R2', 'LAW', 780, 900, 30]],
10],
[['R2', 'CS', 'GEO'], ['R2', 'CS', 'LAW'], ['R2', 'GEO', 'LAW']]),
('boundary control 4', [[['R1', 'A', 540, 600, 30], ['R1', 'B', 645, 700, 30]], 15], []),
('normal control 5', [[['R2', 'PHYS', 720, 780, 30], ['R2', 'GEO', 600, 690, 0]], 30],
[['R2', 'GEO', 'PHYS']]),
('normal control 6',
[[['R2', 'GEO', 540, 630, 0], ['R1', 'ART', 660, 780, 45], ['R2', 'PHYS', 840, 900, 0],
['R1', 'ENG', 720, 780, 0]],
30],
[['R1', 'ART', 'ENG']]),
('normal control 7',
[[['R2', 'CS', 540, 630, 45], ['R1', 'LAW', 600, 660, 45], ['R2', 'MED', 540, 600, 0],
['R2', 'ENG', 780, 900, 30]],
15],
[['R2', 'CS', 'MED']]),
('normal control 8',
[[['R2', 'GEO', 840, 900, 15], ['R1', 'MED', 780, 900, 30], ['R1', 'CS', 540, 630, 15],
['R2', 'ENG', 540, 600, 45], ['R2', 'ART', 840, 900, 15]],
30],
[['R2', 'ART', 'GEO']])],
[('regression: pair normalisation 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: pair normalisation 2',
[[['R2', 'ART', 540, 660, 0], ['R1', 'PHYS', 660, 720, 0], ['R1', 'ENG', 600, 720, 30],
['R2', 'GEO', 540, 600, 30]],
15],
[['R1', 'ENG', 'PHYS'], ['R2', 'ART', 'GEO']]),
('partial repair guard 3',
[[['R2', 'PHYS', 720, 780, 15], ['R2', 'GEO', 720, 810, 30], ['R2', 'CS', 540, 630, 30]], 15],
[['R2', 'GEO', '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',
[[['R2', 'LAW', 780, 900, 15], ['R2', 'CS', 540, 630, 15], ['R1', 'GEO', 840, 960, 45],
['R1', 'ART', 780, 840, 45]],
10],
[['R1', 'ART', 'GEO']]),
('normal control 7',
[[['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']]),
('normal control 8',
[[['R1', 'CS', 780, 900, 15], ['R2', 'ENG', 720, 780, 15], ['R2', 'GEO', 600, 660, 45],
['R2', 'MED', 600, 720, 15], ['R1', 'PHYS', 600, 690, 30]],
10],
[['R2', 'ENG', 'MED'], ['R2', 'GEO', 'MED']])],
[('regression: pair normalisation 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: pair normalisation 2',
[[['R2', 'GEO', 540, 600, 45], ['R2', 'ENG', 660, 780, 15], ['R1', 'PHYS', 780, 870, 0],
['R2', 'CS', 600, 660, 0], ['R1', 'ART', 660, 750, 30]],
30],
[['R2', 'CS', 'ENG'], ['R2', 'CS', 'GEO']]),
('partial repair guard 3',
[[['R1', 'GEO', 540, 600, 45], ['R1', 'MED', 540, 600, 45], ['R2', 'LAW', 780, 900, 45]], 30],
[['R1', 'GEO', 'MED']]),
('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', 'PHYS', 840, 930, 0], ['R2', 'ENG', 600, 720, 30], ['R2', 'CS', 600, 720, 15]], 15],
[['R2', 'CS', 'ENG']]),
('normal control 7',
[[['R2', 'GEO', 720, 840, 0], ['R1', 'LAW', 840, 930, 0], ['R2', 'PHYS', 540, 660, 0],
['R1', 'ART', 540, 630, 30]],
15],
[]),
('normal control 8',
[[['R2', 'CS', 840, 900, 30], ['R1', 'LAW', 840, 960, 30], ['R2', 'ART', 660, 780, 45]], 10], [])],
[('regression: pair normalisation 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: pair normalisation 2',
[[['R2', 'ART', 840, 900, 30], ['R1', 'ENG', 840, 900, 0], ['R2', 'PHYS', 840, 930, 0],
['R1', 'MED', 540, 630, 30], ['R2', 'LAW', 840, 900, 15]],
10],
[['R2', 'ART', 'LAW'], ['R2', 'ART', 'PHYS'], ['R2', 'LAW', 'PHYS']]),
('partial repair guard 3',
[[['R2', 'ART', 660, 720, 45], ['R2', 'PHYS', 720, 840, 30], ['R1', 'ENG', 840, 930, 0],
['R1', 'GEO', 780, 900, 0], ['R1', 'CS', 720, 780, 45]],
10],
[['R1', 'CS', 'GEO'], ['R1', 'ENG', 'GEO'], ['R2', 'ART', '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', [[['R2', 'MED', 540, 630, 0], ['R1', 'GEO', 660, 750, 45]], 15], []),
('normal control 7',
[[['R2', 'ENG', 720, 810, 15], ['R2', 'CS', 780, 900, 0], ['R2', 'GEO', 540, 630, 45],
['R1', 'PHYS', 600, 660, 30], ['R1', 'LAW', 600, 720, 0]],
30],
[['R1', 'LAW', 'PHYS'], ['R2', 'CS', 'ENG']]),
('normal control 8', [[['R1', 'LAW', 600, 660, 30], ['R1', 'PHYS', 600, 660, 45]], 30],
[['R1', 'LAW', 'PHYS']])]]
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: pair normalisation 1 | [['R1', 'B', 'A']] | [['R1', 'A', 'B']] | Failed |
| regression variant: pair normalisation 2 | [['R2', 'PHYS', 'GEO']] | [['R2', 'GEO', 'PHYS']] | Failed |
| partial repair guard 3 | [['R1', 'LAW', 'ART']] | [['R1', 'ART', 'LAW']] | Failed |
| boundary control 4 | [] | [] | Passed |
| normal control 5 | [['R1', 'CS', 'ART']] | [['R1', 'ART', 'CS']] | Failed |
| normal control 6 | [['R2', 'LAW', 'GEO']] | [['R2', 'GEO', 'LAW']] | Failed |
| normal control 7 | [['R2', 'MED', 'GEO']] | [['R2', 'GEO', 'MED']] | Failed |
| normal control 8 | [['R1', 'LAW', 'CS'], ['R1', 'MED', 'CS'], ['R1', 'MED', 'LAW']] | [['R1', 'CS', 'LAW'], ['R1', 'CS', 'MED'], ['R1', 'LAW', 'MED']] | Failed |
SHA-256 / 01bb8734cb40b3110e70d1a1b95f91bea979448fd2b2af8ece37b3e51b90749a
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: pair normalisation 1', [[['R1', 'B', 540, 700, 15], ['R1', 'A', 600, 620, 15]], 15],
[['R1', 'A', 'B']]),
('regression variant: pair normalisation 2',
[[['R2', 'PHYS', 720, 780, 15], ['R2', 'GEO', 720, 810, 30], ['R2', 'CS', 540, 630, 30]], 15],
[['R2', 'GEO', 'PHYS']]),
('partial repair guard 3',
[[['R1', 'ART', 600, 660, 45], ['R1', 'GEO', 840, 930, 15], ['R2', 'MED', 840, 900, 30],
['R1', 'LAW', 600, 720, 0]],
15],
[['R1', 'ART', 'LAW']]),
('boundary control 4', [[['R1', 'B', 540, 600, 15], ['R2', 'A', 540, 600, 15]], 15], []),
('normal control 5',
[[['R2', 'PHYS', 840, 930, 45], ['R1', 'ART', 780, 870, 15], ['R1', 'CS', 840, 960, 0]], 15],
[['R1', 'ART', 'CS']]),
('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',
[[['R1', 'ENG', 660, 720, 15], ['R2', 'GEO', 720, 780, 15], ['R2', 'MED', 780, 870, 45]], 15],
[['R2', 'GEO', 'MED']]),
('normal control 8',
[[['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']])],
[('regression: pair normalisation 1', [[['R1', 'B', 540, 600, 45], ['R1', 'A', 610, 700, 0]], 15],
[['R1', 'A', 'B']]),
('regression variant: pair normalisation 2',
[[['R2', 'PHYS', 540, 630, 0], ['R1', 'CS', 600, 720, 45], ['R2', 'ENG', 600, 720, 0]], 30],
[['R2', 'ENG', 'PHYS']]),
('partial repair guard 3',
[[['R2', 'GEO', 720, 780, 45], ['R1', 'MED', 660, 720, 30], ['R2', 'CS', 780, 840, 15],
['R2', 'LAW', 780, 900, 30]],
10],
[['R2', 'CS', 'GEO'], ['R2', 'CS', 'LAW'], ['R2', 'GEO', 'LAW']]),
('boundary control 4', [[['R1', 'A', 540, 600, 30], ['R1', 'B', 645, 700, 30]], 15], []),
('normal control 5', [[['R2', 'PHYS', 720, 780, 30], ['R2', 'GEO', 600, 690, 0]], 30],
[['R2', 'GEO', 'PHYS']]),
('normal control 6',
[[['R2', 'GEO', 540, 630, 0], ['R1', 'ART', 660, 780, 45], ['R2', 'PHYS', 840, 900, 0],
['R1', 'ENG', 720, 780, 0]],
30],
[['R1', 'ART', 'ENG']]),
('normal control 7',
[[['R2', 'CS', 540, 630, 45], ['R1', 'LAW', 600, 660, 45], ['R2', 'MED', 540, 600, 0],
['R2', 'ENG', 780, 900, 30]],
15],
[['R2', 'CS', 'MED']]),
('normal control 8',
[[['R2', 'GEO', 840, 900, 15], ['R1', 'MED', 780, 900, 30], ['R1', 'CS', 540, 630, 15],
['R2', 'ENG', 540, 600, 45], ['R2', 'ART', 840, 900, 15]],
30],
[['R2', 'ART', 'GEO']])],
[('regression: pair normalisation 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: pair normalisation 2',
[[['R2', 'ART', 540, 660, 0], ['R1', 'PHYS', 660, 720, 0], ['R1', 'ENG', 600, 720, 30],
['R2', 'GEO', 540, 600, 30]],
15],
[['R1', 'ENG', 'PHYS'], ['R2', 'ART', 'GEO']]),
('partial repair guard 3',
[[['R2', 'PHYS', 720, 780, 15], ['R2', 'GEO', 720, 810, 30], ['R2', 'CS', 540, 630, 30]], 15],
[['R2', 'GEO', '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',
[[['R2', 'LAW', 780, 900, 15], ['R2', 'CS', 540, 630, 15], ['R1', 'GEO', 840, 960, 45],
['R1', 'ART', 780, 840, 45]],
10],
[['R1', 'ART', 'GEO']]),
('normal control 7',
[[['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']]),
('normal control 8',
[[['R1', 'CS', 780, 900, 15], ['R2', 'ENG', 720, 780, 15], ['R2', 'GEO', 600, 660, 45],
['R2', 'MED', 600, 720, 15], ['R1', 'PHYS', 600, 690, 30]],
10],
[['R2', 'ENG', 'MED'], ['R2', 'GEO', 'MED']])],
[('regression: pair normalisation 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: pair normalisation 2',
[[['R2', 'GEO', 540, 600, 45], ['R2', 'ENG', 660, 780, 15], ['R1', 'PHYS', 780, 870, 0],
['R2', 'CS', 600, 660, 0], ['R1', 'ART', 660, 750, 30]],
30],
[['R2', 'CS', 'ENG'], ['R2', 'CS', 'GEO']]),
('partial repair guard 3',
[[['R1', 'GEO', 540, 600, 45], ['R1', 'MED', 540, 600, 45], ['R2', 'LAW', 780, 900, 45]], 30],
[['R1', 'GEO', 'MED']]),
('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', 'PHYS', 840, 930, 0], ['R2', 'ENG', 600, 720, 30], ['R2', 'CS', 600, 720, 15]], 15],
[['R2', 'CS', 'ENG']]),
('normal control 7',
[[['R2', 'GEO', 720, 840, 0], ['R1', 'LAW', 840, 930, 0], ['R2', 'PHYS', 540, 660, 0],
['R1', 'ART', 540, 630, 30]],
15],
[]),
('normal control 8',
[[['R2', 'CS', 840, 900, 30], ['R1', 'LAW', 840, 960, 30], ['R2', 'ART', 660, 780, 45]], 10], [])],
[('regression: pair normalisation 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: pair normalisation 2',
[[['R2', 'ART', 840, 900, 30], ['R1', 'ENG', 840, 900, 0], ['R2', 'PHYS', 840, 930, 0],
['R1', 'MED', 540, 630, 30], ['R2', 'LAW', 840, 900, 15]],
10],
[['R2', 'ART', 'LAW'], ['R2', 'ART', 'PHYS'], ['R2', 'LAW', 'PHYS']]),
('partial repair guard 3',
[[['R2', 'ART', 660, 720, 45], ['R2', 'PHYS', 720, 840, 30], ['R1', 'ENG', 840, 930, 0],
['R1', 'GEO', 780, 900, 0], ['R1', 'CS', 720, 780, 45]],
10],
[['R1', 'CS', 'GEO'], ['R1', 'ENG', 'GEO'], ['R2', 'ART', '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', [[['R2', 'MED', 540, 630, 0], ['R1', 'GEO', 660, 750, 45]], 15], []),
('normal control 7',
[[['R2', 'ENG', 720, 810, 15], ['R2', 'CS', 780, 900, 0], ['R2', 'GEO', 540, 630, 45],
['R1', 'PHYS', 600, 660, 30], ['R1', 'LAW', 600, 720, 0]],
30],
[['R1', 'LAW', 'PHYS'], ['R2', 'CS', 'ENG']]),
('normal control 8', [[['R1', 'LAW', 600, 660, 30], ['R1', 'PHYS', 600, 660, 45]], 30],
[['R1', 'LAW', 'PHYS']])]]
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: pair normalisation 1 | [['R1', 'A', 'B']] | [['R1', 'A', 'B']] | Passed |
| regression variant: pair normalisation 2 | [['R2', 'GEO', 'PHYS']] | [['R2', 'GEO', 'PHYS']] | Passed |
| partial repair guard 3 | [['R1', 'ART', 'LAW']] | [['R1', 'ART', 'LAW']] | Passed |
| boundary control 4 | [] | [] | Passed |
| normal control 5 | [['R1', 'ART', 'CS']] | [['R1', 'ART', 'CS']] | Passed |
| normal control 6 | [['R2', 'GEO', 'LAW']] | [['R2', 'GEO', 'LAW']] | Passed |
| normal control 7 | [['R2', 'GEO', 'MED']] | [['R2', 'GEO', 'MED']] | Passed |
| normal control 8 | [['R1', 'CS', 'LAW'], ['R1', 'CS', 'MED'], ['R1', 'LAW', 'MED']] | [['R1', 'CS', 'LAW'], ['R1', 'CS', 'MED'], ['R1', 'LAW', 'MED']] | Passed |
SHA-256 / 2e6615ce329b54ace6961a62ca3f079d58d0fdd40be080ce05f5bf8975863f1f
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.301730+00:00.
Case digest / 3c89635407f165e97fcf652b49e37ce5fcd9d443eb05bf31847241a3e80336d5