Skip to content

Diogo TravassosData leadership · Analytics · Decision-making

Public data

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.

Evening out overtime at the proven optimum closed the gap between staff to 4 hours or less and cost 4 to 27% more in gaps and overtime (median 12.5%).

Cost of gaps and overtime (4 per uncovered staff-hour, 1.5 per overtime hour), fairness unpriced (hollow) and priced highest (filled)

Cost of gaps and overtime at the proven optimum, fairness unpriced and priced highest2505007501,000Instance 1 (8 staff, 2 weeks): cost of gaps and overtime 300 with fairness unpriced, 320 priced highest (+6.7%); overtime gap between staff 16 h, then 0 h. Both proven optimal.Instance 18 staff, 2 weeks+6.7%gap 16 to 0 hInstance 2 (14 staff, 2 weeks): cost of gaps and overtime 496 with fairness unpriced, 576 priced highest (+16.1%); overtime gap between staff 8 h, then 4 h. Both proven optimal.Instance 214 staff, 2 weeks+16.1%gap 8 to 4 hInstance 3 (20 staff, 2 weeks): cost of gaps and overtime 638 with fairness unpriced, 718 priced highest (+12.5%); overtime gap between staff 16 h, then 4 h. Both proven optimal.Instance 320 staff, 2 weeks+12.5%gap 16 to 4 hInstance 6 (18 staff, 4 weeks): cost of gaps and overtime 884 with fairness unpriced, 920 priced highest (+4.1%); overtime gap between staff 16 h, then 0 h. Both proven optimal.Instance 618 staff, 4 weeks+4.1%gap 16 to 0 hInstance 7 (20 staff, 4 weeks): cost of gaps and overtime 740 with fairness unpriced, 940 priced highest (+27.0%); overtime gap between staff 16 h, then 0 h. Both proven optimal.Instance 720 staff, 4 weeks+27.0%gap 16 to 0 h

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 repairLocal 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 largestExact solver3 of 8instances proven optimal at base prices within its search budget; 30 of 48 instance and price settings overallPrice 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

On Instance 3, the exact solver cut the overtime gap from 16 hours to 8 at no extra cost, and to 4 for 80 more in gaps and overtime. Local search cost more at every price.

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)

