Why is mathematics important in staff rostering? A roster must match people to shifts while respecting coverage, skills, availability, rest, contractual conditions and human needs. Even a small workplace can have more possible schedules than anyone can inspect manually. Variables and constraints organise the choices; optimisation compares workable rosters; statistics checks whether the burden is distributed fairly.
This is mathematics in careers and daily organisational life, but it is not a substitute for employment law, contracts, collective arrangements, workplace policy or conversation. In Singapore, the Ministry of Manpower’s current hours of work, overtime and rest days guidance explains that Part 4 protections apply to covered employees and sets out conditions that vary by work pattern. Rules and coverage are date-sensitive, so an employer must use current authoritative guidance and professional advice where needed.
Quick reading route: variables, constraints, fairness, optimisation, uncertainty, limits, learning, guidance, or FAQs.
A roster is a set of decisions
Let x(e,s) be a binary variable: it equals 1 if employee e is assigned to shift s, and 0 otherwise. With 12 employees and 21 weekly shifts, there are 252 such yes-or-no decisions. The notation looks abstract, yet each variable answers a plain question: “Does this person work this shift?”
Binary variables make counting possible. The number assigned to shift s is the sum of x(e,s) over employees. The number of shifts assigned to employee e is the sum of x(e,s) over shifts. Once the decisions are represented, rules can be expressed as equations or inequalities.
Suppose a fictional café has six trained workers and needs exactly two on each of seven evening shifts. Ignoring every other rule, there are C(6,2) = 15 possible pairs for one evening and 15⁷ = 170,859,375 weekly pair sequences. Many will overload the same people or conflict with availability. The huge count explains why “just try every roster” quickly becomes impractical.
Data must have meaning
A rostering table might include employee ID, skills, contracted hours, declared availability, approved leave and shift preferences. These fields should not be confused. “Unavailable” may be a hard restriction; “prefer not” may be a soft request. “Qualified” should refer to a defined requirement, not a manager’s vague impression.
Poor input creates poor output. If skill records are outdated or availability is entered incorrectly, an optimiser can produce a mathematically perfect roster that is operationally wrong. Data validation therefore belongs inside the model:
- allowed employee and shift identifiers;
- complete start and end times;
- no negative durations;
- explicit time zones and dates;
- current skill records;
- traceable changes and approvals.
This is a broad benefit of learning mathematics: representation forces an organisation to say what its words mean.
Hard constraints define what is allowed
A hard constraint must be satisfied. Coverage is a common example. If shift s requires at least three people, then Σe x(e,s) ≥ 3. If it needs exactly one designated supervisor among a qualified set Q, then Σe∈Q x(e,s) ≥ 1, perhaps combined with other role rules.
Availability is simpler: if employee e cannot work shift s, set x(e,s) = 0. One-shift-at-a-time rules prevent overlapping assignments. Work-hour, rest and sequence constraints consider time across several shifts.
Google’s official Workforce Scheduling API documentation illustrates the range of constraints a scheduling system may represent: minimum and maximum work time, consecutive working days, number of shifts, rest time, skills, resources, coverage and employee requests. The documentation is a technical example, not Singapore employment advice.
Coverage by skill
Headcount alone can be misleading. A shift with five people may still fail if a required capability is absent. Let q(e,k) be 1 if employee e holds current skill k. A skill-coverage constraint can require Σe q(e,k)x(e,s) ≥ r(k,s), where r(k,s) is the required number for that skill and shift.
If a person’s certification expires before the shift date, q should reflect that date. This is a reminder that parameters can be time-dependent. Treating a qualification as permanent when it is not is a data error, not an optimisation failure.
Hours are intervals, not labels
A shift called “night” might run from 22:00 to 06:00 and cross midnight. Duration cannot be calculated by simply subtracting 22 from 6. Represent times as date-time intervals. The duration is eight hours before considering unpaid breaks under the applicable arrangement.
Overlapping intervals can be tested mathematically. Two half-open intervals [a,b) and [c,d) overlap if a < d and c < b. Half-open notation allows one shift ending at 14:00 and another beginning at 14:00 to touch without overlapping, though required transition or rest time may still make the sequence invalid.
| Constraint type | Illustrative expression | Question |
|---|---|---|
| Headcount | Σe x(e,s) ≥ demand(s) | Are enough people present? |
| Availability | x(e,s) = 0 | Is this assignment forbidden? |
| Skill | Σe q(e,k)x(e,s) ≥ r(k,s) | Is required competence covered? |
| Workload | L(e) ≤ Σs h(s)x(e,s) ≤ U(e) | Are hours within defined bounds? |
| Rest | x(e,s)+x(e,t) ≤ 1 for conflicting pair | Can both shifts be worked? |
Current Singapore context must be checked
As at the current MOM page, covered arrangements under Part 4 distinguish employees working five days or fewer, those working more than five days, and shift workers. MOM states limits and averaging provisions, including an average 44-hour week over a continuous three-week period for shift workers in the described circumstances, along with guidance on maximum daily hours, overtime and rest days. Do not lift one number out of that page and apply it universally. Coverage, exceptions, approvals, contracts and collective arrangements matter.
MOM also explains what to specify in key employment terms for employees who work shifts: hours per shift, hours per week, number of working days and rest days. Clear terms provide model inputs; the model does not create the legal terms.
Soft constraints express preferences and costs
A soft constraint may be violated at a quantified penalty. An employee may prefer Tuesday off, a manager may prefer continuity, or the organisation may want to limit isolated single-day duties. If every wish were hard, no roster might exist. Soft constraints let the system trade less-important goals while preserving mandatory rules.
Define p(e,s) as a penalty for assigning employee e to shift s. The preference cost is Σe,s p(e,s)x(e,s). A requested shift might have penalty 0, a neutral shift 2 and a disliked shift 8. Those numbers do not emerge from nature. They are policy choices that should be explained and reviewed.
A large penalty does not make a rule ethically legitimate. Penalising a protected need as if it were a casual preference could encode discrimination. Human governance must decide which facts are mandatory, sensitive or inappropriate to optimise.
Priorities can be lexicographic
Adding every objective with weights can allow a serious shortfall to be traded against many minor preferences. Lexicographic optimisation avoids that: first minimise uncovered essential demand; among equally good coverage solutions, minimise rule exceptions; among those, improve fairness; then consider convenience.
This resembles dictionary order. The first priority dominates the second rather than merely receiving a larger coefficient. It often matches organisational reasoning better and is easier to explain.
Fairness needs a definition
“Fair” is not one equation. Equal total hours may still distribute nights badly. Equal night counts may ignore weekends. Equal counts may disregard requested availability or previous burdens. A roster can be fair in one metric and unfair in another.
Suppose four workers receive weekend counts [3,3,1,1]. Mean is 2 and range is 2. Another roster gives [2,2,2,2], mean 2 and range 0. The second is more equal by range. But if two workers requested weekends and two requested weekdays, the first may better fit preferences. Context matters.
Useful fairness measures include:
- maximum minus minimum burden;
- sum of absolute deviations from a target;
- variance of assigned nights or weekends;
- maximum individual dissatisfaction;
- proportion of preferences honoured;
- changes from an already communicated roster.
Minimising the maximum burden can protect the worst-off person better than minimising total dissatisfaction. Consider costs [0,0,0,12] and [4,4,4,4]. Both total 12 or 16 respectively, so total cost prefers the first even though one person carries all dissatisfaction. A minimax objective prefers the balanced maximum of 4. Neither is automatically correct; the choice is a value decision.
Fairness over time
A single week may look unequal because some people are unavailable. Fairness can be evaluated across a rolling period. Let B(e,t) be cumulative undesirable-shift burden up to week t. The next roster can penalise assignments that widen the historical gap.
Historical correction needs boundaries. A worker should be able to inspect and challenge the record. Old data should not create a permanent label. Changes in contract, role or preference may make comparisons invalid. The mathematics encourages memory; governance decides what memory is appropriate.
Did You Know? Rotating every shift mechanically can look equal but still be unfair if workers have different agreed availability. Symmetry in a table is not the same as fairness in people’s lives.
Optimisation compares feasible rosters
A constraint solver searches assignments that satisfy hard rules and improve objectives. Google’s employee scheduling example shows binary assignments and constraints, while its constraint programming overview explains a method suited to discrete decisions.
The workflow is:
- define variables;
- add hard constraints;
- define penalties or objectives;
- solve;
- inspect status and solution;
- test against independent rules;
- review with people;
- publish through an authorised process.
“No solution” is useful evidence. It means the encoded hard constraints cannot all hold together under the current data. It does not identify which rule should be broken. The organisation can examine unsatisfied coverage, tight availability or conflicting limits, then change the real plan or correct data.
A small worked assignment
Imagine workers A, B, C and D covering four shifts, one person per shift. Each can work at most one shift. Their fictional preference costs are:
| Worker | S1 | S2 | S3 | S4 |
|---|---|---|---|---|
| A | 1 | 7 | 4 | 6 |
| B | 2 | 1 | 8 | 5 |
| C | 6 | 3 | 1 | 4 |
| D | 5 | 6 | 2 | 1 |
Assigning A–S1, B–S2, C–S3 and D–S4 has total cost 4. It is clearly strong because each worker receives their cost-1 shift. If C were unavailable for S3, the remaining assignment problem changes globally; greedily giving each person a locally cheapest remaining shift can block a better full matching.
This is why optimisation matters. Choices interact. A scarce qualified person used early may be unavailable for the only later shift they can cover. The best decision for one row may be poor for the whole week.
Multiple good rosters
There may be many solutions with the same objective. Diversity can be valuable: planners can compare alternatives, or the system can avoid always selecting the same person when ties occur. Tie-breaking should be intentional and auditable.
Random tie-breaking can spread opportunities but makes exact reproduction harder. Deterministic tie-breaking aids audit but may create hidden repeated patterns. A recorded seed or secondary fairness criterion can help.
Real demand is uncertain
Required staffing often depends on customer arrivals, workload, illness, weather or events. A single forecast is not certainty. If hourly demand has a distribution, planners can consider service risk at several staffing levels.
Suppose expected arrivals are 40 per hour, but actual values vary. Staffing only for the mean may leave frequent shortages if service capacity is tight. A percentile-based plan, scenario set or buffer may be appropriate, balanced against cost and fatigue. The correct choice depends on consequences and organisational policy.
Scenario analysis asks, “What if demand is 20% higher? What if one trained person is absent? What if a shift starts late?” A robust roster preserves acceptable performance across defined scenarios. It may cost more than the nominal optimum, but it reduces fragility.
The logic connects to queueing theory, waiting times and service systems. Rostering sets capacity; queues reveal what happens when variable demand meets that capacity. Neither model should be interpreted without the other in a service setting.
Re-rostering has a cost
When disruption occurs, recomputing from scratch may produce a numerically better roster that changes many people’s plans. Add a change penalty for assignments that differ from the published roster. This creates stability.
Let y(e,s) be the prior published assignment. The number of changes is Σe,s |x(e,s) − y(e,s)|. Because variables are binary, this counts added and removed assignments. A high weight preserves stability, but it must not override safety or mandatory constraints.
Communicating one necessary change early may be better than silently optimising total hours. The objective should include the human cost the organisation truly cares about.
Verification, audit and privacy
A solver saying “optimal” means optimal for the encoded model, not universally best. Independent verification should recompute coverage, overlaps, hours, rest intervals, qualifications and totals from the exported roster. Tests should include midnight crossings, daylight-saving zones if relevant, leave changes and zero-demand shifts.
An audit record can store input version, rule version, solver version, objective weights, status, timestamp and authorised changes. It should avoid unnecessary sensitive data. People need a route to correct inaccurate inputs and challenge decisions that affect them.
Privacy is not an afterthought. Medical information, caring responsibilities and protected characteristics may require careful handling. Often the scheduling model needs only a derived restriction such as “unavailable,” not the underlying reason. Data minimisation reduces harm.
Explainability also matters. “The algorithm chose you” is not a reason. A useful explanation names the constraints and tie-breakers: required skill, declared availability, historical night count and chosen fairness policy. If the decision cannot be explained, governance is weak.
Where the mathematical model stops
A model does not know whether a team works well together, whether a shift is unusually stressful, whether travel after a late shift is difficult, or whether a person is being pressured not to state a preference. Those facts enter only if people identify and govern them.
Mathematical fairness can conceal structural unfairness. Equalising overtime among people with unequal base opportunities may not solve the underlying issue. Historical data may encode earlier bias. A high objective score should trigger questions, not close them.
Legality is not reducible to a generic constraint library. MOM guidance, employment contracts, collective agreements, sector requirements and individual circumstances must be checked. The current MOM page notes specific conditions and exceptions; this educational article cannot determine coverage or compliance.
Common misconceptions
“There is one fairest roster” is false because fairness has several dimensions. “More constraints always improve the roster” is false because unnecessary rules can make it infeasible or brittle. “Optimisation removes bias” is false if data and objectives encode bias. “An average weekly number proves adequate rest” is false because sequence and intervals matter. “Optimal means acceptable” is false because the model may omit essential human facts.
Another misconception is that preferences are promises. A system may try to honour them, but coverage and competing requests can prevent it. The policy should say how conflicts are resolved.
How students can build the skill
Start with a paper puzzle: four people, four shifts, availability crosses and one skill requirement. Use a grid to find a feasible assignment. Then add preference scores and compare all feasible solutions. This makes the difference between feasibility and optimisation visible.
Next, represent each yes-or-no choice as 0 or 1. Write coverage as a sum. Write “at most one” as an inequality. Check that every sentence has a corresponding mathematical rule and every rule has a plain-language interpretation.
Then evaluate fairness with at least two metrics. Compare range of weekend counts and maximum preference cost. If the metrics disagree, write which value each protects. There is no need to hide disagreement behind a single score.
Finally, stress-test. Remove one worker, raise demand or lock a requested day off. Record whether the model remains feasible and which objective worsens. Resilience is a property you discover through variation.
A safe classroom project
Create a fictional school-event roster with ushers, registration staff and first-aid-qualified adults. Use invented names. Define mandatory skill and coverage rules. Gather fictional preferences. Find at least two feasible rosters and explain the trade-offs.
Keep a model card:
- purpose and non-purpose;
- input fields and source;
- hard rules;
- soft goals and weights;
- fairness metrics;
- known omissions;
- human review and appeal route;
- date of rule verification.
This documentation teaches more than code alone. It makes the mathematical object inspectable.
For a related sequence problem, read project scheduling, critical paths and deadlines. Project scheduling assigns time to dependent tasks; rostering assigns people to timed duties. Both use constraints, but the human fairness dimension is especially central in rosters.
Guidance for students, parents and teachers
For students, learn to distinguish “must,” “should” and “nice to have.” Translate each into a hard constraint, soft penalty or comment. This habit transfers to examination planning, transport, computing and operations research.
For parents, use household activities carefully. A chores table can illustrate workload balance, but family care is not an optimisation contest. Ask the child to propose two fairness definitions and listen for who benefits from each.
For teachers, use fictional employment data and avoid collecting sensitive student information. Current Singapore facts should be linked to MOM and dated in lesson notes. A solver demonstration should include infeasibility, not just a polished answer, because real learning happens when constraints conflict.
Career pathways include operations research, workforce planning, healthcare operations, hospitality, transport, software and public services. Mathematics supports these areas, but ethical judgement, domain knowledge, communication and legal literacy are equally important. No algorithm grants automatic career access or guarantees a good workplace.
Questions worth asking before publication
Does every assignment satisfy hard requirements? Are hours and intervals recomputed independently? Was the current rule source checked? Are preferences recent? Does the fairness report include nights and weekends, not only total hours? Can each person see and challenge their information? How many assignments changed from the earlier roster? Who authorised exceptions?
These questions turn a schedule into a governed decision.
A complete fictional rostering investigation
Consider five fictional workers—A, B, C, D and E—and five evening shifts from Monday to Friday. Each shift needs two people, including at least one of A, B or C with a fictional closing skill. Everyone may work at most three evenings. A is unavailable Friday, B unavailable Monday, C unavailable Wednesday, D unavailable Tuesday and E unavailable Thursday.
There are ten assignment slots. If hours are equal, average workload is two shifts per person. That average is a useful fairness target, not a guarantee that a feasible roster can give exactly two to everyone.
One candidate is:
| Day | Assigned pair | Skilled closer present? |
|---|---|---|
| Monday | A, D | Yes—A |
| Tuesday | B, E | Yes—B |
| Wednesday | A, D | Yes—A |
| Thursday | C, E | Yes—C |
| Friday | B, C | Yes—B and C |
Workloads are A2, B2, C2, D2 and E2. Every stated unavailability is respected and the range of shift counts is zero. Under these narrow rules, the roster is perfectly balanced by total count.
Now add preferences: A dislikes Wednesday, B dislikes Friday, C prefers Thursday, D prefers Monday and E prefers Tuesday. Give a disliked assignment cost 5, neutral 2 and preferred 0. The candidate includes costs A-Wed 5, B-Tue 2, B-Fri 5, C-Thu 0, C-Fri 2, D-Mon 0, D-Wed 2, E-Tue 0, E-Thu 2, A-Mon 2, total 20.
Can total cost fall without breaking count equality? Swap A and B where availability permits: B cannot Monday, so the Monday closer remains A or C. C cannot Wednesday, so Wednesday needs A or B. Local swaps are constrained by the skilled-closing requirement. The puzzle demonstrates that balance and preference interact.
Write the equations
For Monday M, coverage is x(A,M)+x(B,M)+x(C,M)+x(D,M)+x(E,M)=2. Skill coverage is x(A,M)+x(B,M)+x(C,M)≥1. B’s unavailability gives x(B,M)=0. A’s workload is Σs x(A,s)≤3. Equivalent rules apply to every day and person.
To enforce exactly two shifts per person, replace the upper bound with Σs x(e,s)=2. Because there are ten total slots and five people, these equalities are consistent with total coverage. Yet they might become infeasible after another availability change. Counting totals is a quick necessary-condition test: required slots must equal the sum of desired workloads.
Suppose C also becomes unavailable Friday. Friday then requires A or B as closer; A is unavailable, so B is forced. Since B already works Tuesday in the candidate, this may still be feasible. If B also becomes unavailable Friday, there is no qualified available closer. The correct status is infeasible, not “assign D anyway.”
Compare fairness metrics
Remove exact equality and produce counts [3,3,2,1,1]. Mean remains 2, range is 2, and squared deviations sum to 1+1+0+1+1=4. Counts [3,2,2,2,1] also have range 2 but squared deviations sum to 2. Variance therefore prefers the second distribution even though range ties.
Now attach night-burden weights: Friday counts 2 units and other days 1. A person with one Friday plus one ordinary day has burden 3, while a person with three ordinary days also has burden 3. Weighted burden can reveal equality hidden by raw counts, but the weights are policy choices requiring explanation.
Minimax fairness would minimise the largest burden. Sum-of-squares fairness penalises extremes increasingly. Lexicographic fairness might first minimise maximum burden, then minimise the number at that maximum, then preference cost. Each method encodes a different moral intuition.
Model rest as time, not day names
Extend the scenario with a Saturday 06:00 start. A Friday evening ending at 23:00 leaves only seven hours between shifts. A rule based solely on “different dates” would miss the short interval. Store actual start and end timestamps and calculate rest.
If shift s ends at end(s) and t starts at start(t), define them as conflicting when start(t)−end(s) is below the applicable required minimum. Then add x(e,s)+x(e,t)≤1. Which minimum applies is not supplied by generic mathematics; it comes from current lawful and contractual requirements.
Introduce uncertainty and recovery
Imagine Friday demand might require a third worker with probability 0.35. One option is to schedule three; another is to designate an on-call arrangement if lawful and agreed; another is to cross-train. Expected shortage alone is not enough: consequence matters.
If E reports illness, rerostering can minimise changes from the published plan. The solver should preserve unaffected assignments where possible, satisfy mandatory coverage and present the planner with explainable alternatives. A tiny objective improvement is not worth five unnecessary changes.
Audit the result
Recompute each check outside the optimisation model: two people per day, closer coverage, availability, shift counts, interval conflicts and preference score. Record source data version and rule date. Ask the people affected whether inputs are accurate. If someone challenges a preference record, correct it and resolve again.
The final report should not say, “The computer found the fair roster.” It should say, “This roster satisfies the listed mandatory rules; counts are equal in this fictional week; total preference cost is 20 under the declared scale; and the model does not capture every human circumstance.” That is precise, reviewable and humble.
Further reasoning challenges
Challenge one concerns percentages. Team X receives 18 of 20 requested shifts, or 90%. Team Y receives 4 of 5, or 80%. The ten-point gap sounds large, but it represents one unmet request in each team. Report counts and denominators beside percentages so readers can interpret scale.
Challenge two concerns averages. Two workers receive 16 hours each and two receive 24 hours each. Mean is 20 hours, yet nobody works exactly the mean. If maximum agreed hours were 22, the mean would not reveal two violations. Constraints must be checked person by person.
Challenge three concerns consecutive duties. A seven-day binary sequence 1110011 contains a run of three, then two. If the planning limit is two consecutive duties, total count five does not expose the problem. Sequence structure matters.
Challenge four concerns scarce skills. If only A can cover both Tuesday and Thursday specialist duties but A may work only one, the model is infeasible unless demand, qualification availability or the real plan changes. A greedy algorithm may assign A to Tuesday and discover Thursday too late; a constraint solver sees the interaction.
Challenge five concerns weighted fairness. Nights have weight 2 and days weight 1. Worker A receives two nights, burden 4. Worker B receives four days, also burden 4. Equal weighted burden does not imply equal preferences, pay or fatigue. A weight is a summary, not a complete account.
Challenge six concerns robustness. A nominal roster has exactly one qualified closer every day. It is feasible but fragile: any closer absence creates failure. Requiring two qualified people on high-risk days or maintaining an agreed contingency increases resilience at a cost. The objective must make that value explicit.
Pareto choices
A roster is Pareto-dominated if another roster is at least as good on every measured objective and better on one. Remove dominated options before discussion. The remaining Pareto frontier contains trade-offs: lower preference cost may require more changes; stronger resilience may require more staffing.
No formula automatically selects one frontier point. Decision-makers should name priorities, show affected people and record the reason. This is where optimisation supports governance rather than replacing it.
Communication exercise
Give students two rosters with identical coverage. Ask them to write one paragraph for workers, one for a manager and one for an auditor. The worker version emphasises assignments and correction route. The manager version emphasises coverage, cost and contingencies. The auditor version emphasises rules, data versions and exceptions.
All three must remain truthful. Audience changes emphasis, not facts. Mathematical communication is therefore part of fairness: people cannot challenge a decision they cannot understand.
Frequently asked questions
What is a binary decision variable?
It is a variable restricted to 0 or 1. In rostering it can represent whether a person is assigned to a shift.
What is the difference between a hard and soft constraint?
A hard constraint must hold for a roster to be feasible. A soft constraint may be violated at a penalty so competing preferences can be compared.
Why not simply rotate everyone equally?
People may have different skills, contracts, availability and agreed needs. Mechanical rotation can be equal in appearance while producing impractical or unfair outcomes.
What does infeasible mean?
It means no assignment satisfies all encoded hard constraints with the current data. The planner must investigate data or real requirements; the solver should not silently break a rule.
Is the roster with the lowest total penalty fair?
Not necessarily. A low total can hide one person receiving a very high burden. Compare maximum burden, distribution and historical context too.
How should Singapore working-hour rules be modelled?
Use current MOM sources, determine which provisions and arrangements apply, incorporate contracts and sector requirements, and obtain professional advice where needed. Do not universalise one numeric limit.
Can an optimiser replace a manager?
No. It can search and check combinations. People remain responsible for lawful rules, correct data, ethical objectives, communication, exceptions and appeal.
Why keep a change penalty?
Once a roster is communicated, changes disrupt plans. A change penalty helps preserve stability while allowing mandatory corrections.
What school mathematics is useful?
Sets, binary variables, inequalities, combinatorics, graphs, averages, variance, probability and optimisation all contribute. Clear writing is also essential.
What is the deepest lesson?
Scarce time and skills must be allocated, but the objective is not merely numerical efficiency. Good mathematics makes constraints and trade-offs visible so people can govern them fairly.
Useful next reading
Use the current MOM hours, overtime and rest guidance for Singapore context and the OR-Tools workforce scheduling documentation for a technical view of model features. Compare rostering with school timetabling, constraints and scheduling and comparing percentages fairly when reporting preference fulfilment across groups of different sizes.
Mathematics matters because a roster is not merely a calendar. It is a public explanation of how an organisation balanced coverage, time, skills, uncertainty and human claims. The equations help most when their assumptions remain open to inspection.
