假设您要为某个联络中心生成轮班, 让员工的需求得到满足。该联络中心全天候运营,并且 所需员工人数会随着时间而变化。联络中心聘请 包括全职和兼职员工。
全职员工轮班 9 小时,休息 1 小时 4 或 5 小时 在轮班开始后,且可以在凌晨 5 点到 中午 12 点。兼职员工每 4 小时轮班 15 分钟, 第二个工作小时的下班时间,且可以随时开始轮班。在 则以 15 分钟为增量考虑可能的轮班开始时间。
联络中心想要为 Google Cloud 客户 考虑到可能最多只能有 20 名全职员工 和 40 名兼职员工。
全职和兼职员工轮班模板
用于确定有效班次的规则可以用 shift 表示 模板。在偏移模板中,可以表示停顿的概念 事件模板。例如,针对全职员工的轮班模板 员工轮班表示为:
{
"id": "full-time",
"earliestStartTime": {
"hours": 5
},
"latestStartTime": {
"hours": 12
},
"durationMinutes": 540,
"startTimeIncrementMinutes": 15,
"eventTemplates": [
{
"id": "full-time-break",
"minimumMinutesAfterShiftStart": 240,
"maximumMinutesAfterShiftStart": 300,
"durationMinutes": 60,
"startTimeIncrementMinutes": 60
}
],
"maximumEmployeeCount": 20
}
类似地,非全职员工轮班的轮班模板表示为:
{
"id": "part-time",
"earliestStartTime": {},
"latestStartTime": {
"hours": 23,
"minutes": 59
},
"durationMinutes": 240,
"startTimeIncrementMinutes": 15,
"eventTemplates": [
{
"id": "part-time-break",
"minimumMinutesAfterShiftStart": 120,
"maximumMinutesAfterShiftStart": 120,
"durationMinutes": 15,
"startTimeIncrementMinutes": 0
}
],
"maximumEmployeeCount": 40
}
员工需求随时间变化的情况
对员工的需求由 EmployeeDemand
列表表示,
其中每个要素都以时间间隔和员工
计数。在本例中,需求在 4 至 13 名员工之间波动
span 为两天,表示为:
{
...
"employeeDemands": [
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 20
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 20,
"hours": 12
},
"employeeCount": 8
},
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 20,
"hours": 12
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 20,
"hours": 20
},
"employeeCount": 12
},
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 20,
"hours": 20
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 21,
"hours": 6
},
"employeeCount": 4
},
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 21,
"hours": 6
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 22,
"hours": 0
},
"employeeCount": 13
}
]
}
完整请求示例
{
"solverConfig": {
"timeLimit": "30s"
},
"shiftTemplates": [
{
"id": "full-time",
"earliestStartTime": {
"hours": 5
},
"latestStartTime": {
"hours": 12
},
"durationMinutes": 540,
"startTimeIncrementMinutes": 15,
"eventTemplates": [
{
"id": "full-time-break",
"minimumMinutesAfterShiftStart": 240,
"maximumMinutesAfterShiftStart": 300,
"durationMinutes": 60,
"startTimeIncrementMinutes": 60
}
],
"maximumEmployeeCount": 20
},
{
"id": "part-time",
"earliestStartTime": {},
"latestStartTime": {
"hours": 23,
"minutes": 59
},
"durationMinutes": 240,
"startTimeIncrementMinutes": 15,
"eventTemplates": [
{
"id": "part-time-break",
"minimumMinutesAfterShiftStart": 120,
"maximumMinutesAfterShiftStart": 120,
"durationMinutes": 15,
"startTimeIncrementMinutes": 0
}
],
"maximumEmployeeCount": 40
}
],
"employeeDemands": [
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 20
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 20,
"hours": 12
},
"employeeCount": 8
},
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 20,
"hours": 12
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 20,
"hours": 20
},
"employeeCount": 12
},
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 20,
"hours": 20
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 21,
"hours": 6
},
"employeeCount": 4
},
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 21,
"hours": 6
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 22,
"hours": 0
},
"employeeCount": 13
}
]
}
响应示例
求解器的回答包含员工排班表和 要求的员工人数。如果完全覆盖需求 响应也会列出每个相关时间的 。
以下示例显示了系统生成的其中一个员工排班表 全职员工:
{
"solutionStatus": "SHIFT_GENERATION_SOLVED",
"employeeSchedules": [
{
"shiftTemplateId": "full-time",
"shifts": [
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 21,
"hours": 7,
"minutes": 30
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 21,
"hours": 16,
"minutes": 30
},
"events": [
{
"startDateTime": {
"year": 2024,
"month": 5,
"day": 21,
"hours": 12,
"minutes": 30
},
"endDateTime": {
"year": 2024,
"month": 5,
"day": 21,
"hours": 13,
"minutes": 30
},
"eventTemplateId": "full-time-break"
}
]
}
],
"employeeCount": 1
},
...
]
...
}