Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .nextmv/golden/shift-assignment-ortools/inputs/input.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,37 @@
{
"assigned_shifts": [
{
"end_time": "2023-11-20T22:00:00+02:00",
"end": "2023-11-20T22:00:00+02:00",
"shift_id": "welder_monday-late",
"start_time": "2023-11-20T14:00:00+02:00",
"start": "2023-11-20T14:00:00+02:00",
"worker_id": "Louis Hardy"
},
{
"end_time": "2023-11-20T14:00:00+02:00",
"end": "2023-11-20T14:00:00+02:00",
"shift_id": "welder_monday-early",
"start_time": "2023-11-20T06:00:00+02:00",
"start": "2023-11-20T06:00:00+02:00",
"worker_id": "Jacob Cunningham"
},
{
"end_time": "2023-11-20T14:00:00+02:00",
"end": "2023-11-20T14:00:00+02:00",
"shift_id": "normal_monday-early",
"start_time": "2023-11-20T06:00:00+02:00",
"start": "2023-11-20T06:00:00+02:00",
"worker_id": "Ray Heard"
},
{
"end_time": "2023-11-20T22:00:00+02:00",
"end": "2023-11-20T22:00:00+02:00",
"shift_id": "normal_monday-late",
"start_time": "2023-11-20T14:00:00+02:00",
"start": "2023-11-20T14:00:00+02:00",
"worker_id": "Mark Leath"
},
{
"end_time": "2023-11-20T14:00:00+02:00",
"end": "2023-11-20T14:00:00+02:00",
"shift_id": "normal_monday-early",
"start_time": "2023-11-20T06:00:00+02:00",
"start": "2023-11-20T06:00:00+02:00",
"worker_id": "Dylan Mccormack"
}
]
],
"number_assigned_workers": 5
}
],
"statistics": {
Expand Down
23 changes: 12 additions & 11 deletions .nextmv/golden/shift-assignment-pyomo/inputs/input.json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,37 @@
{
"assigned_shifts": [
{
"end_time": "2023-11-20T22:00:00+02:00",
"end": "2023-11-20T22:00:00+02:00",
"shift_id": "welder_monday-late",
"start_time": "2023-11-20T14:00:00+02:00",
"start": "2023-11-20T14:00:00+02:00",
"worker_id": "Louis Hardy"
},
{
"end_time": "2023-11-20T14:00:00+02:00",
"end": "2023-11-20T14:00:00+02:00",
"shift_id": "normal_monday-early",
"start_time": "2023-11-20T06:00:00+02:00",
"start": "2023-11-20T06:00:00+02:00",
"worker_id": "Jacob Cunningham"
},
{
"end_time": "2023-11-20T14:00:00+02:00",
"end": "2023-11-20T14:00:00+02:00",
"shift_id": "welder_monday-early",
"start_time": "2023-11-20T06:00:00+02:00",
"start": "2023-11-20T06:00:00+02:00",
"worker_id": "Ray Heard"
},
{
"end_time": "2023-11-20T22:00:00+02:00",
"end": "2023-11-20T22:00:00+02:00",
"shift_id": "normal_monday-late",
"start_time": "2023-11-20T14:00:00+02:00",
"start": "2023-11-20T14:00:00+02:00",
"worker_id": "Mark Leath"
},
{
"end_time": "2023-11-20T14:00:00+02:00",
"end": "2023-11-20T14:00:00+02:00",
"shift_id": "normal_monday-early",
"start_time": "2023-11-20T06:00:00+02:00",
"start": "2023-11-20T06:00:00+02:00",
"worker_id": "Dylan Mccormack"
}
]
],
"number_assigned_workers": 5
}
],
"statistics": {
Expand Down
7 changes: 4 additions & 3 deletions shift-assignment-ortools/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ def solve(input_data: dict[str, Any], duration: int, provider: str) -> dict[str,
schedule = {
"assigned_shifts": [
{
"start_time": s["start_time"],
"end_time": s["end_time"],
"start": s["start_time"],
"end": s["end_time"],
"worker_id": e["id"],
"shift_id": s["id"],
}
Expand All @@ -170,7 +170,8 @@ def solve(input_data: dict[str, Any], duration: int, provider: str) -> dict[str,
if x_assign[(e["id"], s["id"])].solution_value() > 0.5
],
}
active_workers = len({s["worker_id"] for s in schedule["assigned_shifts"]})
schedule["number_assigned_workers"] = len(schedule["assigned_shifts"])
active_workers = schedule["number_assigned_workers"]
total_workers = len(workers)

# Creates the statistics.
Expand Down
7 changes: 4 additions & 3 deletions shift-assignment-pyomo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ def solve(input_data: dict[str, Any], duration: int, provider: str) -> dict[str,
schedule = {
"assigned_shifts": [
{
"start_time": s["start_time"],
"end_time": s["end_time"],
"start": s["start_time"],
"end": s["end_time"],
"worker_id": e["id"],
"shift_id": s["id"],
}
Expand All @@ -186,7 +186,8 @@ def solve(input_data: dict[str, Any], duration: int, provider: str) -> dict[str,
if model.x_assign[(e["id"], s["id"])].value > 0.5
],
}
active_workers = len({s["worker_id"] for s in schedule["assigned_shifts"]})
schedule["number_assigned_workers"] = len(schedule["assigned_shifts"])
active_workers = schedule["number_assigned_workers"]
total_workers = len(workers)

# Creates the statistics.
Expand Down