FA-94551 / Exam timetabling constraints / Open access
Front-load set built from the smallest exams · case 01
Small exams are pulled forward while the largest are ignored.
ROOT CAUSE
Exams are ranked by ascending size.
VERIFIED REPAIR
Rank by descending size, ties by exam id.
Unsuccessful approach: Breaking ties by period makes the chosen set depend on the timetable being judged.
Case contract
sizes exam -> candidates, period exam -> period index, n_periods, big = how many largest exams are front-loaded (ranked by size descending, ties by id), last = how many final periods to avoid. Return the sorted front-loaded exams scheduled in the final last periods and their count.
Why this case matters
Front-loading large exams gives markers time; it is a standard soft constraint.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sizes, period, n_periods, big, last):
ranked = sorted(sizes, key=lambda e: (sizes[e], e))[:big]
bad = sorted(e for e in ranked if period[e] >= n_periods - last)
return [bad, len(bad)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: rank direction 1', [{'A': 100, 'B': 50}, {'A': 8, 'B': 9}, 10, 1, 2], [['A'], 1]),
('regression variant: rank direction 2',
[{'MATH101': 20, 'MATH101H': 120, 'PHYS110': 80}, {'MATH101': 7, 'MATH101H': 4, 'PHYS110': 2}, 8, 1, 2],
[[], 0]),
('partial repair guard 3',
[{'MATH101': 80, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 120, 'BIO130': 80},
{'MATH101': 0, 'MATH101H': 3, 'PHYS110': 5, 'CHEM120': 3, 'BIO130': 5}, 8, 3, 3],
[['BIO130'], 1]),
('boundary control 4', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2], [['A', 'B'], 2]),
('normal control 5',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 80}, {'MATH101': 1, 'MATH101H': 5, 'PHYS110': 4}, 6, 1, 3],
[[], 0]),
('normal control 6',
[{'MATH101': 200, 'MATH101H': 80, 'PHYS110': 80}, {'MATH101': 9, 'MATH101H': 7, 'PHYS110': 2}, 10, 3, 2],
[['MATH101'], 1]),
('normal control 7',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 200, 'CHEM120': 20},
{'MATH101': 1, 'MATH101H': 3, 'PHYS110': 6, 'CHEM120': 7}, 10, 2, 3],
[[], 0]),
('normal control 8',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 50, 'CHEM120': 50, 'BIO130': 20, 'HIST140': 20},
{'MATH101': 1, 'MATH101H': 1, 'PHYS110': 0, 'CHEM120': 0, 'BIO130': 2, 'HIST140': 4}, 6, 2, 3],
[[], 0])],
[('regression: rank direction 1', [{'A': 100, 'B': 50}, {'A': 7, 'B': 9}, 10, 1, 2], [[], 0]),
('regression variant: rank direction 2',
[{'MATH101': 50, 'MATH101H': 200, 'PHYS110': 50}, {'MATH101': 5, 'MATH101H': 3, 'PHYS110': 0}, 6, 2, 3],
[['MATH101', 'MATH101H'], 2]),
('partial repair guard 3',
[{'MATH101': 80, 'MATH101H': 20, 'PHYS110': 120, 'CHEM120': 20, 'BIO130': 80, 'HIST140': 20},
{'MATH101': 3, 'MATH101H': 1, 'PHYS110': 4, 'CHEM120': 2, 'BIO130': 7, 'HIST140': 4}, 8, 2, 2],
[['BIO130'], 1]),
('boundary control 4', [{'A': 80, 'B': 80, 'C': 20}, {'A': 1, 'B': 9, 'C': 9}, 10, 1, 2], [[], 0]),
('boundary control 5', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2], [['A', 'B'], 2]),
('normal control 6',
[{'MATH101': 50, 'MATH101H': 200, 'PHYS110': 50, 'CHEM120': 20, 'BIO130': 80, 'HIST140': 120},
{'MATH101': 0, 'MATH101H': 1, 'PHYS110': 0, 'CHEM120': 4, 'BIO130': 7, 'HIST140': 9}, 10, 2, 3],
[['HIST140'], 1]),
('normal control 7',
[{'MATH101': 20,
'MATH101H': 80,
'PHYS110': 200,
'CHEM120': 120,
'BIO130': 80,
'HIST140': 200,
'ECON150': 120},
{'MATH101': 5, 'MATH101H': 3, 'PHYS110': 3, 'CHEM120': 0, 'BIO130': 5, 'HIST140': 3, 'ECON150': 5}, 6, 3,
3],
[['HIST140', 'PHYS110'], 2]),
('normal control 8',
[{'MATH101': 80, 'MATH101H': 20, 'PHYS110': 200}, {'MATH101': 0, 'MATH101H': 3, 'PHYS110': 2}, 8, 3, 2],
[[], 0])],
[('regression: rank direction 1', [{'A': 80, 'B': 80, 'C': 20}, {'A': 1, 'B': 9, 'C': 9}, 10, 1, 2],
[[], 0]),
('regression variant: rank direction 2',
[{'MATH101': 50,
'MATH101H': 80,
'PHYS110': 200,
'CHEM120': 50,
'BIO130': 200,
'HIST140': 120,
'ECON150': 50},
{'MATH101': 6, 'MATH101H': 1, 'PHYS110': 9, 'CHEM120': 5, 'BIO130': 3, 'HIST140': 0, 'ECON150': 1}, 10, 3,
2],
[['PHYS110'], 1]),
('partial repair guard 3',
[{'MATH101': 50, 'MATH101H': 80, 'PHYS110': 50, 'CHEM120': 80},
{'MATH101': 5, 'MATH101H': 4, 'PHYS110': 1, 'CHEM120': 4}, 6, 3, 3],
[['CHEM120', 'MATH101', 'MATH101H'], 3]),
('boundary control 4', [{'A': 100, 'B': 50}, {'A': 7, 'B': 9}, 10, 1, 2], [[], 0]),
('normal control 5',
[{'MATH101': 50, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 120},
{'MATH101': 6, 'MATH101H': 3, 'PHYS110': 3, 'CHEM120': 9}, 10, 3, 2],
[['CHEM120'], 1]),
('normal control 6',
[{'MATH101': 200, 'MATH101H': 50, 'PHYS110': 50, 'CHEM120': 80, 'BIO130': 80},
{'MATH101': 0, 'MATH101H': 9, 'PHYS110': 4, 'CHEM120': 2, 'BIO130': 3}, 10, 1, 2],
[[], 0]),
('normal control 7',
[{'MATH101': 50, 'MATH101H': 120, 'PHYS110': 50, 'CHEM120': 80, 'BIO130': 120},
{'MATH101': 3, 'MATH101H': 4, 'PHYS110': 5, 'CHEM120': 2, 'BIO130': 5}, 6, 1, 2],
[['BIO130'], 1]),
('normal control 8',
[{'MATH101': 20, 'MATH101H': 200, 'PHYS110': 120, 'CHEM120': 80, 'BIO130': 20, 'HIST140': 80},
{'MATH101': 0, 'MATH101H': 0, 'PHYS110': 2, 'CHEM120': 4, 'BIO130': 4, 'HIST140': 6}, 8, 1, 3],
[[], 0])],
[('regression: rank direction 1', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2],
[['A', 'B'], 2]),
('regression variant: rank direction 2',
[{'MATH101': 200, 'MATH101H': 200, 'PHYS110': 20, 'CHEM120': 120, 'BIO130': 50},
{'MATH101': 3, 'MATH101H': 4, 'PHYS110': 0, 'CHEM120': 3, 'BIO130': 5}, 6, 3, 2],
[['MATH101H'], 1]),
('partial repair guard 3',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 1, 'MATH101H': 4, 'PHYS110': 1, 'CHEM120': 3}, 6, 3, 3],
[['CHEM120', 'MATH101H'], 2]),
('boundary control 4', [{'A': 100, 'B': 50}, {'A': 8, 'B': 9}, 10, 1, 2], [['A'], 1]),
('boundary control 5', [{'A': 100, 'B': 50}, {'A': 7, 'B': 9}, 10, 1, 2], [[], 0]),
('normal control 6',
[{'MATH101': 50, 'MATH101H': 20, 'PHYS110': 50, 'CHEM120': 80},
{'MATH101': 4, 'MATH101H': 4, 'PHYS110': 4, 'CHEM120': 1}, 6, 1, 3],
[[], 0]),
('normal control 7',
[{'MATH101': 120, 'MATH101H': 120, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 0, 'MATH101H': 1, 'PHYS110': 2, 'CHEM120': 2}, 6, 2, 2],
[[], 0]),
('normal control 8',
[{'MATH101': 120, 'MATH101H': 20, 'PHYS110': 50}, {'MATH101': 0, 'MATH101H': 4, 'PHYS110': 1}, 6, 3, 2],
[['MATH101H'], 1])],
[('regression: rank direction 1',
[{'MATH101': 20, 'MATH101H': 80, 'PHYS110': 80}, {'MATH101': 7, 'MATH101H': 5, 'PHYS110': 3}, 8, 1, 3],
[['MATH101H'], 1]),
('regression variant: rank direction 2',
[{'MATH101': 80, 'MATH101H': 80, 'PHYS110': 50}, {'MATH101': 1, 'MATH101H': 4, 'PHYS110': 6}, 8, 2, 2],
[[], 0]),
('partial repair guard 3',
[{'MATH101': 80, 'MATH101H': 80, 'PHYS110': 20, 'CHEM120': 120, 'BIO130': 80, 'HIST140': 80},
{'MATH101': 4, 'MATH101H': 6, 'PHYS110': 3, 'CHEM120': 7, 'BIO130': 7, 'HIST140': 2}, 8, 3, 3],
[['BIO130', 'CHEM120'], 2]),
('boundary control 4', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2], [['A', 'B'], 2]),
('boundary control 5', [{'A': 100, 'B': 50}, {'A': 8, 'B': 9}, 10, 1, 2], [['A'], 1]),
('normal control 6',
[{'MATH101': 80, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 1, 'MATH101H': 6, 'PHYS110': 7, 'CHEM120': 7}, 8, 2, 2],
[['CHEM120'], 1]),
('normal control 7',
[{'MATH101': 80, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 1, 'MATH101H': 1, 'PHYS110': 2, 'CHEM120': 3}, 6, 3, 2],
[[], 0]),
('normal control 8',
[{'MATH101': 80, 'MATH101H': 200, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 3, 'MATH101H': 6, 'PHYS110': 5, 'CHEM120': 4}, 8, 2, 2],
[['MATH101H'], 1])]]
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: rank direction 1 | [['B'], 1] | [['A'], 1] | Failed |
| regression variant: rank direction 2 | [['MATH101'], 1] | [[], 0] | Failed |
| partial repair guard 3 | [['BIO130'], 1] | [['BIO130'], 1] | Passed |
| boundary control 4 | [['A', 'C'], 2] | [['A', 'B'], 2] | Failed |
| normal control 5 | [['MATH101H'], 1] | [[], 0] | Failed |
| normal control 6 | [['MATH101'], 1] | [['MATH101'], 1] | Passed |
| normal control 7 | [['CHEM120'], 1] | [[], 0] | Failed |
| normal control 8 | [['HIST140'], 1] | [[], 0] | Failed |
SHA-256 / 08d5c492753ac622598c3b59c5e6b99a1e4a26973865b34c1c6b42ca6dc29b94
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sizes, period, n_periods, big, last):
ranked = sorted(sizes, key=lambda e: (-sizes[e], period[e]))[:big]
bad = sorted(e for e in ranked if period[e] >= n_periods - last)
return [bad, len(bad)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: rank direction 1', [{'A': 100, 'B': 50}, {'A': 8, 'B': 9}, 10, 1, 2], [['A'], 1]),
('regression variant: rank direction 2',
[{'MATH101': 20, 'MATH101H': 120, 'PHYS110': 80}, {'MATH101': 7, 'MATH101H': 4, 'PHYS110': 2}, 8, 1, 2],
[[], 0]),
('partial repair guard 3',
[{'MATH101': 80, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 120, 'BIO130': 80},
{'MATH101': 0, 'MATH101H': 3, 'PHYS110': 5, 'CHEM120': 3, 'BIO130': 5}, 8, 3, 3],
[['BIO130'], 1]),
('boundary control 4', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2], [['A', 'B'], 2]),
('normal control 5',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 80}, {'MATH101': 1, 'MATH101H': 5, 'PHYS110': 4}, 6, 1, 3],
[[], 0]),
('normal control 6',
[{'MATH101': 200, 'MATH101H': 80, 'PHYS110': 80}, {'MATH101': 9, 'MATH101H': 7, 'PHYS110': 2}, 10, 3, 2],
[['MATH101'], 1]),
('normal control 7',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 200, 'CHEM120': 20},
{'MATH101': 1, 'MATH101H': 3, 'PHYS110': 6, 'CHEM120': 7}, 10, 2, 3],
[[], 0]),
('normal control 8',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 50, 'CHEM120': 50, 'BIO130': 20, 'HIST140': 20},
{'MATH101': 1, 'MATH101H': 1, 'PHYS110': 0, 'CHEM120': 0, 'BIO130': 2, 'HIST140': 4}, 6, 2, 3],
[[], 0])],
[('regression: rank direction 1', [{'A': 100, 'B': 50}, {'A': 7, 'B': 9}, 10, 1, 2], [[], 0]),
('regression variant: rank direction 2',
[{'MATH101': 50, 'MATH101H': 200, 'PHYS110': 50}, {'MATH101': 5, 'MATH101H': 3, 'PHYS110': 0}, 6, 2, 3],
[['MATH101', 'MATH101H'], 2]),
('partial repair guard 3',
[{'MATH101': 80, 'MATH101H': 20, 'PHYS110': 120, 'CHEM120': 20, 'BIO130': 80, 'HIST140': 20},
{'MATH101': 3, 'MATH101H': 1, 'PHYS110': 4, 'CHEM120': 2, 'BIO130': 7, 'HIST140': 4}, 8, 2, 2],
[['BIO130'], 1]),
('boundary control 4', [{'A': 80, 'B': 80, 'C': 20}, {'A': 1, 'B': 9, 'C': 9}, 10, 1, 2], [[], 0]),
('boundary control 5', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2], [['A', 'B'], 2]),
('normal control 6',
[{'MATH101': 50, 'MATH101H': 200, 'PHYS110': 50, 'CHEM120': 20, 'BIO130': 80, 'HIST140': 120},
{'MATH101': 0, 'MATH101H': 1, 'PHYS110': 0, 'CHEM120': 4, 'BIO130': 7, 'HIST140': 9}, 10, 2, 3],
[['HIST140'], 1]),
('normal control 7',
[{'MATH101': 20,
'MATH101H': 80,
'PHYS110': 200,
'CHEM120': 120,
'BIO130': 80,
'HIST140': 200,
'ECON150': 120},
{'MATH101': 5, 'MATH101H': 3, 'PHYS110': 3, 'CHEM120': 0, 'BIO130': 5, 'HIST140': 3, 'ECON150': 5}, 6, 3,
3],
[['HIST140', 'PHYS110'], 2]),
('normal control 8',
[{'MATH101': 80, 'MATH101H': 20, 'PHYS110': 200}, {'MATH101': 0, 'MATH101H': 3, 'PHYS110': 2}, 8, 3, 2],
[[], 0])],
[('regression: rank direction 1', [{'A': 80, 'B': 80, 'C': 20}, {'A': 1, 'B': 9, 'C': 9}, 10, 1, 2],
[[], 0]),
('regression variant: rank direction 2',
[{'MATH101': 50,
'MATH101H': 80,
'PHYS110': 200,
'CHEM120': 50,
'BIO130': 200,
'HIST140': 120,
'ECON150': 50},
{'MATH101': 6, 'MATH101H': 1, 'PHYS110': 9, 'CHEM120': 5, 'BIO130': 3, 'HIST140': 0, 'ECON150': 1}, 10, 3,
2],
[['PHYS110'], 1]),
('partial repair guard 3',
[{'MATH101': 50, 'MATH101H': 80, 'PHYS110': 50, 'CHEM120': 80},
{'MATH101': 5, 'MATH101H': 4, 'PHYS110': 1, 'CHEM120': 4}, 6, 3, 3],
[['CHEM120', 'MATH101', 'MATH101H'], 3]),
('boundary control 4', [{'A': 100, 'B': 50}, {'A': 7, 'B': 9}, 10, 1, 2], [[], 0]),
('normal control 5',
[{'MATH101': 50, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 120},
{'MATH101': 6, 'MATH101H': 3, 'PHYS110': 3, 'CHEM120': 9}, 10, 3, 2],
[['CHEM120'], 1]),
('normal control 6',
[{'MATH101': 200, 'MATH101H': 50, 'PHYS110': 50, 'CHEM120': 80, 'BIO130': 80},
{'MATH101': 0, 'MATH101H': 9, 'PHYS110': 4, 'CHEM120': 2, 'BIO130': 3}, 10, 1, 2],
[[], 0]),
('normal control 7',
[{'MATH101': 50, 'MATH101H': 120, 'PHYS110': 50, 'CHEM120': 80, 'BIO130': 120},
{'MATH101': 3, 'MATH101H': 4, 'PHYS110': 5, 'CHEM120': 2, 'BIO130': 5}, 6, 1, 2],
[['BIO130'], 1]),
('normal control 8',
[{'MATH101': 20, 'MATH101H': 200, 'PHYS110': 120, 'CHEM120': 80, 'BIO130': 20, 'HIST140': 80},
{'MATH101': 0, 'MATH101H': 0, 'PHYS110': 2, 'CHEM120': 4, 'BIO130': 4, 'HIST140': 6}, 8, 1, 3],
[[], 0])],
[('regression: rank direction 1', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2],
[['A', 'B'], 2]),
('regression variant: rank direction 2',
[{'MATH101': 200, 'MATH101H': 200, 'PHYS110': 20, 'CHEM120': 120, 'BIO130': 50},
{'MATH101': 3, 'MATH101H': 4, 'PHYS110': 0, 'CHEM120': 3, 'BIO130': 5}, 6, 3, 2],
[['MATH101H'], 1]),
('partial repair guard 3',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 1, 'MATH101H': 4, 'PHYS110': 1, 'CHEM120': 3}, 6, 3, 3],
[['CHEM120', 'MATH101H'], 2]),
('boundary control 4', [{'A': 100, 'B': 50}, {'A': 8, 'B': 9}, 10, 1, 2], [['A'], 1]),
('boundary control 5', [{'A': 100, 'B': 50}, {'A': 7, 'B': 9}, 10, 1, 2], [[], 0]),
('normal control 6',
[{'MATH101': 50, 'MATH101H': 20, 'PHYS110': 50, 'CHEM120': 80},
{'MATH101': 4, 'MATH101H': 4, 'PHYS110': 4, 'CHEM120': 1}, 6, 1, 3],
[[], 0]),
('normal control 7',
[{'MATH101': 120, 'MATH101H': 120, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 0, 'MATH101H': 1, 'PHYS110': 2, 'CHEM120': 2}, 6, 2, 2],
[[], 0]),
('normal control 8',
[{'MATH101': 120, 'MATH101H': 20, 'PHYS110': 50}, {'MATH101': 0, 'MATH101H': 4, 'PHYS110': 1}, 6, 3, 2],
[['MATH101H'], 1])],
[('regression: rank direction 1',
[{'MATH101': 20, 'MATH101H': 80, 'PHYS110': 80}, {'MATH101': 7, 'MATH101H': 5, 'PHYS110': 3}, 8, 1, 3],
[['MATH101H'], 1]),
('regression variant: rank direction 2',
[{'MATH101': 80, 'MATH101H': 80, 'PHYS110': 50}, {'MATH101': 1, 'MATH101H': 4, 'PHYS110': 6}, 8, 2, 2],
[[], 0]),
('partial repair guard 3',
[{'MATH101': 80, 'MATH101H': 80, 'PHYS110': 20, 'CHEM120': 120, 'BIO130': 80, 'HIST140': 80},
{'MATH101': 4, 'MATH101H': 6, 'PHYS110': 3, 'CHEM120': 7, 'BIO130': 7, 'HIST140': 2}, 8, 3, 3],
[['BIO130', 'CHEM120'], 2]),
('boundary control 4', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2], [['A', 'B'], 2]),
('boundary control 5', [{'A': 100, 'B': 50}, {'A': 8, 'B': 9}, 10, 1, 2], [['A'], 1]),
('normal control 6',
[{'MATH101': 80, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 1, 'MATH101H': 6, 'PHYS110': 7, 'CHEM120': 7}, 8, 2, 2],
[['CHEM120'], 1]),
('normal control 7',
[{'MATH101': 80, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 1, 'MATH101H': 1, 'PHYS110': 2, 'CHEM120': 3}, 6, 3, 2],
[[], 0]),
('normal control 8',
[{'MATH101': 80, 'MATH101H': 200, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 3, 'MATH101H': 6, 'PHYS110': 5, 'CHEM120': 4}, 8, 2, 2],
[['MATH101H'], 1])]]
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: rank direction 1 | [['A'], 1] | [['A'], 1] | Passed |
| regression variant: rank direction 2 | [[], 0] | [[], 0] | Passed |
| partial repair guard 3 | [['PHYS110'], 1] | [['BIO130'], 1] | Failed |
| boundary control 4 | [['A', 'B'], 2] | [['A', 'B'], 2] | Passed |
| normal control 5 | [[], 0] | [[], 0] | Passed |
| normal control 6 | [['MATH101'], 1] | [['MATH101'], 1] | Passed |
| normal control 7 | [[], 0] | [[], 0] | Passed |
| normal control 8 | [[], 0] | [[], 0] | Passed |
SHA-256 / b031bccb940fe796d44d520805fe6a72ed25e782a26b74b845bf6c4776d794a5
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sizes, period, n_periods, big, last):
ranked = sorted(sizes, key=lambda e: (-sizes[e], e))[:big]
bad = sorted(e for e in ranked if period[e] >= n_periods - last)
return [bad, len(bad)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: rank direction 1', [{'A': 100, 'B': 50}, {'A': 8, 'B': 9}, 10, 1, 2], [['A'], 1]),
('regression variant: rank direction 2',
[{'MATH101': 20, 'MATH101H': 120, 'PHYS110': 80}, {'MATH101': 7, 'MATH101H': 4, 'PHYS110': 2}, 8, 1, 2],
[[], 0]),
('partial repair guard 3',
[{'MATH101': 80, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 120, 'BIO130': 80},
{'MATH101': 0, 'MATH101H': 3, 'PHYS110': 5, 'CHEM120': 3, 'BIO130': 5}, 8, 3, 3],
[['BIO130'], 1]),
('boundary control 4', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2], [['A', 'B'], 2]),
('normal control 5',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 80}, {'MATH101': 1, 'MATH101H': 5, 'PHYS110': 4}, 6, 1, 3],
[[], 0]),
('normal control 6',
[{'MATH101': 200, 'MATH101H': 80, 'PHYS110': 80}, {'MATH101': 9, 'MATH101H': 7, 'PHYS110': 2}, 10, 3, 2],
[['MATH101'], 1]),
('normal control 7',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 200, 'CHEM120': 20},
{'MATH101': 1, 'MATH101H': 3, 'PHYS110': 6, 'CHEM120': 7}, 10, 2, 3],
[[], 0]),
('normal control 8',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 50, 'CHEM120': 50, 'BIO130': 20, 'HIST140': 20},
{'MATH101': 1, 'MATH101H': 1, 'PHYS110': 0, 'CHEM120': 0, 'BIO130': 2, 'HIST140': 4}, 6, 2, 3],
[[], 0])],
[('regression: rank direction 1', [{'A': 100, 'B': 50}, {'A': 7, 'B': 9}, 10, 1, 2], [[], 0]),
('regression variant: rank direction 2',
[{'MATH101': 50, 'MATH101H': 200, 'PHYS110': 50}, {'MATH101': 5, 'MATH101H': 3, 'PHYS110': 0}, 6, 2, 3],
[['MATH101', 'MATH101H'], 2]),
('partial repair guard 3',
[{'MATH101': 80, 'MATH101H': 20, 'PHYS110': 120, 'CHEM120': 20, 'BIO130': 80, 'HIST140': 20},
{'MATH101': 3, 'MATH101H': 1, 'PHYS110': 4, 'CHEM120': 2, 'BIO130': 7, 'HIST140': 4}, 8, 2, 2],
[['BIO130'], 1]),
('boundary control 4', [{'A': 80, 'B': 80, 'C': 20}, {'A': 1, 'B': 9, 'C': 9}, 10, 1, 2], [[], 0]),
('boundary control 5', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2], [['A', 'B'], 2]),
('normal control 6',
[{'MATH101': 50, 'MATH101H': 200, 'PHYS110': 50, 'CHEM120': 20, 'BIO130': 80, 'HIST140': 120},
{'MATH101': 0, 'MATH101H': 1, 'PHYS110': 0, 'CHEM120': 4, 'BIO130': 7, 'HIST140': 9}, 10, 2, 3],
[['HIST140'], 1]),
('normal control 7',
[{'MATH101': 20,
'MATH101H': 80,
'PHYS110': 200,
'CHEM120': 120,
'BIO130': 80,
'HIST140': 200,
'ECON150': 120},
{'MATH101': 5, 'MATH101H': 3, 'PHYS110': 3, 'CHEM120': 0, 'BIO130': 5, 'HIST140': 3, 'ECON150': 5}, 6, 3,
3],
[['HIST140', 'PHYS110'], 2]),
('normal control 8',
[{'MATH101': 80, 'MATH101H': 20, 'PHYS110': 200}, {'MATH101': 0, 'MATH101H': 3, 'PHYS110': 2}, 8, 3, 2],
[[], 0])],
[('regression: rank direction 1', [{'A': 80, 'B': 80, 'C': 20}, {'A': 1, 'B': 9, 'C': 9}, 10, 1, 2],
[[], 0]),
('regression variant: rank direction 2',
[{'MATH101': 50,
'MATH101H': 80,
'PHYS110': 200,
'CHEM120': 50,
'BIO130': 200,
'HIST140': 120,
'ECON150': 50},
{'MATH101': 6, 'MATH101H': 1, 'PHYS110': 9, 'CHEM120': 5, 'BIO130': 3, 'HIST140': 0, 'ECON150': 1}, 10, 3,
2],
[['PHYS110'], 1]),
('partial repair guard 3',
[{'MATH101': 50, 'MATH101H': 80, 'PHYS110': 50, 'CHEM120': 80},
{'MATH101': 5, 'MATH101H': 4, 'PHYS110': 1, 'CHEM120': 4}, 6, 3, 3],
[['CHEM120', 'MATH101', 'MATH101H'], 3]),
('boundary control 4', [{'A': 100, 'B': 50}, {'A': 7, 'B': 9}, 10, 1, 2], [[], 0]),
('normal control 5',
[{'MATH101': 50, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 120},
{'MATH101': 6, 'MATH101H': 3, 'PHYS110': 3, 'CHEM120': 9}, 10, 3, 2],
[['CHEM120'], 1]),
('normal control 6',
[{'MATH101': 200, 'MATH101H': 50, 'PHYS110': 50, 'CHEM120': 80, 'BIO130': 80},
{'MATH101': 0, 'MATH101H': 9, 'PHYS110': 4, 'CHEM120': 2, 'BIO130': 3}, 10, 1, 2],
[[], 0]),
('normal control 7',
[{'MATH101': 50, 'MATH101H': 120, 'PHYS110': 50, 'CHEM120': 80, 'BIO130': 120},
{'MATH101': 3, 'MATH101H': 4, 'PHYS110': 5, 'CHEM120': 2, 'BIO130': 5}, 6, 1, 2],
[['BIO130'], 1]),
('normal control 8',
[{'MATH101': 20, 'MATH101H': 200, 'PHYS110': 120, 'CHEM120': 80, 'BIO130': 20, 'HIST140': 80},
{'MATH101': 0, 'MATH101H': 0, 'PHYS110': 2, 'CHEM120': 4, 'BIO130': 4, 'HIST140': 6}, 8, 1, 3],
[[], 0])],
[('regression: rank direction 1', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2],
[['A', 'B'], 2]),
('regression variant: rank direction 2',
[{'MATH101': 200, 'MATH101H': 200, 'PHYS110': 20, 'CHEM120': 120, 'BIO130': 50},
{'MATH101': 3, 'MATH101H': 4, 'PHYS110': 0, 'CHEM120': 3, 'BIO130': 5}, 6, 3, 2],
[['MATH101H'], 1]),
('partial repair guard 3',
[{'MATH101': 120, 'MATH101H': 80, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 1, 'MATH101H': 4, 'PHYS110': 1, 'CHEM120': 3}, 6, 3, 3],
[['CHEM120', 'MATH101H'], 2]),
('boundary control 4', [{'A': 100, 'B': 50}, {'A': 8, 'B': 9}, 10, 1, 2], [['A'], 1]),
('boundary control 5', [{'A': 100, 'B': 50}, {'A': 7, 'B': 9}, 10, 1, 2], [[], 0]),
('normal control 6',
[{'MATH101': 50, 'MATH101H': 20, 'PHYS110': 50, 'CHEM120': 80},
{'MATH101': 4, 'MATH101H': 4, 'PHYS110': 4, 'CHEM120': 1}, 6, 1, 3],
[[], 0]),
('normal control 7',
[{'MATH101': 120, 'MATH101H': 120, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 0, 'MATH101H': 1, 'PHYS110': 2, 'CHEM120': 2}, 6, 2, 2],
[[], 0]),
('normal control 8',
[{'MATH101': 120, 'MATH101H': 20, 'PHYS110': 50}, {'MATH101': 0, 'MATH101H': 4, 'PHYS110': 1}, 6, 3, 2],
[['MATH101H'], 1])],
[('regression: rank direction 1',
[{'MATH101': 20, 'MATH101H': 80, 'PHYS110': 80}, {'MATH101': 7, 'MATH101H': 5, 'PHYS110': 3}, 8, 1, 3],
[['MATH101H'], 1]),
('regression variant: rank direction 2',
[{'MATH101': 80, 'MATH101H': 80, 'PHYS110': 50}, {'MATH101': 1, 'MATH101H': 4, 'PHYS110': 6}, 8, 2, 2],
[[], 0]),
('partial repair guard 3',
[{'MATH101': 80, 'MATH101H': 80, 'PHYS110': 20, 'CHEM120': 120, 'BIO130': 80, 'HIST140': 80},
{'MATH101': 4, 'MATH101H': 6, 'PHYS110': 3, 'CHEM120': 7, 'BIO130': 7, 'HIST140': 2}, 8, 3, 3],
[['BIO130', 'CHEM120'], 2]),
('boundary control 4', [{'A': 80, 'B': 80, 'C': 20}, {'A': 9, 'B': 9, 'C': 9}, 10, 2, 2], [['A', 'B'], 2]),
('boundary control 5', [{'A': 100, 'B': 50}, {'A': 8, 'B': 9}, 10, 1, 2], [['A'], 1]),
('normal control 6',
[{'MATH101': 80, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 1, 'MATH101H': 6, 'PHYS110': 7, 'CHEM120': 7}, 8, 2, 2],
[['CHEM120'], 1]),
('normal control 7',
[{'MATH101': 80, 'MATH101H': 50, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 1, 'MATH101H': 1, 'PHYS110': 2, 'CHEM120': 3}, 6, 3, 2],
[[], 0]),
('normal control 8',
[{'MATH101': 80, 'MATH101H': 200, 'PHYS110': 80, 'CHEM120': 80},
{'MATH101': 3, 'MATH101H': 6, 'PHYS110': 5, 'CHEM120': 4}, 8, 2, 2],
[['MATH101H'], 1])]]
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: rank direction 1 | [['A'], 1] | [['A'], 1] | Passed |
| regression variant: rank direction 2 | [[], 0] | [[], 0] | Passed |
| partial repair guard 3 | [['BIO130'], 1] | [['BIO130'], 1] | Passed |
| boundary control 4 | [['A', 'B'], 2] | [['A', 'B'], 2] | Passed |
| normal control 5 | [[], 0] | [[], 0] | Passed |
| normal control 6 | [['MATH101'], 1] | [['MATH101'], 1] | Passed |
| normal control 7 | [[], 0] | [[], 0] | Passed |
| normal control 8 | [[], 0] | [[], 0] | Passed |
SHA-256 / 48b2ad08992abd2bcf7fef07e74876b999f9f79003ae0e17bec9e773efe8c728
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:05.398120+00:00.
Case digest / fac2ce91795e2a1ab18b2f03d45782d7903b3a4753b05059ed3f113da9bc2ba1