Manual intervention
Different industries have different scheduling requirements and it is not always possible to automatically assign and optimize every shift.
In employee shift scheduling you can pin one or many shifts when a specific employee or group of employees must be assigned to specific shifts.
Even after you’ve implemented fully automated and optimize scheduling, there are still times when it is necessary to manually intervene and assign specific shifts manually.
Shifts are pinned by setting pinned to true for the shift and adding the employee ID of the employee who has been assigned to the shift to employee:
{
"shifts": [
{
"id": "Mon A1",
"start": "2027-02-01T09:00:00Z",
"end": "2027-02-01T17:00:00Z",
"pinned": true,
"employee": "Ann"
},
{
"id": "Dinner 1",
"start": "2027-02-01T09:00:00Z",
"end": "2027-02-01T17:00:00Z",
"pinned": true,
"employee": "Beth"
}
]
}
Pinning is useful in the following scenarios:
Comparing solutions
When you first start evaluating scheduling options it can be useful to compare the outcome of different solutions. This could mean comparing a solely human generated schedule with a schedule generated by Timefold or comparing solutions between Timefold and another company.
In order for any comparison to be useful it must use the same data and apply the same constraints.
Comparison schedule
To compare a schedule from Timefold with an existing schedule from a human planner or another scheduling solver, create an input dataset with the shifts and employees that were scheduled by the human planner or the other solver, and pin every shift with the employee the shift was assigned to:
{
"id": "Shift Mon 1",
"start": "2027-02-01T09:00:00Z",
"end": "2027-02-01T17:00:00Z",
"pinned": true,
"employee": "Ann"
}
Timefold’s schedule
To generate a schedule from Timefold, create a copy of the dataset from the previous step and unpin all the shifts by removing "pinned": true, and the employee:
{
"id": "Shift Mon 1",
"start": "2027-02-01T09:00:00Z",
"end": "2027-02-01T17:00:00Z"
}
Add the contractual constraints that must be considered, for instance, employees work 8 hours a day for a total of 40 hours per week:
{
"contracts": [
{
"id": "fullTimeContract",
"periodRules": [
{
"id": "Max8HoursPerDay",
"period": "DAY",
"satisfiability": "REQUIRED",
"minutesWorkedMax": 480
},
{
"id": "Max40HoursPerWeek",
"period": "WEEK",
"satisfiability": "REQUIRED",
"minutesWorkedMax": 2400
}
]
}
]
}
If employees are only available at specific times, this can also be added per employee:
{
"employees": [
{
"id": "Carl",
"availableTimeSpans": [
{
"start": "2027-02-02T00:00:00Z",
"end": "2027-02-06T00:00:00Z"
}
]
}
]
}
Timefold includes many more employee resource constraints and shift service constraints that can be added to the initial comparison.
Comparing the schedules
In Timefold Platform create plans for both the comparison dataset and Timefold dataset.
Timefold will respect the pinned shifts in the comparison dataset and create an optimized schedule for the Timefold dataset. Both plans will be assigned a score, the higher the score, the better the quality of the schedule.
Both plans will include output metrics that can give you a sense of how the plans compare. These include:
-
Assigned shifts
-
Unassigned shifts
-
Activated employees
| A preview version of our comparison UI is available: Comparing datasets (preview). |
Also see Interpreting dataset results for more information about understanding the results of your datasets.
Gradual adoption of the technology
Complex technology is rarely adopted all at once.
With pinning you can gradually introduce Timefold into the scheduling process as you build trust in the plans it generates. This also gives you time to fine-tune the constraints and constraint weights that are used in your datasets.
To gradually adopt Timefold, decide on which portion of the schedule Timefold will optimize (perhaps starting with one region or business function) and gradually increase over time.
Real-time planning
Real-time planning makes it possible to change schedule even when the schedule is being executed, for instance, to assign new employees to shifts, due to sick leave or additional demand. You can use pinning in real-time planning to minimize the disruption caused by the re-planning process.
See the Real-time planning guide for details.
Self-rostering
Some industries (for instance nursing) can allow some employees to choose their own shifts. In this scenario when an employee has chosen a shift, the shift is pinned to that employee to ensure it is assigned to that employee and not another employee.
| You can also define preferred employees if you want to take self-rostering choices into account but also want to keep the flexibility of assigning different employees when it makes sense to do so. |
Joker shifts
When employees have the flexibility to choose 1 shift they want to work (a joker shift), this shift is pinned to the employee to ensure it is assigned to them and is not assigned to another employee.
Experiments
Pinning can also be used to complete experiments on your datasets. By pinning a portion of the dataset you can answer "what would the result be if" questions that will help you improve the quality of your plans over time.
Next
-
See the full API spec or try the online API.
-
Learn more about employee shift scheduling from our YouTube playlist.