Building a staff roster: greedy, local search or an exact solver
On 8 public rostering problems, greedy rosters broke rules on all 8 and local search ran 10 to 12% above proven optima on 3; evening out overtime cost 4 to 27% more at the optimum on 5, at assumed prices.
Cost of gaps and overtime (4 per uncovered staff-hour, 1.5 per overtime hour), fairness unpriced (hollow) and priced highest (filled)
Main limitation The prices, and reading the benchmark's minimum hours as each person's contract, are assumptions: every cost figure moves with them. "Proven" means proven within one fixed search budget; a larger budget may prove more.
All three methods at every price are in the trade-off chart and the fairness table.
A roster has to cover every shift, keep overtime down and share that overtime fairly, all under staffing rules: days off, weekends, the shortest and longest run of shifts, contracted hours. I took 8 instances of a public nurse-rostering benchmark (8 to 30 staff, 2 to 4 weeks) and built each roster three ways: a greedy method that fills one shift at a time, local search that starts from the greedy roster and keeps improving it, and an exact solver that can prove when nothing better exists. One checker scores every roster. The prices are assumed: an uncovered staff-hour costs 4, an overtime hour 1.5, and each hour of gap between the most and least overtime any one person works costs a fairness price, swept from 0 to 32.
| Greedy alone8 of 8instances where the greedy roster broke a staffing rule, each time a run of shifts shorter than the minimum: not usable without repair | Local search, base prices10 to 12%above the proven optimum on the 3 two-week instances (median of 5 runs); 12 to 20% above the exact solver's best roster on 4 more; no rule-abiding roster on the largest | Exact solver3 of 8instances proven optimal at base prices within its search budget; 30 of 48 instance and price settings overall | Price of fairness4 to 27%more cost of gaps and overtime at the proven optimum when the overtime gap was priced highest, on the 5 instances proven at both ends; the gap fell from 8 or more to 4 hours or less |
In plain words
Every ward, contact centre, warehouse and store builds a roster: who works which shift on which day. Three things pull against each other. Shifts left uncovered are a risk and usually the most expensive outcome. Covering them takes overtime, which costs more than regular hours. And overtime that always lands on the same few people is unfair and drives them out. On top sit hard rules: days off, how many weekends, the shortest and longest run of shifts, minimum rest, contracted hours.
The question for a scheduling lead is which method to trust: a simple one anyone can follow, a heuristic that keeps improving a roster, or an optimizer that can prove its roster is the best possible. And what fairness costs once it is priced.
The answer here: greedy alone never produced a roster that kept every rule. Local search repaired the greedy roster on 7 of 8 instances but stayed 10 to 12% above the optimum, at base prices, where one was proven. The exact solver proved the optimum on the small instances, and on the larger ones its best roster within the budget still beat local search every time. Evening out overtime was never free at the optimum: 4 to 27% more cost of gaps and overtime.
The data is a public benchmark of nurse-rostering problems (Curtois and Qu, University of Nottingham), used by researchers to compare rostering methods. It holds no personal data. The prices are this study's assumptions, not the benchmark's.
- Instance
- One rostering problem: its staff, their rules, the days and the cover required for each shift.
- Uncovered staff-hours
- Required staff missing from a shift, times the shift's length.
- Overtime
- Hours above a person's contract. The benchmark gives each person a minimum and a maximum number of minutes; this study reads the minimum as the contract and the maximum as the cap.
- Overtime gap
- The most overtime any one person works minus the least: the fairness measure, fixed before any roster was built.
- Cost of gaps and overtime
- 4 per uncovered staff-hour plus 1.5 per overtime hour, the base prices.
- Fairness price
- What each hour of overtime gap adds to the cost a method minimizes: 0, 0.5, 2 (the base), 8 or 32.
- Greedy
- Fill day by day, giving each open shift to whoever adds least cost now, never revisiting a choice.
- Local search
- Start from a roster and try many small changes, keeping most that help and a shrinking share that do not, so it can climb out of dead ends.
- Exact solver
- A constraint solver (OR-Tools CP-SAT) that searches every roster implicitly and reports a proven optimum when its lower bound meets its best roster.
- Moves per staff-day
- Local search's effort: changes tried, divided by staff times days.
The evidence
The trade-off on one instance
Across: overtime gap between staff (hours). Up: cost of gaps and overtime. One point per method and fairness price.
Exact solver (proven optimum at every price here)Local search, median runGreedy (breaks rules)
Show the data
| Method | Price | Overtime gap (h) | Uncovered (h) | Overtime (h) | Cost of gaps and overtime | Note |
|---|---|---|---|---|---|---|
| Exact solver | fairness unpriced | 16 | 80 | 212 | 638 | proven optimum |
| Exact solver | fairness at 0.5 per hour of gap | 8 | 80 | 212 | 638 | proven optimum |
| Exact solver | fairness at 2 per hour of gap (base) | 8 | 80 | 212 | 638 | proven optimum |
| Exact solver | fairness at 8 per hour of gap | 8 | 80 | 212 | 638 | proven optimum |
| Exact solver | fairness at 32 per hour of gap | 4 | 112 | 180 | 718 | proven optimum |
| Local search | fairness unpriced | 16 | 112 | 180 | 718 | median of the 5 of 5 runs that kept every rule |
| Local search | fairness at 0.5 per hour of gap | 16 | 104 | 188 | 698 | median of the 5 of 5 runs that kept every rule |
| Local search | fairness at 2 per hour of gap (base) | 16 | 104 | 188 | 698 | median of the 5 of 5 runs that kept every rule |
| Local search | fairness at 8 per hour of gap | 12 | 128 | 164 | 758 | median of the 5 of 5 runs that kept every rule |
| Local search | fairness at 32 per hour of gap | 8 | 176 | 116 | 878 | median of the 4 of 5 runs that kept every rule |
| Greedy | fairness unpriced | 16 | 200 | 92 | 938 | breaks 3 rules, so not a usable roster |
| Greedy | fairness at 0.5 per hour of gap | 16 | 200 | 92 | 938 | breaks 3 rules, so not a usable roster |
| Greedy | fairness at 2 per hour of gap (base) | 16 | 200 | 92 | 938 | breaks 3 rules, so not a usable roster |
| Greedy | fairness at 8 per hour of gap | 8 | 240 | 52 | 1,038 | breaks 3 rules, so not a usable roster |
| Greedy | fairness at 32 per hour of gap | 8 | 240 | 52 | 1,038 | breaks 3 rules, so not a usable roster |
The greedy rosters break rules, so they are drawn only for scale. Instance 3 (20 staff, 2 weeks) is shown because it is the largest instance with a proven optimum at all five fairness prices, a rule fixed before the runs. Local search: 1000 moves per staff-day, 5 runs.
Every instance at base prices
Fairness price 2. The exact solver's cost is the reference; local search is the median of 5 runs that kept every rule, with the range.
| Instance | Size | Exact solver: cost | Greedy: broken rules | Which rules | Local search: runs keeping every rule | Local search: cost above the exact solver, median (range) |
|---|---|---|---|---|---|---|
| Instance 1 | 8 staff, 2 weeks | 320, proven | 4 | a run of shifts shorter than the minimum | 5 of 5 | +10.0% (+10.0% to +12.5%) |
| Instance 2 | 14 staff, 2 weeks | 512, proven | 2 | a run of shifts shorter than the minimum | 5 of 5 | +11.7% (+7.8% to +25.0%) |
| Instance 3 | 20 staff, 2 weeks | 654, proven | 3 | more weekends than allowed; a run of shifts shorter than the minimum | 5 of 5 | +11.6% (+8.6% to +14.7%) |
| Instance 4 | 10 staff, 4 weeks | 650, not proven (bound 616) | 6 | more weekends than allowed; a break shorter than the minimum; a run of shifts shorter than the minimum | 5 of 5 | +12.3% (+6.2% to +17.8%) against the best found |
| Instance 5 | 16 staff, 4 weeks | 668, not proven (bound 627) | 8 | a run of shifts longer than the maximum; more weekends than allowed; a break shorter than the minimum; a run of shifts shorter than the minimum | 5 of 5 | +20.4% (+14.4% to +29.3%) against the best found |
| Instance 6 | 18 staff, 4 weeks | 908, not proven (bound 889) | 4 | more weekends than allowed; a break shorter than the minimum; a run of shifts shorter than the minimum | 4 of 5 | +18.7% (+18.1% to +22.9%) against the best found |
| Instance 7 | 20 staff, 4 weeks | 772, not proven (bound 748) | 2 | more weekends than allowed; a run of shifts shorter than the minimum | 5 of 5 | +15.5% (+13.0% to +18.1%) against the best found |
| Instance 8 | 30 staff, 4 weeks | 696, not proven (bound 616) | 17 | more weekends than allowed; a break shorter than the minimum; a run of shifts shorter than the minimum | 0 of 5 | no run kept every rule |
Two things stand out. The greedy roster broke a rule on every instance, every time including a run of shifts shorter than the minimum: it fills today's gaps without seeing that tomorrow someone must work again. And where the exact solver could not prove an optimum, its best roster was still cheaper than local search's median by 12 to 20%, and on the worst of them (Instance 5) its cost was 6.5% above the solver's own lower bound, so at most that far above the optimum. On Instance 8, the largest (30 staff, 4 weeks), local search found no roster that kept every rule in any run.
The price of fairness, at the proven optimum
The 5 instances where the exact solver proved the optimum both with fairness unpriced and priced highest (32 per hour of gap). With fairness unpriced, the exact solver's roster (proven best on 5, best found on 3) left an overtime gap of 8 hours or more on all 8 instances, 16 hours on 6: the cheapest roster puts overtime on whoever is cheapest to schedule.
| Instance | Exact: overtime gap (h) | Exact: cost of gaps and overtime | Exact: change | Local search: overtime gap (h) | Local search: change |
|---|---|---|---|---|---|
| Instance 1 | 16 to 0 | 300 to 320 | +6.7% | 16 to 0 | +63.9% |
| Instance 2 | 8 to 4 | 496 to 576 | +16.1% | 16 to 4 | +65.7% |
| Instance 3 | 16 to 4 | 638 to 718 | +12.5% | 16 to 8 | +22.3% |
| Instance 6 | 16 to 0 | 884 to 920 | +4.1% | 16 to 0 | +71.4% |
| Instance 7 | 16 to 0 | 740 to 940 | +27.0% | 16 to 8 | +17.4% |
The exact solver evened out overtime for 4 to 27% more cost of gaps and overtime. Local search, asked for the same fairness, paid more on 4 of the 5 (17 to 71% across all 5), by leaving more shifts uncovered than the exact solver did. A likely reason is that the overtime gap is set by the two most extreme people, so most small changes do not move it.
How much search local search needs
Base prices; each cell gives how many of 5 runs ended with a roster that kept every rule, and the median cost above the exact solver's roster (proven on Instances 1 to 3, best found on the rest).
| Instance | 30 moves | 100 moves | 300 moves | 1000 moves |
|---|---|---|---|---|
| Instance 1 | 4 of 5, +25% | 5 of 5, +22% | 5 of 5, +20% | 5 of 5, +10% |
| Instance 2 | 4 of 5, +37% | 5 of 5, +29% | 5 of 5, +19% | 5 of 5, +12% |
| Instance 3 | 0 of 5 | 3 of 5, +27% | 3 of 5, +12% | 5 of 5, +12% |
| Instance 4 | 0 of 5 | 1 of 5, +28% | 5 of 5, +22% | 5 of 5, +12% |
| Instance 5 | 0 of 5 | 0 of 5 | 3 of 5, +42% | 5 of 5, +20% |
| Instance 6 | 0 of 5 | 1 of 5, +44% | 1 of 5, +47% | 4 of 5, +19% |
| Instance 7 | 5 of 5, +61% | 4 of 5, +40% | 5 of 5, +23% | 5 of 5, +16% |
| Instance 8 | 0 of 5 | 0 of 5 | 0 of 5 | 0 of 5 |
Effort decides whether local search produces a usable roster at all. At 30 moves per staff-day, 13 of 40 runs kept every rule; at 1000, 34. From 100 to 1000 moves the median cost fell on every instance with a rule-abiding run at both, and even the largest budget left it above the exact solver everywhere.
Worked example: one week of one unit
Instance 3 (20 staff, 2 weeks, three shift types, E, D and L), week one, base prices. The greedy roster against local search's (run 1). A shaded cell changed: the greedy entry is struck through and local search's follows. An unshaded cell is the same in both. Last column: each person's overtime over both weeks, greedy then local search.
| Staff | Mon | Tue | Wed | Thu | Fri | Sat | Sun | Overtime, two weeks (h) |
|---|---|---|---|---|---|---|---|---|
| A | off | E | E | E | D | D off | off | 0 / 16 |
| B | E L | L off | L off | L E | L | off | off | 16 / 8 |
| C | E off | off | off E | E | E | E off | E off | 8 / 8 |
| D | off | E L | E L | E L | L | L off | off | 0 / 16 |
| E | off E | E | E off | off | off | E | E | 0 / 0 |
| F | off | D E | D | D | D | D off | off | 0 / 16 |
| G | D E | L | L | L off | off | off D | E L | 8 / 8 |
| H | D off | L off | L D | off L | off L | E L | E L | 8 / 8 |
| I | D off | off D | off D | E D | E L | E off | off | 8 / 16 |
| J | off D | D off | off | off D | D | D | D | 0 / 8 |
| K | off D | D | D | D | off | off | off | 0 / 16 |
| L | L off | off D | off L | off | off | D off | D off | 0 / 8 |
| M | L D | off | off | off | D off | D | D | 0 / 0 |
| N | L off | off D | off D | off D | D | D off | D off | 0 / 16 |
| O | off L | D off | D off | off | off D | off D | D L | 8 / 0 |
| P | off | off | off | D off | L off | off | off | 12 / 4 |
| Q | off L | off L | D off | D off | off | off | off | 12 / 12 |
| R | off | off | D off | off E | off | off | E off | 4 / 12 |
| S | off | off | off E | off | L off | L E | off E | 4 / 12 |
| T | off | off | off | D off | off E | off D | E D | 4 / 12 |
| Staffed, greedy | 8 of 8 | 10 of 10 | 11 of 11 | 11 of 11 | 11 of 11 | 12 of 12 | 11 of 14 | |
| Staffed, local search | 8 of 8 | 10 of 10 | 11 of 11 | 11 of 11 | 11 of 11 | 8 of 12 | 8 of 14 |
- Which rules moved. The greedy roster breaks three rules: staff B has a run of shifts shorter than the minimum; staff J has a run of shifts shorter than the minimum; staff N has more weekends than allowed. Local search's roster breaks none.
- Where the gaps went. Greedy covers week one almost fully (24 uncovered staff-hours, all on Sunday's late shift) and runs out of hours and weekends in week two (176). Local search spreads the shortfall: 80 in week one, all on the weekend, where the weekend rule binds, and 16 in week two. Over both weeks uncovered hours fall from 200 to 96.
- What it cost. Overtime rises from 92 to 196 hours, as it should at these prices (an uncovered hour costs more than an overtime hour). The overtime gap stays at 16 hours; the exact solver's roster at the same prices has 8.
- How much changed. 74 of the week's 140 cells: local search does not polish a greedy roster, it rebuilds more than half of it.
What went wrong or was missed
- I expected local search to be nearly optimal, and it was not. The prediction was within 5% of the optimum on every instance that has one; it ran 10 to 12% above. Its moves and budget were tuned on a made-up instance before the runs; on the benchmark it never matched the exact solver.
- I expected fairness to be cheap at the optimum, and it was not. The prediction was a rise of at most 3% in the cost of gaps and overtime on the median instance; it was 12.5% (4 to 27% across the 5).
- One prediction could not be tested. It compared greedy's cost with the optimum counting only greedy rosters that keep every rule, and greedy never produced one at base prices: it broke a rule at every instance and every fairness price.
- I expected most of local search's gain to come early, and it did not. The prediction was that 100 moves per staff-day would remove at least 70% of the cost difference between the greedy roster and the 1000-move result; the median was 44% over the 6 instances where local search had a rule-abiding result at both budgets (52% over all 8 counting runs that broke a rule).
- A safe bet missed. One prediction was a safe bet that should have held by construction (with uncovered hours cheaper than overtime, every method cuts overtime by at least 80%); it missed: on one instance the exact solver cut overtime by only 67%, and local search and greedy cut it by less on others, greedy by none at all on one.
- Local search failed outright on the largest instance. On Instance 8 (30 staff, 4 weeks) no run at any budget kept every rule; the exact solver's best roster cost 13% more than its own lower bound, without being proven optimal.
- "Proven" depends on the budget. The exact solver proved 3 of 8 instances at base prices and 30 of 48 settings overall, all within one fixed budget. On the others its best roster is reported with its lower bound; a larger budget or a stronger model may prove more of them, so local search sat at least as far from the optimum as its gap to "the best found", and the exact solver's own distance is bounded but unknown.
- The prices are mine. Every cost, gap and percentage depends on the prices: uncovered hours at 4, overtime at 1.5, the fairness sweep. When uncovered hours were made cheaper than overtime, the exact solver traded overtime for gaps on every instance (overtime down 67 to 100%). What did not change with the prices: greedy breaking rules at every fairness price, and local search failing on the largest instance at every price.
When to use which
| Situation | Use | Why |
|---|---|---|
| Small unit, rules fit on a page, roster built weekly or monthly (here: up to 20 staff over 2 weeks) | An exact solver | It proved the optimum on all three such instances here; at base prices local search stayed 10 to 12% above it |
| Larger unit or longer horizon, where the solver cannot prove an optimum within the search budget you can afford | An exact solver with a fixed budget, reporting its bound | Its best roster still beat local search on every such instance here, and the bound says how far from the optimum it can be (at most 6.5% above its lower bound on the four where local search also produced a roster) |
| No solver allowed, or a roster that must be repaired on the spot | Local search with a rule checker, and a large move budget | With 1000 moves per staff-day it found a rule-abiding roster on 7 of 8 instances; with 30, 3 of 8 |
| A first draft for a person to finish | Greedy, if someone checks every rule | Here it never kept every rule on its own, every time leaving someone a run of shifts shorter than the minimum |
| Fairness matters to the team | Price it explicitly and show the trade-off | Unpriced, the exact solver's roster (proven best on 5, best found on 3) left an overtime gap of 8 hours or more on all 8 instances; priced, the gap closed for 4 to 27% more cost here, a figure each team should see before choosing its price |
Whatever builds the roster, one independent checker should score it: every rule, the gaps, the overtime and the fairness measure. That checker is what showed greedy's rosters breaking rules here, and it is what lets a team compare a solver, a heuristic and a person's roster on equal terms.
On tools: the exact solver here is OR-Tools CP-SAT, free and open source, driven from Python; local search and greedy are a few hundred lines of Python each. Commercial solvers and workforce-management products are the alternatives; the comparison worth making before buying is the one on this page, on your own rules and a few past rosters.
How I would roll this out with a team
For a scheduling lead with one unit of about 20 staff and a roster every two weeks.
- Write the rules down and build the checker first. Every rule the scheduler applies from memory goes into one list, and a checker scores past rosters against it. Here the checker was tested on a made-up instance with a planted breach of every rule before any real roster was scored.
- Agree the prices with the people affected. What an uncovered shift, an overtime hour and an hour of overtime gap between colleagues are worth is a management decision, not a modelling one. Show the trade-off chart on the team's own data and let them choose the fairness price.
- Run the solver beside the current process. For a few cycles the scheduler keeps building the roster as now; the solver builds one too, and both are scored by the checker. Switch only when the solver's roster wins on the measures the team agreed.
- Keep a person in the loop. About 2 hours per roster for the scheduler to review, swap and approve, with every manual change re-scored by the checker.
- Watch the budget. Record whether each roster was proven optimal within the budget. When the unit grows and proofs stop, report the bound, and decide on a larger budget or a split of the problem from that, not from a feeling.
A build of about 6 weeks at US$4,000 a week (US$24,000) is the declared assumption for the rules, checker, solver and review screen; the solver licence costs nothing.
What it is worth
From declared assumptions, not from the study's data: one cost unit is one straight-time staff-hour at US$45, so an uncovered staff-hour is priced at US$180 (agency cover and the risk of running short) and an overtime hour at US$68 (time and a half). On Instance 3, at base prices, the exact solver's roster cost 76 units less than local search's median: US$3,420 per two-week roster, US$88,920 a year over 26 rosters, for one unit that size. Against a build of US$24,000, that pays back within the first year, if the prices hold. Against greedy, there is no cost to compare: its rosters broke rules, and making them legal is the scheduler's unpaid time.
Every figure here scales with the assumed prices. Halve the price of an uncovered hour and the difference shrinks; the proof that the roster is optimal, at whatever prices the team chooses, does not.
Where AI fits
A language model is useful around a roster, not inside it: turning a manager's description of the rules into the constraint list, explaining why a person got a shift, drafting the message when a swap is needed. It should not build the roster itself. A roster has dozens of rules interacting over weeks, and a plausible roster that breaks one rule looks the same as a correct one until someone works the short run of shifts. Here even a purpose-built greedy method broke rules on every instance.
The safe pattern is the one on this page: whatever proposes the roster, a solver or an assistant, a deterministic checker scores every rule, and nothing reaches the team until it passes.
Method and checks
The data and its checks
Instances 1 to 8 of the shift scheduling benchmark (nurse rostering) published at schedulingbenchmarks.org: Tim Curtois and Rong Qu, "Computational results on new staff scheduling benchmark instances", technical report, ASAP Research Group, School of Computer Science, University of Nottingham, 2014. The instance files are not copied here: a download script fetches them from the source. Instances 1 to 8 are the benchmark's small and medium tier: 8 to 30 staff, 2 or 4 weeks, 1 to 4 shift types, all shifts 8 hours.
Model check: the exact solver, given the benchmark's own objective, reproduced the published optima on Instances 1 to 3 exactly (607, 828, 1,001), and the checker scored its rosters to the same values.
The rules and the measures
Hard rules, as the benchmark defines them: one shift a day; days off; which shift may follow which; the most shifts of each type; the most and least minutes worked; the longest and shortest run of shifts; the shortest break; the most weekends worked. Runs that touch the first or last day are exempt from the shortest-run and shortest-break rules. The benchmark's least minutes per person is read here as that person's contract: minutes above it are overtime, capped by the most minutes. That reading is this study's assumption, not the benchmark's.
Measures, fixed before any run: uncovered staff-hours (required staff missing from each shift, times its length); overtime hours; and the overtime gap, the most overtime hours any one person works minus the fewest. Each method minimizes 4 per uncovered staff-hour plus 1.5 per overtime hour plus the fairness price per hour of gap, with the fairness price at 0, 0.5, 2 (base), 8 or 32, and one sensitivity setting where uncovered hours cost 1, less than overtime.
The three methods and their effort
Greedy: day by day, each open shift to the eligible person who adds the least cost; a shift stays open when everyone costs more than the gap; anyone on a run shorter than the minimum is asked first the next day; then a pass tops up anyone below contract. Deterministic, one pass.
Local search: simulated annealing from the greedy roster at the same prices. Moves: change one person's shift on one day (30%), swap two people's shifts on one day (30%), change one person's shifts over 2 or 3 days (20%), swap two people's shifts over 2 to 7 days (20%). A broken rule costs 1000 per unit, so it can pass through illegal rosters but reports only the cheapest roster that keeps every rule. Temperature from 100 to 1, 1000 moves per staff-day, 5 runs with seeds 1 to 5, and an effort sweep at 30, 100, 300 and 1000 moves per staff-day. Moves, temperatures and budget were set on a made-up 20-staff instance before any benchmark instance was solved.
Exact solver: OR-Tools CP-SAT 9.15 with every rule as a constraint, 8 workers, seed 0, and the same fixed search budget for every instance and setting. A setting has an optimum only when the solver proves it within that budget; otherwise the page reports its best roster and lower bound. Effort is reported as moves for local search and as proved or not for the solver, never as time.
Predictions, declared before the runs
4 held, 4 missed, 1 could not be tested. The design, prices, measures, budgets, seeds and these predictions were committed before any benchmark run, and nothing in them changed after.
- Exact solver proves the optimum: held. The exact solver proves the optimum within its budget at base prices on Instances 1, 2 and 3, and on at most 5 of the 8 instances.
- Local search near the optimum: missed. Local search (median over 5 seeds) is within 5% of the proven optimum at base prices on every instance that has one.
- Greedy against the optimum: untestable. Greedy alone is 15% to 60% above the proven optimum at base prices (median over instances with an optimum, counting only rule-abiding greedy rosters).
- Greedy breaks rules: held. Greedy breaks at least one hard rule at base prices on at least 3 of the 8 instances.
- Overtime gap with fairness unpriced: held. With fairness unpriced, the exact solver's roster (proven or best) has an overtime gap of at least 8 hours on at least half the instances.
- Fairness is cheap at the optimum: missed. From fairness unpriced to fairness at 32 per hour of gap, the proven-optimal roster's overtime gap falls by at least half while its cost of gaps and overtime (4 x uncovered hours + 1.5 x overtime hours) rises by at most 3%, on the median instance proven at both prices.
- Local search pays more for fairness: held. The rise in local search's cost of gaps and overtime from fairness unpriced to fairness at 32 is larger than the exact solver's on the median instance proven at both prices.
- Cheap gaps cut overtime: missed (safe bet). When uncovered hours are cheaper than overtime, every method cuts overtime hours by at least 80% against base prices. A safe bet: nearly true by construction.
- Local search gains come early: missed. At 100 moves per staff-day, local search already removes at least 70% of the cost difference between the greedy roster and its own 1000-move result (median over the 8 instances, base prices).
Which results depend on the prices: every cost, gap to the optimum and fairness figure, and the worked example. Which do not: greedy breaking rules (at every fairness price), local search failing on Instance 8 (at every price), and the model check.
Reproduce itThe checker (Python)GreedyLocal searchExact solver modelAll resultsThe predictions as declaredMoney assumptions
Use this at your company
To compare roster methods on your own team, paste this into your AI assistant along with your rules and staff list.
This method comes from Diogo Travassos's study "Building a staff roster: greedy, local search or an exact solver" (https://diogotravassos.dev/shift-scheduling-optimization/). If you can open links, read it first: it compares the three methods on a public rostering benchmark and shows where each one failed. The steps below stand on their own if you can't. Help me compare ways to build a staff roster for my team, using the rules and data I paste below (staff, contracts, days off, required cover per shift, and our scheduling rules). Method: 1. List every hard rule as a check (one shift a day, days off, which shift may follow which, longest and shortest run of shifts, shortest break, most weekends, most and least hours). Write a checker that scores any roster: rules broken, uncovered staff-hours, overtime hours above each person's contract, and the overtime gap (most overtime any one person works minus the least). Test it on a small made-up roster with one planted breach of each rule. 2. Agree prices with me before building anything: what an uncovered staff-hour, an overtime hour and an hour of overtime gap cost, relative to each other. 3. Build three rosters: a greedy one (fill day by day, cheapest person first), local search starting from it (small changes and swaps, keeping only rosters that pass the checker), and an exact constraint solver such as OR-Tools CP-SAT with a fixed budget. Report whether the solver proved its roster optimal or only found it, with its lower bound. 4. Score all three with the same checker. Then rerun the solver with the fairness price at zero and at a high value, and show me what evening out overtime costs in gaps and overtime. Report back: a table of the three methods (rules broken, uncovered hours, overtime, overtime gap, cost, proven or not), the fairness trade-off, and which method you would use for a team like mine and why. Never hand me a roster that the checker has not passed. In your report, say which study you followed and link it: https://diogotravassos.dev/shift-scheduling-optimization/