FAILURE MAP
← Case archive

FA-94406 / Exam timetabling constraints / Open access

Rooms used by a split exam keep no duration record · case 01

A later exam of a different duration is seated in a room already running part of a split exam.

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

ROOT CAUSE

The split branch does not record the exam duration on the rooms it fills.

VERIFIED REPAIR

Record the duration on every room that receives part of the split exam.

Unsuccessful approach: Recording it only on the first split room leaves the other rooms open to mixed 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
                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: split room duration record 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: split room duration record 2',
   [[['E0', 45, 120, True], ['E1', 20, 90, False], ['E2', 60, 120, True]],
    [['R0', 40], ['R1', 30], ['R2', 40], ['R3', 50]]],
   {'placed': {'E2': [['R3', 50], ['R0', 10]], 'E0': [['R2', 40], ['R0', 5]], 'E1': [['R1', 20]]},
    'unplaced': []}),
  ('partial repair guard 3',
   [[['E0', 45, 180, False], ['E1', 80, 120, True], ['E2', 45, 180, True], ['E3', 20, 180, True],
     ['E4', 80, 180, True]],
    [['R0', 30], ['R1', 60], ['R2', 20], ['R3', 20]]],
   {'placed': {'E1': [['R1', 60], ['R0', 20]], 'E3': [['R2', 20]]}, 'unplaced': ['E4', 'E0', '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', 10, 180, True], ['E1', 10, 90, False]], [['R0', 60], ['R1', 60]]],
   {'placed': {'E0': [['R0', 10]], 'E1': [['R1', 10]]}, 'unplaced': []}),
  ('normal control 6',
   [[['E0', 30, 120, True], ['E1', 30, 180, True], ['E2', 30, 120, True], ['E3', 30, 180, True],
     ['E4', 60, 120, True]],
    [['R0', 20], ['R1', 50], ['R2', 60], ['R3', 30]]],
   {'placed': {'E4': [['R2', 60]], 'E0': [['R3', 30]], 'E1': [['R1', 30]], 'E3': [['R0', 20], ['R1', 10]]},
    'unplaced': ['E2']}),
  ('normal control 7',
   [[['E0', 10, 90, False], ['E1', 80, 180, True], ['E2', 30, 90, True]], [['R0', 30], ['R1', 20]]],
   {'placed': {'E2': [['R0', 30]], 'E0': [['R1', 10]]}, 'unplaced': ['E1']}),
  ('normal control 8',
   [[['E0', 30, 180, True], ['E1', 10, 120, True], ['E2', 80, 180, True]],
    [['R0', 20], ['R1', 20], ['R2', 60], ['R3', 60]]],
   {'placed': {'E2': [['R2', 60], ['R3', 20]], 'E0': [['R3', 30]], 'E1': [['R0', 10]]}, 'unplaced': []})],
 [('regression: split room duration record 1',
   [[['E0', 10, 120, False], ['E1', 60, 120, False], ['E2', 60, 90, True], ['E3', 30, 120, True],
     ['E4', 80, 120, False]],
    [['R0', 60], ['R1', 50], ['R2', 50], ['R3', 40]]],
   {'placed': {'E1': [['R0', 60]], 'E2': [['R1', 50], ['R2', 10]], 'E3': [['R3', 30]], 'E0': [['R3', 10]]},
    'unplaced': ['E4']}),
  ('regression variant: split room duration record 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, 120, True], ['E1', 80, 90, False], ['E2', 10, 180, False], ['E3', 80, 180, True]],
    [['R0', 40], ['R1', 20]]],
   {'placed': {'E0': [['R0', 40], ['R1', 5]]}, 'unplaced': ['E1', 'E3', 'E2']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 20]]],
   {'placed': {'A': [['R1', 30], ['R2', 20]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 30, 120, True], ['E1', 60, 120, False], ['E2', 60, 90, True], ['E3', 20, 90, True],
     ['E4', 20, 120, False]],
    [['R0', 50], ['R1', 40], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60]], 'E2': [['R0', 50], ['R1', 10]], 'E3': [['R1', 20]]},
    'unplaced': ['E0', 'E4']}),
  ('normal control 6',
   [[['E0', 30, 120, True], ['E1', 10, 180, False]], [['R0', 20], ['R1', 30], ['R2', 30]]],
   {'placed': {'E0': [['R1', 30]], 'E1': [['R0', 10]]}, 'unplaced': []}),
  ('normal control 7',
   [[['E0', 30, 120, True], ['E1', 60, 120, True], ['E2', 45, 120, False]],
    [['R0', 40], ['R1', 60], ['R2', 30], ['R3', 20]]],
   {'placed': {'E1': [['R1', 60]], 'E0': [['R2', 30]]}, 'unplaced': ['E2']}),
  ('normal control 8',
   [[['E0', 80, 120, True], ['E1', 60, 120, True], ['E2', 60, 90, True], ['E3', 20, 180, False],
     ['E4', 30, 120, False]],
    [['R0', 40], ['R1', 40], ['R2', 20]]],
   {'placed': {'E0': [['R0', 40], ['R1', 40]], 'E3': [['R2', 20]]}, 'unplaced': ['E1', 'E2', 'E4']})],
 [('regression: split room duration record 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: split room duration record 2',
   [[['E0', 60, 120, True], ['E1', 30, 90, False], ['E2', 30, 90, True], ['E3', 20, 120, True],
     ['E4', 80, 120, True]],
    [['R0', 20], ['R1', 30], ['R2', 60], ['R3', 20]]],
   {'placed': {'E4': [['R2', 60], ['R1', 20]], 'E2': [['R0', 20], ['R3', 10]]},
    'unplaced': ['E0', 'E1', 'E3']}),
  ('partial repair guard 3',
   [[['E0', 80, 180, True], ['E1', 20, 120, False], ['E2', 20, 180, False], ['E3', 30, 180, False],
     ['E4', 45, 90, True]],
    [['R0', 60], ['R1', 40], ['R2', 60]]],
   {'placed': {'E0': [['R0', 60], ['R2', 20]], 'E3': [['R1', 30]], 'E2': [['R2', 20]]},
    'unplaced': ['E4', 'E1']}),
  ('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', 30, 180, False], ['E1', 60, 120, True], ['E2', 10, 180, True]],
    [['R0', 20], ['R1', 40], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60]], 'E0': [['R1', 30]], 'E2': [['R1', 10]]}, 'unplaced': []}),
  ('normal control 6',
   [[['E0', 45, 120, True], ['E1', 80, 120, False], ['E2', 60, 90, False]],
    [['R0', 40], ['R1', 40], ['R2', 50], ['R3', 40]]],
   {'placed': {'E0': [['R2', 45]]}, 'unplaced': ['E1', 'E2']}),
  ('normal control 7',
   [[['E0', 80, 120, False], ['E1', 80, 120, True]], [['R0', 40], ['R1', 20], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60], ['R0', 20]]}, 'unplaced': ['E0']}),
  ('normal control 8',
   [[['E0', 45, 120, False], ['E1', 45, 90, False], ['E2', 80, 90, True], ['E3', 60, 90, False],
     ['E4', 80, 180, True]],
    [['R0', 60], ['R1', 20], ['R2', 20]]],
   {'placed': {'E2': [['R0', 60], ['R1', 20]]}, 'unplaced': ['E4', 'E3', 'E0', 'E1']})],
 [('regression: split room duration record 1',
   [[['E0', 60, 90, True], ['E1', 30, 120, False], ['E2', 10, 180, True]],
    [['R0', 50], ['R1', 40], ['R2', 20]]],
   {'placed': {'E0': [['R0', 50], ['R1', 10]], 'E2': [['R2', 10]]}, 'unplaced': ['E1']}),
  ('regression variant: split room duration record 2',
   [[['E0', 60, 120, False], ['E1', 60, 90, True], ['E2', 10, 120, True], ['E3', 20, 90, False],
     ['E4', 30, 180, True]],
    [['R0', 50], ['R1', 40]]],
   {'placed': {'E1': [['R0', 50], ['R1', 10]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E4', 'E2']}),
  ('partial repair guard 3',
   [[['E0', 10, 90, True], ['E1', 20, 120, True], ['E2', 80, 120, False], ['E3', 60, 120, True],
     ['E4', 20, 120, True]],
    [['R0', 50], ['R1', 20], ['R2', 50], ['R3', 30]]],
   {'placed': {'E3': [['R0', 50], ['R2', 10]], 'E1': [['R1', 20]], 'E4': [['R3', 20]]},
    'unplaced': ['E2', 'E0']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 19]]],
   {'placed': {}, 'unplaced': ['A']}),
  ('normal control 5',
   [[['E0', 60, 120, True], ['E1', 45, 120, True]], [['R0', 20], ['R1', 20], ['R2', 60], ['R3', 60]]],
   {'placed': {'E0': [['R2', 60]], 'E1': [['R3', 45]]}, 'unplaced': []}),
  ('normal control 6',
   [[['E0', 80, 180, True], ['E1', 80, 120, False], ['E2', 10, 180, False], ['E3', 45, 120, False],
     ['E4', 80, 90, False]],
    [['R0', 40], ['R1', 30], ['R2', 40], ['R3', 30]]],
   {'placed': {'E0': [['R0', 40], ['R2', 40]], 'E2': [['R1', 10]]}, 'unplaced': ['E1', 'E4', 'E3']}),
  ('normal control 7',
   [[['E0', 30, 180, True], ['E1', 45, 120, False], ['E2', 45, 90, True], ['E3', 60, 120, False],
     ['E4', 30, 120, True]],
    [['R0', 30], ['R1', 50]]],
   {'placed': {'E1': [['R1', 45]], 'E0': [['R0', 30]]}, 'unplaced': ['E3', 'E2', 'E4']}),
  ('normal control 8',
   [[['E0', 20, 120, True], ['E1', 60, 180, False], ['E2', 80, 180, False], ['E3', 60, 120, True]],
    [['R0', 20], ['R1', 20], ['R2', 30], ['R3', 60]]],
   {'placed': {'E1': [['R3', 60]], 'E3': [['R2', 30], ['R0', 20], ['R1', 10]]}, 'unplaced': ['E2', 'E0']})],
 [('regression: split room duration record 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: split room duration record 2',
   [[['E0', 20, 120, True], ['E1', 60, 120, False], ['E2', 30, 180, True], ['E3', 80, 120, True]],
    [['R0', 20], ['R1', 50], ['R2', 40]]],
   {'placed': {'E3': [['R1', 50], ['R2', 30]], 'E0': [['R0', 20]]}, 'unplaced': ['E1', 'E2']}),
  ('partial repair guard 3',
   [[['E0', 80, 90, False], ['E1', 45, 120, True], ['E2', 10, 120, True], ['E3', 20, 120, False],
     ['E4', 20, 90, True]],
    [['R0', 30], ['R1', 40], ['R2', 40]]],
   {'placed': {'E1': [['R1', 40], ['R2', 5]], 'E3': [['R0', 20]], 'E2': [['R0', 10]]},
    'unplaced': ['E0', 'E4']}),
  ('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, True], ['E1', 60, 120, True]], [['R0', 30], ['R1', 40]]],
   {'placed': {'E1': [['R1', 40], ['R0', 20]]}, 'unplaced': ['E0']}),
  ('normal control 6',
   [[['E0', 80, 180, True], ['E1', 45, 180, True], ['E2', 60, 180, False], ['E3', 80, 90, False]],
    [['R0', 50], ['R1', 50], ['R2', 50], ['R3', 60]]],
   {'placed': {'E0': [['R3', 60], ['R0', 20]], 'E1': [['R1', 45]]}, 'unplaced': ['E3', 'E2']}),
  ('normal control 7',
   [[['E0', 80, 120, False], ['E1', 20, 120, True]], [['R0', 40], ['R1', 30], ['R2', 60], ['R3', 40]]],
   {'placed': {'E1': [['R1', 20]]}, 'unplaced': ['E0']}),
  ('normal control 8',
   [[['E0', 30, 90, False], ['E1', 80, 120, True], ['E2', 20, 90, False], ['E3', 20, 120, False],
     ['E4', 60, 120, False]],
    [['R0', 50], ['R1', 20], ['R2', 40]]],
   {'placed': {'E1': [['R0', 50], ['R2', 30]], 'E2': [['R1', 20]]}, 'unplaced': ['E4', 'E0', 'E3']})]]
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: split room duration record 1{'placed': {'E0': [['R0', 60], ['R1', 20]], 'E3': [['R1', 40], ['R2', 20], ['R3', 20]]}, 'unplaced': ['E2', 'E1']}{'placed': {'E0': [['R0', 60], ['R1', 20]], 'E1': [['R2', 20]]}, 'unplaced': ['E2', 'E3']}Failed
regression variant: split room duration record 2{'placed': {'E0': [['R2', 40], ['R0', 5]], 'E1': [['R0', 20]], 'E2': [['R3', 50], ['R0', 10]]}, 'unplaced': []}{'placed': {'E0': [['R2', 40], ['R0', 5]], 'E1': [['R1', 20]], 'E2': [['R3', 50], ['R0', 10]]}, 'unplaced': []}Failed
partial repair guard 3{'placed': {'E1': [['R1', 60], ['R0', 20]], 'E2': [['R2', 20], ['R3', 20], ['R0', 5]]}, 'unplaced': ['E4', 'E0', 'E3']}{'placed': {'E1': [['R1', 60], ['R0', 20]], 'E3': [['R2', 20]]}, 'unplaced': ['E4', 'E0', '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', 10]], 'E1': [['R1', 10]]}, 'unplaced': []}{'placed': {'E0': [['R0', 10]], 'E1': [['R1', 10]]}, 'unplaced': []}Passed
normal control 6{'placed': {'E0': [['R3', 30]], 'E1': [['R1', 30]], 'E3': [['R0', 20], ['R1', 10]], 'E4': [['R2', 60]]}, 'unplaced': ['E2']}{'placed': {'E0': [['R3', 30]], 'E1': [['R1', 30]], 'E3': [['R0', 20], ['R1', 10]], 'E4': [['R2', 60]]}, 'unplaced': ['E2']}Passed
normal control 7{'placed': {'E0': [['R1', 10]], 'E2': [['R0', 30]]}, 'unplaced': ['E1']}{'placed': {'E0': [['R1', 10]], 'E2': [['R0', 30]]}, 'unplaced': ['E1']}Passed
normal control 8{'placed': {'E0': [['R3', 30]], 'E1': [['R0', 10]], 'E2': [['R2', 60], ['R3', 20]]}, 'unplaced': []}{'placed': {'E0': [['R3', 30]], 'E1': [['R0', 10]], 'E2': [['R2', 60], ['R3', 20]]}, 'unplaced': []}Passed

