FA-94696 / Exam timetabling constraints / Open access
Online exam candidates consume hall seats · case 01
Periods with online exams appear over capacity.
ROOT CAUSE
Online sittings are not excluded from seat counts.
VERIFIED REPAIR
Skip online exams when counting seats.
Unsuccessful approach: Defaulting unknown modes to online drops paper exams missing from the mode table.
Case contract
sits [student, exam, period, access]; cap period -> seats (missing = 0); mode exam -> paper/online (missing = paper). Each distinct (student, exam) uses one seat, two with an access arrangement, and none for online exams. Return [period, used, capacity] for periods over capacity, by period.
Why this case matters
Seat capacity per period is a hard constraint on which periods can take large exams.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sits, cap, mode):
seen = set()
used = {}
for st, ex, p, acc in sits:
if (st, ex) in seen:
continue
seen.add((st, ex))
used[p] = used.get(p, 0) + (2 if acc else 1)
return [[p, used[p], cap.get(p, 0)] for p in sorted(used) if used[p] > cap.get(p, 0)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: online seats 1', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}],
[]),
('regression variant: online seats 2',
[[['s1', 'MATH101', 1, True], ['s1', 'CHEM120', 0, False], ['s5', 'PHYS110', 0, False],
['s5', 'CHEM120', 0, False], ['s3', 'PHYS110', 1, False], ['s3', 'MATH101H', 0, False],
['s1', 'CHEM120', 1, False], ['s1', 'CHEM120', 0, False], ['s3', 'CHEM120', 2, False],
['s3', 'PHYS110', 2, False], ['s3', 'PHYS110', 1, False]],
{0: 3, 1: 2, 2: 4}, {'MATH101': 'online', 'MATH101H': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[]),
('partial repair guard 3',
[[['s3', 'MATH101', 0, False], ['s3', 'BIO130', 2, False], ['s2', 'MATH101H', 0, False],
['s2', 'MATH101H', 2, False], ['s3', 'BIO130', 2, False]],
{0: 1, 1: 2, 2: 3}, {'MATH101': 'paper', 'PHYS110': 'paper', 'BIO130': 'online'}],
[[0, 2, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s1', 'BIO130', 1, False], ['s2', 'PHYS110', 1, False]], {0: 1, 1: 1, 2: 2},
{'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[1, 2, 1]]),
('normal control 7',
[[['s2', 'PHYS110', 0, False], ['s5', 'PHYS110', 2, False], ['s5', 'BIO130', 2, True],
['s1', 'MATH101H', 1, False], ['s5', 'BIO130', 2, True]],
{0: 4, 1: 3, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 8',
[[['s3', 'BIO130', 1, False], ['s5', 'PHYS110', 2, False], ['s3', 'MATH101H', 1, False],
['s3', 'MATH101H', 0, False], ['s4', 'MATH101H', 1, True], ['s1', 'CHEM120', 2, False],
['s3', 'MATH101H', 1, False], ['s1', 'BIO130', 1, False]],
{0: 3, 1: 4, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online'}],
[[1, 5, 4]])],
[('regression: online seats 1',
[[['s4', 'MATH101H', 0, False], ['s5', 'CHEM120', 1, False], ['s5', 'MATH101H', 1, False],
['s5', 'MATH101H', 2, False], ['s4', 'MATH101H', 2, False], ['s2', 'CHEM120', 1, False],
['s3', 'MATH101', 0, False], ['s2', 'MATH101', 2, False], ['s2', 'BIO130', 1, False],
['s2', 'MATH101H', 0, False]],
{0: 3, 1: 1, 2: 3},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[[1, 3, 1]]),
('regression variant: online seats 2',
[[['s1', 'PHYS110', 2, False], ['s4', 'MATH101H', 0, False], ['s1', 'MATH101H', 2, False],
['s5', 'MATH101', 1, True], ['s5', 'PHYS110', 2, False], ['s3', 'BIO130', 2, True],
['s4', 'MATH101H', 2, False]],
{1: 2, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'online'}],
[[2, 4, 1]]),
('partial repair guard 3',
[[['s2', 'MATH101H', 2, True], ['s4', 'MATH101', 0, False], ['s3', 'CHEM120', 0, True],
['s1', 'MATH101', 2, False], ['s2', 'PHYS110', 1, True], ['s4', 'BIO130', 0, True],
['s3', 'CHEM120', 2, False], ['s4', 'BIO130', 0, True]],
{0: 2, 1: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'CHEM120': 'paper'}],
[[0, 5, 2], [2, 1, 0]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 5', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 6',
[[['s1', 'PHYS110', 2, False], ['s4', 'MATH101', 1, False], ['s4', 'MATH101', 1, False]], {1: 1, 2: 3},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s5', 'BIO130', 0, False], ['s5', 'PHYS110', 1, False], ['s1', 'PHYS110', 0, False],
['s5', 'MATH101', 1, False], ['s3', 'MATH101', 2, False]],
{0: 4, 1: 4, 2: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[]),
('normal control 8',
[[['s2', 'PHYS110', 1, False], ['s4', 'MATH101', 2, False], ['s5', 'MATH101', 0, True],
['s4', 'MATH101', 0, True], ['s1', 'MATH101', 2, True], ['s2', 'MATH101', 0, False],
['s2', 'BIO130', 2, True], ['s4', 'BIO130', 2, False], ['s2', 'MATH101H', 2, False],
['s3', 'BIO130', 1, False]],
{0: 1, 1: 2, 2: 1}, {'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 3, 1], [2, 7, 1]])],
[('regression: online seats 1',
[[['s3', 'MATH101H', 2, False], ['s3', 'MATH101H', 0, False], ['s5', 'PHYS110', 0, False],
['s2', 'MATH101H', 0, False], ['s4', 'MATH101H', 0, False], ['s3', 'PHYS110', 1, False],
['s2', 'MATH101', 1, False], ['s5', 'PHYS110', 0, False], ['s4', 'CHEM120', 0, False],
['s3', 'MATH101H', 1, True]],
{0: 1, 2: 1},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 2, 1], [1, 1, 0]]),
('regression variant: online seats 2',
[[['s4', 'PHYS110', 1, False], ['s1', 'MATH101H', 1, True], ['s3', 'BIO130', 1, False],
['s1', 'MATH101H', 1, False], ['s4', 'MATH101H', 1, False], ['s1', 'MATH101H', 1, True]],
{0: 2, 1: 2, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[]),
('partial repair guard 3',
[[['s1', 'PHYS110', 2, False], ['s4', 'MATH101H', 0, False], ['s1', 'MATH101H', 2, False],
['s5', 'MATH101', 1, True], ['s5', 'PHYS110', 2, False], ['s3', 'BIO130', 2, True],
['s4', 'MATH101H', 2, False]],
{1: 2, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'online'}],
[[2, 4, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s4', 'CHEM120', 1, True], ['s5', 'CHEM120', 0, False], ['s3', 'MATH101', 0, False],
['s4', 'BIO130', 0, False], ['s4', 'MATH101', 1, False], ['s3', 'MATH101H', 1, False],
['s4', 'MATH101', 1, False], ['s1', 'MATH101', 0, True]],
{0: 4, 1: 4, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s5', 'PHYS110', 0, True], ['s2', 'MATH101', 0, False], ['s3', 'PHYS110', 0, False],
['s4', 'BIO130', 2, False], ['s2', 'MATH101', 0, False]],
{1: 4, 2: 3},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 3, 0]]),
('normal control 8',
[[['s3', 'PHYS110', 2, True], ['s5', 'MATH101', 1, True], ['s5', 'CHEM120', 0, True],
['s4', 'CHEM120', 2, False], ['s4', 'PHYS110', 0, False], ['s2', 'MATH101H', 0, True],
['s3', 'PHYS110', 1, True], ['s5', 'MATH101', 1, True]],
{0: 3, 1: 3, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'online'}],
[])],
[('regression: online seats 1',
[[['s5', 'CHEM120', 0, False], ['s2', 'MATH101H', 2, True], ['s5', 'PHYS110', 2, False],
['s3', 'PHYS110', 0, False], ['s3', 'MATH101', 1, False], ['s1', 'MATH101H', 1, True],
['s2', 'MATH101H', 0, True], ['s3', 'MATH101', 2, False], ['s4', 'PHYS110', 2, False],
['s3', 'MATH101', 2, False]],
{0: 3, 1: 2, 2: 1}, {'MATH101': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[2, 4, 1]]),
('regression variant: online seats 2',
[[['s4', 'PHYS110', 1, False], ['s1', 'CHEM120', 2, False], ['s1', 'CHEM120', 0, True],
['s2', 'MATH101H', 1, False], ['s3', 'CHEM120', 0, False], ['s5', 'PHYS110', 0, True],
['s1', 'PHYS110', 1, True], ['s1', 'MATH101H', 0, True], ['s1', 'BIO130', 0, True],
['s4', 'MATH101', 1, False]],
{0: 3, 1: 2, 2: 1}, {'MATH101': 'online', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 5, 3], [1, 4, 2]]),
('partial repair guard 3',
[[['s2', 'BIO130', 1, False], ['s2', 'BIO130', 0, False], ['s2', 'MATH101', 2, False],
['s4', 'MATH101H', 2, False], ['s2', 'MATH101', 2, False], ['s3', 'CHEM120', 0, False],
['s3', 'MATH101H', 1, False], ['s2', 'MATH101H', 1, False], ['s5', 'BIO130', 2, False],
['s4', 'MATH101', 1, True]],
{0: 1, 1: 4, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'online', 'CHEM120': 'paper'}],
[[2, 2, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 5', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 6',
[[['s1', 'CHEM120', 2, False], ['s3', 'BIO130', 0, True], ['s1', 'MATH101', 1, True],
['s5', 'BIO130', 1, False], ['s3', 'BIO130', 0, True]],
{0: 1, 1: 2}, {'MATH101': 'online', 'CHEM120': 'online', 'BIO130': 'online'}],
[]),
('normal control 7',
[[['s3', 'BIO130', 1, False], ['s2', 'PHYS110', 0, False], ['s2', 'MATH101H', 2, False],
['s5', 'CHEM120', 0, False], ['s4', 'MATH101', 1, False], ['s3', 'CHEM120', 0, True],
['s1', 'PHYS110', 1, False]],
{0: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 4, 2], [1, 2, 0]]),
('normal control 8',
[[['s1', 'PHYS110', 1, False], ['s3', 'CHEM120', 2, False], ['s4', 'MATH101H', 1, False],
['s3', 'MATH101H', 0, False]],
{0: 2, 1: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[])],
[('regression: online seats 1',
[[['s5', 'BIO130', 1, False], ['s2', 'MATH101H', 2, False], ['s5', 'BIO130', 1, False],
['s3', 'MATH101H', 2, False], ['s2', 'MATH101', 2, False], ['s2', 'PHYS110', 0, False],
['s3', 'PHYS110', 1, False], ['s1', 'BIO130', 1, False], ['s2', 'CHEM120', 1, True],
['s1', 'PHYS110', 2, False], ['s1', 'PHYS110', 2, False]],
{0: 2, 1: 2},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[1, 3, 2], [2, 2, 0]]),
('regression variant: online seats 2',
[[['s1', 'PHYS110', 0, False], ['s2', 'CHEM120', 1, False], ['s1', 'PHYS110', 2, False],
['s1', 'CHEM120', 2, False], ['s1', 'CHEM120', 1, False], ['s2', 'PHYS110', 0, False],
['s4', 'MATH101H', 0, False]],
{0: 1, 1: 3, 2: 2},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('partial repair guard 3',
[[['s1', 'PHYS110', 0, True], ['s1', 'PHYS110', 1, False], ['s3', 'MATH101H', 0, True],
['s4', 'MATH101', 1, True], ['s4', 'BIO130', 2, False], ['s3', 'MATH101', 2, False],
['s1', 'PHYS110', 1, False]],
{0: 1, 1: 2}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[[0, 2, 1], [2, 2, 0]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s2', 'PHYS110', 0, False], ['s1', 'MATH101H', 1, False], ['s2', 'MATH101', 1, False],
['s4', 'CHEM120', 0, False]],
{0: 1, 1: 3, 2: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper'}],
[[0, 2, 1]]),
('normal control 7',
[[['s3', 'PHYS110', 2, False], ['s2', 'MATH101', 2, False]], {0: 1, 1: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[[2, 2, 0]]),
('normal control 8',
[[['s1', 'MATH101H', 2, False], ['s3', 'MATH101H', 1, True], ['s1', 'BIO130', 1, False],
['s5', 'MATH101H', 2, False], ['s2', 'PHYS110', 0, False], ['s5', 'CHEM120', 1, True],
['s1', 'MATH101', 1, False]],
{0: 2, 1: 2, 2: 2},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 2]])]]
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: online seats 1 | [[0, 2, 1]] | [] | Failed |
| regression variant: online seats 2 | [[0, 4, 3], [1, 3, 2]] | [] | Failed |
| partial repair guard 3 | [[0, 2, 1]] | [[0, 2, 1]] | Passed |
| boundary control 4 | [[0, 2, 1]] | [[0, 2, 1]] | Passed |
| boundary control 5 | [] | [] | Passed |
| normal control 6 | [[1, 2, 1]] | [[1, 2, 1]] | Passed |
| normal control 7 | [] | [] | Passed |
| normal control 8 | [[1, 5, 4], [2, 2, 1]] | [[1, 5, 4]] | Failed |
SHA-256 / 16177774624d7b1ecad98fabd5dcc9ae0356f7d6bbdb0afe47a82a40ad70dce1
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sits, cap, mode):
seen = set()
used = {}
for st, ex, p, acc in sits:
if (st, ex) in seen:
continue
seen.add((st, ex))
if mode.get(ex, 'online') == 'online':
continue
used[p] = used.get(p, 0) + (2 if acc else 1)
return [[p, used[p], cap.get(p, 0)] for p in sorted(used) if used[p] > cap.get(p, 0)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: online seats 1', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}],
[]),
('regression variant: online seats 2',
[[['s1', 'MATH101', 1, True], ['s1', 'CHEM120', 0, False], ['s5', 'PHYS110', 0, False],
['s5', 'CHEM120', 0, False], ['s3', 'PHYS110', 1, False], ['s3', 'MATH101H', 0, False],
['s1', 'CHEM120', 1, False], ['s1', 'CHEM120', 0, False], ['s3', 'CHEM120', 2, False],
['s3', 'PHYS110', 2, False], ['s3', 'PHYS110', 1, False]],
{0: 3, 1: 2, 2: 4}, {'MATH101': 'online', 'MATH101H': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[]),
('partial repair guard 3',
[[['s3', 'MATH101', 0, False], ['s3', 'BIO130', 2, False], ['s2', 'MATH101H', 0, False],
['s2', 'MATH101H', 2, False], ['s3', 'BIO130', 2, False]],
{0: 1, 1: 2, 2: 3}, {'MATH101': 'paper', 'PHYS110': 'paper', 'BIO130': 'online'}],
[[0, 2, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s1', 'BIO130', 1, False], ['s2', 'PHYS110', 1, False]], {0: 1, 1: 1, 2: 2},
{'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[1, 2, 1]]),
('normal control 7',
[[['s2', 'PHYS110', 0, False], ['s5', 'PHYS110', 2, False], ['s5', 'BIO130', 2, True],
['s1', 'MATH101H', 1, False], ['s5', 'BIO130', 2, True]],
{0: 4, 1: 3, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 8',
[[['s3', 'BIO130', 1, False], ['s5', 'PHYS110', 2, False], ['s3', 'MATH101H', 1, False],
['s3', 'MATH101H', 0, False], ['s4', 'MATH101H', 1, True], ['s1', 'CHEM120', 2, False],
['s3', 'MATH101H', 1, False], ['s1', 'BIO130', 1, False]],
{0: 3, 1: 4, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online'}],
[[1, 5, 4]])],
[('regression: online seats 1',
[[['s4', 'MATH101H', 0, False], ['s5', 'CHEM120', 1, False], ['s5', 'MATH101H', 1, False],
['s5', 'MATH101H', 2, False], ['s4', 'MATH101H', 2, False], ['s2', 'CHEM120', 1, False],
['s3', 'MATH101', 0, False], ['s2', 'MATH101', 2, False], ['s2', 'BIO130', 1, False],
['s2', 'MATH101H', 0, False]],
{0: 3, 1: 1, 2: 3},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[[1, 3, 1]]),
('regression variant: online seats 2',
[[['s1', 'PHYS110', 2, False], ['s4', 'MATH101H', 0, False], ['s1', 'MATH101H', 2, False],
['s5', 'MATH101', 1, True], ['s5', 'PHYS110', 2, False], ['s3', 'BIO130', 2, True],
['s4', 'MATH101H', 2, False]],
{1: 2, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'online'}],
[[2, 4, 1]]),
('partial repair guard 3',
[[['s2', 'MATH101H', 2, True], ['s4', 'MATH101', 0, False], ['s3', 'CHEM120', 0, True],
['s1', 'MATH101', 2, False], ['s2', 'PHYS110', 1, True], ['s4', 'BIO130', 0, True],
['s3', 'CHEM120', 2, False], ['s4', 'BIO130', 0, True]],
{0: 2, 1: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'CHEM120': 'paper'}],
[[0, 5, 2], [2, 1, 0]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 5', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 6',
[[['s1', 'PHYS110', 2, False], ['s4', 'MATH101', 1, False], ['s4', 'MATH101', 1, False]], {1: 1, 2: 3},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s5', 'BIO130', 0, False], ['s5', 'PHYS110', 1, False], ['s1', 'PHYS110', 0, False],
['s5', 'MATH101', 1, False], ['s3', 'MATH101', 2, False]],
{0: 4, 1: 4, 2: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[]),
('normal control 8',
[[['s2', 'PHYS110', 1, False], ['s4', 'MATH101', 2, False], ['s5', 'MATH101', 0, True],
['s4', 'MATH101', 0, True], ['s1', 'MATH101', 2, True], ['s2', 'MATH101', 0, False],
['s2', 'BIO130', 2, True], ['s4', 'BIO130', 2, False], ['s2', 'MATH101H', 2, False],
['s3', 'BIO130', 1, False]],
{0: 1, 1: 2, 2: 1}, {'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 3, 1], [2, 7, 1]])],
[('regression: online seats 1',
[[['s3', 'MATH101H', 2, False], ['s3', 'MATH101H', 0, False], ['s5', 'PHYS110', 0, False],
['s2', 'MATH101H', 0, False], ['s4', 'MATH101H', 0, False], ['s3', 'PHYS110', 1, False],
['s2', 'MATH101', 1, False], ['s5', 'PHYS110', 0, False], ['s4', 'CHEM120', 0, False],
['s3', 'MATH101H', 1, True]],
{0: 1, 2: 1},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 2, 1], [1, 1, 0]]),
('regression variant: online seats 2',
[[['s4', 'PHYS110', 1, False], ['s1', 'MATH101H', 1, True], ['s3', 'BIO130', 1, False],
['s1', 'MATH101H', 1, False], ['s4', 'MATH101H', 1, False], ['s1', 'MATH101H', 1, True]],
{0: 2, 1: 2, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[]),
('partial repair guard 3',
[[['s1', 'PHYS110', 2, False], ['s4', 'MATH101H', 0, False], ['s1', 'MATH101H', 2, False],
['s5', 'MATH101', 1, True], ['s5', 'PHYS110', 2, False], ['s3', 'BIO130', 2, True],
['s4', 'MATH101H', 2, False]],
{1: 2, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'online'}],
[[2, 4, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s4', 'CHEM120', 1, True], ['s5', 'CHEM120', 0, False], ['s3', 'MATH101', 0, False],
['s4', 'BIO130', 0, False], ['s4', 'MATH101', 1, False], ['s3', 'MATH101H', 1, False],
['s4', 'MATH101', 1, False], ['s1', 'MATH101', 0, True]],
{0: 4, 1: 4, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s5', 'PHYS110', 0, True], ['s2', 'MATH101', 0, False], ['s3', 'PHYS110', 0, False],
['s4', 'BIO130', 2, False], ['s2', 'MATH101', 0, False]],
{1: 4, 2: 3},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 3, 0]]),
('normal control 8',
[[['s3', 'PHYS110', 2, True], ['s5', 'MATH101', 1, True], ['s5', 'CHEM120', 0, True],
['s4', 'CHEM120', 2, False], ['s4', 'PHYS110', 0, False], ['s2', 'MATH101H', 0, True],
['s3', 'PHYS110', 1, True], ['s5', 'MATH101', 1, True]],
{0: 3, 1: 3, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'online'}],
[])],
[('regression: online seats 1',
[[['s5', 'CHEM120', 0, False], ['s2', 'MATH101H', 2, True], ['s5', 'PHYS110', 2, False],
['s3', 'PHYS110', 0, False], ['s3', 'MATH101', 1, False], ['s1', 'MATH101H', 1, True],
['s2', 'MATH101H', 0, True], ['s3', 'MATH101', 2, False], ['s4', 'PHYS110', 2, False],
['s3', 'MATH101', 2, False]],
{0: 3, 1: 2, 2: 1}, {'MATH101': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[2, 4, 1]]),
('regression variant: online seats 2',
[[['s4', 'PHYS110', 1, False], ['s1', 'CHEM120', 2, False], ['s1', 'CHEM120', 0, True],
['s2', 'MATH101H', 1, False], ['s3', 'CHEM120', 0, False], ['s5', 'PHYS110', 0, True],
['s1', 'PHYS110', 1, True], ['s1', 'MATH101H', 0, True], ['s1', 'BIO130', 0, True],
['s4', 'MATH101', 1, False]],
{0: 3, 1: 2, 2: 1}, {'MATH101': 'online', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 5, 3], [1, 4, 2]]),
('partial repair guard 3',
[[['s2', 'BIO130', 1, False], ['s2', 'BIO130', 0, False], ['s2', 'MATH101', 2, False],
['s4', 'MATH101H', 2, False], ['s2', 'MATH101', 2, False], ['s3', 'CHEM120', 0, False],
['s3', 'MATH101H', 1, False], ['s2', 'MATH101H', 1, False], ['s5', 'BIO130', 2, False],
['s4', 'MATH101', 1, True]],
{0: 1, 1: 4, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'online', 'CHEM120': 'paper'}],
[[2, 2, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 5', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 6',
[[['s1', 'CHEM120', 2, False], ['s3', 'BIO130', 0, True], ['s1', 'MATH101', 1, True],
['s5', 'BIO130', 1, False], ['s3', 'BIO130', 0, True]],
{0: 1, 1: 2}, {'MATH101': 'online', 'CHEM120': 'online', 'BIO130': 'online'}],
[]),
('normal control 7',
[[['s3', 'BIO130', 1, False], ['s2', 'PHYS110', 0, False], ['s2', 'MATH101H', 2, False],
['s5', 'CHEM120', 0, False], ['s4', 'MATH101', 1, False], ['s3', 'CHEM120', 0, True],
['s1', 'PHYS110', 1, False]],
{0: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 4, 2], [1, 2, 0]]),
('normal control 8',
[[['s1', 'PHYS110', 1, False], ['s3', 'CHEM120', 2, False], ['s4', 'MATH101H', 1, False],
['s3', 'MATH101H', 0, False]],
{0: 2, 1: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[])],
[('regression: online seats 1',
[[['s5', 'BIO130', 1, False], ['s2', 'MATH101H', 2, False], ['s5', 'BIO130', 1, False],
['s3', 'MATH101H', 2, False], ['s2', 'MATH101', 2, False], ['s2', 'PHYS110', 0, False],
['s3', 'PHYS110', 1, False], ['s1', 'BIO130', 1, False], ['s2', 'CHEM120', 1, True],
['s1', 'PHYS110', 2, False], ['s1', 'PHYS110', 2, False]],
{0: 2, 1: 2},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[1, 3, 2], [2, 2, 0]]),
('regression variant: online seats 2',
[[['s1', 'PHYS110', 0, False], ['s2', 'CHEM120', 1, False], ['s1', 'PHYS110', 2, False],
['s1', 'CHEM120', 2, False], ['s1', 'CHEM120', 1, False], ['s2', 'PHYS110', 0, False],
['s4', 'MATH101H', 0, False]],
{0: 1, 1: 3, 2: 2},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('partial repair guard 3',
[[['s1', 'PHYS110', 0, True], ['s1', 'PHYS110', 1, False], ['s3', 'MATH101H', 0, True],
['s4', 'MATH101', 1, True], ['s4', 'BIO130', 2, False], ['s3', 'MATH101', 2, False],
['s1', 'PHYS110', 1, False]],
{0: 1, 1: 2}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[[0, 2, 1], [2, 2, 0]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s2', 'PHYS110', 0, False], ['s1', 'MATH101H', 1, False], ['s2', 'MATH101', 1, False],
['s4', 'CHEM120', 0, False]],
{0: 1, 1: 3, 2: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper'}],
[[0, 2, 1]]),
('normal control 7',
[[['s3', 'PHYS110', 2, False], ['s2', 'MATH101', 2, False]], {0: 1, 1: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[[2, 2, 0]]),
('normal control 8',
[[['s1', 'MATH101H', 2, False], ['s3', 'MATH101H', 1, True], ['s1', 'BIO130', 1, False],
['s5', 'MATH101H', 2, False], ['s2', 'PHYS110', 0, False], ['s5', 'CHEM120', 1, True],
['s1', 'MATH101', 1, False]],
{0: 2, 1: 2, 2: 2},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 2]])]]
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: online seats 1 | [] | [] | Passed |
| regression variant: online seats 2 | [] | [] | Passed |
| partial repair guard 3 | [] | [[0, 2, 1]] | Failed |
| boundary control 4 | [] | [[0, 2, 1]] | Failed |
| boundary control 5 | [] | [] | Passed |
| normal control 6 | [[1, 2, 1]] | [[1, 2, 1]] | Passed |
| normal control 7 | [] | [] | Passed |
| normal control 8 | [] | [[1, 5, 4]] | Failed |
SHA-256 / adbd9abfc0f62b962555261f5169c3ce49c8a45abaeb8cb2dff6babddb9c51d7
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sits, cap, mode):
seen = set()
used = {}
for st, ex, p, acc in sits:
if (st, ex) in seen:
continue
seen.add((st, ex))
if mode.get(ex) == 'online':
continue
used[p] = used.get(p, 0) + (2 if acc else 1)
return [[p, used[p], cap.get(p, 0)] for p in sorted(used) if used[p] > cap.get(p, 0)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: online seats 1', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}],
[]),
('regression variant: online seats 2',
[[['s1', 'MATH101', 1, True], ['s1', 'CHEM120', 0, False], ['s5', 'PHYS110', 0, False],
['s5', 'CHEM120', 0, False], ['s3', 'PHYS110', 1, False], ['s3', 'MATH101H', 0, False],
['s1', 'CHEM120', 1, False], ['s1', 'CHEM120', 0, False], ['s3', 'CHEM120', 2, False],
['s3', 'PHYS110', 2, False], ['s3', 'PHYS110', 1, False]],
{0: 3, 1: 2, 2: 4}, {'MATH101': 'online', 'MATH101H': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[]),
('partial repair guard 3',
[[['s3', 'MATH101', 0, False], ['s3', 'BIO130', 2, False], ['s2', 'MATH101H', 0, False],
['s2', 'MATH101H', 2, False], ['s3', 'BIO130', 2, False]],
{0: 1, 1: 2, 2: 3}, {'MATH101': 'paper', 'PHYS110': 'paper', 'BIO130': 'online'}],
[[0, 2, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s1', 'BIO130', 1, False], ['s2', 'PHYS110', 1, False]], {0: 1, 1: 1, 2: 2},
{'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[1, 2, 1]]),
('normal control 7',
[[['s2', 'PHYS110', 0, False], ['s5', 'PHYS110', 2, False], ['s5', 'BIO130', 2, True],
['s1', 'MATH101H', 1, False], ['s5', 'BIO130', 2, True]],
{0: 4, 1: 3, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 8',
[[['s3', 'BIO130', 1, False], ['s5', 'PHYS110', 2, False], ['s3', 'MATH101H', 1, False],
['s3', 'MATH101H', 0, False], ['s4', 'MATH101H', 1, True], ['s1', 'CHEM120', 2, False],
['s3', 'MATH101H', 1, False], ['s1', 'BIO130', 1, False]],
{0: 3, 1: 4, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online'}],
[[1, 5, 4]])],
[('regression: online seats 1',
[[['s4', 'MATH101H', 0, False], ['s5', 'CHEM120', 1, False], ['s5', 'MATH101H', 1, False],
['s5', 'MATH101H', 2, False], ['s4', 'MATH101H', 2, False], ['s2', 'CHEM120', 1, False],
['s3', 'MATH101', 0, False], ['s2', 'MATH101', 2, False], ['s2', 'BIO130', 1, False],
['s2', 'MATH101H', 0, False]],
{0: 3, 1: 1, 2: 3},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[[1, 3, 1]]),
('regression variant: online seats 2',
[[['s1', 'PHYS110', 2, False], ['s4', 'MATH101H', 0, False], ['s1', 'MATH101H', 2, False],
['s5', 'MATH101', 1, True], ['s5', 'PHYS110', 2, False], ['s3', 'BIO130', 2, True],
['s4', 'MATH101H', 2, False]],
{1: 2, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'online'}],
[[2, 4, 1]]),
('partial repair guard 3',
[[['s2', 'MATH101H', 2, True], ['s4', 'MATH101', 0, False], ['s3', 'CHEM120', 0, True],
['s1', 'MATH101', 2, False], ['s2', 'PHYS110', 1, True], ['s4', 'BIO130', 0, True],
['s3', 'CHEM120', 2, False], ['s4', 'BIO130', 0, True]],
{0: 2, 1: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'CHEM120': 'paper'}],
[[0, 5, 2], [2, 1, 0]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 5', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 6',
[[['s1', 'PHYS110', 2, False], ['s4', 'MATH101', 1, False], ['s4', 'MATH101', 1, False]], {1: 1, 2: 3},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s5', 'BIO130', 0, False], ['s5', 'PHYS110', 1, False], ['s1', 'PHYS110', 0, False],
['s5', 'MATH101', 1, False], ['s3', 'MATH101', 2, False]],
{0: 4, 1: 4, 2: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[]),
('normal control 8',
[[['s2', 'PHYS110', 1, False], ['s4', 'MATH101', 2, False], ['s5', 'MATH101', 0, True],
['s4', 'MATH101', 0, True], ['s1', 'MATH101', 2, True], ['s2', 'MATH101', 0, False],
['s2', 'BIO130', 2, True], ['s4', 'BIO130', 2, False], ['s2', 'MATH101H', 2, False],
['s3', 'BIO130', 1, False]],
{0: 1, 1: 2, 2: 1}, {'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 3, 1], [2, 7, 1]])],
[('regression: online seats 1',
[[['s3', 'MATH101H', 2, False], ['s3', 'MATH101H', 0, False], ['s5', 'PHYS110', 0, False],
['s2', 'MATH101H', 0, False], ['s4', 'MATH101H', 0, False], ['s3', 'PHYS110', 1, False],
['s2', 'MATH101', 1, False], ['s5', 'PHYS110', 0, False], ['s4', 'CHEM120', 0, False],
['s3', 'MATH101H', 1, True]],
{0: 1, 2: 1},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 2, 1], [1, 1, 0]]),
('regression variant: online seats 2',
[[['s4', 'PHYS110', 1, False], ['s1', 'MATH101H', 1, True], ['s3', 'BIO130', 1, False],
['s1', 'MATH101H', 1, False], ['s4', 'MATH101H', 1, False], ['s1', 'MATH101H', 1, True]],
{0: 2, 1: 2, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[]),
('partial repair guard 3',
[[['s1', 'PHYS110', 2, False], ['s4', 'MATH101H', 0, False], ['s1', 'MATH101H', 2, False],
['s5', 'MATH101', 1, True], ['s5', 'PHYS110', 2, False], ['s3', 'BIO130', 2, True],
['s4', 'MATH101H', 2, False]],
{1: 2, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'online'}],
[[2, 4, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s4', 'CHEM120', 1, True], ['s5', 'CHEM120', 0, False], ['s3', 'MATH101', 0, False],
['s4', 'BIO130', 0, False], ['s4', 'MATH101', 1, False], ['s3', 'MATH101H', 1, False],
['s4', 'MATH101', 1, False], ['s1', 'MATH101', 0, True]],
{0: 4, 1: 4, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s5', 'PHYS110', 0, True], ['s2', 'MATH101', 0, False], ['s3', 'PHYS110', 0, False],
['s4', 'BIO130', 2, False], ['s2', 'MATH101', 0, False]],
{1: 4, 2: 3},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 3, 0]]),
('normal control 8',
[[['s3', 'PHYS110', 2, True], ['s5', 'MATH101', 1, True], ['s5', 'CHEM120', 0, True],
['s4', 'CHEM120', 2, False], ['s4', 'PHYS110', 0, False], ['s2', 'MATH101H', 0, True],
['s3', 'PHYS110', 1, True], ['s5', 'MATH101', 1, True]],
{0: 3, 1: 3, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'online'}],
[])],
[('regression: online seats 1',
[[['s5', 'CHEM120', 0, False], ['s2', 'MATH101H', 2, True], ['s5', 'PHYS110', 2, False],
['s3', 'PHYS110', 0, False], ['s3', 'MATH101', 1, False], ['s1', 'MATH101H', 1, True],
['s2', 'MATH101H', 0, True], ['s3', 'MATH101', 2, False], ['s4', 'PHYS110', 2, False],
['s3', 'MATH101', 2, False]],
{0: 3, 1: 2, 2: 1}, {'MATH101': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[2, 4, 1]]),
('regression variant: online seats 2',
[[['s4', 'PHYS110', 1, False], ['s1', 'CHEM120', 2, False], ['s1', 'CHEM120', 0, True],
['s2', 'MATH101H', 1, False], ['s3', 'CHEM120', 0, False], ['s5', 'PHYS110', 0, True],
['s1', 'PHYS110', 1, True], ['s1', 'MATH101H', 0, True], ['s1', 'BIO130', 0, True],
['s4', 'MATH101', 1, False]],
{0: 3, 1: 2, 2: 1}, {'MATH101': 'online', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 5, 3], [1, 4, 2]]),
('partial repair guard 3',
[[['s2', 'BIO130', 1, False], ['s2', 'BIO130', 0, False], ['s2', 'MATH101', 2, False],
['s4', 'MATH101H', 2, False], ['s2', 'MATH101', 2, False], ['s3', 'CHEM120', 0, False],
['s3', 'MATH101H', 1, False], ['s2', 'MATH101H', 1, False], ['s5', 'BIO130', 2, False],
['s4', 'MATH101', 1, True]],
{0: 1, 1: 4, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'online', 'CHEM120': 'paper'}],
[[2, 2, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 5', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 6',
[[['s1', 'CHEM120', 2, False], ['s3', 'BIO130', 0, True], ['s1', 'MATH101', 1, True],
['s5', 'BIO130', 1, False], ['s3', 'BIO130', 0, True]],
{0: 1, 1: 2}, {'MATH101': 'online', 'CHEM120': 'online', 'BIO130': 'online'}],
[]),
('normal control 7',
[[['s3', 'BIO130', 1, False], ['s2', 'PHYS110', 0, False], ['s2', 'MATH101H', 2, False],
['s5', 'CHEM120', 0, False], ['s4', 'MATH101', 1, False], ['s3', 'CHEM120', 0, True],
['s1', 'PHYS110', 1, False]],
{0: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 4, 2], [1, 2, 0]]),
('normal control 8',
[[['s1', 'PHYS110', 1, False], ['s3', 'CHEM120', 2, False], ['s4', 'MATH101H', 1, False],
['s3', 'MATH101H', 0, False]],
{0: 2, 1: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[])],
[('regression: online seats 1',
[[['s5', 'BIO130', 1, False], ['s2', 'MATH101H', 2, False], ['s5', 'BIO130', 1, False],
['s3', 'MATH101H', 2, False], ['s2', 'MATH101', 2, False], ['s2', 'PHYS110', 0, False],
['s3', 'PHYS110', 1, False], ['s1', 'BIO130', 1, False], ['s2', 'CHEM120', 1, True],
['s1', 'PHYS110', 2, False], ['s1', 'PHYS110', 2, False]],
{0: 2, 1: 2},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[1, 3, 2], [2, 2, 0]]),
('regression variant: online seats 2',
[[['s1', 'PHYS110', 0, False], ['s2', 'CHEM120', 1, False], ['s1', 'PHYS110', 2, False],
['s1', 'CHEM120', 2, False], ['s1', 'CHEM120', 1, False], ['s2', 'PHYS110', 0, False],
['s4', 'MATH101H', 0, False]],
{0: 1, 1: 3, 2: 2},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('partial repair guard 3',
[[['s1', 'PHYS110', 0, True], ['s1', 'PHYS110', 1, False], ['s3', 'MATH101H', 0, True],
['s4', 'MATH101', 1, True], ['s4', 'BIO130', 2, False], ['s3', 'MATH101', 2, False],
['s1', 'PHYS110', 1, False]],
{0: 1, 1: 2}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[[0, 2, 1], [2, 2, 0]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s2', 'PHYS110', 0, False], ['s1', 'MATH101H', 1, False], ['s2', 'MATH101', 1, False],
['s4', 'CHEM120', 0, False]],
{0: 1, 1: 3, 2: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper'}],
[[0, 2, 1]]),
('normal control 7',
[[['s3', 'PHYS110', 2, False], ['s2', 'MATH101', 2, False]], {0: 1, 1: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[[2, 2, 0]]),
('normal control 8',
[[['s1', 'MATH101H', 2, False], ['s3', 'MATH101H', 1, True], ['s1', 'BIO130', 1, False],
['s5', 'MATH101H', 2, False], ['s2', 'PHYS110', 0, False], ['s5', 'CHEM120', 1, True],
['s1', 'MATH101', 1, False]],
{0: 2, 1: 2, 2: 2},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 2]])]]
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: online seats 1 | [] | [] | Passed |
| regression variant: online seats 2 | [] | [] | Passed |
| partial repair guard 3 | [[0, 2, 1]] | [[0, 2, 1]] | Passed |
| boundary control 4 | [[0, 2, 1]] | [[0, 2, 1]] | Passed |
| boundary control 5 | [] | [] | Passed |
| normal control 6 | [[1, 2, 1]] | [[1, 2, 1]] | Passed |
| normal control 7 | [] | [] | Passed |
| normal control 8 | [[1, 5, 4]] | [[1, 5, 4]] | Passed |
SHA-256 / 1d9103e9c9209152622134ec29be12e294175ccaed8c9d20e5b0c7fa40befe55
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.732124+00:00.
Case digest / e06e044683f6beffe02af53ccdce7f9c079d401c5c6ab7988428dc57545e982f