Instance 3: overtime gap between staff against the cost of gaps and overtime, for each method at five fairness prices0 h4 h8 h12 h16 h6007008009001,0001,100overtime gap between staff (hours)Exact solver, fairness unpriced: overtime gap 16 h, cost of gaps and overtime 638 (80 uncovered staff-hours, 212 overtime hours); proven optimum.Local search, fairness unpriced: overtime gap 16 h, cost of gaps and overtime 718 (112 uncovered staff-hours, 180 overtime hours); median of the 5 of 5 runs that kept every rule.Greedy, fairness unpriced: overtime gap 16 h, cost of gaps and overtime 938 (200 uncovered staff-hours, 92 overtime hours); breaks 3 rules, so not a usable roster.Exact solver, fairness at 0.5 per hour of gap: overtime gap 8 h, cost of gaps and overtime 638 (80 uncovered staff-hours, 212 overtime hours); proven optimum.Local search, fairness at 0.5 per hour of gap: overtime gap 16 h, cost of gaps and overtime 698 (104 uncovered staff-hours, 188 overtime hours); median of the 5 of 5 runs that kept every rule.Greedy, fairness at 0.5 per hour of gap: overtime gap 16 h, cost of gaps and overtime 938 (200 uncovered staff-hours, 92 overtime hours); breaks 3 rules, so not a usable roster.Exact solver, fairness at 2 per hour of gap (base): overtime gap 8 h, cost of gaps and overtime 638 (80 uncovered staff-hours, 212 overtime hours); proven optimum.Local search, fairness at 2 per hour of gap (base): overtime gap 16 h, cost of gaps and overtime 698 (104 uncovered staff-hours, 188 overtime hours); median of the 5 of 5 runs that kept every rule.Greedy, fairness at 2 per hour of gap (base): overtime gap 16 h, cost of gaps and overtime 938 (200 uncovered staff-hours, 92 overtime hours); breaks 3 rules, so not a usable roster.Exact solver, fairness at 8 per hour of gap: overtime gap 8 h, cost of gaps and overtime 638 (80 uncovered staff-hours, 212 overtime hours); proven optimum.Local search, fairness at 8 per hour of gap: overtime gap 12 h, cost of gaps and overtime 758 (128 uncovered staff-hours, 164 overtime hours); median of the 5 of 5 runs that kept every rule.Greedy, fairness at 8 per hour of gap: overtime gap 8 h, cost of gaps and overtime 1,038 (240 uncovered staff-hours, 52 overtime hours); breaks 3 rules, so not a usable roster.Exact solver, fairness at 32 per hour of gap: overtime gap 4 h, cost of gaps and overtime 718 (112 uncovered staff-hours, 180 overtime hours); proven optimum.Local search, fairness at 32 per hour of gap: overtime gap 8 h, cost of gaps and overtime 878 (176 uncovered staff-hours, 116 overtime hours); median of the 4 of 5 runs that kept every rule.Greedy, fairness at 32 per hour of gap: overtime gap 8 h, cost of gaps and overtime 1,038 (240 uncovered staff-hours, 52 overtime hours); breaks 3 rules, so not a usable roster.unpricedpriced highest
Show the data
MethodPriceOvertime gap (h)Uncovered (h)Overtime (h)Cost of gaps and overtimeNote
Exact solverfairness unpriced1680212638proven optimum
Exact solverfairness at 0.5 per hour of gap880212638proven optimum
Exact solverfairness at 2 per hour of gap (base)880212638proven optimum
Exact solverfairness at 8 per hour of gap880212638proven optimum
Exact solverfairness at 32 per hour of gap4112180718proven optimum
Local searchfairness unpriced16112180718median of the 5 of 5 runs that kept every rule
Local searchfairness at 0.5 per hour of gap16104188698median of the 5 of 5 runs that kept every rule
Local searchfairness at 2 per hour of gap (base)16104188698median of the 5 of 5 runs that kept every rule
Local searchfairness at 8 per hour of gap12128164758median of the 5 of 5 runs that kept every rule
Local searchfairness at 32 per hour of gap8176116878median of the 4 of 5 runs that kept every rule
Greedyfairness unpriced1620092938breaks 3 rules, so not a usable roster
Greedyfairness at 0.5 per hour of gap1620092938breaks 3 rules, so not a usable roster
Greedyfairness at 2 per hour of gap (base)1620092938breaks 3 rules, so not a usable roster
Greedyfairness at 8 per hour of gap8240521,038breaks 3 rules, so not a usable roster
Greedyfairness at 32 per hour of gap8240521,038breaks 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.

InstanceSizeExact solver: costGreedy: broken rulesWhich rulesLocal search: runs keeping every ruleLocal search: cost above the exact solver, median (range)
Instance 18 staff, 2 weeks320, proven4a run of shifts shorter than the minimum5 of 5+10.0% (+10.0% to +12.5%)
Instance 214 staff, 2 weeks512, proven2a run of shifts shorter than the minimum5 of 5+11.7% (+7.8% to +25.0%)
Instance 320 staff, 2 weeks654, proven3more weekends than allowed; a run of shifts shorter than the minimum5 of 5+11.6% (+8.6% to +14.7%)
Instance 410 staff, 4 weeks650, not proven (bound 616)6more weekends than allowed; a break shorter than the minimum; a run of shifts shorter than the minimum5 of 5+12.3% (+6.2% to +17.8%) against the best found
Instance 516 staff, 4 weeks668, not proven (bound 627)8a run of shifts longer than the maximum; more weekends than allowed; a break shorter than the minimum; a run of shifts shorter than the minimum5 of 5+20.4% (+14.4% to +29.3%) against the best found
Instance 618 staff, 4 weeks908, not proven (bound 889)4more weekends than allowed; a break shorter than the minimum; a run of shifts shorter than the minimum4 of 5+18.7% (+18.1% to +22.9%) against the best found
Instance 720 staff, 4 weeks772, not proven (bound 748)2more weekends than allowed; a run of shifts shorter than the minimum5 of 5+15.5% (+13.0% to +18.1%) against the best found
Instance 830 staff, 4 weeks696, not proven (bound 616)17more weekends than allowed; a break shorter than the minimum; a run of shifts shorter than the minimum0 of 5no 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.

