FA-94631 / Exam timetabling constraints / Open access
Setup buffer placed after the exam · case 01
A booking immediately after another exam passes although the room needs setup first.
ROOT CAUSE
Each booking's own setup buffer is appended after its end instead of before its start.
VERIFIED REPAIR
Occupy setup minutes before start and cleanup minutes after end.
Unsuccessful approach: Swapping the buffers applies the wrong length on each side.
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, e + setup + 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: buffer sides 1', [[['R1', 'A', 540, 600, 0], ['R1', 'B', 640, 700, 45]], 10],
[['R1', 'A', 'B']]),
('regression variant: buffer sides 2',
[[['R1', 'ART', 720, 840, 30], ['R2', 'PHYS', 540, 630, 0], ['R1', 'GEO', 840, 960, 45],
['R1', 'CS', 600, 690, 0], ['R1', 'LAW', 720, 810, 0]],
15],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW'], ['R1', 'GEO', 'LAW']]),
('partial repair guard 3',
[[['R2', 'GEO', 600, 660, 45], ['R1', 'CS', 840, 960, 45], ['R1', 'ENG', 660, 720, 15],
['R2', 'LAW', 660, 720, 45], ['R1', 'ART', 540, 630, 45]],
10],
[['R2', 'GEO', 'LAW']]),
('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', 'LAW', 720, 840, 15], ['R2', 'PHYS', 720, 810, 45], ['R1', 'ENG', 600, 720, 15]], 10],
[['R1', 'ENG', 'LAW']]),
('normal control 7',
[[['R1', 'MED', 720, 840, 45], ['R2', 'ART', 600, 720, 45], ['R2', 'PHYS', 660, 780, 30],
['R1', 'GEO', 780, 870, 30]],
15],
[['R1', 'GEO', 'MED'], ['R2', 'ART', 'PHYS']]),
('normal control 8',
[[['R1', 'GEO', 720, 840, 15], ['R1', 'LAW', 720, 810, 0], ['R2', 'MED', 540, 630, 0],
['R2', 'CS', 780, 900, 0]],
30],
[['R1', 'GEO', 'LAW']])],
[('regression: buffer sides 1',
[[['R1', 'ENG', 540, 660, 0], ['R2', 'GEO', 720, 810, 15], ['R1', 'ART', 780, 870, 30],
['R2', 'LAW', 840, 930, 0], ['R1', 'CS', 540, 600, 0]],
30],
[['R1', 'CS', 'ENG']]),
('regression variant: buffer sides 2',
[[['R2', 'ART', 660, 720, 45], ['R1', 'MED', 780, 870, 45], ['R1', 'GEO', 780, 840, 15],
['R1', 'LAW', 660, 750, 45], ['R2', 'CS', 720, 840, 30]],
15],
[['R1', 'GEO', 'MED'], ['R1', 'LAW', 'MED'], ['R2', 'ART', 'CS']]),
('partial repair guard 3',
[[['R1', 'LAW', 780, 840, 0], ['R1', 'ENG', 660, 750, 45], ['R2', 'MED', 600, 660, 30]], 10], []),
('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',
[[['R2', 'ART', 600, 690, 30], ['R2', 'PHYS', 600, 720, 15], ['R1', 'MED', 780, 840, 45],
['R1', 'CS', 540, 630, 0]],
10],
[['R2', 'ART', 'PHYS']]),
('normal control 7',
[[['R2', 'ENG', 720, 810, 45], ['R1', 'GEO', 540, 600, 45], ['R2', 'LAW', 660, 780, 15],
['R2', 'PHYS', 780, 840, 30]],
10],
[['R2', 'ENG', 'LAW'], ['R2', 'ENG', 'PHYS'], ['R2', 'LAW', 'PHYS']]),
('normal control 8',
[[['R2', 'ENG', 660, 780, 30], ['R2', 'MED', 540, 660, 45], ['R2', 'CS', 840, 960, 0],
['R1', 'LAW', 540, 600, 30]],
10],
[['R2', 'ENG', 'MED']])],
[('regression: buffer sides 1',
[[['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']]),
('regression variant: buffer sides 2',
[[['R2', 'ENG', 720, 810, 45], ['R2', 'MED', 540, 630, 0], ['R2', 'GEO', 540, 660, 0],
['R2', 'LAW', 840, 960, 45]],
30],
[['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'LAW'], ['R2', 'GEO', 'MED']]),
('partial repair guard 3',
[[['R2', 'LAW', 600, 660, 15], ['R1', 'PHYS', 720, 810, 30], ['R2', 'MED', 720, 810, 15],
['R2', 'GEO', 840, 960, 30], ['R2', 'ART', 780, 900, 45]],
15],
[['R2', 'ART', 'GEO'], ['R2', 'ART', 'MED'], ['R2', 'GEO', 'MED']]),
('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', 'PHYS', 780, 900, 30], ['R1', 'MED', 840, 900, 45], ['R1', 'ART', 780, 840, 15],
['R1', 'ENG', 540, 660, 15], ['R1', 'CS', 660, 780, 30]],
10],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'MED'], ['R1', 'CS', 'ENG']]),
('normal control 7',
[[['R2', 'CS', 600, 720, 15], ['R2', 'MED', 540, 630, 30], ['R2', 'ENG', 780, 840, 30],
['R1', 'LAW', 720, 810, 15], ['R2', 'GEO', 720, 780, 15]],
10],
[['R2', 'CS', 'GEO'], ['R2', 'CS', 'MED'], ['R2', 'ENG', 'GEO']]),
('normal control 8',
[[['R1', 'ENG', 540, 660, 45], ['R2', 'ART', 780, 900, 0], ['R1', 'PHYS', 600, 660, 45],
['R2', 'LAW', 720, 810, 45], ['R2', 'CS', 840, 930, 45]],
30],
[['R1', 'ENG', 'PHYS'], ['R2', 'ART', 'CS'], ['R2', 'ART', 'LAW'], ['R2', 'CS', 'LAW']])],
[('regression: buffer sides 1',
[[['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']]),
('regression variant: buffer sides 2',
[[['R1', 'GEO', 840, 900, 15], ['R1', 'ART', 720, 840, 0], ['R2', 'ENG', 720, 810, 15],
['R1', 'PHYS', 540, 600, 45], ['R1', 'LAW', 660, 780, 15]],
30],
[['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW']]),
('partial repair guard 3',
[[['R2', 'LAW', 720, 810, 15], ['R2', 'MED', 660, 750, 0], ['R2', 'ART', 660, 720, 15],
['R1', 'PHYS', 780, 900, 0], ['R2', 'GEO', 840, 900, 45]],
15],
[['R2', 'ART', 'LAW'], ['R2', 'ART', 'MED'], ['R2', 'GEO', 'LAW'], ['R2', 'LAW', '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', 'MED', 600, 690, 0], ['R2', 'ENG', 660, 720, 30], ['R1', 'PHYS', 780, 870, 0],
['R2', 'LAW', 540, 600, 0]],
15],
[]),
('normal control 7', [[['R2', 'PHYS', 660, 780, 30], ['R2', 'LAW', 600, 690, 30]], 30],
[['R2', 'LAW', 'PHYS']]),
('normal control 8',
[[['R1', 'LAW', 780, 840, 45], ['R2', 'CS', 600, 720, 30], ['R2', 'MED', 660, 720, 0]], 10],
[['R2', 'CS', 'MED']])],
[('regression: buffer sides 1',
[[['R1', 'CS', 660, 750, 15], ['R1', 'LAW', 780, 870, 15], ['R1', 'GEO', 660, 720, 15],
['R1', 'PHYS', 600, 720, 30], ['R1', 'ART', 780, 840, 45]],
10],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'LAW'], ['R1', 'CS', 'GEO'], ['R1', 'CS', 'PHYS'],
['R1', 'GEO', 'PHYS']]),
('regression variant: buffer sides 2',
[[['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']]),
('partial repair guard 3',
[[['R2', 'ART', 720, 810, 30], ['R2', 'MED', 840, 930, 45], ['R2', 'PHYS', 840, 930, 0],
['R1', 'CS', 540, 660, 0]],
10],
[['R2', 'ART', 'MED'], ['R2', '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', 840, 960, 45], ['R1', 'PHYS', 720, 810, 15], ['R2', 'ENG', 660, 780, 15],
['R1', 'MED', 840, 930, 30], ['R2', 'CS', 780, 870, 30]],
10],
[['R1', 'GEO', 'MED'], ['R1', 'GEO', 'PHYS'], ['R1', 'MED', 'PHYS'], ['R2', 'CS', 'ENG']]),
('normal control 7',
[[['R2', 'LAW', 660, 720, 15], ['R2', 'ENG', 840, 960, 15], ['R2', 'PHYS', 780, 870, 15],
['R1', 'MED', 600, 690, 30], ['R2', 'CS', 600, 690, 45]],
30],
[['R2', 'CS', 'LAW'], ['R2', 'ENG', 'PHYS']]),
('normal control 8',
[[['R2', 'ENG', 540, 660, 15], ['R1', 'PHYS', 780, 900, 30], ['R2', 'ART', 660, 720, 45],
['R1', 'CS', 540, 630, 15]],
30],
[['R2', 'ART', 'ENG']])]]
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: buffer sides 1 | [] | [['R1', 'A', 'B']] | Failed |
| regression variant: buffer sides 2 | [['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW']] | [['R1', 'ART', 'CS'], ['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW'], ['R1', 'GEO', 'LAW']] | Failed |
| partial repair guard 3 | [['R1', 'ART', 'ENG'], ['R2', 'GEO', 'LAW']] | [['R2', 'GEO', 'LAW']] | Failed |
| boundary control 4 | [] | [] | Passed |
| boundary control 5 | [['R1', 'A', 'B']] | [['R1', 'A', 'B']] | Passed |
| normal control 6 | [['R1', 'ENG', 'LAW']] | [['R1', 'ENG', 'LAW']] | Passed |
| normal control 7 | [['R1', 'GEO', 'MED'], ['R2', 'ART', 'PHYS']] | [['R1', 'GEO', 'MED'], ['R2', 'ART', 'PHYS']] | Passed |
| normal control 8 | [['R1', 'GEO', 'LAW']] | [['R1', 'GEO', 'LAW']] | Passed |
SHA-256 / 4905aaafc12685ca1e6b598285539628546dba517b669b257bf3e1813e16edcf
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 - cleanup, e + setup, 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: buffer sides 1', [[['R1', 'A', 540, 600, 0], ['R1', 'B', 640, 700, 45]], 10],
[['R1', 'A', 'B']]),
('regression variant: buffer sides 2',
[[['R1', 'ART', 720, 840, 30], ['R2', 'PHYS', 540, 630, 0], ['R1', 'GEO', 840, 960, 45],
['R1', 'CS', 600, 690, 0], ['R1', 'LAW', 720, 810, 0]],
15],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW'], ['R1', 'GEO', 'LAW']]),
('partial repair guard 3',
[[['R2', 'GEO', 600, 660, 45], ['R1', 'CS', 840, 960, 45], ['R1', 'ENG', 660, 720, 15],
['R2', 'LAW', 660, 720, 45], ['R1', 'ART', 540, 630, 45]],
10],
[['R2', 'GEO', 'LAW']]),
('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', 'LAW', 720, 840, 15], ['R2', 'PHYS', 720, 810, 45], ['R1', 'ENG', 600, 720, 15]], 10],
[['R1', 'ENG', 'LAW']]),
('normal control 7',
[[['R1', 'MED', 720, 840, 45], ['R2', 'ART', 600, 720, 45], ['R2', 'PHYS', 660, 780, 30],
['R1', 'GEO', 780, 870, 30]],
15],
[['R1', 'GEO', 'MED'], ['R2', 'ART', 'PHYS']]),
('normal control 8',
[[['R1', 'GEO', 720, 840, 15], ['R1', 'LAW', 720, 810, 0], ['R2', 'MED', 540, 630, 0],
['R2', 'CS', 780, 900, 0]],
30],
[['R1', 'GEO', 'LAW']])],
[('regression: buffer sides 1',
[[['R1', 'ENG', 540, 660, 0], ['R2', 'GEO', 720, 810, 15], ['R1', 'ART', 780, 870, 30],
['R2', 'LAW', 840, 930, 0], ['R1', 'CS', 540, 600, 0]],
30],
[['R1', 'CS', 'ENG']]),
('regression variant: buffer sides 2',
[[['R2', 'ART', 660, 720, 45], ['R1', 'MED', 780, 870, 45], ['R1', 'GEO', 780, 840, 15],
['R1', 'LAW', 660, 750, 45], ['R2', 'CS', 720, 840, 30]],
15],
[['R1', 'GEO', 'MED'], ['R1', 'LAW', 'MED'], ['R2', 'ART', 'CS']]),
('partial repair guard 3',
[[['R1', 'LAW', 780, 840, 0], ['R1', 'ENG', 660, 750, 45], ['R2', 'MED', 600, 660, 30]], 10], []),
('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',
[[['R2', 'ART', 600, 690, 30], ['R2', 'PHYS', 600, 720, 15], ['R1', 'MED', 780, 840, 45],
['R1', 'CS', 540, 630, 0]],
10],
[['R2', 'ART', 'PHYS']]),
('normal control 7',
[[['R2', 'ENG', 720, 810, 45], ['R1', 'GEO', 540, 600, 45], ['R2', 'LAW', 660, 780, 15],
['R2', 'PHYS', 780, 840, 30]],
10],
[['R2', 'ENG', 'LAW'], ['R2', 'ENG', 'PHYS'], ['R2', 'LAW', 'PHYS']]),
('normal control 8',
[[['R2', 'ENG', 660, 780, 30], ['R2', 'MED', 540, 660, 45], ['R2', 'CS', 840, 960, 0],
['R1', 'LAW', 540, 600, 30]],
10],
[['R2', 'ENG', 'MED']])],
[('regression: buffer sides 1',
[[['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']]),
('regression variant: buffer sides 2',
[[['R2', 'ENG', 720, 810, 45], ['R2', 'MED', 540, 630, 0], ['R2', 'GEO', 540, 660, 0],
['R2', 'LAW', 840, 960, 45]],
30],
[['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'LAW'], ['R2', 'GEO', 'MED']]),
('partial repair guard 3',
[[['R2', 'LAW', 600, 660, 15], ['R1', 'PHYS', 720, 810, 30], ['R2', 'MED', 720, 810, 15],
['R2', 'GEO', 840, 960, 30], ['R2', 'ART', 780, 900, 45]],
15],
[['R2', 'ART', 'GEO'], ['R2', 'ART', 'MED'], ['R2', 'GEO', 'MED']]),
('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', 'PHYS', 780, 900, 30], ['R1', 'MED', 840, 900, 45], ['R1', 'ART', 780, 840, 15],
['R1', 'ENG', 540, 660, 15], ['R1', 'CS', 660, 780, 30]],
10],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'MED'], ['R1', 'CS', 'ENG']]),
('normal control 7',
[[['R2', 'CS', 600, 720, 15], ['R2', 'MED', 540, 630, 30], ['R2', 'ENG', 780, 840, 30],
['R1', 'LAW', 720, 810, 15], ['R2', 'GEO', 720, 780, 15]],
10],
[['R2', 'CS', 'GEO'], ['R2', 'CS', 'MED'], ['R2', 'ENG', 'GEO']]),
('normal control 8',
[[['R1', 'ENG', 540, 660, 45], ['R2', 'ART', 780, 900, 0], ['R1', 'PHYS', 600, 660, 45],
['R2', 'LAW', 720, 810, 45], ['R2', 'CS', 840, 930, 45]],
30],
[['R1', 'ENG', 'PHYS'], ['R2', 'ART', 'CS'], ['R2', 'ART', 'LAW'], ['R2', 'CS', 'LAW']])],
[('regression: buffer sides 1',
[[['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']]),
('regression variant: buffer sides 2',
[[['R1', 'GEO', 840, 900, 15], ['R1', 'ART', 720, 840, 0], ['R2', 'ENG', 720, 810, 15],
['R1', 'PHYS', 540, 600, 45], ['R1', 'LAW', 660, 780, 15]],
30],
[['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW']]),
('partial repair guard 3',
[[['R2', 'LAW', 720, 810, 15], ['R2', 'MED', 660, 750, 0], ['R2', 'ART', 660, 720, 15],
['R1', 'PHYS', 780, 900, 0], ['R2', 'GEO', 840, 900, 45]],
15],
[['R2', 'ART', 'LAW'], ['R2', 'ART', 'MED'], ['R2', 'GEO', 'LAW'], ['R2', 'LAW', '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', 'MED', 600, 690, 0], ['R2', 'ENG', 660, 720, 30], ['R1', 'PHYS', 780, 870, 0],
['R2', 'LAW', 540, 600, 0]],
15],
[]),
('normal control 7', [[['R2', 'PHYS', 660, 780, 30], ['R2', 'LAW', 600, 690, 30]], 30],
[['R2', 'LAW', 'PHYS']]),
('normal control 8',
[[['R1', 'LAW', 780, 840, 45], ['R2', 'CS', 600, 720, 30], ['R2', 'MED', 660, 720, 0]], 10],
[['R2', 'CS', 'MED']])],
[('regression: buffer sides 1',
[[['R1', 'CS', 660, 750, 15], ['R1', 'LAW', 780, 870, 15], ['R1', 'GEO', 660, 720, 15],
['R1', 'PHYS', 600, 720, 30], ['R1', 'ART', 780, 840, 45]],
10],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'LAW'], ['R1', 'CS', 'GEO'], ['R1', 'CS', 'PHYS'],
['R1', 'GEO', 'PHYS']]),
('regression variant: buffer sides 2',
[[['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']]),
('partial repair guard 3',
[[['R2', 'ART', 720, 810, 30], ['R2', 'MED', 840, 930, 45], ['R2', 'PHYS', 840, 930, 0],
['R1', 'CS', 540, 660, 0]],
10],
[['R2', 'ART', 'MED'], ['R2', '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', 840, 960, 45], ['R1', 'PHYS', 720, 810, 15], ['R2', 'ENG', 660, 780, 15],
['R1', 'MED', 840, 930, 30], ['R2', 'CS', 780, 870, 30]],
10],
[['R1', 'GEO', 'MED'], ['R1', 'GEO', 'PHYS'], ['R1', 'MED', 'PHYS'], ['R2', 'CS', 'ENG']]),
('normal control 7',
[[['R2', 'LAW', 660, 720, 15], ['R2', 'ENG', 840, 960, 15], ['R2', 'PHYS', 780, 870, 15],
['R1', 'MED', 600, 690, 30], ['R2', 'CS', 600, 690, 45]],
30],
[['R2', 'CS', 'LAW'], ['R2', 'ENG', 'PHYS']]),
('normal control 8',
[[['R2', 'ENG', 540, 660, 15], ['R1', 'PHYS', 780, 900, 30], ['R2', 'ART', 660, 720, 45],
['R1', 'CS', 540, 630, 15]],
30],
[['R2', 'ART', 'ENG']])]]
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: buffer sides 1 | [] | [['R1', 'A', 'B']] | Failed |
| regression variant: buffer sides 2 | [['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW']] | [['R1', 'ART', 'CS'], ['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW'], ['R1', 'GEO', 'LAW']] | Failed |
| partial repair guard 3 | [['R1', 'ART', 'ENG'], ['R2', 'GEO', 'LAW']] | [['R2', 'GEO', 'LAW']] | Failed |
| boundary control 4 | [] | [] | Passed |
| boundary control 5 | [['R1', 'A', 'B']] | [['R1', 'A', 'B']] | Passed |
| normal control 6 | [['R1', 'ENG', 'LAW']] | [['R1', 'ENG', 'LAW']] | Passed |
| normal control 7 | [['R1', 'GEO', 'MED'], ['R2', 'ART', 'PHYS']] | [['R1', 'GEO', 'MED'], ['R2', 'ART', 'PHYS']] | Passed |
| normal control 8 | [['R1', 'GEO', 'LAW']] | [['R1', 'GEO', 'LAW']] | Passed |
SHA-256 / 5a082170d253f7292c45f729c6bdf957302f1459296b0e6dd99d4f20530b4358
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: buffer sides 1', [[['R1', 'A', 540, 600, 0], ['R1', 'B', 640, 700, 45]], 10],
[['R1', 'A', 'B']]),
('regression variant: buffer sides 2',
[[['R1', 'ART', 720, 840, 30], ['R2', 'PHYS', 540, 630, 0], ['R1', 'GEO', 840, 960, 45],
['R1', 'CS', 600, 690, 0], ['R1', 'LAW', 720, 810, 0]],
15],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW'], ['R1', 'GEO', 'LAW']]),
('partial repair guard 3',
[[['R2', 'GEO', 600, 660, 45], ['R1', 'CS', 840, 960, 45], ['R1', 'ENG', 660, 720, 15],
['R2', 'LAW', 660, 720, 45], ['R1', 'ART', 540, 630, 45]],
10],
[['R2', 'GEO', 'LAW']]),
('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', 'LAW', 720, 840, 15], ['R2', 'PHYS', 720, 810, 45], ['R1', 'ENG', 600, 720, 15]], 10],
[['R1', 'ENG', 'LAW']]),
('normal control 7',
[[['R1', 'MED', 720, 840, 45], ['R2', 'ART', 600, 720, 45], ['R2', 'PHYS', 660, 780, 30],
['R1', 'GEO', 780, 870, 30]],
15],
[['R1', 'GEO', 'MED'], ['R2', 'ART', 'PHYS']]),
('normal control 8',
[[['R1', 'GEO', 720, 840, 15], ['R1', 'LAW', 720, 810, 0], ['R2', 'MED', 540, 630, 0],
['R2', 'CS', 780, 900, 0]],
30],
[['R1', 'GEO', 'LAW']])],
[('regression: buffer sides 1',
[[['R1', 'ENG', 540, 660, 0], ['R2', 'GEO', 720, 810, 15], ['R1', 'ART', 780, 870, 30],
['R2', 'LAW', 840, 930, 0], ['R1', 'CS', 540, 600, 0]],
30],
[['R1', 'CS', 'ENG']]),
('regression variant: buffer sides 2',
[[['R2', 'ART', 660, 720, 45], ['R1', 'MED', 780, 870, 45], ['R1', 'GEO', 780, 840, 15],
['R1', 'LAW', 660, 750, 45], ['R2', 'CS', 720, 840, 30]],
15],
[['R1', 'GEO', 'MED'], ['R1', 'LAW', 'MED'], ['R2', 'ART', 'CS']]),
('partial repair guard 3',
[[['R1', 'LAW', 780, 840, 0], ['R1', 'ENG', 660, 750, 45], ['R2', 'MED', 600, 660, 30]], 10], []),
('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',
[[['R2', 'ART', 600, 690, 30], ['R2', 'PHYS', 600, 720, 15], ['R1', 'MED', 780, 840, 45],
['R1', 'CS', 540, 630, 0]],
10],
[['R2', 'ART', 'PHYS']]),
('normal control 7',
[[['R2', 'ENG', 720, 810, 45], ['R1', 'GEO', 540, 600, 45], ['R2', 'LAW', 660, 780, 15],
['R2', 'PHYS', 780, 840, 30]],
10],
[['R2', 'ENG', 'LAW'], ['R2', 'ENG', 'PHYS'], ['R2', 'LAW', 'PHYS']]),
('normal control 8',
[[['R2', 'ENG', 660, 780, 30], ['R2', 'MED', 540, 660, 45], ['R2', 'CS', 840, 960, 0],
['R1', 'LAW', 540, 600, 30]],
10],
[['R2', 'ENG', 'MED']])],
[('regression: buffer sides 1',
[[['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']]),
('regression variant: buffer sides 2',
[[['R2', 'ENG', 720, 810, 45], ['R2', 'MED', 540, 630, 0], ['R2', 'GEO', 540, 660, 0],
['R2', 'LAW', 840, 960, 45]],
30],
[['R2', 'ENG', 'GEO'], ['R2', 'ENG', 'LAW'], ['R2', 'GEO', 'MED']]),
('partial repair guard 3',
[[['R2', 'LAW', 600, 660, 15], ['R1', 'PHYS', 720, 810, 30], ['R2', 'MED', 720, 810, 15],
['R2', 'GEO', 840, 960, 30], ['R2', 'ART', 780, 900, 45]],
15],
[['R2', 'ART', 'GEO'], ['R2', 'ART', 'MED'], ['R2', 'GEO', 'MED']]),
('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', 'PHYS', 780, 900, 30], ['R1', 'MED', 840, 900, 45], ['R1', 'ART', 780, 840, 15],
['R1', 'ENG', 540, 660, 15], ['R1', 'CS', 660, 780, 30]],
10],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'MED'], ['R1', 'CS', 'ENG']]),
('normal control 7',
[[['R2', 'CS', 600, 720, 15], ['R2', 'MED', 540, 630, 30], ['R2', 'ENG', 780, 840, 30],
['R1', 'LAW', 720, 810, 15], ['R2', 'GEO', 720, 780, 15]],
10],
[['R2', 'CS', 'GEO'], ['R2', 'CS', 'MED'], ['R2', 'ENG', 'GEO']]),
('normal control 8',
[[['R1', 'ENG', 540, 660, 45], ['R2', 'ART', 780, 900, 0], ['R1', 'PHYS', 600, 660, 45],
['R2', 'LAW', 720, 810, 45], ['R2', 'CS', 840, 930, 45]],
30],
[['R1', 'ENG', 'PHYS'], ['R2', 'ART', 'CS'], ['R2', 'ART', 'LAW'], ['R2', 'CS', 'LAW']])],
[('regression: buffer sides 1',
[[['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']]),
('regression variant: buffer sides 2',
[[['R1', 'GEO', 840, 900, 15], ['R1', 'ART', 720, 840, 0], ['R2', 'ENG', 720, 810, 15],
['R1', 'PHYS', 540, 600, 45], ['R1', 'LAW', 660, 780, 15]],
30],
[['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW']]),
('partial repair guard 3',
[[['R2', 'LAW', 720, 810, 15], ['R2', 'MED', 660, 750, 0], ['R2', 'ART', 660, 720, 15],
['R1', 'PHYS', 780, 900, 0], ['R2', 'GEO', 840, 900, 45]],
15],
[['R2', 'ART', 'LAW'], ['R2', 'ART', 'MED'], ['R2', 'GEO', 'LAW'], ['R2', 'LAW', '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', 'MED', 600, 690, 0], ['R2', 'ENG', 660, 720, 30], ['R1', 'PHYS', 780, 870, 0],
['R2', 'LAW', 540, 600, 0]],
15],
[]),
('normal control 7', [[['R2', 'PHYS', 660, 780, 30], ['R2', 'LAW', 600, 690, 30]], 30],
[['R2', 'LAW', 'PHYS']]),
('normal control 8',
[[['R1', 'LAW', 780, 840, 45], ['R2', 'CS', 600, 720, 30], ['R2', 'MED', 660, 720, 0]], 10],
[['R2', 'CS', 'MED']])],
[('regression: buffer sides 1',
[[['R1', 'CS', 660, 750, 15], ['R1', 'LAW', 780, 870, 15], ['R1', 'GEO', 660, 720, 15],
['R1', 'PHYS', 600, 720, 30], ['R1', 'ART', 780, 840, 45]],
10],
[['R1', 'ART', 'CS'], ['R1', 'ART', 'LAW'], ['R1', 'CS', 'GEO'], ['R1', 'CS', 'PHYS'],
['R1', 'GEO', 'PHYS']]),
('regression variant: buffer sides 2',
[[['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']]),
('partial repair guard 3',
[[['R2', 'ART', 720, 810, 30], ['R2', 'MED', 840, 930, 45], ['R2', 'PHYS', 840, 930, 0],
['R1', 'CS', 540, 660, 0]],
10],
[['R2', 'ART', 'MED'], ['R2', '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', 840, 960, 45], ['R1', 'PHYS', 720, 810, 15], ['R2', 'ENG', 660, 780, 15],
['R1', 'MED', 840, 930, 30], ['R2', 'CS', 780, 870, 30]],
10],
[['R1', 'GEO', 'MED'], ['R1', 'GEO', 'PHYS'], ['R1', 'MED', 'PHYS'], ['R2', 'CS', 'ENG']]),
('normal control 7',
[[['R2', 'LAW', 660, 720, 15], ['R2', 'ENG', 840, 960, 15], ['R2', 'PHYS', 780, 870, 15],
['R1', 'MED', 600, 690, 30], ['R2', 'CS', 600, 690, 45]],
30],
[['R2', 'CS', 'LAW'], ['R2', 'ENG', 'PHYS']]),
('normal control 8',
[[['R2', 'ENG', 540, 660, 15], ['R1', 'PHYS', 780, 900, 30], ['R2', 'ART', 660, 720, 45],
['R1', 'CS', 540, 630, 15]],
30],
[['R2', 'ART', 'ENG']])]]
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: buffer sides 1 | [['R1', 'A', 'B']] | [['R1', 'A', 'B']] | Passed |
| regression variant: buffer sides 2 | [['R1', 'ART', 'CS'], ['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW'], ['R1', 'GEO', 'LAW']] | [['R1', 'ART', 'CS'], ['R1', 'ART', 'GEO'], ['R1', 'ART', 'LAW'], ['R1', 'GEO', 'LAW']] | Passed |
| partial repair guard 3 | [['R2', 'GEO', 'LAW']] | [['R2', 'GEO', 'LAW']] | Passed |
| boundary control 4 | [] | [] | Passed |
| boundary control 5 | [['R1', 'A', 'B']] | [['R1', 'A', 'B']] | Passed |
| normal control 6 | [['R1', 'ENG', 'LAW']] | [['R1', 'ENG', 'LAW']] | Passed |
| normal control 7 | [['R1', 'GEO', 'MED'], ['R2', 'ART', 'PHYS']] | [['R1', 'GEO', 'MED'], ['R2', 'ART', 'PHYS']] | Passed |
| normal control 8 | [['R1', 'GEO', 'LAW']] | [['R1', 'GEO', 'LAW']] | Passed |
SHA-256 / 68a5b1f4df8d1ad034971077cbe89220932f8bf17df76b9c5ee1c9e09bd70e31
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.167184+00:00.
Case digest / 4bacc6b9d81ea00ea0e0561dcc191cc1245b9ae745804e44641f2c10fdd84033