SHA-256 / a8eb78083c174f3e5ce5e4b85ad719af75b64343ce97ebf1a0269417fadd77fd

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 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
                if not parts[:-1]:
                    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: split room duration record 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: split room duration record 2',
   [[['E0', 45, 120, True], ['E1', 20, 90, False], ['E2', 60, 120, True]],
    [['R0', 40], ['R1', 30], ['R2', 40], ['R3', 50]]],
   {'placed': {'E2': [['R3', 50], ['R0', 10]], 'E0': [['R2', 40], ['R0', 5]], 'E1': [['R1', 20]]},
    'unplaced': []}),
  ('partial repair guard 3',
   [[['E0', 45, 180, False], ['E1', 80, 120, True], ['E2', 45, 180, True], ['E3', 20, 180, True],
     ['E4', 80, 180, True]],
    [['R0', 30], ['R1', 60], ['R2', 20], ['R3', 20]]],
   {'placed': {'E1': [['R1', 60], ['R0', 20]], 'E3': [['R2', 20]]}, 'unplaced': ['E4', 'E0', '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', 10, 180, True], ['E1', 10, 90, False]], [['R0', 60], ['R1', 60]]],
   {'placed': {'E0': [['R0', 10]], 'E1': [['R1', 10]]}, 'unplaced': []}),
  ('normal control 6',
   [[['E0', 30, 120, True], ['E1', 30, 180, True], ['E2', 30, 120, True], ['E3', 30, 180, True],
     ['E4', 60, 120, True]],
    [['R0', 20], ['R1', 50], ['R2', 60], ['R3', 30]]],
   {'placed': {'E4': [['R2', 60]], 'E0': [['R3', 30]], 'E1': [['R1', 30]], 'E3': [['R0', 20], ['R1', 10]]},
    'unplaced': ['E2']}),
  ('normal control 7',
   [[['E0', 10, 90, False], ['E1', 80, 180, True], ['E2', 30, 90, True]], [['R0', 30], ['R1', 20]]],
   {'placed': {'E2': [['R0', 30]], 'E0': [['R1', 10]]}, 'unplaced': ['E1']}),
  ('normal control 8',
   [[['E0', 30, 180, True], ['E1', 10, 120, True], ['E2', 80, 180, True]],
    [['R0', 20], ['R1', 20], ['R2', 60], ['R3', 60]]],
   {'placed': {'E2': [['R2', 60], ['R3', 20]], 'E0': [['R3', 30]], 'E1': [['R0', 10]]}, 'unplaced': []})],
 [('regression: split room duration record 1',
   [[['E0', 10, 120, False], ['E1', 60, 120, False], ['E2', 60, 90, True], ['E3', 30, 120, True],
     ['E4', 80, 120, False]],
    [['R0', 60], ['R1', 50], ['R2', 50], ['R3', 40]]],
   {'placed': {'E1': [['R0', 60]], 'E2': [['R1', 50], ['R2', 10]], 'E3': [['R3', 30]], 'E0': [['R3', 10]]},
    'unplaced': ['E4']}),
  ('regression variant: split room duration record 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, 120, True], ['E1', 80, 90, False], ['E2', 10, 180, False], ['E3', 80, 180, True]],
    [['R0', 40], ['R1', 20]]],
   {'placed': {'E0': [['R0', 40], ['R1', 5]]}, 'unplaced': ['E1', 'E3', 'E2']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 20]]],
   {'placed': {'A': [['R1', 30], ['R2', 20]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 30, 120, True], ['E1', 60, 120, False], ['E2', 60, 90, True], ['E3', 20, 90, True],
     ['E4', 20, 120, False]],
    [['R0', 50], ['R1', 40], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60]], 'E2': [['R0', 50], ['R1', 10]], 'E3': [['R1', 20]]},
    'unplaced': ['E0', 'E4']}),
  ('normal control 6',
   [[['E0', 30, 120, True], ['E1', 10, 180, False]], [['R0', 20], ['R1', 30], ['R2', 30]]],
   {'placed': {'E0': [['R1', 30]], 'E1': [['R0', 10]]}, 'unplaced': []}),
  ('normal control 7',
   [[['E0', 30, 120, True], ['E1', 60, 120, True], ['E2', 45, 120, False]],
    [['R0', 40], ['R1', 60], ['R2', 30], ['R3', 20]]],
   {'placed': {'E1': [['R1', 60]], 'E0': [['R2', 30]]}, 'unplaced': ['E2']}),
  ('normal control 8',
   [[['E0', 80, 120, True], ['E1', 60, 120, True], ['E2', 60, 90, True], ['E3', 20, 180, False],
     ['E4', 30, 120, False]],
    [['R0', 40], ['R1', 40], ['R2', 20]]],
   {'placed': {'E0': [['R0', 40], ['R1', 40]], 'E3': [['R2', 20]]}, 'unplaced': ['E1', 'E2', 'E4']})],
 [('regression: split room duration record 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: split room duration record 2',
   [[['E0', 60, 120, True], ['E1', 30, 90, False], ['E2', 30, 90, True], ['E3', 20, 120, True],
     ['E4', 80, 120, True]],
    [['R0', 20], ['R1', 30], ['R2', 60], ['R3', 20]]],
   {'placed': {'E4': [['R2', 60], ['R1', 20]], 'E2': [['R0', 20], ['R3', 10]]},
    'unplaced': ['E0', 'E1', 'E3']}),
  ('partial repair guard 3',
   [[['E0', 80, 180, True], ['E1', 20, 120, False], ['E2', 20, 180, False], ['E3', 30, 180, False],
     ['E4', 45, 90, True]],
    [['R0', 60], ['R1', 40], ['R2', 60]]],
   {'placed': {'E0': [['R0', 60], ['R2', 20]], 'E3': [['R1', 30]], 'E2': [['R2', 20]]},
    'unplaced': ['E4', 'E1']}),
  ('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', 30, 180, False], ['E1', 60, 120, True], ['E2', 10, 180, True]],
    [['R0', 20], ['R1', 40], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60]], 'E0': [['R1', 30]], 'E2': [['R1', 10]]}, 'unplaced': []}),
  ('normal control 6',
   [[['E0', 45, 120, True], ['E1', 80, 120, False], ['E2', 60, 90, False]],
    [['R0', 40], ['R1', 40], ['R2', 50], ['R3', 40]]],
   {'placed': {'E0': [['R2', 45]]}, 'unplaced': ['E1', 'E2']}),
  ('normal control 7',
   [[['E0', 80, 120, False], ['E1', 80, 120, True]], [['R0', 40], ['R1', 20], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60], ['R0', 20]]}, 'unplaced': ['E0']}),
  ('normal control 8',
   [[['E0', 45, 120, False], ['E1', 45, 90, False], ['E2', 80, 90, True], ['E3', 60, 90, False],
     ['E4', 80, 180, True]],
    [['R0', 60], ['R1', 20], ['R2', 20]]],
   {'placed': {'E2': [['R0', 60], ['R1', 20]]}, 'unplaced': ['E4', 'E3', 'E0', 'E1']})],
 [('regression: split room duration record 1',
   [[['E0', 60, 90, True], ['E1', 30, 120, False], ['E2', 10, 180, True]],
    [['R0', 50], ['R1', 40], ['R2', 20]]],
   {'placed': {'E0': [['R0', 50], ['R1', 10]], 'E2': [['R2', 10]]}, 'unplaced': ['E1']}),
  ('regression variant: split room duration record 2',
   [[['E0', 60, 120, False], ['E1', 60, 90, True], ['E2', 10, 120, True], ['E3', 20, 90, False],
     ['E4', 30, 180, True]],
    [['R0', 50], ['R1', 40]]],
   {'placed': {'E1': [['R0', 50], ['R1', 10]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E4', 'E2']}),
  ('partial repair guard 3',
   [[['E0', 10, 90, True], ['E1', 20, 120, True], ['E2', 80, 120, False], ['E3', 60, 120, True],
     ['E4', 20, 120, True]],
    [['R0', 50], ['R1', 20], ['R2', 50], ['R3', 30]]],
   {'placed': {'E3': [['R0', 50], ['R2', 10]], 'E1': [['R1', 20]], 'E4': [['R3', 20]]},
    'unplaced': ['E2', 'E0']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 19]]],
   {'placed': {}, 'unplaced': ['A']}),
  ('normal control 5',
   [[['E0', 60, 120, True], ['E1', 45, 120, True]], [['R0', 20], ['R1', 20], ['R2', 60], ['R3', 60]]],
   {'placed': {'E0': [['R2', 60]], 'E1': [['R3', 45]]}, 'unplaced': []}),
  ('normal control 6',
   [[['E0', 80, 180, True], ['E1', 80, 120, False], ['E2', 10, 180, False], ['E3', 45, 120, False],
     ['E4', 80, 90, False]],
    [['R0', 40], ['R1', 30], ['R2', 40], ['R3', 30]]],
   {'placed': {'E0': [['R0', 40], ['R2', 40]], 'E2': [['R1', 10]]}, 'unplaced': ['E1', 'E4', 'E3']}),
  ('normal control 7',
   [[['E0', 30, 180, True], ['E1', 45, 120, False], ['E2', 45, 90, True], ['E3', 60, 120, False],
     ['E4', 30, 120, True]],
    [['R0', 30], ['R1', 50]]],
   {'placed': {'E1': [['R1', 45]], 'E0': [['R0', 30]]}, 'unplaced': ['E3', 'E2', 'E4']}),
  ('normal control 8',
   [[['E0', 20, 120, True], ['E1', 60, 180, False], ['E2', 80, 180, False], ['E3', 60, 120, True]],
    [['R0', 20], ['R1', 20], ['R2', 30], ['R3', 60]]],
   {'placed': {'E1': [['R3', 60]], 'E3': [['R2', 30], ['R0', 20], ['R1', 10]]}, 'unplaced': ['E2', 'E0']})],
 [('regression: split room duration record 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: split room duration record 2',
   [[['E0', 20, 120, True], ['E1', 60, 120, False], ['E2', 30, 180, True], ['E3', 80, 120, True]],
    [['R0', 20], ['R1', 50], ['R2', 40]]],
   {'placed': {'E3': [['R1', 50], ['R2', 30]], 'E0': [['R0', 20]]}, 'unplaced': ['E1', 'E2']}),
  ('partial repair guard 3',
   [[['E0', 80, 90, False], ['E1', 45, 120, True], ['E2', 10, 120, True], ['E3', 20, 120, False],
     ['E4', 20, 90, True]],
    [['R0', 30], ['R1', 40], ['R2', 40]]],
   {'placed': {'E1': [['R1', 40], ['R2', 5]], 'E3': [['R0', 20]], 'E2': [['R0', 10]]},
    'unplaced': ['E0', 'E4']}),
  ('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, True], ['E1', 60, 120, True]], [['R0', 30], ['R1', 40]]],
   {'placed': {'E1': [['R1', 40], ['R0', 20]]}, 'unplaced': ['E0']}),
  ('normal control 6',
   [[['E0', 80, 180, True], ['E1', 45, 180, True], ['E2', 60, 180, False], ['E3', 80, 90, False]],
    [['R0', 50], ['R1', 50], ['R2', 50], ['R3', 60]]],
   {'placed': {'E0': [['R3', 60], ['R0', 20]], 'E1': [['R1', 45]]}, 'unplaced': ['E3', 'E2']}),
  ('normal control 7',
   [[['E0', 80, 120, False], ['E1', 20, 120, True]], [['R0', 40], ['R1', 30], ['R2', 60], ['R3', 40]]],
   {'placed': {'E1': [['R1', 20]]}, 'unplaced': ['E0']}),
  ('normal control 8',
   [[['E0', 30, 90, False], ['E1', 80, 120, True], ['E2', 20, 90, False], ['E3', 20, 120, False],
     ['E4', 60, 120, False]],
    [['R0', 50], ['R1', 20], ['R2', 40]]],
   {'placed': {'E1': [['R0', 50], ['R2', 30]], 'E2': [['R1', 20]]}, 'unplaced': ['E4', 'E0', 'E3']})]]
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: split room duration record 1{'placed': {'E0': [['R0', 60], ['R1', 20]], 'E3': [['R1', 40], ['R2', 20], ['R3', 20]]}, 'unplaced': ['E2', 'E1']}{'placed': {'E0': [['R0', 60], ['R1', 20]], 'E1': [['R2', 20]]}, 'unplaced': ['E2', 'E3']}Failed
regression variant: split room duration record 2{'placed': {'E0': [['R2', 40], ['R0', 5]], 'E1': [['R0', 20]], 'E2': [['R3', 50], ['R0', 10]]}, 'unplaced': []}{'placed': {'E0': [['R2', 40], ['R0', 5]], 'E1': [['R1', 20]], 'E2': [['R3', 50], ['R0', 10]]}, 'unplaced': []}Failed
partial repair guard 3{'placed': {'E1': [['R1', 60], ['R0', 20]], 'E2': [['R2', 20], ['R3', 20], ['R0', 5]]}, 'unplaced': ['E4', 'E0', 'E3']}{'placed': {'E1': [['R1', 60], ['R0', 20]], 'E3': [['R2', 20]]}, 'unplaced': ['E4', 'E0', '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', 10]], 'E1': [['R1', 10]]}, 'unplaced': []}{'placed': {'E0': [['R0', 10]], 'E1': [['R1', 10]]}, 'unplaced': []}Passed
normal control 6{'placed': {'E0': [['R3', 30]], 'E1': [['R1', 30]], 'E3': [['R0', 20], ['R1', 10]], 'E4': [['R2', 60]]}, 'unplaced': ['E2']}{'placed': {'E0': [['R3', 30]], 'E1': [['R1', 30]], 'E3': [['R0', 20], ['R1', 10]], 'E4': [['R2', 60]]}, 'unplaced': ['E2']}Passed
normal control 7{'placed': {'E0': [['R1', 10]], 'E2': [['R0', 30]]}, 'unplaced': ['E1']}{'placed': {'E0': [['R1', 10]], 'E2': [['R0', 30]]}, 'unplaced': ['E1']}Passed
normal control 8{'placed': {'E0': [['R3', 30]], 'E1': [['R0', 10]], 'E2': [['R2', 60], ['R3', 20]]}, 'unplaced': []}{'placed': {'E0': [['R3', 30]], 'E1': [['R0', 10]], 'E2': [['R2', 60], ['R3', 20]]}, 'unplaced': []}Passed