InstanceExact: overtime gap (h)Exact: cost of gaps and overtimeExact: changeLocal search: overtime gap (h)Local search: change
Instance 116 to 0300 to 320+6.7%16 to 0+63.9%
Instance 28 to 4496 to 576+16.1%16 to 4+65.7%
Instance 316 to 4638 to 718+12.5%16 to 8+22.3%
Instance 616 to 0884 to 920+4.1%16 to 0+71.4%
Instance 716 to 0740 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).

Instance30 moves100 moves300 moves1000 moves
Instance 14 of 5, +25%5 of 5, +22%5 of 5, +20%5 of 5, +10%
Instance 24 of 5, +37%5 of 5, +29%5 of 5, +19%5 of 5, +12%
Instance 30 of 53 of 5, +27%3 of 5, +12%5 of 5, +12%
Instance 40 of 51 of 5, +28%5 of 5, +22%5 of 5, +12%
Instance 50 of 50 of 53 of 5, +42%5 of 5, +20%
Instance 60 of 51 of 5, +44%1 of 5, +47%4 of 5, +19%
Instance 75 of 5, +61%4 of 5, +40%5 of 5, +23%5 of 5, +16%
Instance 80 of 50 of 50 of 50 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.

StaffMonTueWedThuFriSatSunOvertime, two weeks (h)
AoffEEEDD offoff0 / 16
BE LL offL offL ELoffoff16 / 8
CE offoffoff EEEE offE off8 / 8
DoffE LE LE LLL offoff0 / 16
Eoff EEE offoffoffEE0 / 0
FoffD EDDDD offoff0 / 16
GD ELLL offoffoff DE L8 / 8
HD offL offL Doff Loff LE LE L8 / 8
ID offoff Doff DE DE LE offoff8 / 16
Joff DD offoffoff DDDD0 / 8
Koff DDDDoffoffoff0 / 16
LL offoff Doff LoffoffD offD off0 / 8
ML DoffoffoffD offDD0 / 0
NL offoff Doff Doff DDD offD off0 / 16
Ooff LD offD offoffoff Doff DD L8 / 0
PoffoffoffD offL offoffoff12 / 4
Qoff Loff LD offD offoffoffoff12 / 12
RoffoffD offoff EoffoffE off4 / 12
Soffoffoff EoffL offL Eoff E4 / 12
ToffoffoffD offoff Eoff DE D4 / 12
Staffed, greedy8 of 810 of 1011 of 1111 of 1111 of 1112 of 1211 of 14
Staffed, local search8 of 810 of 1011 of 1111 of 1111 of 118 of 128 of 14

What went wrong or was missed

When to use which

SituationUseWhy
Small unit, rules fit on a page, roster built weekly or monthly (here: up to 20 staff over 2 weeks)An exact solverIt 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 affordAn exact solver with a fixed budget, reporting its boundIts 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 spotLocal search with a rule checker, and a large move budgetWith 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 finishGreedy, if someone checks every ruleHere it never kept every rule on its own, every time leaving someone a run of shifts shorter than the minimum
Fairness matters to the teamPrice it explicitly and show the trade-offUnpriced, 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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.

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/