FAILURE MAP
← Case archive

FA-94676 / Exam timetabling constraints / Open access

Second sitting ending exactly at close flagged infeasible · case 01

Sittings that finish at the building closing time are rejected.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The feasibility test is strict.

VERIFIED REPAIR

The second exam may end at day_end.

Unsuccessful approach: Checking only the start time accepts sittings that overrun.

Case contract

Each clash [student, exam a, exam b] shares a start time. The longer exam is sat first (ties by id), then a 15-minute supervised break, then the second exam. Return [student, first, second, second start, whether the second exam ends by day_end (inclusive)].

Why this case matters

Clash resolution by supervised sequential sitting is a standard timetabling fallback.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(clashes, dur, start, day_end):
    out = []
    for st, a, b in clashes:
        first, second = sorted([a, b], key=lambda e: (-dur[e], e))
        s2 = start + dur[first] + 15
        out.append([st, first, second, s2, s2 + dur[second] < day_end])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 600, 855],
   [['s1', 'A', 'B', 735, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('partial repair guard 3',
   [[['s4', 'PHYS110', 'MATH101H']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 180,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 90,
     'ECON150': 90},
    780, 1020],
   [['s4', 'PHYS110', 'MATH101H', 975, False]]),
  ('boundary control 4', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 840, 1080],
   [['s1', 'A', 'B', 1035, False]]),
  ('boundary control 5', [[['s1', 'A', 'B']], {'A': 120, 'B': 180}, 600, 1080],
   [['s1', 'B', 'A', 795, True]]),
  ('normal control 6',
   [[['s1', 'BIO130', 'PHYS110'], ['s4', 'PHYS110', 'CHEM120'], ['s2', 'MATH101H', 'MATH101']],
    {'MATH101': 180,
     'MATH101H': 90,
     'PHYS110': 60,
     'CHEM120': 120,
     'BIO130': 120,
     'HIST140': 180,
     'ECON150': 120},
    600, 1020],
   [['s1', 'BIO130', 'PHYS110', 735, True], ['s4', 'CHEM120', 'PHYS110', 735, True],
    ['s2', 'MATH101', 'MATH101H', 795, True]]),
  ('normal control 7',
   [[['s2', 'HIST140', 'BIO130'], ['s5', 'PHYS110', 'CHEM120']],
    {'MATH101': 180,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 60,
     'BIO130': 60,
     'HIST140': 180,
     'ECON150': 120},
    840, 1020],
   [['s2', 'HIST140', 'BIO130', 1035, False], ['s5', 'PHYS110', 'CHEM120', 1035, False]]),
  ('normal control 8',
   [[['s2', 'MATH101H', 'PHYS110']],
    {'MATH101': 90, 'MATH101H': 60, 'PHYS110': 90, 'CHEM120': 90, 'BIO130': 60, 'HIST140': 60, 'ECON150': 60},
    600, 1080],
   [['s2', 'PHYS110', 'MATH101H', 705, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 780, 1035],
   [['s1', 'A', 'B', 915, True]]),
  ('partial repair guard 3',
   [[['s2', 'BIO130', 'ECON150'], ['s4', 'ECON150', 'MATH101']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 120,
     'ECON150': 120},
    780, 1020],
   [['s2', 'BIO130', 'ECON150', 975, False], ['s4', 'MATH101', 'ECON150', 975, False]]),
  ('boundary control 4', [[['s3', 'A', 'B'], ['s1', 'A', 'B']], {'A': 60, 'B': 90}, 780, 1020],
   [['s3', 'B', 'A', 885, True], ['s1', 'B', 'A', 885, True]]),
  ('boundary control 5', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 840, 1080],
   [['s1', 'A', 'B', 1035, False]]),
  ('normal control 6',
   [[['s3', 'MATH101', 'CHEM120'], ['s1', 'MATH101H', 'BIO130'], ['s4', 'PHYS110', 'CHEM120']],
    {'MATH101': 60,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 180,
     'BIO130': 120,
     'HIST140': 90,
     'ECON150': 120},
    840, 1080],
   [['s3', 'CHEM120', 'MATH101', 1035, False], ['s1', 'BIO130', 'MATH101H', 975, False],
    ['s4', 'CHEM120', 'PHYS110', 1035, False]]),
  ('normal control 7',
   [[['s5', 'PHYS110', 'BIO130'], ['s5', 'MATH101', 'BIO130']],
    {'MATH101': 90,
     'MATH101H': 60,
     'PHYS110': 120,
     'CHEM120': 120,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 180},
    540, 1020],
   [['s5', 'BIO130', 'PHYS110', 735, True], ['s5', 'BIO130', 'MATH101', 735, True]]),
  ('normal control 8',
   [[['s2', 'HIST140', 'BIO130'], ['s2', 'ECON150', 'CHEM120']],
    {'MATH101': 90,
     'MATH101H': 180,
     'PHYS110': 180,
     'CHEM120': 60,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 120},
    840, 1080],
   [['s2', 'BIO130', 'HIST140', 1035, False], ['s2', 'ECON150', 'CHEM120', 975, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 780, 1035],
   [['s1', 'A', 'B', 915, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 600, 855],
   [['s1', 'A', 'B', 735, True]]),
  ('partial repair guard 3',
   [[['s4', 'HIST140', 'MATH101H']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 90,
     'CHEM120': 60,
     'BIO130': 120,
     'HIST140': 180,
     'ECON150': 120},
    780, 1080],
   [['s4', 'HIST140', 'MATH101H', 975, False]]),
  ('boundary control 4', [[['s3', 'A', 'B'], ['s1', 'A', 'B']], {'A': 60, 'B': 90}, 780, 1020],
   [['s3', 'B', 'A', 885, True], ['s1', 'B', 'A', 885, True]]),
  ('normal control 5',
   [[['s3', 'BIO130', 'HIST140']],
    {'MATH101': 90,
     'MATH101H': 90,
     'PHYS110': 90,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 60,
     'ECON150': 90},
    780, 1020],
   [['s3', 'BIO130', 'HIST140', 975, False]]),
  ('normal control 6',
   [[['s3', 'MATH101H', 'MATH101'], ['s4', 'ECON150', 'MATH101H'], ['s2', 'CHEM120', 'ECON150']],
    {'MATH101': 180,
     'MATH101H': 180,
     'PHYS110': 120,
     'CHEM120': 120,
     'BIO130': 60,
     'HIST140': 120,
     'ECON150': 180},
    780, 1080],
   [['s3', 'MATH101', 'MATH101H', 975, False], ['s4', 'ECON150', 'MATH101H', 975, False],
    ['s2', 'ECON150', 'CHEM120', 975, False]]),
  ('normal control 7',
   [[['s4', 'MATH101H', 'ECON150'], ['s3', 'PHYS110', 'BIO130'], ['s5', 'HIST140', 'MATH101']],
    {'MATH101': 90,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 60,
     'ECON150': 60},
    540, 1020],
   [['s4', 'ECON150', 'MATH101H', 615, True], ['s3', 'PHYS110', 'BIO130', 735, True],
    ['s5', 'MATH101', 'HIST140', 645, True]]),
  ('normal control 8',
   [[['s4', 'HIST140', 'PHYS110'], ['s2', 'PHYS110', 'MATH101']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 90,
     'CHEM120': 180,
     'BIO130': 120,
     'HIST140': 120,
     'ECON150': 180},
    600, 1080],
   [['s4', 'HIST140', 'PHYS110', 735, True], ['s2', 'MATH101', 'PHYS110', 795, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 600, 855],
   [['s1', 'A', 'B', 735, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('partial repair guard 3',
   [[['s3', 'PHYS110', 'MATH101H'], ['s3', 'ECON150', 'HIST140']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 120,
     'CHEM120': 60,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 120},
    840, 1080],
   [['s3', 'PHYS110', 'MATH101H', 975, True], ['s3', 'HIST140', 'ECON150', 1035, False]]),
  ('normal control 4',
   [[['s2', 'ECON150', 'MATH101H'], ['s1', 'MATH101', 'MATH101H']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 180,
     'BIO130': 90,
     'HIST140': 60,
     'ECON150': 90},
    840, 1020],
   [['s2', 'MATH101H', 'ECON150', 975, False], ['s1', 'MATH101', 'MATH101H', 1035, False]]),
  ('normal control 5',
   [[['s1', 'MATH101H', 'ECON150'], ['s2', 'ECON150', 'MATH101H'], ['s3', 'PHYS110', 'HIST140']],
    {'MATH101': 90,
     'MATH101H': 90,
     'PHYS110': 60,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 120},
    840, 1020],
   [['s1', 'ECON150', 'MATH101H', 975, False], ['s2', 'ECON150', 'MATH101H', 975, False],
    ['s3', 'HIST140', 'PHYS110', 1035, False]]),
  ('normal control 6',
   [[['s4', 'CHEM120', 'HIST140']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 120,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 90,
     'ECON150': 60},
    600, 1080],
   [['s4', 'CHEM120', 'HIST140', 705, True]]),
  ('normal control 7',
   [[['s1', 'MATH101', 'PHYS110'], ['s2', 'PHYS110', 'BIO130'], ['s2', 'MATH101H', 'PHYS110']],
    {'MATH101': 90,
     'MATH101H': 180,
     'PHYS110': 60,
     'CHEM120': 180,
     'BIO130': 90,
     'HIST140': 120,
     'ECON150': 120},
    600, 1080],
   [['s1', 'MATH101', 'PHYS110', 705, True], ['s2', 'BIO130', 'PHYS110', 705, True],
    ['s2', 'MATH101H', 'PHYS110', 795, True]]),
  ('normal control 8',
   [[['s4', 'MATH101H', 'ECON150'], ['s3', 'PHYS110', 'BIO130'], ['s5', 'HIST140', 'MATH101']],
    {'MATH101': 90,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 60,
     'ECON150': 60},
    540, 1020],
   [['s4', 'ECON150', 'MATH101H', 615, True], ['s3', 'PHYS110', 'BIO130', 735, True],
    ['s5', 'MATH101', 'HIST140', 645, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 780, 1035],
   [['s1', 'A', 'B', 915, True]]),
  ('partial repair guard 3',
   [[['s1', 'ECON150', 'CHEM120'], ['s2', 'PHYS110', 'MATH101'], ['s4', 'BIO130', 'ECON150']],
    {'MATH101': 60,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 120,
     'ECON150': 180},
    840, 1020],
   [['s1', 'ECON150', 'CHEM120', 1035, False], ['s2', 'PHYS110', 'MATH101', 975, False],
    ['s4', 'BIO130', 'ECON150', 1035, False]]),
  ('normal control 4',
   [[['s3', 'HIST140', 'BIO130'], ['s4', 'ECON150', 'HIST140']],
    {'MATH101': 60,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 180,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 60},
    600, 1020],
   [['s3', 'BIO130', 'HIST140', 795, True], ['s4', 'HIST140', 'ECON150', 795, True]]),
  ('normal control 5',
   [[['s2', 'BIO130', 'ECON150']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 90,
     'CHEM120': 120,
     'BIO130': 180,
     'HIST140': 90,
     'ECON150': 180},
    540, 1020],
   [['s2', 'BIO130', 'ECON150', 735, True]]),
  ('normal control 6',
   [[['s2', 'PHYS110', 'CHEM120'], ['s5', 'PHYS110', 'ECON150'], ['s5', 'BIO130', 'MATH101H']],
    {'MATH101': 90,
     'MATH101H': 180,
     'PHYS110': 60,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 120,
     'ECON150': 60},
    840, 1080],
   [['s2', 'CHEM120', 'PHYS110', 945, True], ['s5', 'ECON150', 'PHYS110', 915, True],
    ['s5', 'BIO130', 'MATH101H', 1035, False]]),
  ('normal control 7',
   [[['s5', 'MATH101H', 'BIO130'], ['s2', 'HIST140', 'MATH101'], ['s1', 'MATH101H', 'HIST140']],
    {'MATH101': 60,
     'MATH101H': 90,
     'PHYS110': 120,
     'CHEM120': 120,
     'BIO130': 90,
     'HIST140': 180,
     'ECON150': 60},
    780, 1020],
   [['s5', 'BIO130', 'MATH101H', 885, True], ['s2', 'HIST140', 'MATH101', 975, False],
    ['s1', 'HIST140', 'MATH101H', 975, False]]),
  ('normal control 8',
   [[['s1', 'BIO130', 'MATH101H']],
    {'MATH101': 180,
     'MATH101H': 60,
     'PHYS110': 60,
     'CHEM120': 180,
     'BIO130': 60,
     'HIST140': 90,
     'ECON150': 120},
    600, 1080],
   [['s1', 'BIO130', 'MATH101H', 675, True]])]]
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 fixtureActualExpectedOutcome
regression: day end inclusive 1[['s1', 'A', 'B', 735, False]][['s1', 'A', 'B', 735, True]]Failed
regression variant: day end inclusive 2[['s1', 'A', 'B', 795, False]][['s1', 'A', 'B', 795, True]]Failed
partial repair guard 3[['s4', 'PHYS110', 'MATH101H', 975, False]][['s4', 'PHYS110', 'MATH101H', 975, False]]Passed
boundary control 4[['s1', 'A', 'B', 1035, False]][['s1', 'A', 'B', 1035, False]]Passed
boundary control 5[['s1', 'B', 'A', 795, True]][['s1', 'B', 'A', 795, True]]Passed
normal control 6[['s1', 'BIO130', 'PHYS110', 735, True], ['s4', 'CHEM120', 'PHYS110', 735, True], ['s2', 'MATH101', 'MATH101H', 795, True]][['s1', 'BIO130', 'PHYS110', 735, True], ['s4', 'CHEM120', 'PHYS110', 735, True], ['s2', 'MATH101', 'MATH101H', 795, True]]Passed
normal control 7[['s2', 'HIST140', 'BIO130', 1035, False], ['s5', 'PHYS110', 'CHEM120', 1035, False]][['s2', 'HIST140', 'BIO130', 1035, False], ['s5', 'PHYS110', 'CHEM120', 1035, False]]Passed
normal control 8[['s2', 'PHYS110', 'MATH101H', 705, True]][['s2', 'PHYS110', 'MATH101H', 705, True]]Passed

SHA-256 / fba0486a2abaa68d03b766887d42d684f98cf0282f1a46d165b47a81b19fee99

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(clashes, dur, start, day_end):
    out = []
    for st, a, b in clashes:
        first, second = sorted([a, b], key=lambda e: (-dur[e], e))
        s2 = start + dur[first] + 15
        out.append([st, first, second, s2, s2 <= day_end])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 600, 855],
   [['s1', 'A', 'B', 735, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('partial repair guard 3',
   [[['s4', 'PHYS110', 'MATH101H']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 180,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 90,
     'ECON150': 90},
    780, 1020],
   [['s4', 'PHYS110', 'MATH101H', 975, False]]),
  ('boundary control 4', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 840, 1080],
   [['s1', 'A', 'B', 1035, False]]),
  ('boundary control 5', [[['s1', 'A', 'B']], {'A': 120, 'B': 180}, 600, 1080],
   [['s1', 'B', 'A', 795, True]]),
  ('normal control 6',
   [[['s1', 'BIO130', 'PHYS110'], ['s4', 'PHYS110', 'CHEM120'], ['s2', 'MATH101H', 'MATH101']],
    {'MATH101': 180,
     'MATH101H': 90,
     'PHYS110': 60,
     'CHEM120': 120,
     'BIO130': 120,
     'HIST140': 180,
     'ECON150': 120},
    600, 1020],
   [['s1', 'BIO130', 'PHYS110', 735, True], ['s4', 'CHEM120', 'PHYS110', 735, True],
    ['s2', 'MATH101', 'MATH101H', 795, True]]),
  ('normal control 7',
   [[['s2', 'HIST140', 'BIO130'], ['s5', 'PHYS110', 'CHEM120']],
    {'MATH101': 180,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 60,
     'BIO130': 60,
     'HIST140': 180,
     'ECON150': 120},
    840, 1020],
   [['s2', 'HIST140', 'BIO130', 1035, False], ['s5', 'PHYS110', 'CHEM120', 1035, False]]),
  ('normal control 8',
   [[['s2', 'MATH101H', 'PHYS110']],
    {'MATH101': 90, 'MATH101H': 60, 'PHYS110': 90, 'CHEM120': 90, 'BIO130': 60, 'HIST140': 60, 'ECON150': 60},
    600, 1080],
   [['s2', 'PHYS110', 'MATH101H', 705, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 780, 1035],
   [['s1', 'A', 'B', 915, True]]),
  ('partial repair guard 3',
   [[['s2', 'BIO130', 'ECON150'], ['s4', 'ECON150', 'MATH101']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 120,
     'ECON150': 120},
    780, 1020],
   [['s2', 'BIO130', 'ECON150', 975, False], ['s4', 'MATH101', 'ECON150', 975, False]]),
  ('boundary control 4', [[['s3', 'A', 'B'], ['s1', 'A', 'B']], {'A': 60, 'B': 90}, 780, 1020],
   [['s3', 'B', 'A', 885, True], ['s1', 'B', 'A', 885, True]]),
  ('boundary control 5', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 840, 1080],
   [['s1', 'A', 'B', 1035, False]]),
  ('normal control 6',
   [[['s3', 'MATH101', 'CHEM120'], ['s1', 'MATH101H', 'BIO130'], ['s4', 'PHYS110', 'CHEM120']],
    {'MATH101': 60,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 180,
     'BIO130': 120,
     'HIST140': 90,
     'ECON150': 120},
    840, 1080],
   [['s3', 'CHEM120', 'MATH101', 1035, False], ['s1', 'BIO130', 'MATH101H', 975, False],
    ['s4', 'CHEM120', 'PHYS110', 1035, False]]),
  ('normal control 7',
   [[['s5', 'PHYS110', 'BIO130'], ['s5', 'MATH101', 'BIO130']],
    {'MATH101': 90,
     'MATH101H': 60,
     'PHYS110': 120,
     'CHEM120': 120,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 180},
    540, 1020],
   [['s5', 'BIO130', 'PHYS110', 735, True], ['s5', 'BIO130', 'MATH101', 735, True]]),
  ('normal control 8',
   [[['s2', 'HIST140', 'BIO130'], ['s2', 'ECON150', 'CHEM120']],
    {'MATH101': 90,
     'MATH101H': 180,
     'PHYS110': 180,
     'CHEM120': 60,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 120},
    840, 1080],
   [['s2', 'BIO130', 'HIST140', 1035, False], ['s2', 'ECON150', 'CHEM120', 975, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 780, 1035],
   [['s1', 'A', 'B', 915, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 600, 855],
   [['s1', 'A', 'B', 735, True]]),
  ('partial repair guard 3',
   [[['s4', 'HIST140', 'MATH101H']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 90,
     'CHEM120': 60,
     'BIO130': 120,
     'HIST140': 180,
     'ECON150': 120},
    780, 1080],
   [['s4', 'HIST140', 'MATH101H', 975, False]]),
  ('boundary control 4', [[['s3', 'A', 'B'], ['s1', 'A', 'B']], {'A': 60, 'B': 90}, 780, 1020],
   [['s3', 'B', 'A', 885, True], ['s1', 'B', 'A', 885, True]]),
  ('normal control 5',
   [[['s3', 'BIO130', 'HIST140']],
    {'MATH101': 90,
     'MATH101H': 90,
     'PHYS110': 90,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 60,
     'ECON150': 90},
    780, 1020],
   [['s3', 'BIO130', 'HIST140', 975, False]]),
  ('normal control 6',
   [[['s3', 'MATH101H', 'MATH101'], ['s4', 'ECON150', 'MATH101H'], ['s2', 'CHEM120', 'ECON150']],
    {'MATH101': 180,
     'MATH101H': 180,
     'PHYS110': 120,
     'CHEM120': 120,
     'BIO130': 60,
     'HIST140': 120,
     'ECON150': 180},
    780, 1080],
   [['s3', 'MATH101', 'MATH101H', 975, False], ['s4', 'ECON150', 'MATH101H', 975, False],
    ['s2', 'ECON150', 'CHEM120', 975, False]]),
  ('normal control 7',
   [[['s4', 'MATH101H', 'ECON150'], ['s3', 'PHYS110', 'BIO130'], ['s5', 'HIST140', 'MATH101']],
    {'MATH101': 90,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 60,
     'ECON150': 60},
    540, 1020],
   [['s4', 'ECON150', 'MATH101H', 615, True], ['s3', 'PHYS110', 'BIO130', 735, True],
    ['s5', 'MATH101', 'HIST140', 645, True]]),
  ('normal control 8',
   [[['s4', 'HIST140', 'PHYS110'], ['s2', 'PHYS110', 'MATH101']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 90,
     'CHEM120': 180,
     'BIO130': 120,
     'HIST140': 120,
     'ECON150': 180},
    600, 1080],
   [['s4', 'HIST140', 'PHYS110', 735, True], ['s2', 'MATH101', 'PHYS110', 795, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 600, 855],
   [['s1', 'A', 'B', 735, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('partial repair guard 3',
   [[['s3', 'PHYS110', 'MATH101H'], ['s3', 'ECON150', 'HIST140']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 120,
     'CHEM120': 60,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 120},
    840, 1080],
   [['s3', 'PHYS110', 'MATH101H', 975, True], ['s3', 'HIST140', 'ECON150', 1035, False]]),
  ('normal control 4',
   [[['s2', 'ECON150', 'MATH101H'], ['s1', 'MATH101', 'MATH101H']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 180,
     'BIO130': 90,
     'HIST140': 60,
     'ECON150': 90},
    840, 1020],
   [['s2', 'MATH101H', 'ECON150', 975, False], ['s1', 'MATH101', 'MATH101H', 1035, False]]),
  ('normal control 5',
   [[['s1', 'MATH101H', 'ECON150'], ['s2', 'ECON150', 'MATH101H'], ['s3', 'PHYS110', 'HIST140']],
    {'MATH101': 90,
     'MATH101H': 90,
     'PHYS110': 60,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 120},
    840, 1020],
   [['s1', 'ECON150', 'MATH101H', 975, False], ['s2', 'ECON150', 'MATH101H', 975, False],
    ['s3', 'HIST140', 'PHYS110', 1035, False]]),
  ('normal control 6',
   [[['s4', 'CHEM120', 'HIST140']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 120,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 90,
     'ECON150': 60},
    600, 1080],
   [['s4', 'CHEM120', 'HIST140', 705, True]]),
  ('normal control 7',
   [[['s1', 'MATH101', 'PHYS110'], ['s2', 'PHYS110', 'BIO130'], ['s2', 'MATH101H', 'PHYS110']],
    {'MATH101': 90,
     'MATH101H': 180,
     'PHYS110': 60,
     'CHEM120': 180,
     'BIO130': 90,
     'HIST140': 120,
     'ECON150': 120},
    600, 1080],
   [['s1', 'MATH101', 'PHYS110', 705, True], ['s2', 'BIO130', 'PHYS110', 705, True],
    ['s2', 'MATH101H', 'PHYS110', 795, True]]),
  ('normal control 8',
   [[['s4', 'MATH101H', 'ECON150'], ['s3', 'PHYS110', 'BIO130'], ['s5', 'HIST140', 'MATH101']],
    {'MATH101': 90,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 60,
     'ECON150': 60},
    540, 1020],
   [['s4', 'ECON150', 'MATH101H', 615, True], ['s3', 'PHYS110', 'BIO130', 735, True],
    ['s5', 'MATH101', 'HIST140', 645, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 780, 1035],
   [['s1', 'A', 'B', 915, True]]),
  ('partial repair guard 3',
   [[['s1', 'ECON150', 'CHEM120'], ['s2', 'PHYS110', 'MATH101'], ['s4', 'BIO130', 'ECON150']],
    {'MATH101': 60,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 120,
     'ECON150': 180},
    840, 1020],
   [['s1', 'ECON150', 'CHEM120', 1035, False], ['s2', 'PHYS110', 'MATH101', 975, False],
    ['s4', 'BIO130', 'ECON150', 1035, False]]),
  ('normal control 4',
   [[['s3', 'HIST140', 'BIO130'], ['s4', 'ECON150', 'HIST140']],
    {'MATH101': 60,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 180,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 60},
    600, 1020],
   [['s3', 'BIO130', 'HIST140', 795, True], ['s4', 'HIST140', 'ECON150', 795, True]]),
  ('normal control 5',
   [[['s2', 'BIO130', 'ECON150']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 90,
     'CHEM120': 120,
     'BIO130': 180,
     'HIST140': 90,
     'ECON150': 180},
    540, 1020],
   [['s2', 'BIO130', 'ECON150', 735, True]]),
  ('normal control 6',
   [[['s2', 'PHYS110', 'CHEM120'], ['s5', 'PHYS110', 'ECON150'], ['s5', 'BIO130', 'MATH101H']],
    {'MATH101': 90,
     'MATH101H': 180,
     'PHYS110': 60,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 120,
     'ECON150': 60},
    840, 1080],
   [['s2', 'CHEM120', 'PHYS110', 945, True], ['s5', 'ECON150', 'PHYS110', 915, True],
    ['s5', 'BIO130', 'MATH101H', 1035, False]]),
  ('normal control 7',
   [[['s5', 'MATH101H', 'BIO130'], ['s2', 'HIST140', 'MATH101'], ['s1', 'MATH101H', 'HIST140']],
    {'MATH101': 60,
     'MATH101H': 90,
     'PHYS110': 120,
     'CHEM120': 120,
     'BIO130': 90,
     'HIST140': 180,
     'ECON150': 60},
    780, 1020],
   [['s5', 'BIO130', 'MATH101H', 885, True], ['s2', 'HIST140', 'MATH101', 975, False],
    ['s1', 'HIST140', 'MATH101H', 975, False]]),
  ('normal control 8',
   [[['s1', 'BIO130', 'MATH101H']],
    {'MATH101': 180,
     'MATH101H': 60,
     'PHYS110': 60,
     'CHEM120': 180,
     'BIO130': 60,
     'HIST140': 90,
     'ECON150': 120},
    600, 1080],
   [['s1', 'BIO130', 'MATH101H', 675, True]])]]
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 fixtureActualExpectedOutcome
regression: day end inclusive 1[['s1', 'A', 'B', 735, True]][['s1', 'A', 'B', 735, True]]Passed
regression variant: day end inclusive 2[['s1', 'A', 'B', 795, True]][['s1', 'A', 'B', 795, True]]Passed
partial repair guard 3[['s4', 'PHYS110', 'MATH101H', 975, True]][['s4', 'PHYS110', 'MATH101H', 975, False]]Failed
boundary control 4[['s1', 'A', 'B', 1035, True]][['s1', 'A', 'B', 1035, False]]Failed
boundary control 5[['s1', 'B', 'A', 795, True]][['s1', 'B', 'A', 795, True]]Passed
normal control 6[['s1', 'BIO130', 'PHYS110', 735, True], ['s4', 'CHEM120', 'PHYS110', 735, True], ['s2', 'MATH101', 'MATH101H', 795, True]][['s1', 'BIO130', 'PHYS110', 735, True], ['s4', 'CHEM120', 'PHYS110', 735, True], ['s2', 'MATH101', 'MATH101H', 795, True]]Passed
normal control 7[['s2', 'HIST140', 'BIO130', 1035, False], ['s5', 'PHYS110', 'CHEM120', 1035, False]][['s2', 'HIST140', 'BIO130', 1035, False], ['s5', 'PHYS110', 'CHEM120', 1035, False]]Passed
normal control 8[['s2', 'PHYS110', 'MATH101H', 705, True]][['s2', 'PHYS110', 'MATH101H', 705, True]]Passed

SHA-256 / 408777da696def2797a26ff623b4e075b9a4831cda4a2a2f28ac969c70eadbd5

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(clashes, dur, start, day_end):
    out = []
    for st, a, b in clashes:
        first, second = sorted([a, b], key=lambda e: (-dur[e], e))
        s2 = start + dur[first] + 15
        out.append([st, first, second, s2, s2 + dur[second] <= day_end])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 600, 855],
   [['s1', 'A', 'B', 735, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('partial repair guard 3',
   [[['s4', 'PHYS110', 'MATH101H']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 180,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 90,
     'ECON150': 90},
    780, 1020],
   [['s4', 'PHYS110', 'MATH101H', 975, False]]),
  ('boundary control 4', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 840, 1080],
   [['s1', 'A', 'B', 1035, False]]),
  ('boundary control 5', [[['s1', 'A', 'B']], {'A': 120, 'B': 180}, 600, 1080],
   [['s1', 'B', 'A', 795, True]]),
  ('normal control 6',
   [[['s1', 'BIO130', 'PHYS110'], ['s4', 'PHYS110', 'CHEM120'], ['s2', 'MATH101H', 'MATH101']],
    {'MATH101': 180,
     'MATH101H': 90,
     'PHYS110': 60,
     'CHEM120': 120,
     'BIO130': 120,
     'HIST140': 180,
     'ECON150': 120},
    600, 1020],
   [['s1', 'BIO130', 'PHYS110', 735, True], ['s4', 'CHEM120', 'PHYS110', 735, True],
    ['s2', 'MATH101', 'MATH101H', 795, True]]),
  ('normal control 7',
   [[['s2', 'HIST140', 'BIO130'], ['s5', 'PHYS110', 'CHEM120']],
    {'MATH101': 180,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 60,
     'BIO130': 60,
     'HIST140': 180,
     'ECON150': 120},
    840, 1020],
   [['s2', 'HIST140', 'BIO130', 1035, False], ['s5', 'PHYS110', 'CHEM120', 1035, False]]),
  ('normal control 8',
   [[['s2', 'MATH101H', 'PHYS110']],
    {'MATH101': 90, 'MATH101H': 60, 'PHYS110': 90, 'CHEM120': 90, 'BIO130': 60, 'HIST140': 60, 'ECON150': 60},
    600, 1080],
   [['s2', 'PHYS110', 'MATH101H', 705, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 780, 1035],
   [['s1', 'A', 'B', 915, True]]),
  ('partial repair guard 3',
   [[['s2', 'BIO130', 'ECON150'], ['s4', 'ECON150', 'MATH101']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 120,
     'ECON150': 120},
    780, 1020],
   [['s2', 'BIO130', 'ECON150', 975, False], ['s4', 'MATH101', 'ECON150', 975, False]]),
  ('boundary control 4', [[['s3', 'A', 'B'], ['s1', 'A', 'B']], {'A': 60, 'B': 90}, 780, 1020],
   [['s3', 'B', 'A', 885, True], ['s1', 'B', 'A', 885, True]]),
  ('boundary control 5', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 840, 1080],
   [['s1', 'A', 'B', 1035, False]]),
  ('normal control 6',
   [[['s3', 'MATH101', 'CHEM120'], ['s1', 'MATH101H', 'BIO130'], ['s4', 'PHYS110', 'CHEM120']],
    {'MATH101': 60,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 180,
     'BIO130': 120,
     'HIST140': 90,
     'ECON150': 120},
    840, 1080],
   [['s3', 'CHEM120', 'MATH101', 1035, False], ['s1', 'BIO130', 'MATH101H', 975, False],
    ['s4', 'CHEM120', 'PHYS110', 1035, False]]),
  ('normal control 7',
   [[['s5', 'PHYS110', 'BIO130'], ['s5', 'MATH101', 'BIO130']],
    {'MATH101': 90,
     'MATH101H': 60,
     'PHYS110': 120,
     'CHEM120': 120,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 180},
    540, 1020],
   [['s5', 'BIO130', 'PHYS110', 735, True], ['s5', 'BIO130', 'MATH101', 735, True]]),
  ('normal control 8',
   [[['s2', 'HIST140', 'BIO130'], ['s2', 'ECON150', 'CHEM120']],
    {'MATH101': 90,
     'MATH101H': 180,
     'PHYS110': 180,
     'CHEM120': 60,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 120},
    840, 1080],
   [['s2', 'BIO130', 'HIST140', 1035, False], ['s2', 'ECON150', 'CHEM120', 975, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 780, 1035],
   [['s1', 'A', 'B', 915, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 600, 855],
   [['s1', 'A', 'B', 735, True]]),
  ('partial repair guard 3',
   [[['s4', 'HIST140', 'MATH101H']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 90,
     'CHEM120': 60,
     'BIO130': 120,
     'HIST140': 180,
     'ECON150': 120},
    780, 1080],
   [['s4', 'HIST140', 'MATH101H', 975, False]]),
  ('boundary control 4', [[['s3', 'A', 'B'], ['s1', 'A', 'B']], {'A': 60, 'B': 90}, 780, 1020],
   [['s3', 'B', 'A', 885, True], ['s1', 'B', 'A', 885, True]]),
  ('normal control 5',
   [[['s3', 'BIO130', 'HIST140']],
    {'MATH101': 90,
     'MATH101H': 90,
     'PHYS110': 90,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 60,
     'ECON150': 90},
    780, 1020],
   [['s3', 'BIO130', 'HIST140', 975, False]]),
  ('normal control 6',
   [[['s3', 'MATH101H', 'MATH101'], ['s4', 'ECON150', 'MATH101H'], ['s2', 'CHEM120', 'ECON150']],
    {'MATH101': 180,
     'MATH101H': 180,
     'PHYS110': 120,
     'CHEM120': 120,
     'BIO130': 60,
     'HIST140': 120,
     'ECON150': 180},
    780, 1080],
   [['s3', 'MATH101', 'MATH101H', 975, False], ['s4', 'ECON150', 'MATH101H', 975, False],
    ['s2', 'ECON150', 'CHEM120', 975, False]]),
  ('normal control 7',
   [[['s4', 'MATH101H', 'ECON150'], ['s3', 'PHYS110', 'BIO130'], ['s5', 'HIST140', 'MATH101']],
    {'MATH101': 90,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 60,
     'ECON150': 60},
    540, 1020],
   [['s4', 'ECON150', 'MATH101H', 615, True], ['s3', 'PHYS110', 'BIO130', 735, True],
    ['s5', 'MATH101', 'HIST140', 645, True]]),
  ('normal control 8',
   [[['s4', 'HIST140', 'PHYS110'], ['s2', 'PHYS110', 'MATH101']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 90,
     'CHEM120': 180,
     'BIO130': 120,
     'HIST140': 120,
     'ECON150': 180},
    600, 1080],
   [['s4', 'HIST140', 'PHYS110', 735, True], ['s2', 'MATH101', 'PHYS110', 795, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 600, 855],
   [['s1', 'A', 'B', 735, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('partial repair guard 3',
   [[['s3', 'PHYS110', 'MATH101H'], ['s3', 'ECON150', 'HIST140']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 120,
     'CHEM120': 60,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 120},
    840, 1080],
   [['s3', 'PHYS110', 'MATH101H', 975, True], ['s3', 'HIST140', 'ECON150', 1035, False]]),
  ('normal control 4',
   [[['s2', 'ECON150', 'MATH101H'], ['s1', 'MATH101', 'MATH101H']],
    {'MATH101': 180,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 180,
     'BIO130': 90,
     'HIST140': 60,
     'ECON150': 90},
    840, 1020],
   [['s2', 'MATH101H', 'ECON150', 975, False], ['s1', 'MATH101', 'MATH101H', 1035, False]]),
  ('normal control 5',
   [[['s1', 'MATH101H', 'ECON150'], ['s2', 'ECON150', 'MATH101H'], ['s3', 'PHYS110', 'HIST140']],
    {'MATH101': 90,
     'MATH101H': 90,
     'PHYS110': 60,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 120},
    840, 1020],
   [['s1', 'ECON150', 'MATH101H', 975, False], ['s2', 'ECON150', 'MATH101H', 975, False],
    ['s3', 'HIST140', 'PHYS110', 1035, False]]),
  ('normal control 6',
   [[['s4', 'CHEM120', 'HIST140']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 120,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 90,
     'ECON150': 60},
    600, 1080],
   [['s4', 'CHEM120', 'HIST140', 705, True]]),
  ('normal control 7',
   [[['s1', 'MATH101', 'PHYS110'], ['s2', 'PHYS110', 'BIO130'], ['s2', 'MATH101H', 'PHYS110']],
    {'MATH101': 90,
     'MATH101H': 180,
     'PHYS110': 60,
     'CHEM120': 180,
     'BIO130': 90,
     'HIST140': 120,
     'ECON150': 120},
    600, 1080],
   [['s1', 'MATH101', 'PHYS110', 705, True], ['s2', 'BIO130', 'PHYS110', 705, True],
    ['s2', 'MATH101H', 'PHYS110', 795, True]]),
  ('normal control 8',
   [[['s4', 'MATH101H', 'ECON150'], ['s3', 'PHYS110', 'BIO130'], ['s5', 'HIST140', 'MATH101']],
    {'MATH101': 90,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 90,
     'BIO130': 120,
     'HIST140': 60,
     'ECON150': 60},
    540, 1020],
   [['s4', 'ECON150', 'MATH101H', 615, True], ['s3', 'PHYS110', 'BIO130', 735, True],
    ['s5', 'MATH101', 'HIST140', 645, True]])],
 [('regression: day end inclusive 1', [[['s1', 'A', 'B']], {'A': 180, 'B': 60}, 600, 855],
   [['s1', 'A', 'B', 795, True]]),
  ('regression variant: day end inclusive 2', [[['s1', 'A', 'B']], {'A': 120, 'B': 120}, 780, 1035],
   [['s1', 'A', 'B', 915, True]]),
  ('partial repair guard 3',
   [[['s1', 'ECON150', 'CHEM120'], ['s2', 'PHYS110', 'MATH101'], ['s4', 'BIO130', 'ECON150']],
    {'MATH101': 60,
     'MATH101H': 120,
     'PHYS110': 120,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 120,
     'ECON150': 180},
    840, 1020],
   [['s1', 'ECON150', 'CHEM120', 1035, False], ['s2', 'PHYS110', 'MATH101', 975, False],
    ['s4', 'BIO130', 'ECON150', 1035, False]]),
  ('normal control 4',
   [[['s3', 'HIST140', 'BIO130'], ['s4', 'ECON150', 'HIST140']],
    {'MATH101': 60,
     'MATH101H': 60,
     'PHYS110': 180,
     'CHEM120': 180,
     'BIO130': 180,
     'HIST140': 180,
     'ECON150': 60},
    600, 1020],
   [['s3', 'BIO130', 'HIST140', 795, True], ['s4', 'HIST140', 'ECON150', 795, True]]),
  ('normal control 5',
   [[['s2', 'BIO130', 'ECON150']],
    {'MATH101': 120,
     'MATH101H': 90,
     'PHYS110': 90,
     'CHEM120': 120,
     'BIO130': 180,
     'HIST140': 90,
     'ECON150': 180},
    540, 1020],
   [['s2', 'BIO130', 'ECON150', 735, True]]),
  ('normal control 6',
   [[['s2', 'PHYS110', 'CHEM120'], ['s5', 'PHYS110', 'ECON150'], ['s5', 'BIO130', 'MATH101H']],
    {'MATH101': 90,
     'MATH101H': 180,
     'PHYS110': 60,
     'CHEM120': 90,
     'BIO130': 180,
     'HIST140': 120,
     'ECON150': 60},
    840, 1080],
   [['s2', 'CHEM120', 'PHYS110', 945, True], ['s5', 'ECON150', 'PHYS110', 915, True],
    ['s5', 'BIO130', 'MATH101H', 1035, False]]),
  ('normal control 7',
   [[['s5', 'MATH101H', 'BIO130'], ['s2', 'HIST140', 'MATH101'], ['s1', 'MATH101H', 'HIST140']],
    {'MATH101': 60,
     'MATH101H': 90,
     'PHYS110': 120,
     'CHEM120': 120,
     'BIO130': 90,
     'HIST140': 180,
     'ECON150': 60},
    780, 1020],
   [['s5', 'BIO130', 'MATH101H', 885, True], ['s2', 'HIST140', 'MATH101', 975, False],
    ['s1', 'HIST140', 'MATH101H', 975, False]]),
  ('normal control 8',
   [[['s1', 'BIO130', 'MATH101H']],
    {'MATH101': 180,
     'MATH101H': 60,
     'PHYS110': 60,
     'CHEM120': 180,
     'BIO130': 60,
     'HIST140': 90,
     'ECON150': 120},
    600, 1080],
   [['s1', 'BIO130', 'MATH101H', 675, True]])]]
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 fixtureActualExpectedOutcome
regression: day end inclusive 1[['s1', 'A', 'B', 735, True]][['s1', 'A', 'B', 735, True]]Passed
regression variant: day end inclusive 2[['s1', 'A', 'B', 795, True]][['s1', 'A', 'B', 795, True]]Passed
partial repair guard 3[['s4', 'PHYS110', 'MATH101H', 975, False]][['s4', 'PHYS110', 'MATH101H', 975, False]]Passed
boundary control 4[['s1', 'A', 'B', 1035, False]][['s1', 'A', 'B', 1035, False]]Passed
boundary control 5[['s1', 'B', 'A', 795, True]][['s1', 'B', 'A', 795, True]]Passed
normal control 6[['s1', 'BIO130', 'PHYS110', 735, True], ['s4', 'CHEM120', 'PHYS110', 735, True], ['s2', 'MATH101', 'MATH101H', 795, True]][['s1', 'BIO130', 'PHYS110', 735, True], ['s4', 'CHEM120', 'PHYS110', 735, True], ['s2', 'MATH101', 'MATH101H', 795, True]]Passed
normal control 7[['s2', 'HIST140', 'BIO130', 1035, False], ['s5', 'PHYS110', 'CHEM120', 1035, False]][['s2', 'HIST140', 'BIO130', 1035, False], ['s5', 'PHYS110', 'CHEM120', 1035, False]]Passed
normal control 8[['s2', 'PHYS110', 'MATH101H', 705, True]][['s2', 'PHYS110', 'MATH101H', 705, True]]Passed

SHA-256 / 69a5d1022062f4a3a575beaeb84282919754ae02e903d426e38b8e98ece1b60c

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.561395+00:00.

Case digest / d6a0c30947830eb4ae21e096c6035ed1c27944a3a68a2709d0b6e7dd7dddce07