SHA-256 / a2f9cc425e0ae0f7bb366a740cd6b42595c079cea54c2aebfb9a138d39be67f4

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: split room duration record 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: split room duration record 2',
   [[['E0', 45, 120, True], ['E1', 20, 90, False], ['E2', 60, 120, True]],
    [['R0', 40], ['R1', 30], ['R2', 40], ['R3', 50]]],
   {'placed': {'E2': [['R3', 50], ['R0', 10]], 'E0': [['R2', 40], ['R0', 5]], 'E1': [['R1', 20]]},
    'unplaced': []}),
  ('partial repair guard 3',
   [[['E0', 45, 180, False], ['E1', 80, 120, True], ['E2', 45, 180, True], ['E3', 20, 180, True],
     ['E4', 80, 180, True]],
    [['R0', 30], ['R1', 60], ['R2', 20], ['R3', 20]]],
   {'placed': {'E1': [['R1', 60], ['R0', 20]], 'E3': [['R2', 20]]}, 'unplaced': ['E4', 'E0', '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', 10, 180, True], ['E1', 10, 90, False]], [['R0', 60], ['R1', 60]]],
   {'placed': {'E0': [['R0', 10]], 'E1': [['R1', 10]]}, 'unplaced': []}),
  ('normal control 6',
   [[['E0', 30, 120, True], ['E1', 30, 180, True], ['E2', 30, 120, True], ['E3', 30, 180, True],
     ['E4', 60, 120, True]],
    [['R0', 20], ['R1', 50], ['R2', 60], ['R3', 30]]],
   {'placed': {'E4': [['R2', 60]], 'E0': [['R3', 30]], 'E1': [['R1', 30]], 'E3': [['R0', 20], ['R1', 10]]},
    'unplaced': ['E2']}),
  ('normal control 7',
   [[['E0', 10, 90, False], ['E1', 80, 180, True], ['E2', 30, 90, True]], [['R0', 30], ['R1', 20]]],
   {'placed': {'E2': [['R0', 30]], 'E0': [['R1', 10]]}, 'unplaced': ['E1']}),
  ('normal control 8',
   [[['E0', 30, 180, True], ['E1', 10, 120, True], ['E2', 80, 180, True]],
    [['R0', 20], ['R1', 20], ['R2', 60], ['R3', 60]]],
   {'placed': {'E2': [['R2', 60], ['R3', 20]], 'E0': [['R3', 30]], 'E1': [['R0', 10]]}, 'unplaced': []})],
 [('regression: split room duration record 1',
   [[['E0', 10, 120, False], ['E1', 60, 120, False], ['E2', 60, 90, True], ['E3', 30, 120, True],
     ['E4', 80, 120, False]],
    [['R0', 60], ['R1', 50], ['R2', 50], ['R3', 40]]],
   {'placed': {'E1': [['R0', 60]], 'E2': [['R1', 50], ['R2', 10]], 'E3': [['R3', 30]], 'E0': [['R3', 10]]},
    'unplaced': ['E4']}),
  ('regression variant: split room duration record 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, 120, True], ['E1', 80, 90, False], ['E2', 10, 180, False], ['E3', 80, 180, True]],
    [['R0', 40], ['R1', 20]]],
   {'placed': {'E0': [['R0', 40], ['R1', 5]]}, 'unplaced': ['E1', 'E3', 'E2']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 20]]],
   {'placed': {'A': [['R1', 30], ['R2', 20]]}, 'unplaced': []}),
  ('normal control 5',
   [[['E0', 30, 120, True], ['E1', 60, 120, False], ['E2', 60, 90, True], ['E3', 20, 90, True],
     ['E4', 20, 120, False]],
    [['R0', 50], ['R1', 40], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60]], 'E2': [['R0', 50], ['R1', 10]], 'E3': [['R1', 20]]},
    'unplaced': ['E0', 'E4']}),
  ('normal control 6',
   [[['E0', 30, 120, True], ['E1', 10, 180, False]], [['R0', 20], ['R1', 30], ['R2', 30]]],
   {'placed': {'E0': [['R1', 30]], 'E1': [['R0', 10]]}, 'unplaced': []}),
  ('normal control 7',
   [[['E0', 30, 120, True], ['E1', 60, 120, True], ['E2', 45, 120, False]],
    [['R0', 40], ['R1', 60], ['R2', 30], ['R3', 20]]],
   {'placed': {'E1': [['R1', 60]], 'E0': [['R2', 30]]}, 'unplaced': ['E2']}),
  ('normal control 8',
   [[['E0', 80, 120, True], ['E1', 60, 120, True], ['E2', 60, 90, True], ['E3', 20, 180, False],
     ['E4', 30, 120, False]],
    [['R0', 40], ['R1', 40], ['R2', 20]]],
   {'placed': {'E0': [['R0', 40], ['R1', 40]], 'E3': [['R2', 20]]}, 'unplaced': ['E1', 'E2', 'E4']})],
 [('regression: split room duration record 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: split room duration record 2',
   [[['E0', 60, 120, True], ['E1', 30, 90, False], ['E2', 30, 90, True], ['E3', 20, 120, True],
     ['E4', 80, 120, True]],
    [['R0', 20], ['R1', 30], ['R2', 60], ['R3', 20]]],
   {'placed': {'E4': [['R2', 60], ['R1', 20]], 'E2': [['R0', 20], ['R3', 10]]},
    'unplaced': ['E0', 'E1', 'E3']}),
  ('partial repair guard 3',
   [[['E0', 80, 180, True], ['E1', 20, 120, False], ['E2', 20, 180, False], ['E3', 30, 180, False],
     ['E4', 45, 90, True]],
    [['R0', 60], ['R1', 40], ['R2', 60]]],
   {'placed': {'E0': [['R0', 60], ['R2', 20]], 'E3': [['R1', 30]], 'E2': [['R2', 20]]},
    'unplaced': ['E4', 'E1']}),
  ('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', 30, 180, False], ['E1', 60, 120, True], ['E2', 10, 180, True]],
    [['R0', 20], ['R1', 40], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60]], 'E0': [['R1', 30]], 'E2': [['R1', 10]]}, 'unplaced': []}),
  ('normal control 6',
   [[['E0', 45, 120, True], ['E1', 80, 120, False], ['E2', 60, 90, False]],
    [['R0', 40], ['R1', 40], ['R2', 50], ['R3', 40]]],
   {'placed': {'E0': [['R2', 45]]}, 'unplaced': ['E1', 'E2']}),
  ('normal control 7',
   [[['E0', 80, 120, False], ['E1', 80, 120, True]], [['R0', 40], ['R1', 20], ['R2', 60]]],
   {'placed': {'E1': [['R2', 60], ['R0', 20]]}, 'unplaced': ['E0']}),
  ('normal control 8',
   [[['E0', 45, 120, False], ['E1', 45, 90, False], ['E2', 80, 90, True], ['E3', 60, 90, False],
     ['E4', 80, 180, True]],
    [['R0', 60], ['R1', 20], ['R2', 20]]],
   {'placed': {'E2': [['R0', 60], ['R1', 20]]}, 'unplaced': ['E4', 'E3', 'E0', 'E1']})],
 [('regression: split room duration record 1',
   [[['E0', 60, 90, True], ['E1', 30, 120, False], ['E2', 10, 180, True]],
    [['R0', 50], ['R1', 40], ['R2', 20]]],
   {'placed': {'E0': [['R0', 50], ['R1', 10]], 'E2': [['R2', 10]]}, 'unplaced': ['E1']}),
  ('regression variant: split room duration record 2',
   [[['E0', 60, 120, False], ['E1', 60, 90, True], ['E2', 10, 120, True], ['E3', 20, 90, False],
     ['E4', 30, 180, True]],
    [['R0', 50], ['R1', 40]]],
   {'placed': {'E1': [['R0', 50], ['R1', 10]], 'E3': [['R1', 20]]}, 'unplaced': ['E0', 'E4', 'E2']}),
  ('partial repair guard 3',
   [[['E0', 10, 90, True], ['E1', 20, 120, True], ['E2', 80, 120, False], ['E3', 60, 120, True],
     ['E4', 20, 120, True]],
    [['R0', 50], ['R1', 20], ['R2', 50], ['R3', 30]]],
   {'placed': {'E3': [['R0', 50], ['R2', 10]], 'E1': [['R1', 20]], 'E4': [['R3', 20]]},
    'unplaced': ['E2', 'E0']}),
  ('boundary control 4', [[['A', 50, 120, True]], [['R1', 30], ['R2', 19]]],
   {'placed': {}, 'unplaced': ['A']}),
  ('normal control 5',
   [[['E0', 60, 120, True], ['E1', 45, 120, True]], [['R0', 20], ['R1', 20], ['R2', 60], ['R3', 60]]],
   {'placed': {'E0': [['R2', 60]], 'E1': [['R3', 45]]}, 'unplaced': []}),
  ('normal control 6',
   [[['E0', 80, 180, True], ['E1', 80, 120, False], ['E2', 10, 180, False], ['E3', 45, 120, False],
     ['E4', 80, 90, False]],
    [['R0', 40], ['R1', 30], ['R2', 40], ['R3', 30]]],
   {'placed': {'E0': [['R0', 40], ['R2', 40]], 'E2': [['R1', 10]]}, 'unplaced': ['E1', 'E4', 'E3']}),
  ('normal control 7',
   [[['E0', 30, 180, True], ['E1', 45, 120, False], ['E2', 45, 90, True], ['E3', 60, 120, False],
     ['E4', 30, 120, True]],
    [['R0', 30], ['R1', 50]]],
   {'placed': {'E1': [['R1', 45]], 'E0': [['R0', 30]]}, 'unplaced': ['E3', 'E2', 'E4']}),
  ('normal control 8',
   [[['E0', 20, 120, True], ['E1', 60, 180, False], ['E2', 80, 180, False], ['E3', 60, 120, True]],
    [['R0', 20], ['R1', 20], ['R2', 30], ['R3', 60]]],
   {'placed': {'E1': [['R3', 60]], 'E3': [['R2', 30], ['R0', 20], ['R1', 10]]}, 'unplaced': ['E2', 'E0']})],
 [('regression: split room duration record 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: split room duration record 2',
   [[['E0', 20, 120, True], ['E1', 60, 120, False], ['E2', 30, 180, True], ['E3', 80, 120, True]],
    [['R0', 20], ['R1', 50], ['R2', 40]]],
   {'placed': {'E3': [['R1', 50], ['R2', 30]], 'E0': [['R0', 20]]}, 'unplaced': ['E1', 'E2']}),
  ('partial repair guard 3',
   [[['E0', 80, 90, False], ['E1', 45, 120, True], ['E2', 10, 120, True], ['E3', 20, 120, False],
     ['E4', 20, 90, True]],
    [['R0', 30], ['R1', 40], ['R2', 40]]],
   {'placed': {'E1': [['R1', 40], ['R2', 5]], 'E3': [['R0', 20]], 'E2': [['R0', 10]]},
    'unplaced': ['E0', 'E4']}),
  ('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, True], ['E1', 60, 120, True]], [['R0', 30], ['R1', 40]]],
   {'placed': {'E1': [['R1', 40], ['R0', 20]]}, 'unplaced': ['E0']}),
  ('normal control 6',
   [[['E0', 80, 180, True], ['E1', 45, 180, True], ['E2', 60, 180, False], ['E3', 80, 90, False]],
    [['R0', 50], ['R1', 50], ['R2', 50], ['R3', 60]]],
   {'placed': {'E0': [['R3', 60], ['R0', 20]], 'E1': [['R1', 45]]}, 'unplaced': ['E3', 'E2']}),
  ('normal control 7',
   [[['E0', 80, 120, False], ['E1', 20, 120, True]], [['R0', 40], ['R1', 30], ['R2', 60], ['R3', 40]]],
   {'placed': {'E1': [['R1', 20]]}, 'unplaced': ['E0']}),
  ('normal control 8',
   [[['E0', 30, 90, False], ['E1', 80, 120, True], ['E2', 20, 90, False], ['E3', 20, 120, False],
     ['E4', 60, 120, False]],
    [['R0', 50], ['R1', 20], ['R2', 40]]],
   {'placed': {'E1': [['R0', 50], ['R2', 30]], 'E2': [['R1', 20]]}, 'unplaced': ['E4', 'E0', 'E3']})]]
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: split room duration record 1{'placed': {'E0': [['R0', 60], ['R1', 20]], 'E1': [['R2', 20]]}, 'unplaced': ['E2', 'E3']}{'placed': {'E0': [['R0', 60], ['R1', 20]], 'E1': [['R2', 20]]}, 'unplaced': ['E2', 'E3']}Passed
regression variant: split room duration record 2{'placed': {'E0': [['R2', 40], ['R0', 5]], 'E1': [['R1', 20]], 'E2': [['R3', 50], ['R0', 10]]}, 'unplaced': []}{'placed': {'E0': [['R2', 40], ['R0', 5]], 'E1': [['R1', 20]], 'E2': [['R3', 50], ['R0', 10]]}, 'unplaced': []}Passed
partial repair guard 3{'placed': {'E1': [['R1', 60], ['R0', 20]], 'E3': [['R2', 20]]}, 'unplaced': ['E4', 'E0', 'E2']}{'placed': {'E1': [['R1', 60], ['R0', 20]], 'E3': [['R2', 20]]}, 'unplaced': ['E4', 'E0', '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', 10]], 'E1': [['R1', 10]]}, 'unplaced': []}{'placed': {'E0': [['R0', 10]], 'E1': [['R1', 10]]}, 'unplaced': []}Passed
normal control 6{'placed': {'E0': [['R3', 30]], 'E1': [['R1', 30]], 'E3': [['R0', 20], ['R1', 10]], 'E4': [['R2', 60]]}, 'unplaced': ['E2']}{'placed': {'E0': [['R3', 30]], 'E1': [['R1', 30]], 'E3': [['R0', 20], ['R1', 10]], 'E4': [['R2', 60]]}, 'unplaced': ['E2']}Passed
normal control 7{'placed': {'E0': [['R1', 10]], 'E2': [['R0', 30]]}, 'unplaced': ['E1']}{'placed': {'E0': [['R1', 10]], 'E2': [['R0', 30]]}, 'unplaced': ['E1']}Passed
normal control 8{'placed': {'E0': [['R3', 30]], 'E1': [['R0', 10]], 'E2': [['R2', 60], ['R3', 20]]}, 'unplaced': []}{'placed': {'E0': [['R3', 30]], 'E1': [['R0', 10]], 'E2': [['R2', 60], ['R3', 20]]}, 'unplaced': []}Passed

SHA-256 / 2bfa7bdf7a0102ff507576a739b5e4c0dcdd7e4677e6b089227fdbc62baa4b57

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

Case digest / 6f52dc6ee652c483cd1a05526d102bfc3c1d8dbe80c95925d18a3fcc87eb1018