レストランのスケジュール

たとえば、週 1 回のスケジュールで厨房をスケジュールしているレストランを考えてみましょう。「 レストランのシフトは月曜日から金曜日の 12 時間から 23 時間までです。5 つの Station chefHead chefSous chef の 3 つのロールを実行できる従業員です。シフトごとに、優先度が高い Station chef として働く従業員が 2 人、中程度の Sous chef として働く従業員が 1 人必要です。 あります。また、火曜日と金曜日は Head chef が必須です。 優先度は中程度ですその他のスケジュール設定の制約は、 従業員 Liam は、「Thursday-2023-05-03」の作業をリクエストしましたが、 Friday-2023-05-05 のシフト勤務です。

あらゆるシフトに対応する職種

特定のロールのカバレッジは、特定のシフトのセットに対して カバレッジ要件。たとえば、最初のシフトが この問題は次のように表せます。

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

5 つのシフトがすべて Monday-2023-05-01Tuesday-2023-05-02Wednesday-2023-05-03Thursday-2023-05-04Friday-2023-05-05 などの Station chef ロールと Sous chef ロールのカバレッジ要件が示されている 例:

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

Head chef の要件を検討するには、次の条件を満たす必要があります。 必要なシフトについて要件を指定できます。Google Cloud Armor の 適用範囲の要件は次のとおりです。

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

従業員のリクエスト

従業員のリクエストはシフト リクエストで表されます。 表示されます。この例では、Liam は水曜日のシフト勤務をリクエストしましたが、 金曜日の勤務はしないでください。(同氏の役割とともに) 例:

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

5 人の従業員全員の場合の例


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

完全なリクエストの例


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

レスポンスの例

解法のレスポンスには、タスクに対する従業員の割り当てが 最適化手順のステータスを確認できます。たとえば、 従業員の 1 人に割り当てられたシフトは次のように返されます。

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

完全なレスポンスの例


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