ลองพิจารณาศูนย์ติดต่อที่คุณต้องการสร้างการเปลี่ยนแปลงที่ครอบคลุมความต้องการพนักงาน ศูนย์ติดต่อให้บริการทุกวันตลอด 24 ชั่วโมง และจำนวนพนักงานที่ต้องใช้จะแตกต่างกันไปในแต่ละช่วงเวลา ศูนย์ติดต่อจ้างทั้งพนักงาน เต็มเวลาและพาร์ทไทม์
พนักงานเต็มเวลาลดกะ 9 ชั่วโมง, หยุดพัก 1 ชั่วโมง 4 หรือ 5 ชั่วโมงหลังจากที่เริ่มกะการทำงาน และสามารถเริ่มกะได้ทุกเมื่อระหว่างเวลา 05:00 น. ถึง 12:00 น. พนักงานพาร์ทไทม์ทำงานกะ 4 ชั่วโมง โดยมีช่วงพัก 15 นาทีเมื่อสิ้นสุดเวลาทำงานที่ 2 และสามารถเริ่มกะได้ทุกเมื่อ ในทั้ง 2 กรณี ระบบจะพิจารณาเวลาเริ่มต้นการเปลี่ยนแปลงที่เป็นไปได้ทีละ 15 นาที
ศูนย์ติดต่อสนใจวางแผนเกี่ยวกับข้อกำหนดด้านแรงงานสำหรับการปฏิบัติงานใน 2 วันถัดไป เนื่องจากอาจมีพนักงานเต็มเวลาไม่เกิน 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 คนในช่วงเวลา 2 วัน และแสดงเป็น
{
...
"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
},
...
]
...
}