FA-94711 / Exam timetabling constraints / Open access
Period without configured capacity treated as unlimited · case 01
Exams placed in periods with no rooms booked pass the capacity check.
ROOT CAUSE
A missing capacity defaults to the seats used.
VERIFIED REPAIR
Missing capacity means zero seats.
Unsuccessful approach: An inclusive comparison flags periods exactly at capacity.
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))
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, used[p])]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: missing capacity 1', [[['s1', 'A', 1, False]], {0: 5}, {'A': 'paper'}], [[1, 1, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'BIO130', 2, False], ['s1', 'MATH101', 0, False], ['s5', 'MATH101H', 2, True],
['s5', 'BIO130', 2, False], ['s2', 'MATH101H', 1, True], ['s5', 'MATH101H', 0, False],
['s1', 'BIO130', 1, True]],
{0: 3, 1: 3}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online'}],
[[2, 4, 0]]),
('partial repair guard 3',
[[['s2', 'CHEM120', 1, False], ['s4', 'PHYS110', 2, False], ['s5', 'MATH101', 0, False]],
{0: 4, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[]),
('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',
[[['s5', 'MATH101', 0, False], ['s5', 'MATH101', 2, False], ['s5', 'MATH101', 2, False]],
{0: 2, 1: 4, 2: 3},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s1', 'BIO130', 2, True], ['s5', 'PHYS110', 1, False], ['s4', 'MATH101H', 1, True],
['s2', 'MATH101H', 1, False], ['s5', 'BIO130', 0, False], ['s1', 'BIO130', 2, True]],
{0: 3, 1: 2, 2: 4}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[1, 4, 2]]),
('normal control 8',
[[['s1', 'PHYS110', 1, False], ['s4', 'PHYS110', 1, False], ['s1', 'PHYS110', 2, True],
['s4', 'MATH101', 0, False], ['s4', 'MATH101H', 1, False], ['s1', 'CHEM120', 0, False],
['s5', 'BIO130', 2, True], ['s2', 'PHYS110', 1, False], ['s4', 'MATH101H', 1, False]],
{1: 2, 2: 1}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0], [1, 4, 2], [2, 2, 1]])],
[('regression: missing capacity 1',
[[['s3', 'BIO130', 0, False], ['s3', 'PHYS110', 2, True], ['s1', 'MATH101H', 1, False],
['s1', 'MATH101H', 1, True], ['s1', 'PHYS110', 1, False], ['s3', 'BIO130', 0, False]],
{1: 3, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'MATH101', 2, False], ['s1', 'PHYS110', 2, True], ['s2', 'BIO130', 0, False],
['s5', 'MATH101', 2, False], ['s4', 'MATH101', 2, False], ['s2', 'CHEM120', 2, True],
['s1', 'CHEM120', 1, False], ['s1', 'MATH101', 1, True], ['s4', 'PHYS110', 0, True],
['s1', 'MATH101', 1, True]],
{1: 3, 2: 2},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 2, 0], [2, 7, 2]]),
('partial repair guard 3',
[[['s3', 'MATH101', 2, False], ['s3', 'BIO130', 1, False], ['s4', 'MATH101H', 2, False],
['s5', 'BIO130', 0, False], ['s2', 'PHYS110', 1, False], ['s3', 'MATH101', 2, False]],
{1: 2, 2: 1}, {'MATH101': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 1, 0], [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',
[[['s3', 'MATH101', 1, True], ['s4', 'BIO130', 0, True]], {0: 1, 1: 4, 2: 3},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1]]),
('normal control 7',
[[['s5', 'BIO130', 2, False], ['s5', 'PHYS110', 0, False], ['s4', 'PHYS110', 0, True],
['s2', 'CHEM120', 0, False], ['s5', 'BIO130', 2, False]],
{0: 1, 2: 4}, {'MATH101': 'online', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[]),
('normal control 8',
[[['s2', 'PHYS110', 0, False], ['s4', 'MATH101H', 0, True], ['s3', 'BIO130', 2, True],
['s5', 'CHEM120', 1, False], ['s4', 'MATH101', 1, False], ['s5', 'MATH101', 1, True],
['s4', 'CHEM120', 0, False], ['s4', 'MATH101H', 1, False], ['s4', 'MATH101H', 1, False]],
{0: 1, 1: 3, 2: 3}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 3, 1]])],
[('regression: missing capacity 1',
[[['s4', 'MATH101H', 1, False], ['s4', 'MATH101', 1, False], ['s5', 'CHEM120', 2, False],
['s5', 'CHEM120', 2, True], ['s4', 'BIO130', 2, True], ['s1', 'PHYS110', 1, False],
['s4', 'MATH101', 1, False], ['s2', 'PHYS110', 2, True], ['s5', 'CHEM120', 1, False],
['s5', 'MATH101H', 2, False]],
{0: 2, 1: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 1], [2, 6, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'MATH101', 0, False], ['s3', 'MATH101H', 2, False], ['s2', 'MATH101H', 2, False],
['s5', 'BIO130', 2, False], ['s2', 'PHYS110', 0, False], ['s4', 'MATH101', 1, False],
['s4', 'PHYS110', 0, False], ['s5', 'MATH101', 0, False], ['s4', 'CHEM120', 1, False],
['s3', 'MATH101H', 2, False]],
{0: 1, 1: 4},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1], [2, 3, 0]]),
('partial repair guard 3',
[[['s1', 'MATH101', 0, False], ['s4', 'BIO130', 1, False], ['s1', 'MATH101', 0, False]],
{0: 1, 1: 4, 2: 2}, {'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[]),
('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', '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]]),
('normal control 7',
[[['s3', 'MATH101H', 2, False], ['s4', 'PHYS110', 1, False], ['s2', 'MATH101', 0, False],
['s3', 'CHEM120', 2, False], ['s3', 'PHYS110', 2, False], ['s1', 'CHEM120', 1, False],
['s1', 'PHYS110', 2, False], ['s4', 'MATH101', 1, False], ['s2', 'MATH101', 1, False]],
{0: 2, 1: 3, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 2, 1]]),
('normal control 8',
[[['s2', 'BIO130', 2, False], ['s1', 'MATH101H', 2, False], ['s4', 'PHYS110', 1, False],
['s2', 'MATH101H', 1, False], ['s3', 'PHYS110', 0, True]],
{1: 3, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 0]])],
[('regression: missing capacity 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: missing capacity 2',
[[['s4', 'MATH101', 2, False], ['s1', 'CHEM120', 1, False], ['s5', 'MATH101H', 2, False],
['s2', 'MATH101H', 2, True], ['s5', 'BIO130', 1, True], ['s5', 'BIO130', 2, False],
['s5', 'PHYS110', 0, True]],
{1: 2, 2: 4}, {'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[[0, 2, 0]]),
('partial repair guard 3',
[[['s2', 'PHYS110', 2, True], ['s2', 'MATH101H', 1, False], ['s2', 'CHEM120', 1, False],
['s5', 'CHEM120', 0, False], ['s4', 'MATH101H', 0, False], ['s1', 'MATH101', 2, False],
['s2', 'MATH101H', 2, False], ['s5', 'MATH101', 0, False], ['s4', 'MATH101', 1, False]],
{0: 1, 1: 4, 2: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'CHEM120': 'online', 'BIO130': 'online'}],
[]),
('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',
[[['s3', 'PHYS110', 0, False], ['s2', 'CHEM120', 1, False], ['s5', 'CHEM120', 0, True],
['s2', 'BIO130', 1, True], ['s5', 'MATH101', 0, False], ['s1', 'PHYS110', 0, True],
['s4', 'BIO130', 0, False], ['s1', 'MATH101', 2, False], ['s2', 'MATH101', 0, True],
['s5', 'CHEM120', 0, True]],
{0: 3, 1: 1, 2: 4}, {'MATH101': 'paper', 'MATH101H': 'paper', 'BIO130': 'paper'}],
[[0, 9, 3], [1, 3, 1]]),
('normal control 7',
[[['s1', 'BIO130', 1, True], ['s3', 'CHEM120', 2, True]], {0: 4, 1: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online'}],
[]),
('normal control 8',
[[['s1', 'CHEM120', 1, False], ['s4', 'PHYS110', 0, False], ['s4', 'PHYS110', 0, False]],
{0: 4, 1: 2, 2: 4}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'online'}],
[])],
[('regression: missing capacity 1',
[[['s1', 'MATH101', 0, False], ['s1', 'MATH101', 0, True], ['s1', 'MATH101', 0, False],
['s3', 'MATH101', 0, False], ['s3', 'BIO130', 1, False], ['s2', 'PHYS110', 1, False],
['s2', 'CHEM120', 2, False], ['s5', 'MATH101H', 0, True], ['s3', 'PHYS110', 1, False]],
{1: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 4, 0], [2, 1, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'MATH101', 0, False], ['s2', 'MATH101H', 1, True], ['s2', 'BIO130', 2, False],
['s2', 'BIO130', 0, False], ['s3', 'MATH101H', 1, False], ['s2', 'MATH101H', 0, True],
['s4', 'MATH101H', 2, True], ['s1', 'MATH101H', 1, False], ['s1', 'MATH101', 0, False]],
{1: 4, 2: 4}, {'MATH101': 'paper', 'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('partial repair guard 3',
[[['s3', 'MATH101H', 2, False], ['s1', 'CHEM120', 2, True], ['s4', 'BIO130', 1, False],
['s4', 'MATH101', 1, False], ['s3', 'MATH101H', 1, False], ['s1', 'MATH101', 0, True],
['s1', 'MATH101H', 0, True], ['s3', 'MATH101H', 1, False], ['s4', 'BIO130', 1, False]],
{0: 4, 1: 4, 2: 2}, {'MATH101': 'paper', 'MATH101H': 'paper', 'BIO130': 'paper'}],
[[2, 3, 2]]),
('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',
[[['s3', 'CHEM120', 2, False], ['s2', 'PHYS110', 0, False], ['s3', 'PHYS110', 2, False],
['s2', 'BIO130', 1, False], ['s1', 'MATH101H', 2, False], ['s4', 'CHEM120', 2, False],
['s4', 'CHEM120', 1, True], ['s5', 'MATH101H', 0, False], ['s1', 'MATH101H', 0, False],
['s2', 'PHYS110', 0, False]],
{0: 2, 1: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[2, 4, 0]]),
('normal control 7',
[[['s4', 'CHEM120', 2, False], ['s5', 'PHYS110', 1, False], ['s1', 'MATH101', 1, True],
['s3', 'MATH101H', 2, True], ['s5', 'MATH101H', 1, False], ['s4', 'CHEM120', 2, False],
['s3', 'MATH101H', 1, False]],
{0: 2, 1: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[[2, 3, 0]]),
('normal control 8',
[[['s1', 'BIO130', 0, False], ['s5', 'MATH101H', 0, True], ['s5', 'PHYS110', 0, False],
['s3', 'MATH101', 0, True], ['s4', 'MATH101H', 2, False], ['s4', 'BIO130', 1, True]],
{0: 3, 1: 3, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'online'}],
[[0, 4, 3]])]]
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: missing capacity 1 | [] | [[1, 1, 0]] | Failed |
| regression variant: missing capacity 2 | [] | [[2, 4, 0]] | Failed |
| partial repair guard 3 | [] | [] | Passed |
| boundary control 4 | [[0, 2, 1]] | [[0, 2, 1]] | Passed |
| boundary control 5 | [] | [] | Passed |
| normal control 6 | [] | [] | Passed |
| normal control 7 | [[1, 4, 2]] | [[1, 4, 2]] | Passed |
| normal control 8 | [[1, 4, 2], [2, 2, 1]] | [[0, 1, 0], [1, 4, 2], [2, 2, 1]] | Failed |
SHA-256 / 787c743dfa01bf0b0040f1b9bb73664e50607081a957dd1b2af8289fd42af18e
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':
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: missing capacity 1', [[['s1', 'A', 1, False]], {0: 5}, {'A': 'paper'}], [[1, 1, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'BIO130', 2, False], ['s1', 'MATH101', 0, False], ['s5', 'MATH101H', 2, True],
['s5', 'BIO130', 2, False], ['s2', 'MATH101H', 1, True], ['s5', 'MATH101H', 0, False],
['s1', 'BIO130', 1, True]],
{0: 3, 1: 3}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online'}],
[[2, 4, 0]]),
('partial repair guard 3',
[[['s2', 'CHEM120', 1, False], ['s4', 'PHYS110', 2, False], ['s5', 'MATH101', 0, False]],
{0: 4, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[]),
('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',
[[['s5', 'MATH101', 0, False], ['s5', 'MATH101', 2, False], ['s5', 'MATH101', 2, False]],
{0: 2, 1: 4, 2: 3},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s1', 'BIO130', 2, True], ['s5', 'PHYS110', 1, False], ['s4', 'MATH101H', 1, True],
['s2', 'MATH101H', 1, False], ['s5', 'BIO130', 0, False], ['s1', 'BIO130', 2, True]],
{0: 3, 1: 2, 2: 4}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[1, 4, 2]]),
('normal control 8',
[[['s1', 'PHYS110', 1, False], ['s4', 'PHYS110', 1, False], ['s1', 'PHYS110', 2, True],
['s4', 'MATH101', 0, False], ['s4', 'MATH101H', 1, False], ['s1', 'CHEM120', 0, False],
['s5', 'BIO130', 2, True], ['s2', 'PHYS110', 1, False], ['s4', 'MATH101H', 1, False]],
{1: 2, 2: 1}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0], [1, 4, 2], [2, 2, 1]])],
[('regression: missing capacity 1',
[[['s3', 'BIO130', 0, False], ['s3', 'PHYS110', 2, True], ['s1', 'MATH101H', 1, False],
['s1', 'MATH101H', 1, True], ['s1', 'PHYS110', 1, False], ['s3', 'BIO130', 0, False]],
{1: 3, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'MATH101', 2, False], ['s1', 'PHYS110', 2, True], ['s2', 'BIO130', 0, False],
['s5', 'MATH101', 2, False], ['s4', 'MATH101', 2, False], ['s2', 'CHEM120', 2, True],
['s1', 'CHEM120', 1, False], ['s1', 'MATH101', 1, True], ['s4', 'PHYS110', 0, True],
['s1', 'MATH101', 1, True]],
{1: 3, 2: 2},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 2, 0], [2, 7, 2]]),
('partial repair guard 3',
[[['s3', 'MATH101', 2, False], ['s3', 'BIO130', 1, False], ['s4', 'MATH101H', 2, False],
['s5', 'BIO130', 0, False], ['s2', 'PHYS110', 1, False], ['s3', 'MATH101', 2, False]],
{1: 2, 2: 1}, {'MATH101': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 1, 0], [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',
[[['s3', 'MATH101', 1, True], ['s4', 'BIO130', 0, True]], {0: 1, 1: 4, 2: 3},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1]]),
('normal control 7',
[[['s5', 'BIO130', 2, False], ['s5', 'PHYS110', 0, False], ['s4', 'PHYS110', 0, True],
['s2', 'CHEM120', 0, False], ['s5', 'BIO130', 2, False]],
{0: 1, 2: 4}, {'MATH101': 'online', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[]),
('normal control 8',
[[['s2', 'PHYS110', 0, False], ['s4', 'MATH101H', 0, True], ['s3', 'BIO130', 2, True],
['s5', 'CHEM120', 1, False], ['s4', 'MATH101', 1, False], ['s5', 'MATH101', 1, True],
['s4', 'CHEM120', 0, False], ['s4', 'MATH101H', 1, False], ['s4', 'MATH101H', 1, False]],
{0: 1, 1: 3, 2: 3}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 3, 1]])],
[('regression: missing capacity 1',
[[['s4', 'MATH101H', 1, False], ['s4', 'MATH101', 1, False], ['s5', 'CHEM120', 2, False],
['s5', 'CHEM120', 2, True], ['s4', 'BIO130', 2, True], ['s1', 'PHYS110', 1, False],
['s4', 'MATH101', 1, False], ['s2', 'PHYS110', 2, True], ['s5', 'CHEM120', 1, False],
['s5', 'MATH101H', 2, False]],
{0: 2, 1: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 1], [2, 6, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'MATH101', 0, False], ['s3', 'MATH101H', 2, False], ['s2', 'MATH101H', 2, False],
['s5', 'BIO130', 2, False], ['s2', 'PHYS110', 0, False], ['s4', 'MATH101', 1, False],
['s4', 'PHYS110', 0, False], ['s5', 'MATH101', 0, False], ['s4', 'CHEM120', 1, False],
['s3', 'MATH101H', 2, False]],
{0: 1, 1: 4},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1], [2, 3, 0]]),
('partial repair guard 3',
[[['s1', 'MATH101', 0, False], ['s4', 'BIO130', 1, False], ['s1', 'MATH101', 0, False]],
{0: 1, 1: 4, 2: 2}, {'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[]),
('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', '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]]),
('normal control 7',
[[['s3', 'MATH101H', 2, False], ['s4', 'PHYS110', 1, False], ['s2', 'MATH101', 0, False],
['s3', 'CHEM120', 2, False], ['s3', 'PHYS110', 2, False], ['s1', 'CHEM120', 1, False],
['s1', 'PHYS110', 2, False], ['s4', 'MATH101', 1, False], ['s2', 'MATH101', 1, False]],
{0: 2, 1: 3, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 2, 1]]),
('normal control 8',
[[['s2', 'BIO130', 2, False], ['s1', 'MATH101H', 2, False], ['s4', 'PHYS110', 1, False],
['s2', 'MATH101H', 1, False], ['s3', 'PHYS110', 0, True]],
{1: 3, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 0]])],
[('regression: missing capacity 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: missing capacity 2',
[[['s4', 'MATH101', 2, False], ['s1', 'CHEM120', 1, False], ['s5', 'MATH101H', 2, False],
['s2', 'MATH101H', 2, True], ['s5', 'BIO130', 1, True], ['s5', 'BIO130', 2, False],
['s5', 'PHYS110', 0, True]],
{1: 2, 2: 4}, {'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[[0, 2, 0]]),
('partial repair guard 3',
[[['s2', 'PHYS110', 2, True], ['s2', 'MATH101H', 1, False], ['s2', 'CHEM120', 1, False],
['s5', 'CHEM120', 0, False], ['s4', 'MATH101H', 0, False], ['s1', 'MATH101', 2, False],
['s2', 'MATH101H', 2, False], ['s5', 'MATH101', 0, False], ['s4', 'MATH101', 1, False]],
{0: 1, 1: 4, 2: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'CHEM120': 'online', 'BIO130': 'online'}],
[]),
('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',
[[['s3', 'PHYS110', 0, False], ['s2', 'CHEM120', 1, False], ['s5', 'CHEM120', 0, True],
['s2', 'BIO130', 1, True], ['s5', 'MATH101', 0, False], ['s1', 'PHYS110', 0, True],
['s4', 'BIO130', 0, False], ['s1', 'MATH101', 2, False], ['s2', 'MATH101', 0, True],
['s5', 'CHEM120', 0, True]],
{0: 3, 1: 1, 2: 4}, {'MATH101': 'paper', 'MATH101H': 'paper', 'BIO130': 'paper'}],
[[0, 9, 3], [1, 3, 1]]),
('normal control 7',
[[['s1', 'BIO130', 1, True], ['s3', 'CHEM120', 2, True]], {0: 4, 1: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online'}],
[]),
('normal control 8',
[[['s1', 'CHEM120', 1, False], ['s4', 'PHYS110', 0, False], ['s4', 'PHYS110', 0, False]],
{0: 4, 1: 2, 2: 4}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'online'}],
[])],
[('regression: missing capacity 1',
[[['s1', 'MATH101', 0, False], ['s1', 'MATH101', 0, True], ['s1', 'MATH101', 0, False],
['s3', 'MATH101', 0, False], ['s3', 'BIO130', 1, False], ['s2', 'PHYS110', 1, False],
['s2', 'CHEM120', 2, False], ['s5', 'MATH101H', 0, True], ['s3', 'PHYS110', 1, False]],
{1: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 4, 0], [2, 1, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'MATH101', 0, False], ['s2', 'MATH101H', 1, True], ['s2', 'BIO130', 2, False],
['s2', 'BIO130', 0, False], ['s3', 'MATH101H', 1, False], ['s2', 'MATH101H', 0, True],
['s4', 'MATH101H', 2, True], ['s1', 'MATH101H', 1, False], ['s1', 'MATH101', 0, False]],
{1: 4, 2: 4}, {'MATH101': 'paper', 'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('partial repair guard 3',
[[['s3', 'MATH101H', 2, False], ['s1', 'CHEM120', 2, True], ['s4', 'BIO130', 1, False],
['s4', 'MATH101', 1, False], ['s3', 'MATH101H', 1, False], ['s1', 'MATH101', 0, True],
['s1', 'MATH101H', 0, True], ['s3', 'MATH101H', 1, False], ['s4', 'BIO130', 1, False]],
{0: 4, 1: 4, 2: 2}, {'MATH101': 'paper', 'MATH101H': 'paper', 'BIO130': 'paper'}],
[[2, 3, 2]]),
('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',
[[['s3', 'CHEM120', 2, False], ['s2', 'PHYS110', 0, False], ['s3', 'PHYS110', 2, False],
['s2', 'BIO130', 1, False], ['s1', 'MATH101H', 2, False], ['s4', 'CHEM120', 2, False],
['s4', 'CHEM120', 1, True], ['s5', 'MATH101H', 0, False], ['s1', 'MATH101H', 0, False],
['s2', 'PHYS110', 0, False]],
{0: 2, 1: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[2, 4, 0]]),
('normal control 7',
[[['s4', 'CHEM120', 2, False], ['s5', 'PHYS110', 1, False], ['s1', 'MATH101', 1, True],
['s3', 'MATH101H', 2, True], ['s5', 'MATH101H', 1, False], ['s4', 'CHEM120', 2, False],
['s3', 'MATH101H', 1, False]],
{0: 2, 1: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[[2, 3, 0]]),
('normal control 8',
[[['s1', 'BIO130', 0, False], ['s5', 'MATH101H', 0, True], ['s5', 'PHYS110', 0, False],
['s3', 'MATH101', 0, True], ['s4', 'MATH101H', 2, False], ['s4', 'BIO130', 1, True]],
{0: 3, 1: 3, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'online'}],
[[0, 4, 3]])]]
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: missing capacity 1 | [[1, 1, 0]] | [[1, 1, 0]] | Passed |
| regression variant: missing capacity 2 | [[2, 4, 0]] | [[2, 4, 0]] | Passed |
| partial repair guard 3 | [[1, 1, 1]] | [] | Failed |
| boundary control 4 | [[0, 2, 1]] | [[0, 2, 1]] | Passed |
| boundary control 5 | [[0, 1, 1]] | [] | Failed |
| normal control 6 | [] | [] | Passed |
| normal control 7 | [[1, 4, 2]] | [[1, 4, 2]] | Passed |
| normal control 8 | [[0, 1, 0], [1, 4, 2], [2, 2, 1]] | [[0, 1, 0], [1, 4, 2], [2, 2, 1]] | Passed |
SHA-256 / 2db562365529b5d9200bb3d067ed8edb15000ba3b2d8c09d74b1f0d40b22a7d6
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: missing capacity 1', [[['s1', 'A', 1, False]], {0: 5}, {'A': 'paper'}], [[1, 1, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'BIO130', 2, False], ['s1', 'MATH101', 0, False], ['s5', 'MATH101H', 2, True],
['s5', 'BIO130', 2, False], ['s2', 'MATH101H', 1, True], ['s5', 'MATH101H', 0, False],
['s1', 'BIO130', 1, True]],
{0: 3, 1: 3}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online'}],
[[2, 4, 0]]),
('partial repair guard 3',
[[['s2', 'CHEM120', 1, False], ['s4', 'PHYS110', 2, False], ['s5', 'MATH101', 0, False]],
{0: 4, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[]),
('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',
[[['s5', 'MATH101', 0, False], ['s5', 'MATH101', 2, False], ['s5', 'MATH101', 2, False]],
{0: 2, 1: 4, 2: 3},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s1', 'BIO130', 2, True], ['s5', 'PHYS110', 1, False], ['s4', 'MATH101H', 1, True],
['s2', 'MATH101H', 1, False], ['s5', 'BIO130', 0, False], ['s1', 'BIO130', 2, True]],
{0: 3, 1: 2, 2: 4}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[1, 4, 2]]),
('normal control 8',
[[['s1', 'PHYS110', 1, False], ['s4', 'PHYS110', 1, False], ['s1', 'PHYS110', 2, True],
['s4', 'MATH101', 0, False], ['s4', 'MATH101H', 1, False], ['s1', 'CHEM120', 0, False],
['s5', 'BIO130', 2, True], ['s2', 'PHYS110', 1, False], ['s4', 'MATH101H', 1, False]],
{1: 2, 2: 1}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0], [1, 4, 2], [2, 2, 1]])],
[('regression: missing capacity 1',
[[['s3', 'BIO130', 0, False], ['s3', 'PHYS110', 2, True], ['s1', 'MATH101H', 1, False],
['s1', 'MATH101H', 1, True], ['s1', 'PHYS110', 1, False], ['s3', 'BIO130', 0, False]],
{1: 3, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'MATH101', 2, False], ['s1', 'PHYS110', 2, True], ['s2', 'BIO130', 0, False],
['s5', 'MATH101', 2, False], ['s4', 'MATH101', 2, False], ['s2', 'CHEM120', 2, True],
['s1', 'CHEM120', 1, False], ['s1', 'MATH101', 1, True], ['s4', 'PHYS110', 0, True],
['s1', 'MATH101', 1, True]],
{1: 3, 2: 2},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 2, 0], [2, 7, 2]]),
('partial repair guard 3',
[[['s3', 'MATH101', 2, False], ['s3', 'BIO130', 1, False], ['s4', 'MATH101H', 2, False],
['s5', 'BIO130', 0, False], ['s2', 'PHYS110', 1, False], ['s3', 'MATH101', 2, False]],
{1: 2, 2: 1}, {'MATH101': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 1, 0], [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',
[[['s3', 'MATH101', 1, True], ['s4', 'BIO130', 0, True]], {0: 1, 1: 4, 2: 3},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1]]),
('normal control 7',
[[['s5', 'BIO130', 2, False], ['s5', 'PHYS110', 0, False], ['s4', 'PHYS110', 0, True],
['s2', 'CHEM120', 0, False], ['s5', 'BIO130', 2, False]],
{0: 1, 2: 4}, {'MATH101': 'online', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[]),
('normal control 8',
[[['s2', 'PHYS110', 0, False], ['s4', 'MATH101H', 0, True], ['s3', 'BIO130', 2, True],
['s5', 'CHEM120', 1, False], ['s4', 'MATH101', 1, False], ['s5', 'MATH101', 1, True],
['s4', 'CHEM120', 0, False], ['s4', 'MATH101H', 1, False], ['s4', 'MATH101H', 1, False]],
{0: 1, 1: 3, 2: 3}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 3, 1]])],
[('regression: missing capacity 1',
[[['s4', 'MATH101H', 1, False], ['s4', 'MATH101', 1, False], ['s5', 'CHEM120', 2, False],
['s5', 'CHEM120', 2, True], ['s4', 'BIO130', 2, True], ['s1', 'PHYS110', 1, False],
['s4', 'MATH101', 1, False], ['s2', 'PHYS110', 2, True], ['s5', 'CHEM120', 1, False],
['s5', 'MATH101H', 2, False]],
{0: 2, 1: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 1], [2, 6, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'MATH101', 0, False], ['s3', 'MATH101H', 2, False], ['s2', 'MATH101H', 2, False],
['s5', 'BIO130', 2, False], ['s2', 'PHYS110', 0, False], ['s4', 'MATH101', 1, False],
['s4', 'PHYS110', 0, False], ['s5', 'MATH101', 0, False], ['s4', 'CHEM120', 1, False],
['s3', 'MATH101H', 2, False]],
{0: 1, 1: 4},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1], [2, 3, 0]]),
('partial repair guard 3',
[[['s1', 'MATH101', 0, False], ['s4', 'BIO130', 1, False], ['s1', 'MATH101', 0, False]],
{0: 1, 1: 4, 2: 2}, {'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[]),
('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', '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]]),
('normal control 7',
[[['s3', 'MATH101H', 2, False], ['s4', 'PHYS110', 1, False], ['s2', 'MATH101', 0, False],
['s3', 'CHEM120', 2, False], ['s3', 'PHYS110', 2, False], ['s1', 'CHEM120', 1, False],
['s1', 'PHYS110', 2, False], ['s4', 'MATH101', 1, False], ['s2', 'MATH101', 1, False]],
{0: 2, 1: 3, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 2, 1]]),
('normal control 8',
[[['s2', 'BIO130', 2, False], ['s1', 'MATH101H', 2, False], ['s4', 'PHYS110', 1, False],
['s2', 'MATH101H', 1, False], ['s3', 'PHYS110', 0, True]],
{1: 3, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 0]])],
[('regression: missing capacity 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: missing capacity 2',
[[['s4', 'MATH101', 2, False], ['s1', 'CHEM120', 1, False], ['s5', 'MATH101H', 2, False],
['s2', 'MATH101H', 2, True], ['s5', 'BIO130', 1, True], ['s5', 'BIO130', 2, False],
['s5', 'PHYS110', 0, True]],
{1: 2, 2: 4}, {'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[[0, 2, 0]]),
('partial repair guard 3',
[[['s2', 'PHYS110', 2, True], ['s2', 'MATH101H', 1, False], ['s2', 'CHEM120', 1, False],
['s5', 'CHEM120', 0, False], ['s4', 'MATH101H', 0, False], ['s1', 'MATH101', 2, False],
['s2', 'MATH101H', 2, False], ['s5', 'MATH101', 0, False], ['s4', 'MATH101', 1, False]],
{0: 1, 1: 4, 2: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'CHEM120': 'online', 'BIO130': 'online'}],
[]),
('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',
[[['s3', 'PHYS110', 0, False], ['s2', 'CHEM120', 1, False], ['s5', 'CHEM120', 0, True],
['s2', 'BIO130', 1, True], ['s5', 'MATH101', 0, False], ['s1', 'PHYS110', 0, True],
['s4', 'BIO130', 0, False], ['s1', 'MATH101', 2, False], ['s2', 'MATH101', 0, True],
['s5', 'CHEM120', 0, True]],
{0: 3, 1: 1, 2: 4}, {'MATH101': 'paper', 'MATH101H': 'paper', 'BIO130': 'paper'}],
[[0, 9, 3], [1, 3, 1]]),
('normal control 7',
[[['s1', 'BIO130', 1, True], ['s3', 'CHEM120', 2, True]], {0: 4, 1: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online'}],
[]),
('normal control 8',
[[['s1', 'CHEM120', 1, False], ['s4', 'PHYS110', 0, False], ['s4', 'PHYS110', 0, False]],
{0: 4, 1: 2, 2: 4}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'online'}],
[])],
[('regression: missing capacity 1',
[[['s1', 'MATH101', 0, False], ['s1', 'MATH101', 0, True], ['s1', 'MATH101', 0, False],
['s3', 'MATH101', 0, False], ['s3', 'BIO130', 1, False], ['s2', 'PHYS110', 1, False],
['s2', 'CHEM120', 2, False], ['s5', 'MATH101H', 0, True], ['s3', 'PHYS110', 1, False]],
{1: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 4, 0], [2, 1, 0]]),
('regression variant: missing capacity 2',
[[['s1', 'MATH101', 0, False], ['s2', 'MATH101H', 1, True], ['s2', 'BIO130', 2, False],
['s2', 'BIO130', 0, False], ['s3', 'MATH101H', 1, False], ['s2', 'MATH101H', 0, True],
['s4', 'MATH101H', 2, True], ['s1', 'MATH101H', 1, False], ['s1', 'MATH101', 0, False]],
{1: 4, 2: 4}, {'MATH101': 'paper', 'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('partial repair guard 3',
[[['s3', 'MATH101H', 2, False], ['s1', 'CHEM120', 2, True], ['s4', 'BIO130', 1, False],
['s4', 'MATH101', 1, False], ['s3', 'MATH101H', 1, False], ['s1', 'MATH101', 0, True],
['s1', 'MATH101H', 0, True], ['s3', 'MATH101H', 1, False], ['s4', 'BIO130', 1, False]],
{0: 4, 1: 4, 2: 2}, {'MATH101': 'paper', 'MATH101H': 'paper', 'BIO130': 'paper'}],
[[2, 3, 2]]),
('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',
[[['s3', 'CHEM120', 2, False], ['s2', 'PHYS110', 0, False], ['s3', 'PHYS110', 2, False],
['s2', 'BIO130', 1, False], ['s1', 'MATH101H', 2, False], ['s4', 'CHEM120', 2, False],
['s4', 'CHEM120', 1, True], ['s5', 'MATH101H', 0, False], ['s1', 'MATH101H', 0, False],
['s2', 'PHYS110', 0, False]],
{0: 2, 1: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[2, 4, 0]]),
('normal control 7',
[[['s4', 'CHEM120', 2, False], ['s5', 'PHYS110', 1, False], ['s1', 'MATH101', 1, True],
['s3', 'MATH101H', 2, True], ['s5', 'MATH101H', 1, False], ['s4', 'CHEM120', 2, False],
['s3', 'MATH101H', 1, False]],
{0: 2, 1: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[[2, 3, 0]]),
('normal control 8',
[[['s1', 'BIO130', 0, False], ['s5', 'MATH101H', 0, True], ['s5', 'PHYS110', 0, False],
['s3', 'MATH101', 0, True], ['s4', 'MATH101H', 2, False], ['s4', 'BIO130', 1, True]],
{0: 3, 1: 3, 2: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'online'}],
[[0, 4, 3]])]]
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: missing capacity 1 | [[1, 1, 0]] | [[1, 1, 0]] | Passed |
| regression variant: missing capacity 2 | [[2, 4, 0]] | [[2, 4, 0]] | Passed |
| partial repair guard 3 | [] | [] | Passed |
| boundary control 4 | [[0, 2, 1]] | [[0, 2, 1]] | Passed |
| boundary control 5 | [] | [] | Passed |
| normal control 6 | [] | [] | Passed |
| normal control 7 | [[1, 4, 2]] | [[1, 4, 2]] | Passed |
| normal control 8 | [[0, 1, 0], [1, 4, 2], [2, 2, 1]] | [[0, 1, 0], [1, 4, 2], [2, 2, 1]] | Passed |
SHA-256 / 251b63f947a565cf393b9fe8500748e7409d26314b50c63684822ffa02e10e12
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.949207+00:00.
Case digest / 2f9be99c452522b1ccc8090a718dceb2b38f006aa818f7f0b46a6902800b9331