Contact Center

假设您要针对某个联络中心安排轮班,以满足对员工的需求。联络中心全天候运营,所需的员工人数会不时变化。联络中心同时雇用全职员工和兼职员工。

全职员工轮班 9 小时,下班后 4 或 5 个小时有 1 小时的休息时间,并且可以在凌晨 5 点到中午 12 点之间随时开始轮班。兼职员工需要 4 个小时的轮班,第二个工作时间结束时有 15 分钟的休息时间,并且可以随时开始轮班。在这两种情况下,可能的轮班开始时间都以 15 分钟为增量。

考虑到最多可能只有 20 名全职员工和 40 名兼职员工,联络中心有意规划未来两天的运营需求。

适用于全职和兼职员工的轮班模板

确定有效偏移的规则可用 shift 模板表示。在 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 名员工之间波动,表示如下:

  {
  ...
  "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
      },
      ...
    ]
    ...
  }