Restaurantplanung

Nehmen wir als Beispiel ein Restaurant, das wöchentliche Zeitpläne für die Küche plant. Die Schichten des Restaurants sind Montag bis Freitag von 12:00 bis 23:00 Uhr. Es gibt fünf Mitarbeiter, die drei Rollen ausüben können: Station chef, Head chef und Sous chef. In jeder Schicht müssen zwei Mitarbeiter als Station chef mit hoher Priorität und ein Mitarbeiter als Sous chef mit mittlerer Priorität arbeiten. Außerdem ist dienstags und freitags mit mittlerer Priorität ein Head chef erforderlich. Die einzige andere Planungseinschränkung gilt für einen der Mitarbeiter, Liam, der am „Mittwoch-2023-05-03“ Arbeit angefordert hat, aber nicht für die Friday-2023-05-05-Schicht.

Rollenabdeckung für jede Schicht

Die Abdeckung für eine bestimmte Rolle kann für eine bestimmte Reihe von Schichten mit einer Abdeckungsanforderung festgelegt werden. Die erste Verschiebung dieses Problems kann beispielsweise so dargestellt werden:

  {
    "shifts": [
      {
        "id": "Monday-2023-05-01",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 12
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 23
        }
      }
    ]
  }

Wenn alle fünf Schichten Monday-2023-05-01, Tuesday-2023-05-02, Wednesday-2023-05-03, Thursday-2023-05-04 und Friday-2023-05-05 sind, wird die Abdeckungsanforderung für die Rollen Station chef und Sous chef so dargestellt:

{
  "coverageRequirements": [{
      "shiftIds": ["Monday-2023-05-01", "Tuesday-2023-05-02",
                  "Wednesday-2023-05-03", "Thursday-2023-05-04",
                  "Friday-2023-05-05"]
      "roleRequirements": [{
        "roleId": "Station chef",
        "targetEmployeeCount": 2,
        "priority": "PRIORITY_HIGH"
      }, {
        "roleId": "Sous chef",
        "targetEmployeeCount": 1,
        "priority": "PRIORITY_MEDIUM"
      }]
    }
  ]
}

Damit die Anforderungen an Head chef berücksichtigt werden, kann für die erforderlichen Schichten eine zusätzliche Abdeckungsanforderung festgelegt werden. Die vollständige Liste der Abdeckungsanforderungen lautet:

{
  "coverageRequirements": [{
      "shiftIds": ["Monday-2023-05-01", "Tuesday-2023-05-02",
                  "Wednesday-2023-05-03", "Thursday-2023-05-04",
                  "Friday-2023-05-05"],
      "roleRequirements": [{
        "roleId": "Station chef",
        "targetEmployeeCount": 2,
        "priority": "PRIORITY_HIGH"
      }, {
        "roleId": "Sous chef",
        "targetEmployeeCount": 1,
        "priority": "PRIORITY_MEDIUM"
      }]
    },
    {
      "shiftIds": ["Tuesday-2023-05-02", "Friday-2023-05-05"],
      "roleRequirements": [{
        "roleId": "Head chef",
        "targetEmployeeCount": 1,
        "priority": "PRIORITY_MEDIUM"
      }]
    }
  ]
}

Mitarbeiteranfragen

Mitarbeiteranfragen werden durch das Feld Schichtanfrage dargestellt. In diesem Beispiel möchte Liam in der Mittwochsschicht arbeiten, aber nicht an der Freitagsschicht. Er wird (zusammen mit seinen Rollen) so dargestellt:

{
  "employees": [{
    "id": "Liam",
    "roleIds": ["Station chef", "Head chef"],
    "shiftRequests": [
      {
        "priority": "PRIORITY_HIGH",
        "shiftIds": ["Wednesday-2023-05-03"],
        "type": "STATUS_WORK"
      },
      {
        "priority": "PRIORITY_HIGH",
        "shiftIds": ["Friday-2023-05-05"],
        "type": "STATUS_NOT_WORK"
      }
    ]
  }]
}

Beispiel mit allen fünf Mitarbeitenden


  {
    "employees": [
      {
        "id": "Liam",
        "roleIds": [
          "Station chef",
          "Head chef"
        ],
        "shiftRequests": [
          {
            "priority": "PRIORITY_HIGH",
            "shiftIds": [
              "Wednesday-2023-05-03"
            ],
            "type": "STATUS_WORK"
          },
          {
            "priority": "PRIORITY_HIGH",
            "shiftIds": [
              "Friday-2023-05-05"
            ],
            "type": "STATUS_NOT_WORK"
          }
        ]
      }
      , {
        "id": "Olivia",
        "roleIds": ["Station chef"]
      }, {
        "id": "Noah",
        "roleIds": ["Station chef"]
      }, {
        "id": "Emma",
        "roleIds": ["Head chef"]
      }, {
        "id": "Oliver",
        "roleIds": ["Station chef", "Sous chef"]
      }
    ]
  }
  

