FAILURE MAP
← Case archive

FA-94386 / Exam timetabling constraints / Open access

Shorter exam shares a room with a longer exam · case 01

A 90-minute exam is seated in a room already running a 120-minute exam.

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

ROOT CAUSE

Room compatibility accepts any exam no longer than the room's current duration.

VERIFIED REPAIR

Share rooms only between exams of identical duration.

Unsuccessful approach: A 30-minute tolerance still mixes durations.

Case contract

exams [id, size, duration, splittable], rooms [id, capacity]. Exams are placed largest first (ties by id). A room is compatible if empty or holding only exams of the same duration. Place whole in the compatible room with the least sufficient remaining capacity (ties by id); else if splittable and compatible rooms have enough total space, fill them by descending remaining capacity (ties by id), skipping full rooms; else unplaced. Return placements and unplaced ids.

Why this case matters

Room allocation rules (mixed durations, best fit, splitting) are the second hard-constraint family of exam timetabling.

1 / The failure

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

N = 1
observations = []
def solve(exams, rooms):
    rem = {r: c for r, c in rooms}
    dur = {}
    place = {}
    unplaced = []
    for eid, size, d, split in sorted(exams, key=lambda x: (-x[1], x[0])):
        ok = [r for r in rem if dur.get(r, d) >= d]
        fit = [r for r in ok if rem[r] >= size]
        if fit:
            r = min(fit, key=lambda r: (rem[r], r))
            place[eid] = [[r, size]]
            rem[r] -= size
            dur[r] = d
            continue
        if split and sum(rem[r] for r in ok) >= size:
            parts = []
            left = size
            for r in sorted(ok, key=lambda r: (-rem[r], r)):
                if left == 0:
                    break
                take = min(rem[r], left)
                parts.append([r, take])
                rem[r] -= take
                dur[r] = d
                left -= take
            place[eid] = parts
            continue
        unplaced.append(eid)
    return {'placed': place, 'unplaced': unplaced}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: duration compatibility 1', [[['A', 30, 120, False], ['B', 30, 90, False]], [['R1', 60]]],
   {'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 60, 180, True], ['E1', 20, 90, False], ['E2', 80, 120, True], ['E3', 10, 120, False],
     ['E4', 60, 120, False]],
    [['R0', 60], ['R1', 40], ['R2', 20], ['R3', 50]]],
   {'placed': {'E2': [['R0', 60], ['R3', 20]], 'E0': [['R1', 40], ['R2', 20]], 'E3': [['R3', 10]]},
    'unplaced': ['E4', 'E1']}),
  ('partial repair guard 3',
   [[['E0', 10, 90, True], ['E1', 20, 120, True], ['E2', 10, 120, False]], [['R0', 20], ['R1', 30]]],
   {'placed': {'E1': [['R0', 20]], 'E0': [['R1', 10]]}, 'unplaced': ['E2']}),
  ('boundary control 4', [[['A', 40, 120, False], ['B', 20, 120, False]], [['R1', 60], ['R2', 40]]],
   {'placed': {'A': [['R2', 40]], 'B': [['R1', 20]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 20, 90, True], ['E1', 10, 120, True], ['E2', 10, 120, True]], [['R0', 30], ['R1', 60]]],
   {'placed': {'E0': [['R0', 20]], 'E1': [['R1', 10]], 'E2': [['R1', 10]]}, 'unplaced': []}),
  ('normal control 6', [[['E0', 30, 120, True], ['E1', 45, 120, True]], [['R0', 60], ['R1', 50]]],
   {'placed': {'E1': [['R1', 45]], 'E0': [['R0', 30]]}, 'unplaced': []}),
  ('normal control 7',
   [[['E0', 45, 120, True], ['E1', 60, 120, False], ['E2', 30, 120, False]],
    [['R0', 50], ['R1', 60], ['R2', 60]]],
   {'placed': {'E1': [['R1', 60]], 'E0': [['R0', 45]], 'E2': [['R2', 30]]}, 'unplaced': []}),
  ('normal control 8',
   [[['E0', 80, 90, False], ['E1', 45, 90, True], ['E2', 80, 90, False], ['E3', 20, 120, True],
     ['E4', 10, 90, True]],
    [['R0', 50], ['R1', 60]]],
   {'placed': {'E1': [['R0', 45]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E2', 'E4']})],
 [('regression: duration compatibility 1',
   [[['E0', 80, 180, True], ['E1', 20, 90, True], ['E2', 80, 90, False], ['E3', 80, 90, True]],
    [['R0', 60], ['R1', 60], ['R2', 20], ['R3', 20]]],
   {'placed': {'E0': [['R0', 60], ['R1', 20]], 'E1': [['R2', 20]]}, 'unplaced': ['E2', 'E3']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 10, 90, True], ['E1', 10, 120, True], ['E2', 30, 120, False], ['E3', 80, 90, False],
     ['E4', 80, 120, True]],
    [['R0', 30], ['R1', 40], ['R2', 50]]],
   {'placed': {'E4': [['R2', 50], ['R1', 30]], 'E2': [['R0', 30]], 'E1': [['R1', 10]]},
    'unplaced': ['E3', 'E0']}),
  ('partial repair guard 3',
   [[['E0', 45, 90, True], ['E1', 80, 90, False], ['E2', 30, 120, True]], [['R0', 20], ['R1', 60]]],
   {'placed': {'E0': [['R1', 45]]}, 'unplaced': ['E1', 'E2']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 20]]],
   {'placed': {'A': [['R1', 30], ['R2', 20]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 80, 120, True], ['E1', 45, 120, True], ['E2', 60, 180, True]],
    [['R0', 40], ['R1', 40], ['R2', 50]]],
   {'placed': {'E0': [['R2', 50], ['R0', 30]], 'E1': [['R1', 40], ['R0', 5]]}, 'unplaced': ['E2']}),
  ('normal control 6',
   [[['E0', 60, 120, True], ['E1', 60, 120, True], ['E2', 80, 120, True], ['E3', 30, 180, False]],
    [['R0', 20], ['R1', 40]]],
   {'placed': {'E0': [['R1', 40], ['R0', 20]]}, 'unplaced': ['E2', 'E1', 'E3']}),
  ('normal control 7', [[['E0', 20, 120, True], ['E1', 20, 120, False]], [['R0', 60], ['R1', 40]]],
   {'placed': {'E0': [['R1', 20]], 'E1': [['R1', 20]]}, 'unplaced': []}),
  ('normal control 8',
   [[['E0', 45, 90, True], ['E1', 45, 90, False], ['E2', 80, 120, False]],
    [['R0', 20], ['R1', 30], ['R2', 50]]],
   {'placed': {'E0': [['R2', 45]]}, 'unplaced': ['E2', 'E1']})],
 [('regression: duration compatibility 1',
   [[['E0', 30, 120, True], ['E1', 10, 90, False]], [['R0', 60], ['R1', 60]]],
   {'placed': {'E0': [['R0', 30]], 'E1': [['R1', 10]]}, 'unplaced': []}),
  ('regression variant: duration compatibility 2',
   [[['E0', 20, 90, False], ['E1', 30, 180, True], ['E2', 30, 120, True], ['E3', 45, 120, False],
     ['E4', 10, 120, False]],
    [['R0', 60], ['R1', 40]]],
   {'placed': {'E3': [['R0', 45]], 'E1': [['R1', 30]], 'E4': [['R0', 10]]}, 'unplaced': ['E2', 'E0']}),
  ('partial repair guard 3',
   [[['E0', 20, 90, True], ['E1', 10, 120, True], ['E2', 30, 90, True]],
    [['R0', 30], ['R1', 30], ['R2', 50]]],
   {'placed': {'E2': [['R0', 30]], 'E0': [['R1', 20]], 'E1': [['R2', 10]]}, 'unplaced': []}),
  ('boundary control 4', [[['A', 30, 120, True], ['B', 30, 120, True]], [['R1', 30], ['R2', 40]]],
   {'placed': {'A': [['R1', 30]], 'B': [['R2', 30]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 20, 90, False], ['E1', 10, 120, False], ['E2', 20, 120, False]], [['R0', 30], ['R1', 20]]],
   {'placed': {'E0': [['R1', 20]], 'E2': [['R0', 20]], 'E1': [['R0', 10]]}, 'unplaced': []}),
  ('normal control 6', [[['E0', 45, 180, False], ['E1', 80, 90, False]], [['R0', 20], ['R1', 60]]],
   {'placed': {'E0': [['R1', 45]]}, 'unplaced': ['E1']}),
  ('normal control 7',
   [[['E0', 60, 120, False], ['E1', 45, 180, True], ['E2', 60, 180, True], ['E3', 30, 120, True],
     ['E4', 20, 180, True]],
    [['R0', 40], ['R1', 60]]],
   {'placed': {'E0': [['R1', 60]], 'E3': [['R0', 30]]}, 'unplaced': ['E2', 'E1', 'E4']}),
  ('normal control 8',
   [[['E0', 60, 90, False], ['E1', 80, 90, True], ['E2', 30, 180, False]], [['R0', 40], ['R1', 30]]],
   {'placed': {'E2': [['R1', 30]]}, 'unplaced': ['E1', 'E0']})],
 [('regression: duration compatibility 1',
   [[['E0', 60, 180, True], ['E1', 20, 120, True], ['E2', 10, 120, True], ['E3', 45, 120, True],
     ['E4', 45, 120, True]],
    [['R0', 30], ['R1', 20], ['R2', 20], ['R3', 50]]],
   {'placed': {'E0': [['R3', 50], ['R0', 10]], 'E1': [['R1', 20]], 'E2': [['R2', 10]]},
    'unplaced': ['E3', 'E4']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 60, 120, True], ['E1', 80, 180, True], ['E2', 10, 90, True]],
    [['R0', 60], ['R1', 30], ['R2', 60]]],
   {'placed': {'E1': [['R0', 60], ['R2', 20]], 'E2': [['R1', 10]]}, 'unplaced': ['E0']}),
  ('partial repair guard 3', [[['E0', 60, 90, True], ['E1', 10, 120, False]], [['R0', 50], ['R1', 20]]],
   {'placed': {'E0': [['R0', 50], ['R1', 10]]}, 'unplaced': ['E1']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 19]]],
   {'placed': {}, 'unplaced': ['A']}),
  ('normal control 5',
   [[['E0', 10, 180, True], ['E1', 20, 120, False], ['E2', 20, 120, True], ['E3', 10, 120, True],
     ['E4', 30, 180, False]],
    [['R0', 50], ['R1', 30], ['R2', 30]]],
   {'placed': {'E4': [['R1', 30]], 'E1': [['R2', 20]], 'E2': [['R0', 20]], 'E3': [['R2', 10]]},
    'unplaced': ['E0']}),
  ('normal control 6',
   [[['E0', 45, 120, True], ['E1', 10, 120, True]], [['R0', 30], ['R1', 50], ['R2', 50], ['R3', 40]]],
   {'placed': {'E0': [['R1', 45]], 'E1': [['R0', 10]]}, 'unplaced': []}),
  ('normal control 7',
   [[['E0', 60, 120, False], ['E1', 45, 180, False], ['E2', 45, 180, True], ['E3', 30, 120, False],
     ['E4', 20, 180, False]],
    [['R0', 30], ['R1', 60], ['R2', 20], ['R3', 40]]],
   {'placed': {'E0': [['R1', 60]], 'E2': [['R3', 40], ['R0', 5]], 'E4': [['R2', 20]]},
    'unplaced': ['E1', 'E3']}),
  ('normal control 8',
   [[['E0', 10, 90, True], ['E1', 10, 120, True]], [['R0', 30], ['R1', 30], ['R2', 50], ['R3', 30]]],
   {'placed': {'E0': [['R0', 10]], 'E1': [['R1', 10]]}, 'unplaced': []})],
 [('regression: duration compatibility 1',
   [[['E0', 80, 120, True], ['E1', 80, 120, True], ['E2', 20, 180, True], ['E3', 10, 90, True],
     ['E4', 80, 180, True]],
    [['R0', 50], ['R1', 60], ['R2', 60]]],
   {'placed': {'E0': [['R1', 60], ['R2', 20]], 'E1': [['R0', 50], ['R2', 30]]},
    'unplaced': ['E4', 'E2', 'E3']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 20, 90, False], ['E1', 10, 120, False], ['E2', 20, 120, True], ['E3', 20, 90, False],
     ['E4', 20, 120, True]],
    [['R0', 20], ['R1', 60], ['R2', 50]]],
   {'placed': {'E0': [['R0', 20]],
               'E2': [['R2', 20]],
               'E3': [['R1', 20]],
               'E4': [['R2', 20]],
               'E1': [['R2', 10]]},
    'unplaced': []}),
  ('partial repair guard 3',
   [[['E0', 10, 120, False], ['E1', 80, 180, True], ['E2', 20, 90, True]],
    [['R0', 30], ['R1', 40], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60], ['R1', 20]], 'E2': [['R0', 20]]}, 'unplaced': ['E0']}),
  ('boundary control 4', [[['A', 30, 120, False], ['B', 30, 90, False]], [['R1', 60]]],
   {'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}),
  ('normal control 5', [[['E0', 30, 120, False], ['E1', 45, 120, True]], [['R0', 20], ['R1', 20]]],
   {'placed': {}, 'unplaced': ['E1', 'E0']}),
  ('normal control 6',
   [[['E0', 60, 120, False], ['E1', 10, 120, True], ['E2', 10, 90, True], ['E3', 30, 90, False],
     ['E4', 80, 120, False]],
    [['R0', 20], ['R1', 30], ['R2', 30]]],
   {'placed': {'E3': [['R1', 30]], 'E1': [['R0', 10]], 'E2': [['R2', 10]]}, 'unplaced': ['E4', 'E0']}),
  ('normal control 7',
   [[['E0', 20, 120, True], ['E1', 20, 180, True], ['E2', 80, 180, True], ['E3', 80, 90, True],
     ['E4', 60, 180, False]],
    [['R0', 30], ['R1', 50]]],
   {'placed': {'E2': [['R1', 50], ['R0', 30]]}, 'unplaced': ['E3', 'E4', 'E0', 'E1']}),
  ('normal control 8',
   [[['E0', 20, 120, True], ['E1', 60, 120, True]], [['R0', 30], ['R1', 40], ['R2', 20], ['R3', 30]]],
   {'placed': {'E1': [['R1', 40], ['R0', 20]], 'E0': [['R2', 20]]}, 'unplaced': []})]]
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: duration compatibility 1{'placed': {'A': [['R1', 30]], 'B': [['R1', 30]]}, 'unplaced': []}{'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}Failed
regression variant: duration compatibility 2{'placed': {'E0': [['R1', 40], ['R2', 20]], 'E1': [['R3', 20]], 'E2': [['R0', 60], ['R3', 20]]}, 'unplaced': ['E4', 'E3']}{'placed': {'E0': [['R1', 40], ['R2', 20]], 'E2': [['R0', 60], ['R3', 20]], 'E3': [['R3', 10]]}, 'unplaced': ['E4', 'E1']}Failed
partial repair guard 3{'placed': {'E0': [['R1', 10]], 'E1': [['R0', 20]]}, 'unplaced': ['E2']}{'placed': {'E0': [['R1', 10]], 'E1': [['R0', 20]]}, 'unplaced': ['E2']}Passed
boundary control 4{'placed': {'A': [['R2', 40]], 'B': [['R1', 20]]}, 'unplaced': []}{'placed': {'A': [['R2', 40]], 'B': [['R1', 20]]}, 'unplaced': []}Passed
normal control 5{'placed': {'E0': [['R0', 20]], 'E1': [['R1', 10]], 'E2': [['R1', 10]]}, 'unplaced': []}{'placed': {'E0': [['R0', 20]], 'E1': [['R1', 10]], 'E2': [['R1', 10]]}, 'unplaced': []}Passed
normal control 6{'placed': {'E0': [['R0', 30]], 'E1': [['R1', 45]]}, 'unplaced': []}{'placed': {'E0': [['R0', 30]], 'E1': [['R1', 45]]}, 'unplaced': []}Passed
normal control 7{'placed': {'E0': [['R0', 45]], 'E1': [['R1', 60]], 'E2': [['R2', 30]]}, 'unplaced': []}{'placed': {'E0': [['R0', 45]], 'E1': [['R1', 60]], 'E2': [['R2', 30]]}, 'unplaced': []}Passed
normal control 8{'placed': {'E1': [['R0', 45]], 'E3': [['R1', 20]], 'E4': [['R1', 10]]}, 'unplaced': ['E0', 'E2']}{'placed': {'E1': [['R0', 45]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E2', 'E4']}Failed

SHA-256 / b920f7024ed26992b750622e488db791deb6e29e71272a66d833a391af3e50da

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(exams, rooms):
    rem = {r: c for r, c in rooms}
    dur = {}
    place = {}
    unplaced = []
    for eid, size, d, split in sorted(exams, key=lambda x: (-x[1], x[0])):
        ok = [r for r in rem if abs(dur.get(r, d) - d) <= 30]
        fit = [r for r in ok if rem[r] >= size]
        if fit:
            r = min(fit, key=lambda r: (rem[r], r))
            place[eid] = [[r, size]]
            rem[r] -= size
            dur[r] = d
            continue
        if split and sum(rem[r] for r in ok) >= size:
            parts = []
            left = size
            for r in sorted(ok, key=lambda r: (-rem[r], r)):
                if left == 0:
                    break
                take = min(rem[r], left)
                parts.append([r, take])
                rem[r] -= take
                dur[r] = d
                left -= take
            place[eid] = parts
            continue
        unplaced.append(eid)
    return {'placed': place, 'unplaced': unplaced}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: duration compatibility 1', [[['A', 30, 120, False], ['B', 30, 90, False]], [['R1', 60]]],
   {'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 60, 180, True], ['E1', 20, 90, False], ['E2', 80, 120, True], ['E3', 10, 120, False],
     ['E4', 60, 120, False]],
    [['R0', 60], ['R1', 40], ['R2', 20], ['R3', 50]]],
   {'placed': {'E2': [['R0', 60], ['R3', 20]], 'E0': [['R1', 40], ['R2', 20]], 'E3': [['R3', 10]]},
    'unplaced': ['E4', 'E1']}),
  ('partial repair guard 3',
   [[['E0', 10, 90, True], ['E1', 20, 120, True], ['E2', 10, 120, False]], [['R0', 20], ['R1', 30]]],
   {'placed': {'E1': [['R0', 20]], 'E0': [['R1', 10]]}, 'unplaced': ['E2']}),
  ('boundary control 4', [[['A', 40, 120, False], ['B', 20, 120, False]], [['R1', 60], ['R2', 40]]],
   {'placed': {'A': [['R2', 40]], 'B': [['R1', 20]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 20, 90, True], ['E1', 10, 120, True], ['E2', 10, 120, True]], [['R0', 30], ['R1', 60]]],
   {'placed': {'E0': [['R0', 20]], 'E1': [['R1', 10]], 'E2': [['R1', 10]]}, 'unplaced': []}),
  ('normal control 6', [[['E0', 30, 120, True], ['E1', 45, 120, True]], [['R0', 60], ['R1', 50]]],
   {'placed': {'E1': [['R1', 45]], 'E0': [['R0', 30]]}, 'unplaced': []}),
  ('normal control 7',
   [[['E0', 45, 120, True], ['E1', 60, 120, False], ['E2', 30, 120, False]],
    [['R0', 50], ['R1', 60], ['R2', 60]]],
   {'placed': {'E1': [['R1', 60]], 'E0': [['R0', 45]], 'E2': [['R2', 30]]}, 'unplaced': []}),
  ('normal control 8',
   [[['E0', 80, 90, False], ['E1', 45, 90, True], ['E2', 80, 90, False], ['E3', 20, 120, True],
     ['E4', 10, 90, True]],
    [['R0', 50], ['R1', 60]]],
   {'placed': {'E1': [['R0', 45]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E2', 'E4']})],
 [('regression: duration compatibility 1',
   [[['E0', 80, 180, True], ['E1', 20, 90, True], ['E2', 80, 90, False], ['E3', 80, 90, True]],
    [['R0', 60], ['R1', 60], ['R2', 20], ['R3', 20]]],
   {'placed': {'E0': [['R0', 60], ['R1', 20]], 'E1': [['R2', 20]]}, 'unplaced': ['E2', 'E3']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 10, 90, True], ['E1', 10, 120, True], ['E2', 30, 120, False], ['E3', 80, 90, False],
     ['E4', 80, 120, True]],
    [['R0', 30], ['R1', 40], ['R2', 50]]],
   {'placed': {'E4': [['R2', 50], ['R1', 30]], 'E2': [['R0', 30]], 'E1': [['R1', 10]]},
    'unplaced': ['E3', 'E0']}),
  ('partial repair guard 3',
   [[['E0', 45, 90, True], ['E1', 80, 90, False], ['E2', 30, 120, True]], [['R0', 20], ['R1', 60]]],
   {'placed': {'E0': [['R1', 45]]}, 'unplaced': ['E1', 'E2']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 20]]],
   {'placed': {'A': [['R1', 30], ['R2', 20]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 80, 120, True], ['E1', 45, 120, True], ['E2', 60, 180, True]],
    [['R0', 40], ['R1', 40], ['R2', 50]]],
   {'placed': {'E0': [['R2', 50], ['R0', 30]], 'E1': [['R1', 40], ['R0', 5]]}, 'unplaced': ['E2']}),
  ('normal control 6',
   [[['E0', 60, 120, True], ['E1', 60, 120, True], ['E2', 80, 120, True], ['E3', 30, 180, False]],
    [['R0', 20], ['R1', 40]]],
   {'placed': {'E0': [['R1', 40], ['R0', 20]]}, 'unplaced': ['E2', 'E1', 'E3']}),
  ('normal control 7', [[['E0', 20, 120, True], ['E1', 20, 120, False]], [['R0', 60], ['R1', 40]]],
   {'placed': {'E0': [['R1', 20]], 'E1': [['R1', 20]]}, 'unplaced': []}),
  ('normal control 8',
   [[['E0', 45, 90, True], ['E1', 45, 90, False], ['E2', 80, 120, False]],
    [['R0', 20], ['R1', 30], ['R2', 50]]],
   {'placed': {'E0': [['R2', 45]]}, 'unplaced': ['E2', 'E1']})],
 [('regression: duration compatibility 1',
   [[['E0', 30, 120, True], ['E1', 10, 90, False]], [['R0', 60], ['R1', 60]]],
   {'placed': {'E0': [['R0', 30]], 'E1': [['R1', 10]]}, 'unplaced': []}),
  ('regression variant: duration compatibility 2',
   [[['E0', 20, 90, False], ['E1', 30, 180, True], ['E2', 30, 120, True], ['E3', 45, 120, False],
     ['E4', 10, 120, False]],
    [['R0', 60], ['R1', 40]]],
   {'placed': {'E3': [['R0', 45]], 'E1': [['R1', 30]], 'E4': [['R0', 10]]}, 'unplaced': ['E2', 'E0']}),
  ('partial repair guard 3',
   [[['E0', 20, 90, True], ['E1', 10, 120, True], ['E2', 30, 90, True]],
    [['R0', 30], ['R1', 30], ['R2', 50]]],
   {'placed': {'E2': [['R0', 30]], 'E0': [['R1', 20]], 'E1': [['R2', 10]]}, 'unplaced': []}),
  ('boundary control 4', [[['A', 30, 120, True], ['B', 30, 120, True]], [['R1', 30], ['R2', 40]]],
   {'placed': {'A': [['R1', 30]], 'B': [['R2', 30]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 20, 90, False], ['E1', 10, 120, False], ['E2', 20, 120, False]], [['R0', 30], ['R1', 20]]],
   {'placed': {'E0': [['R1', 20]], 'E2': [['R0', 20]], 'E1': [['R0', 10]]}, 'unplaced': []}),
  ('normal control 6', [[['E0', 45, 180, False], ['E1', 80, 90, False]], [['R0', 20], ['R1', 60]]],
   {'placed': {'E0': [['R1', 45]]}, 'unplaced': ['E1']}),
  ('normal control 7',
   [[['E0', 60, 120, False], ['E1', 45, 180, True], ['E2', 60, 180, True], ['E3', 30, 120, True],
     ['E4', 20, 180, True]],
    [['R0', 40], ['R1', 60]]],
   {'placed': {'E0': [['R1', 60]], 'E3': [['R0', 30]]}, 'unplaced': ['E2', 'E1', 'E4']}),
  ('normal control 8',
   [[['E0', 60, 90, False], ['E1', 80, 90, True], ['E2', 30, 180, False]], [['R0', 40], ['R1', 30]]],
   {'placed': {'E2': [['R1', 30]]}, 'unplaced': ['E1', 'E0']})],
 [('regression: duration compatibility 1',
   [[['E0', 60, 180, True], ['E1', 20, 120, True], ['E2', 10, 120, True], ['E3', 45, 120, True],
     ['E4', 45, 120, True]],
    [['R0', 30], ['R1', 20], ['R2', 20], ['R3', 50]]],
   {'placed': {'E0': [['R3', 50], ['R0', 10]], 'E1': [['R1', 20]], 'E2': [['R2', 10]]},
    'unplaced': ['E3', 'E4']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 60, 120, True], ['E1', 80, 180, True], ['E2', 10, 90, True]],
    [['R0', 60], ['R1', 30], ['R2', 60]]],
   {'placed': {'E1': [['R0', 60], ['R2', 20]], 'E2': [['R1', 10]]}, 'unplaced': ['E0']}),
  ('partial repair guard 3', [[['E0', 60, 90, True], ['E1', 10, 120, False]], [['R0', 50], ['R1', 20]]],
   {'placed': {'E0': [['R0', 50], ['R1', 10]]}, 'unplaced': ['E1']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 19]]],
   {'placed': {}, 'unplaced': ['A']}),
  ('normal control 5',
   [[['E0', 10, 180, True], ['E1', 20, 120, False], ['E2', 20, 120, True], ['E3', 10, 120, True],
     ['E4', 30, 180, False]],
    [['R0', 50], ['R1', 30], ['R2', 30]]],
   {'placed': {'E4': [['R1', 30]], 'E1': [['R2', 20]], 'E2': [['R0', 20]], 'E3': [['R2', 10]]},
    'unplaced': ['E0']}),
  ('normal control 6',
   [[['E0', 45, 120, True], ['E1', 10, 120, True]], [['R0', 30], ['R1', 50], ['R2', 50], ['R3', 40]]],
   {'placed': {'E0': [['R1', 45]], 'E1': [['R0', 10]]}, 'unplaced': []}),
  ('normal control 7',
   [[['E0', 60, 120, False], ['E1', 45, 180, False], ['E2', 45, 180, True], ['E3', 30, 120, False],
     ['E4', 20, 180, False]],
    [['R0', 30], ['R1', 60], ['R2', 20], ['R3', 40]]],
   {'placed': {'E0': [['R1', 60]], 'E2': [['R3', 40], ['R0', 5]], 'E4': [['R2', 20]]},
    'unplaced': ['E1', 'E3']}),
  ('normal control 8',
   [[['E0', 10, 90, True], ['E1', 10, 120, True]], [['R0', 30], ['R1', 30], ['R2', 50], ['R3', 30]]],
   {'placed': {'E0': [['R0', 10]], 'E1': [['R1', 10]]}, 'unplaced': []})],
 [('regression: duration compatibility 1',
   [[['E0', 80, 120, True], ['E1', 80, 120, True], ['E2', 20, 180, True], ['E3', 10, 90, True],
     ['E4', 80, 180, True]],
    [['R0', 50], ['R1', 60], ['R2', 60]]],
   {'placed': {'E0': [['R1', 60], ['R2', 20]], 'E1': [['R0', 50], ['R2', 30]]},
    'unplaced': ['E4', 'E2', 'E3']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 20, 90, False], ['E1', 10, 120, False], ['E2', 20, 120, True], ['E3', 20, 90, False],
     ['E4', 20, 120, True]],
    [['R0', 20], ['R1', 60], ['R2', 50]]],
   {'placed': {'E0': [['R0', 20]],
               'E2': [['R2', 20]],
               'E3': [['R1', 20]],
               'E4': [['R2', 20]],
               'E1': [['R2', 10]]},
    'unplaced': []}),
  ('partial repair guard 3',
   [[['E0', 10, 120, False], ['E1', 80, 180, True], ['E2', 20, 90, True]],
    [['R0', 30], ['R1', 40], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60], ['R1', 20]], 'E2': [['R0', 20]]}, 'unplaced': ['E0']}),
  ('boundary control 4', [[['A', 30, 120, False], ['B', 30, 90, False]], [['R1', 60]]],
   {'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}),
  ('normal control 5', [[['E0', 30, 120, False], ['E1', 45, 120, True]], [['R0', 20], ['R1', 20]]],
   {'placed': {}, 'unplaced': ['E1', 'E0']}),
  ('normal control 6',
   [[['E0', 60, 120, False], ['E1', 10, 120, True], ['E2', 10, 90, True], ['E3', 30, 90, False],
     ['E4', 80, 120, False]],
    [['R0', 20], ['R1', 30], ['R2', 30]]],
   {'placed': {'E3': [['R1', 30]], 'E1': [['R0', 10]], 'E2': [['R2', 10]]}, 'unplaced': ['E4', 'E0']}),
  ('normal control 7',
   [[['E0', 20, 120, True], ['E1', 20, 180, True], ['E2', 80, 180, True], ['E3', 80, 90, True],
     ['E4', 60, 180, False]],
    [['R0', 30], ['R1', 50]]],
   {'placed': {'E2': [['R1', 50], ['R0', 30]]}, 'unplaced': ['E3', 'E4', 'E0', 'E1']}),
  ('normal control 8',
   [[['E0', 20, 120, True], ['E1', 60, 120, True]], [['R0', 30], ['R1', 40], ['R2', 20], ['R3', 30]]],
   {'placed': {'E1': [['R1', 40], ['R0', 20]], 'E0': [['R2', 20]]}, 'unplaced': []})]]
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: duration compatibility 1{'placed': {'A': [['R1', 30]], 'B': [['R1', 30]]}, 'unplaced': []}{'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}Failed
regression variant: duration compatibility 2{'placed': {'E0': [['R1', 40], ['R2', 20]], 'E1': [['R3', 20]], 'E2': [['R0', 60], ['R3', 20]], 'E3': [['R3', 10]]}, 'unplaced': ['E4']}{'placed': {'E0': [['R1', 40], ['R2', 20]], 'E2': [['R0', 60], ['R3', 20]], 'E3': [['R3', 10]]}, 'unplaced': ['E4', 'E1']}Failed
partial repair guard 3{'placed': {'E0': [['R1', 10]], 'E1': [['R0', 20]], 'E2': [['R1', 10]]}, 'unplaced': []}{'placed': {'E0': [['R1', 10]], 'E1': [['R0', 20]]}, 'unplaced': ['E2']}Failed
boundary control 4{'placed': {'A': [['R2', 40]], 'B': [['R1', 20]]}, 'unplaced': []}{'placed': {'A': [['R2', 40]], 'B': [['R1', 20]]}, 'unplaced': []}Passed
normal control 5{'placed': {'E0': [['R0', 20]], 'E1': [['R0', 10]], 'E2': [['R1', 10]]}, 'unplaced': []}{'placed': {'E0': [['R0', 20]], 'E1': [['R1', 10]], 'E2': [['R1', 10]]}, 'unplaced': []}Failed
normal control 6{'placed': {'E0': [['R0', 30]], 'E1': [['R1', 45]]}, 'unplaced': []}{'placed': {'E0': [['R0', 30]], 'E1': [['R1', 45]]}, 'unplaced': []}Passed
normal control 7{'placed': {'E0': [['R0', 45]], 'E1': [['R1', 60]], 'E2': [['R2', 30]]}, 'unplaced': []}{'placed': {'E0': [['R0', 45]], 'E1': [['R1', 60]], 'E2': [['R2', 30]]}, 'unplaced': []}Passed
normal control 8{'placed': {'E1': [['R0', 45]], 'E3': [['R1', 20]], 'E4': [['R1', 10]]}, 'unplaced': ['E0', 'E2']}{'placed': {'E1': [['R0', 45]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E2', 'E4']}Failed

SHA-256 / 30331c2139fc29b3cdfed11eb0be7015f5b4bb2c3309266d7c25c4b140b759ea

3 / The verified repair

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

N = 1
observations = []
def solve(exams, rooms):
    rem = {r: c for r, c in rooms}
    dur = {}
    place = {}
    unplaced = []
    for eid, size, d, split in sorted(exams, key=lambda x: (-x[1], x[0])):
        ok = [r for r in rem if dur.get(r, d) == d]
        fit = [r for r in ok if rem[r] >= size]
        if fit:
            r = min(fit, key=lambda r: (rem[r], r))
            place[eid] = [[r, size]]
            rem[r] -= size
            dur[r] = d
            continue
        if split and sum(rem[r] for r in ok) >= size:
            parts = []
            left = size
            for r in sorted(ok, key=lambda r: (-rem[r], r)):
                if left == 0:
                    break
                take = min(rem[r], left)
                parts.append([r, take])
                rem[r] -= take
                dur[r] = d
                left -= take
            place[eid] = parts
            continue
        unplaced.append(eid)
    return {'placed': place, 'unplaced': unplaced}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: duration compatibility 1', [[['A', 30, 120, False], ['B', 30, 90, False]], [['R1', 60]]],
   {'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 60, 180, True], ['E1', 20, 90, False], ['E2', 80, 120, True], ['E3', 10, 120, False],
     ['E4', 60, 120, False]],
    [['R0', 60], ['R1', 40], ['R2', 20], ['R3', 50]]],
   {'placed': {'E2': [['R0', 60], ['R3', 20]], 'E0': [['R1', 40], ['R2', 20]], 'E3': [['R3', 10]]},
    'unplaced': ['E4', 'E1']}),
  ('partial repair guard 3',
   [[['E0', 10, 90, True], ['E1', 20, 120, True], ['E2', 10, 120, False]], [['R0', 20], ['R1', 30]]],
   {'placed': {'E1': [['R0', 20]], 'E0': [['R1', 10]]}, 'unplaced': ['E2']}),
  ('boundary control 4', [[['A', 40, 120, False], ['B', 20, 120, False]], [['R1', 60], ['R2', 40]]],
   {'placed': {'A': [['R2', 40]], 'B': [['R1', 20]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 20, 90, True], ['E1', 10, 120, True], ['E2', 10, 120, True]], [['R0', 30], ['R1', 60]]],
   {'placed': {'E0': [['R0', 20]], 'E1': [['R1', 10]], 'E2': [['R1', 10]]}, 'unplaced': []}),
  ('normal control 6', [[['E0', 30, 120, True], ['E1', 45, 120, True]], [['R0', 60], ['R1', 50]]],
   {'placed': {'E1': [['R1', 45]], 'E0': [['R0', 30]]}, 'unplaced': []}),
  ('normal control 7',
   [[['E0', 45, 120, True], ['E1', 60, 120, False], ['E2', 30, 120, False]],
    [['R0', 50], ['R1', 60], ['R2', 60]]],
   {'placed': {'E1': [['R1', 60]], 'E0': [['R0', 45]], 'E2': [['R2', 30]]}, 'unplaced': []}),
  ('normal control 8',
   [[['E0', 80, 90, False], ['E1', 45, 90, True], ['E2', 80, 90, False], ['E3', 20, 120, True],
     ['E4', 10, 90, True]],
    [['R0', 50], ['R1', 60]]],
   {'placed': {'E1': [['R0', 45]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E2', 'E4']})],
 [('regression: duration compatibility 1',
   [[['E0', 80, 180, True], ['E1', 20, 90, True], ['E2', 80, 90, False], ['E3', 80, 90, True]],
    [['R0', 60], ['R1', 60], ['R2', 20], ['R3', 20]]],
   {'placed': {'E0': [['R0', 60], ['R1', 20]], 'E1': [['R2', 20]]}, 'unplaced': ['E2', 'E3']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 10, 90, True], ['E1', 10, 120, True], ['E2', 30, 120, False], ['E3', 80, 90, False],
     ['E4', 80, 120, True]],
    [['R0', 30], ['R1', 40], ['R2', 50]]],
   {'placed': {'E4': [['R2', 50], ['R1', 30]], 'E2': [['R0', 30]], 'E1': [['R1', 10]]},
    'unplaced': ['E3', 'E0']}),
  ('partial repair guard 3',
   [[['E0', 45, 90, True], ['E1', 80, 90, False], ['E2', 30, 120, True]], [['R0', 20], ['R1', 60]]],
   {'placed': {'E0': [['R1', 45]]}, 'unplaced': ['E1', 'E2']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 20]]],
   {'placed': {'A': [['R1', 30], ['R2', 20]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 80, 120, True], ['E1', 45, 120, True], ['E2', 60, 180, True]],
    [['R0', 40], ['R1', 40], ['R2', 50]]],
   {'placed': {'E0': [['R2', 50], ['R0', 30]], 'E1': [['R1', 40], ['R0', 5]]}, 'unplaced': ['E2']}),
  ('normal control 6',
   [[['E0', 60, 120, True], ['E1', 60, 120, True], ['E2', 80, 120, True], ['E3', 30, 180, False]],
    [['R0', 20], ['R1', 40]]],
   {'placed': {'E0': [['R1', 40], ['R0', 20]]}, 'unplaced': ['E2', 'E1', 'E3']}),
  ('normal control 7', [[['E0', 20, 120, True], ['E1', 20, 120, False]], [['R0', 60], ['R1', 40]]],
   {'placed': {'E0': [['R1', 20]], 'E1': [['R1', 20]]}, 'unplaced': []}),
  ('normal control 8',
   [[['E0', 45, 90, True], ['E1', 45, 90, False], ['E2', 80, 120, False]],
    [['R0', 20], ['R1', 30], ['R2', 50]]],
   {'placed': {'E0': [['R2', 45]]}, 'unplaced': ['E2', 'E1']})],
 [('regression: duration compatibility 1',
   [[['E0', 30, 120, True], ['E1', 10, 90, False]], [['R0', 60], ['R1', 60]]],
   {'placed': {'E0': [['R0', 30]], 'E1': [['R1', 10]]}, 'unplaced': []}),
  ('regression variant: duration compatibility 2',
   [[['E0', 20, 90, False], ['E1', 30, 180, True], ['E2', 30, 120, True], ['E3', 45, 120, False],
     ['E4', 10, 120, False]],
    [['R0', 60], ['R1', 40]]],
   {'placed': {'E3': [['R0', 45]], 'E1': [['R1', 30]], 'E4': [['R0', 10]]}, 'unplaced': ['E2', 'E0']}),
  ('partial repair guard 3',
   [[['E0', 20, 90, True], ['E1', 10, 120, True], ['E2', 30, 90, True]],
    [['R0', 30], ['R1', 30], ['R2', 50]]],
   {'placed': {'E2': [['R0', 30]], 'E0': [['R1', 20]], 'E1': [['R2', 10]]}, 'unplaced': []}),
  ('boundary control 4', [[['A', 30, 120, True], ['B', 30, 120, True]], [['R1', 30], ['R2', 40]]],
   {'placed': {'A': [['R1', 30]], 'B': [['R2', 30]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 20, 90, False], ['E1', 10, 120, False], ['E2', 20, 120, False]], [['R0', 30], ['R1', 20]]],
   {'placed': {'E0': [['R1', 20]], 'E2': [['R0', 20]], 'E1': [['R0', 10]]}, 'unplaced': []}),
  ('normal control 6', [[['E0', 45, 180, False], ['E1', 80, 90, False]], [['R0', 20], ['R1', 60]]],
   {'placed': {'E0': [['R1', 45]]}, 'unplaced': ['E1']}),
  ('normal control 7',
   [[['E0', 60, 120, False], ['E1', 45, 180, True], ['E2', 60, 180, True], ['E3', 30, 120, True],
     ['E4', 20, 180, True]],
    [['R0', 40], ['R1', 60]]],
   {'placed': {'E0': [['R1', 60]], 'E3': [['R0', 30]]}, 'unplaced': ['E2', 'E1', 'E4']}),
  ('normal control 8',
   [[['E0', 60, 90, False], ['E1', 80, 90, True], ['E2', 30, 180, False]], [['R0', 40], ['R1', 30]]],
   {'placed': {'E2': [['R1', 30]]}, 'unplaced': ['E1', 'E0']})],
 [('regression: duration compatibility 1',
   [[['E0', 60, 180, True], ['E1', 20, 120, True], ['E2', 10, 120, True], ['E3', 45, 120, True],
     ['E4', 45, 120, True]],
    [['R0', 30], ['R1', 20], ['R2', 20], ['R3', 50]]],
   {'placed': {'E0': [['R3', 50], ['R0', 10]], 'E1': [['R1', 20]], 'E2': [['R2', 10]]},
    'unplaced': ['E3', 'E4']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 60, 120, True], ['E1', 80, 180, True], ['E2', 10, 90, True]],
    [['R0', 60], ['R1', 30], ['R2', 60]]],
   {'placed': {'E1': [['R0', 60], ['R2', 20]], 'E2': [['R1', 10]]}, 'unplaced': ['E0']}),
  ('partial repair guard 3', [[['E0', 60, 90, True], ['E1', 10, 120, False]], [['R0', 50], ['R1', 20]]],
   {'placed': {'E0': [['R0', 50], ['R1', 10]]}, 'unplaced': ['E1']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 19]]],
   {'placed': {}, 'unplaced': ['A']}),
  ('normal control 5',
   [[['E0', 10, 180, True], ['E1', 20, 120, False], ['E2', 20, 120, True], ['E3', 10, 120, True],
     ['E4', 30, 180, False]],
    [['R0', 50], ['R1', 30], ['R2', 30]]],
   {'placed': {'E4': [['R1', 30]], 'E1': [['R2', 20]], 'E2': [['R0', 20]], 'E3': [['R2', 10]]},
    'unplaced': ['E0']}),
  ('normal control 6',
   [[['E0', 45, 120, True], ['E1', 10, 120, True]], [['R0', 30], ['R1', 50], ['R2', 50], ['R3', 40]]],
   {'placed': {'E0': [['R1', 45]], 'E1': [['R0', 10]]}, 'unplaced': []}),
  ('normal control 7',
   [[['E0', 60, 120, False], ['E1', 45, 180, False], ['E2', 45, 180, True], ['E3', 30, 120, False],
     ['E4', 20, 180, False]],
    [['R0', 30], ['R1', 60], ['R2', 20], ['R3', 40]]],
   {'placed': {'E0': [['R1', 60]], 'E2': [['R3', 40], ['R0', 5]], 'E4': [['R2', 20]]},
    'unplaced': ['E1', 'E3']}),
  ('normal control 8',
   [[['E0', 10, 90, True], ['E1', 10, 120, True]], [['R0', 30], ['R1', 30], ['R2', 50], ['R3', 30]]],
   {'placed': {'E0': [['R0', 10]], 'E1': [['R1', 10]]}, 'unplaced': []})],
 [('regression: duration compatibility 1',
   [[['E0', 80, 120, True], ['E1', 80, 120, True], ['E2', 20, 180, True], ['E3', 10, 90, True],
     ['E4', 80, 180, True]],
    [['R0', 50], ['R1', 60], ['R2', 60]]],
   {'placed': {'E0': [['R1', 60], ['R2', 20]], 'E1': [['R0', 50], ['R2', 30]]},
    'unplaced': ['E4', 'E2', 'E3']}),
  ('regression variant: duration compatibility 2',
   [[['E0', 20, 90, False], ['E1', 10, 120, False], ['E2', 20, 120, True], ['E3', 20, 90, False],
     ['E4', 20, 120, True]],
    [['R0', 20], ['R1', 60], ['R2', 50]]],
   {'placed': {'E0': [['R0', 20]],
               'E2': [['R2', 20]],
               'E3': [['R1', 20]],
               'E4': [['R2', 20]],
               'E1': [['R2', 10]]},
    'unplaced': []}),
  ('partial repair guard 3',
   [[['E0', 10, 120, False], ['E1', 80, 180, True], ['E2', 20, 90, True]],
    [['R0', 30], ['R1', 40], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60], ['R1', 20]], 'E2': [['R0', 20]]}, 'unplaced': ['E0']}),
  ('boundary control 4', [[['A', 30, 120, False], ['B', 30, 90, False]], [['R1', 60]]],
   {'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}),
  ('normal control 5', [[['E0', 30, 120, False], ['E1', 45, 120, True]], [['R0', 20], ['R1', 20]]],
   {'placed': {}, 'unplaced': ['E1', 'E0']}),
  ('normal control 6',
   [[['E0', 60, 120, False], ['E1', 10, 120, True], ['E2', 10, 90, True], ['E3', 30, 90, False],
     ['E4', 80, 120, False]],
    [['R0', 20], ['R1', 30], ['R2', 30]]],
   {'placed': {'E3': [['R1', 30]], 'E1': [['R0', 10]], 'E2': [['R2', 10]]}, 'unplaced': ['E4', 'E0']}),
  ('normal control 7',
   [[['E0', 20, 120, True], ['E1', 20, 180, True], ['E2', 80, 180, True], ['E3', 80, 90, True],
     ['E4', 60, 180, False]],
    [['R0', 30], ['R1', 50]]],
   {'placed': {'E2': [['R1', 50], ['R0', 30]]}, 'unplaced': ['E3', 'E4', 'E0', 'E1']}),
  ('normal control 8',
   [[['E0', 20, 120, True], ['E1', 60, 120, True]], [['R0', 30], ['R1', 40], ['R2', 20], ['R3', 30]]],
   {'placed': {'E1': [['R1', 40], ['R0', 20]], 'E0': [['R2', 20]]}, 'unplaced': []})]]
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: duration compatibility 1{'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}{'placed': {'A': [['R1', 30]]}, 'unplaced': ['B']}Passed
regression variant: duration compatibility 2{'placed': {'E0': [['R1', 40], ['R2', 20]], 'E2': [['R0', 60], ['R3', 20]], 'E3': [['R3', 10]]}, 'unplaced': ['E4', 'E1']}{'placed': {'E0': [['R1', 40], ['R2', 20]], 'E2': [['R0', 60], ['R3', 20]], 'E3': [['R3', 10]]}, 'unplaced': ['E4', 'E1']}Passed
partial repair guard 3{'placed': {'E0': [['R1', 10]], 'E1': [['R0', 20]]}, 'unplaced': ['E2']}{'placed': {'E0': [['R1', 10]], 'E1': [['R0', 20]]}, 'unplaced': ['E2']}Passed
boundary control 4{'placed': {'A': [['R2', 40]], 'B': [['R1', 20]]}, 'unplaced': []}{'placed': {'A': [['R2', 40]], 'B': [['R1', 20]]}, 'unplaced': []}Passed
normal control 5{'placed': {'E0': [['R0', 20]], 'E1': [['R1', 10]], 'E2': [['R1', 10]]}, 'unplaced': []}{'placed': {'E0': [['R0', 20]], 'E1': [['R1', 10]], 'E2': [['R1', 10]]}, 'unplaced': []}Passed
normal control 6{'placed': {'E0': [['R0', 30]], 'E1': [['R1', 45]]}, 'unplaced': []}{'placed': {'E0': [['R0', 30]], 'E1': [['R1', 45]]}, 'unplaced': []}Passed
normal control 7{'placed': {'E0': [['R0', 45]], 'E1': [['R1', 60]], 'E2': [['R2', 30]]}, 'unplaced': []}{'placed': {'E0': [['R0', 45]], 'E1': [['R1', 60]], 'E2': [['R2', 30]]}, 'unplaced': []}Passed
normal control 8{'placed': {'E1': [['R0', 45]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E2', 'E4']}{'placed': {'E1': [['R0', 45]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E2', 'E4']}Passed

SHA-256 / c3f1f958ea3d159e06914caebe4baef89f64c1e1f3f73086163ab3413781c35b

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

Case digest / e2ed3ca59564679b55a5ca1fa4e3249220c57305aab0af0b61d7f5b12f391287