Contact Center

Consider a contact center for which you want to generate shifts such that the demand for employees is covered. The contact center operates 24/7, and the number of employees that are required varies over time. The contact center hires both full-time and part-time employees.

Full time employees conduct 9-hour shifts, have a 1 hour break 4 or 5 hours after their shift starts, and can start their shift any time between 5am and 12pm. Part-time employees conduct 4-hour shifts with a 15 minute break at the end of the second working hour, and can start their shift at any time. In both cases, possible shift start times are considered in 15-minute increments.

The contact center is interested in planning the workforce requirements for the next two days of operation, considering that there could be at most 20 full-time employees and 40 part-time employees.

Shift templates for full-time and part-time employees

The rules that determine valid shifts can be represented with a shift template. Within a shift template, the notion of a break can be represented with an event template. For example, the shift template for a full-time employee shift is represented as:

  {
    "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
  }

Similarly, the shift template for a part-time employee shift is represented as:

  {
      "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
    }

Employee demand over time

The demand for employees is represented with a list of EmployeeDemand, where each of these elements is characterized by a time interval and an employee count. In this example, demand fluctuates between 4 and 13 employees over the span of two days, and is represented as:

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

Example of a complete request


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

    

Response example

The response of the solver contains a list of employee schedules with their corresponding number of required employees. If covering the demand exactly is not possible, the response will also list the violations on every relevant time interval.

The following example shows one of the generated employee schedules for a full-time employee:

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