Based on a real-life use case offered by Simon Vandevelde (KU Leuven): a hospital needs a doctor present at all times. Build a 7-day schedule, starting on a Monday, that covers three shifts per day — early, late, and night — using 5 doctors, subject to these rules:
- A doctor can only work one shift per day.
- A doctor must be available for the shift they’re assigned (see availability below).
- If a doctor works the night shift, they either get the next day off or work the night shift again.
- A doctor either works both weekend days or neither.
| Doctor | Availability |
|---|---|
| Fleming | Friday, Saturday, Sunday only |
| Freud | Every day, early or late shift, never night |
| Heimlich | Every day, but never the night shift on weekends |
| Eustachi | Every day, every shift |
| Golgi | Every day, every shift, but at most 2 night shifts total |
Produce a 7-day, 3-shift schedule that satisfies every doctor’s requirements.
Send your solutions to DecisionManagementCommunity@gmail.com, or open a pull request to add yours here.
One submitted solution (Prolog, by Matteo Redaelli) was originally published as an external write-up whose link no longer resolves. If you’re the author (or know a working link), please open a pull request adding the
urlfield back.