FAQs
Answers to common questions about the Employee Shift Scheduling model.
Constraints and weights
Which rules should be hard constraints and which should be soft?
When deciding to use hard or soft constraints, make a rule hard only when a plan that breaks it can’t be used, for instance because it breaks a law, a safety rule, or a physical limit. Make every other rule soft.
The Employee Shift Scheduling model will avoid breaking hard constraints. If it can’t assign work without breaking one, it leaves the work unassigned and shows it as unassigned in the output dataset. Medium constraints push the model to assign as much work as possible, and soft constraints compete with each other based on their weights. Every hard rule you add limits the options the model has, so too many hard rules lead to more unassigned work.
You don’t set the level of each constraint yourself. Each constraint in the model has a fixed level, and many rules have a required version (hard) and a preferred version (soft). You choose the level by which version you use in your input dataset.
For rules with some flexibility, use both versions together.
For instance, if employees usually work 40 hours a week but can work up to 48, add a PREFERRED period rule with a minutesWorkedLimit maximum of 2400 minutes and a REQUIRED period rule with a maximum of 2880 minutes. The model then avoids extra hours, but assigns them when covering more shifts is worth the cost.
Constraints that depend on optional input only apply when your input dataset includes that data.
For more information, see Constraints.
What should my plans optimize for?
Optimize for the goals that cost your business the most when a plan gets them wrong.
The right goals depend on your business, so organizations with similar operations often optimize for different things. For instance, one organization accepts overtime to meet its service level agreements, while another limits overtime because it leads to high employee turnover.
To choose your goals:
-
Decide which metrics matter most to your business and rank them by importance.
-
Review the example optimization goals for the Employee Shift Scheduling model.
-
Tune the constraint weights that affect those metrics, as described in How do I choose values for constraint weights?.
Your goals can change over time. For instance, some organizations allow more overtime at the end of a quarter to clear a backlog. Create a configuration profile for each set of goals, and select the profile that matches your current goals when you solve a dataset.
How do I choose values for constraint weights?
Start with the default weights, and change them only when a plan doesn’t match what your planners expect. The Employee Shift Scheduling model’s defaults are set to balance its optimization goals.
Weights are relative. A constraint with a weight of 0 turns the constraint off. Doubling a constraint weight doubles the impact of the constraint. Multiplying every weight by the same number doesn’t change the plan.
Doubling a weight doesn’t halve the related metric. Constraints compete with each other, so the only way to see the effect of a change is to solve datasets with the new weights and compare the results.
To tune the weights:
-
Find the output metric that doesn’t meet expectations, for instance too much overtime.
-
Use score analysis to find the constraints that affect that metric.
-
Change the weights of those constraints in a new configuration profile.
-
Solve representative datasets with the new profile.
-
Compare the results. Use the comparison UI for out-of-the-box metrics or your own tool for custom metrics. Check that the metric improved and that no other important metric got worse.
-
Repeat for the next metric that doesn’t meet expectations.
Hard and medium constraints always take priority over soft constraints, so a higher soft weight never causes the model to break a hard or medium constraint. If increasing a soft weight has no effect on the plan, a hard or medium constraint is probably preventing the change.
The same happens when there aren’t enough resources to assign all the work. Assigning as much work as possible leaves the model few options, so changing soft weights has little effect on the plan.
Weights have a maximum value of 1,000,000,000,000 (one trillion).
For more information, see Metrics and optimization goals and Balancing different optimization goals.
Should I create a configuration profile for each client?
Yes. A configuration profile saves a set of constraint weights, model configuration, and solve settings, so every dataset you solve with that profile uses the same settings. Create a profile for each client, site, or planning scenario that needs different settings. You can add up to 50 configuration profiles for the Employee Shift Scheduling model.
To add a profile, log in to Timefold Platform, select the Employee Shift Scheduling model, and select Configuration profiles. You can also manage profiles with the Platform API.
To use a profile, add its ID to the POST URL when you submit a dataset, for instance ?configurationId=b7eef8b5-14ca-4a45-a943-582381bd1b08.
You can also select the profile in the platform UI when you create or re-solve a dataset.
Datasets that don’t specify a profile use the default profile.
Learn about using configuration profiles.
Use configuration overrides in the input dataset only for values that change from one dataset to the next. Overrides in the input dataset take priority over the profile.
Before you change a profile’s weights, check that your input datasets include the data needed by the related constraints. For instance, the weight of a constraint about preferences has no effect if your input datasets don’t include any preferences.
For more information, see Configuration profiles and parameters.
If I build Timefold into my own planning software, should my users be able to change constraint weights?
In most cases, no. Give your users a small number of named choices instead, and change the weights behind the scenes.
When planners can change every weight, they tend to keep adjusting the settings and re-solving the plan. Planning becomes a manual process again, and planners lose the time that automatic scheduling saves.
Instead, offer one of the following:
-
One default setting that works for most of your clients.
-
Two or three named options that match your clients' goals, for instance "Lowest cost" and "Fairest workload". Each option uses its own configuration profile.
-
A slider between two goals, for instance cost and employee preferences, that changes several weights at once.
If your users are experienced planners who understand the trade-offs between goals, you can give them access to more of the weights. Seeing what the model takes into account can help them trust the plan.
For more information, see Constraints.
How do I handle planning rules that are inconsistent or undocumented?
Start with the rules a plan must follow to be usable, then add rules until your planners accept the plan.
Planning rules often come from different places. Some are laws or contracts, some exist only in a planner’s head, and some are habits that nobody has questioned. Try to identify different sources of rules, for instance, managers and department heads will be able to tell you the rules that are important to their teams. Treat each rule as real until you’ve tested it, but don’t assume every rule must be a hard constraint.
Before you make a rule hard, check your past schedules against it. Past schedules often break rules that planners describe as fixed. Submit one of your past schedules, with its assignments, to score analysis to see which constraints it breaks. If your past schedules regularly break a rule, use the preferred (soft) version of the rule instead of the required (hard) version.
To find out whether a rule is worth its cost, solve the same dataset with and without the rule, and compare the results with your planners. If the plan without the rule is better and still acceptable, you can relax or remove the rule.
For more information, see Which rules should be hard constraints and which should be soft?.
What if the model doesn’t support one of my rules?
First, check whether an existing constraint already covers the rule. The Employee Shift Scheduling model includes constraints for the most common planning rules, and many rules that seem specific to your business can be expressed with existing features. For instance, a rule about who can work at which location can often be expressed with tags.
To check, see Constraints for the constraints grouped by feature, or the full constraint list on the model’s information page in Timefold Platform. If you find the rules don’t quite fit your use case, contact us for help.
If no existing constraint covers the rule, contact us with a description of the rule, including its edge cases and why your business needs it. You can also submit or vote for a request on the feature requests board.
You can’t add your own constraints to the Employee Shift Scheduling model. New constraints are added by Timefold and announced in the changelog. Some new constraints are disabled by default, so check the changelog entry to see whether you need to set a weight to enable it.
Modeling your planning problem
Which model fits my planning problem?
Choose the model based on what you assign, and whether travel between locations is part of the work.
| Model | Use it when | Typical use cases |
|---|---|---|
People travel between locations during their shift, and the order of their visits matters. |
||
Drivers pick up people or goods at one location and take them to another. |
Non-emergency medical transportation, and courier and express delivery |
|
Employees work shifts at a location, and you decide who works which shift. |
||
Jobs run on machines, employees, or other resources, often with dependencies between jobs. |
Discrete manufacturing, project scheduling, and single-site maintenance |
If employees travel between several locations during a shift, and the route or the order of visits matters, use the Field Service Routing model. The Employee Shift Scheduling model calculates straight-line distances between locations and doesn’t plan routes.
The Task Scheduling model has Preview maturity, so backward-incompatible changes can still be introduced.
If your planning problem matches more than one model, contact us to discuss which one fits best.
For more information, see the model catalog.
Should I plan my whole operation in one dataset or split it up?
Split your operation into separate datasets when its parts don’t share resources or work. Keep the parts in one dataset when they do.
For instance, if each branch has its own employees and its own work, solve one dataset per branch. Smaller datasets solve faster, and a problem in one branch’s data doesn’t affect the others.
If some resources, for instance employees, vehicles, or machines, work for more than one branch, keep those branches in one dataset. The model can then decide where the shared resources are needed most. When you split them, each dataset is planned without knowing about the others, which usually leads to a worse plan overall.
If you need different kinds of plans, for instance shift schedules and routes, use a separate model for each. Solve them in order, and use the output of one plan to prepare the input for the next. For instance, use the shifts from your shift schedule as the vehicle shifts when you plan routes.
Which rules belong in the model, and which can I handle in my own system?
Include a rule in the model when it can make one plan better than another. When a rule doesn’t change which plan is best, handle it in your own system, before you submit the dataset or after the model returns the plan.
For instance:
-
Leave work out of the dataset when it can’t be done yet, for instance a job that’s waiting for parts or materials. Add it to a later dataset when it’s ready.
-
Handle steps that only depend on the finished plan in your own system, for instance creating work orders or notifying customers.
Some work can’t be expressed with the model’s features. Leave that work out of the dataset, and show it in your planning tool so planners can schedule it manually. If that work takes up a resource’s time, make sure the dataset shows the resource as unavailable for that time, so the model plans around it.
What happens to work that doesn’t fit in the plan?
The Employee Shift Scheduling model leaves it unassigned. Unassigned work appears in the output dataset and in the dataset’s metrics, so you can see what wasn’t planned and decide what to do with it.
Work is left unassigned when assigning it would break a hard constraint, for instance when no available resource has the right skills, or when there isn’t enough capacity for all the work.
To control which work is assigned when there isn’t capacity for everything, give your work priorities. When not all work can be assigned, the model prefers higher-priority work. Depending on the model, you can also mark work as optional. Optional work is treated as a soft constraint and assignments will be balanced against other soft constraints.
You can send more work than fits in the planning period. For instance, send a month of maintenance work when you plan two weeks, and give work that must happen soon a higher priority. The model assigns the urgent work, fills the gaps with lower priority work where possible, and leaves the rest unassigned. The unassigned work can be included in the next dataset.
To find out why a specific piece of work wasn’t assigned, use score analysis.
How do shift priorities work?
Give each shift a priority to control which shifts are assigned when there aren’t enough employees for all of them.
There are ten built-in priorities, from 1 (highest) to 10 (lowest).
To set how much each priority counts, and whether shifts with that priority are mandatory or optional, add an unassignedShiftRule with priorityWeights to globalRules.
The penalties for unassigned shifts add up.
For instance, with weights of 100 for priority 1 and 10 for priority 3, leaving one priority 1 shift unassigned counts as much as leaving ten priority 3 shifts unassigned.
-
Use large gaps between weights when higher-priority shifts should almost always be assigned first.
-
Use weights close together, for instance 1002, 1001, and 1000, when the model should assign as many shifts as possible and only use priority to choose between otherwise equal options.
For more information, see Priority and optional shifts.
How do I use my own employees before contractors or agency staff?
Put contractors and agency staff in an employee cost group with an employeeActivationCost.
The Minimize activated employees constraint penalizes each employee who is assigned at least one shift by the activation cost, plus the activation cost again for each of their assigned shifts.
For instance, a contractor with an activation cost of 100 who works two shifts adds a penalty of 300.
This penalty means the model only assigns shifts to contractors when your own employees can’t cover them.
When the model does activate a contractor, the Maximize activated employee saturation constraint encourages it to give that contractor as many shifts as possible, instead of spreading shifts across more contractors.
To keep a fixed ratio between employee groups, for instance a minimum share of permanent staff, use the Keep employee activation ratio constraint.
You can also give your own employees a higher employee priority or contract priority. Priority makes the model more likely to meet those employees' preferences and working-hour rules, for instance their minimum hours.
For more information, see Employee activation.
How do I model skills, certifications, and departments?
Add skills to employees, and add the skills each shift needs to the shift.
Use requiredSkills for skills an employee must have, and preferredSkills for skills that are nice to have.
-
Certifications that expire: add
validityDateTimeSpansto the employee’s skill, so the skill only counts while it’s valid. -
Shifts that accept one of several skills: by default, an employee needs all the required skills. Change the skill matching strategy to match any of the skills instead.
-
Departments and locations: restrict who can work in a department with skills, or with shift tags. To limit how many departments an employee works in during a period, use unique tags per period.
-
Employees who must work together, for instance a trainee and a mentor: use required pairings.
For more information, see Skills and risk factors.