Beispiel für eine vollständige Anfrage


  {
    "employees": [
      {
        "id": "Liam",
        "roleIds": [
          "Station chef",
          "Head chef"
        ],
        "shiftRequests": [
          {
            "priority": "PRIORITY_HIGH",
            "shiftIds": [
              "Wednesday-2023-05-03"
            ],
            "type": "STATUS_WORK"
          },
          {
            "priority": "PRIORITY_HIGH",
            "shiftIds": [
              "Friday-2023-05-05"
            ],
            "type": "STATUS_NOT_WORK"
          }
        ]
      },
      {
        "id": "Olivia",
        "roleIds": [
          "Station chef"
        ]
      },
      {
        "id": "Noah",
        "roleIds": [
          "Station chef"
        ]
      },
      {
        "id": "Emma",
        "roleIds": [
          "Head chef"
        ]
      },
      {
        "id": "Oliver",
        "roleIds": [
          "Station chef",
          "Sous chef"
        ]
      }
    ],
    "shifts": [
      {
        "id": "Monday-2023-05-01",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 12
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 1,
          "hours": 23
        }
      },
      {
        "id": "Tuesday-2023-05-02",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 12
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 2,
          "hours": 23
        }
      },
      {
        "id": "Wednesday-2023-05-03",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 12
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 3,
          "hours": 23
        }
      },
      {
        "id": "Thursday-2023-05-04",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 12
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 4,
          "hours": 23
        }
      },
      {
        "id": "Friday-2023-05-05",
        "startDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 12
        },
        "endDateTime": {
          "year": 2023,
          "month": 5,
          "day": 5,
          "hours": 23
        }
      }
    ],
    "coverageRequirements": [
      {
        "shiftIds": [
          "Monday-2023-05-01",
          "Tuesday-2023-05-02",
          "Wednesday-2023-05-03",
          "Thursday-2023-05-04",
          "Friday-2023-05-05"
        ],
        "roleRequirements": [
          {
            "roleId": "Station chef",
            "targetEmployeeCount": 2,
            "priority": "PRIORITY_HIGH"
          },
          {
            "roleId": "Sous chef",
            "targetEmployeeCount": 1,
            "priority": "PRIORITY_MEDIUM"
          }
        ]
      },
      {
        "shiftIds": [
          "Tuesday-2023-05-02",
          "Friday-2023-05-05"
        ],
        "roleRequirements": [
          {
            "roleId": "Head chef",
            "targetEmployeeCount": 1,
            "priority": "PRIORITY_MEDIUM"
          }
        ]
      }
    ],
    "roleIds": [
      "Station chef",
      "Head chef",
      "Sous chef"
    ]
  }
  

Antwortbeispiel

Die Antwort des Matherechners enthält die Zuweisung von Mitarbeitern zu den Restaurantschichten und den Status des Optimierungsverfahrens. Beispielsweise werden die einem der Mitarbeiter zugewiesenen Schichten so zurückgegeben:

{
  "solutionStatus": "OPTIMAL",
  "shiftAssignments": [
    {
      "employeeId": "Liam",
      "shiftId": "Monday-2023-05-01",
      "roleId": "Station chef"
    },
    {
      "employeeId": "Liam",
      "shiftId": "Tuesday-2023-05-02",
      "roleId": "Station chef"
    },
    {
      "employeeId": "Liam",
      "shiftId": "Wednesday-2023-05-03",
      "roleId": "Station chef"
    },
    {
      "employeeId": "Liam",
      "shiftId": "Thursday-2023-05-04",
      "roleId": "Station chef"
    }, ...
  ]
}

Beispiel für eine vollständige Antwort


  {
    "solutionStatus": "OPTIMAL",
    "shiftAssignments": [
      {
        "employeeId": "Liam",
        "shiftId": "Monday-2023-05-01",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Liam",
        "shiftId": "Tuesday-2023-05-02",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Liam",
        "shiftId": "Wednesday-2023-05-03",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Liam",
        "shiftId": "Thursday-2023-05-04",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Olivia",
        "shiftId": "Friday-2023-05-05",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Noah",
        "shiftId": "Monday-2023-05-01",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Noah",
        "shiftId": "Tuesday-2023-05-02",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Noah",
        "shiftId": "Wednesday-2023-05-03",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Noah",
        "shiftId": "Thursday-2023-05-04",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Noah",
        "shiftId": "Friday-2023-05-05",
        "roleId": "Station chef"
      },
      {
        "employeeId": "Emma",
        "shiftId": "Tuesday-2023-05-02",
        "roleId": "Head chef"
      },
      {
        "employeeId": "Emma",
        "shiftId": "Friday-2023-05-05",
        "roleId": "Head chef"
      },
      {
        "employeeId": "Oliver",
        "shiftId": "Monday-2023-05-01",
        "roleId": "Sous chef"
      },
      {
        "employeeId": "Oliver",
        "shiftId": "Tuesday-2023-05-02",
        "roleId": "Sous chef"
      },
      {
        "employeeId": "Oliver",
        "shiftId": "Wednesday-2023-05-03",
        "roleId": "Sous chef"
      },
      {
        "employeeId": "Oliver",
        "shiftId": "Thursday-2023-05-04",
        "roleId": "Sous chef"
      },
      {
        "employeeId": "Oliver",
        "shiftId": "Friday-2023-05-05",
        "roleId": "Sous chef"
      }
    ]
  }