Update shift configurations and parameters in RotaBuilder for enhanced scheduling
This commit is contained in:
+148
-148
@@ -46,8 +46,8 @@ from rota_generator.workers import (
|
|||||||
def main(
|
def main(
|
||||||
suspend: bool = False,
|
suspend: bool = False,
|
||||||
solve: bool = True,
|
solve: bool = True,
|
||||||
time_to_run: int = 60 * 60 * 8,
|
time_to_run: int = 60 * 60 * 10,
|
||||||
ratio: float = 0.001,
|
ratio: float = 0.0001,
|
||||||
start_date: datetime.datetime = "2026-03-02",
|
start_date: datetime.datetime = "2026-03-02",
|
||||||
weeks: int = 27,
|
weeks: int = 27,
|
||||||
bom: float = 1,
|
bom: float = 1,
|
||||||
@@ -59,7 +59,7 @@ def main(
|
|||||||
rota_start_date,
|
rota_start_date,
|
||||||
weeks_to_rota=weeks,
|
weeks_to_rota=weeks,
|
||||||
balance_offset_modifier=bom,
|
balance_offset_modifier=bom,
|
||||||
name="proc_rota2",
|
name="proc_rota3",
|
||||||
)
|
)
|
||||||
# Rota = RotaBuilder(start_date, weeks_to_rota=20, balance_offset_modifier=1)
|
# Rota = RotaBuilder(start_date, weeks_to_rota=20, balance_offset_modifier=1)
|
||||||
Rota.constraint_options["balance_shifts"] = False
|
Rota.constraint_options["balance_shifts"] = False
|
||||||
@@ -84,149 +84,149 @@ def main(
|
|||||||
#]
|
#]
|
||||||
|
|
||||||
Rota.add_shifts(
|
Rota.add_shifts(
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=(
|
sites=(
|
||||||
# "exeter",
|
"exeter",
|
||||||
# "exeter twilights and weekends",
|
"exeter twilights and weekends",
|
||||||
# "exeter no nights",
|
"exeter no nights",
|
||||||
# "exeter twilights",
|
"exeter twilights",
|
||||||
# ),
|
),
|
||||||
# name="exeter_twilight",
|
name="exeter_twilight",
|
||||||
# length=12.5,
|
length=12.5,
|
||||||
# days=days[:5],
|
days=days[:5],
|
||||||
# balance_offset=2,
|
balance_offset=2,
|
||||||
# constraints=[MaxShiftsPerWeekConstraint(max_shifts=1)],
|
constraints=[MaxShiftsPerWeekConstraint(max_shifts=1)],
|
||||||
#),
|
),
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=(
|
sites=(
|
||||||
# "truro",
|
"truro",
|
||||||
# "truro no nights",
|
"truro no nights",
|
||||||
# "truro twilights",
|
"truro twilights",
|
||||||
# "truro twilights and weekends",
|
"truro twilights and weekends",
|
||||||
# "truro twilights and weekend nights",
|
"truro twilights and weekend nights",
|
||||||
# "truro twilights, weekends and weekend nights",
|
"truro twilights, weekends and weekend nights",
|
||||||
# ),
|
),
|
||||||
# name="truro_twilight",
|
name="truro_twilight",
|
||||||
# length=12.5,
|
length=12.5,
|
||||||
# days=days[:4],
|
days=days[:4],
|
||||||
# balance_offset=4,
|
balance_offset=4,
|
||||||
# constraints=[MaxShiftsPerWeekConstraint(max_shifts=1)],
|
constraints=[MaxShiftsPerWeekConstraint(max_shifts=1)],
|
||||||
#),
|
),
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=("torbay", "torbay twilights", "torbay twilights and weekends"),
|
sites=("torbay", "torbay twilights", "torbay twilights and weekends"),
|
||||||
# name="torbay_twilight",
|
name="torbay_twilight",
|
||||||
# length=12.5,
|
length=12.5,
|
||||||
# days=days[:4],
|
days=days[:4],
|
||||||
# balance_offset=2,
|
balance_offset=2,
|
||||||
# assign_as_block=True,
|
assign_as_block=True,
|
||||||
#),
|
),
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=(
|
sites=(
|
||||||
# "plymouth",
|
"plymouth",
|
||||||
# "plymouth twilights",
|
"plymouth twilights",
|
||||||
# "plymouth twilights and weekends",
|
"plymouth twilights and weekends",
|
||||||
# "plymouth twilights, weekends and weekend nights",
|
"plymouth twilights, weekends and weekend nights",
|
||||||
# ),
|
),
|
||||||
# name="plymouth_twilight",
|
name="plymouth_twilight",
|
||||||
# length=12.5,
|
length=12.5,
|
||||||
# days=days[:5],
|
days=days[:5],
|
||||||
# balance_offset=2,
|
balance_offset=2,
|
||||||
# workers_required=1,
|
workers_required=1,
|
||||||
# constraints=[MaxShiftsPerWeekConstraint(max_shifts=2)],
|
constraints=[MaxShiftsPerWeekConstraint(max_shifts=2)],
|
||||||
#),
|
),
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=(
|
sites=(
|
||||||
# "exeter",
|
"exeter",
|
||||||
# "exeter twilights and weekends",
|
"exeter twilights and weekends",
|
||||||
# "exeter no nights",
|
"exeter no nights",
|
||||||
# "exeter weekends",
|
"exeter weekends",
|
||||||
# #"exeter twilights",
|
#"exeter twilights",
|
||||||
# ),
|
),
|
||||||
# name="weekend_exeter",
|
name="weekend_exeter",
|
||||||
# length=12.5,
|
length=12.5,
|
||||||
# days=days[5:],
|
days=days[5:],
|
||||||
# #balance_offset=2,
|
#balance_offset=2,
|
||||||
# rota_on_nwds=True,
|
rota_on_nwds=True,
|
||||||
# force_as_block=True,
|
force_as_block=True,
|
||||||
# constraints=[PostShiftConstraint(days=2), PreShiftConstraint(days=2)],
|
constraints=[PostShiftConstraint(days=2), PreShiftConstraint(days=2)],
|
||||||
# # constraint=[{"name": "pre", "options": 2}, {"name": "post", "options": 2},],
|
# constraint=[{"name": "pre", "options": 2}, {"name": "post", "options": 2},],
|
||||||
#),
|
),
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=(
|
sites=(
|
||||||
# "truro",
|
"truro",
|
||||||
# "truro no nights",
|
"truro no nights",
|
||||||
# "truro twilights and weekends",
|
"truro twilights and weekends",
|
||||||
# "truro weekends",
|
"truro weekends",
|
||||||
# "truro twilights, weekends and weekend nights",
|
"truro twilights, weekends and weekend nights",
|
||||||
# ),
|
),
|
||||||
# name="weekend_truro",
|
name="weekend_truro",
|
||||||
# length=12.5,
|
length=12.5,
|
||||||
# days=days[4:],
|
days=days[4:],
|
||||||
# #balance_offset=3,
|
#balance_offset=3,
|
||||||
# rota_on_nwds=True,
|
rota_on_nwds=True,
|
||||||
# force_as_block=True,
|
force_as_block=True,
|
||||||
# #assign_as_block=True,
|
#assign_as_block=True,
|
||||||
# constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
||||||
# # force_as_block_unless_nwd=True
|
# force_as_block_unless_nwd=True
|
||||||
#),
|
),
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=("torbay", "torbay twilights and weekends"),
|
sites=("torbay", "torbay twilights and weekends"),
|
||||||
# name="weekend_torbay",
|
name="weekend_torbay",
|
||||||
# length=12.5,
|
length=12.5,
|
||||||
# days=days[4:],
|
days=days[4:],
|
||||||
# #balance_offset=2,
|
#balance_offset=2,
|
||||||
# rota_on_nwds=True,
|
rota_on_nwds=True,
|
||||||
# force_as_block=True,
|
force_as_block=True,
|
||||||
# constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
||||||
# # force_as_block_unless_nwd=True
|
# force_as_block_unless_nwd=True
|
||||||
#),
|
),
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=(
|
sites=(
|
||||||
# "plymouth",
|
"plymouth",
|
||||||
# "plymouth twilights and weekends",
|
"plymouth twilights and weekends",
|
||||||
# "plymouth first on weekends only",
|
"plymouth first on weekends only",
|
||||||
# "plymouth twilights, weekends and weekend nights",
|
"plymouth twilights, weekends and weekend nights",
|
||||||
# ),
|
),
|
||||||
# name="weekend_plymouth1",
|
name="weekend_plymouth1",
|
||||||
# length=8,
|
length=8,
|
||||||
# days=days[5:],
|
days=days[5:],
|
||||||
# #balance_offset=2.9,
|
#balance_offset=2.9,
|
||||||
# workers_required=1,
|
workers_required=1,
|
||||||
# rota_on_nwds=True,
|
rota_on_nwds=True,
|
||||||
# force_as_block=True,
|
force_as_block=True,
|
||||||
# constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
||||||
#),
|
),
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=(
|
sites=(
|
||||||
# "plymouth",
|
"plymouth",
|
||||||
# "plymouth twilights and weekends",
|
"plymouth twilights and weekends",
|
||||||
# "plymouth twilights, weekends and weekend nights",
|
"plymouth twilights, weekends and weekend nights",
|
||||||
# ),
|
),
|
||||||
# name="weekend_plymouth2",
|
name="weekend_plymouth2",
|
||||||
# length=8,
|
length=8,
|
||||||
# days=days[5:],
|
days=days[5:],
|
||||||
# #balance_offset=2.9,
|
#balance_offset=2.9,
|
||||||
# workers_required=1,
|
workers_required=1,
|
||||||
# rota_on_nwds=True,
|
rota_on_nwds=True,
|
||||||
# force_as_block=True,
|
force_as_block=True,
|
||||||
# constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],
|
||||||
#),
|
),
|
||||||
#SingleShift(
|
SingleShift(
|
||||||
# sites=(
|
sites=(
|
||||||
# "plymouth",
|
"plymouth",
|
||||||
# "plymouth twilights",
|
"plymouth twilights",
|
||||||
# "plymouth twilights and weekends",
|
"plymouth twilights and weekends",
|
||||||
# "plymouth twilights, weekends and weekend nights",
|
"plymouth twilights, weekends and weekend nights",
|
||||||
# ),
|
),
|
||||||
# name="plymouth_bank_holidays",
|
name="plymouth_bank_holidays",
|
||||||
# length=8,
|
length=8,
|
||||||
# days=days[5:],
|
days=days[5:],
|
||||||
# balance_offset=1,
|
balance_offset=1,
|
||||||
# workers_required=1,
|
workers_required=1,
|
||||||
# rota_on_nwds=True,
|
rota_on_nwds=True,
|
||||||
# force_as_block=False,
|
force_as_block=False,
|
||||||
# bank_holidays_only=True,
|
bank_holidays_only=True,
|
||||||
#),
|
),
|
||||||
SingleShift(
|
SingleShift(
|
||||||
sites=sites,
|
sites=sites,
|
||||||
name="night_weekday",
|
name="night_weekday",
|
||||||
@@ -280,8 +280,8 @@ def main(
|
|||||||
# Prevent shifts for ST2s for 2 weeks
|
# Prevent shifts for ST2s for 2 weeks
|
||||||
#Rota.add_grade_constraint_by_week([2], [1, 2], [shift.name for shift in Rota.shifts])
|
#Rota.add_grade_constraint_by_week([2], [1, 2], [shift.name for shift in Rota.shifts])
|
||||||
|
|
||||||
#Rota.add_min_summed_grade_by_shifts_per_day_constraint(["weekend_plymouth1", "weekend_plymouth2"], 6)
|
Rota.add_min_summed_grade_by_shifts_per_day_constraint(["weekend_plymouth1", "weekend_plymouth2"], 6)
|
||||||
#Rota.add_min_summed_grade_by_shifts_per_day_constraint(["plymouth_twilight", "plymouth_bank_holidays"], 6)
|
Rota.add_min_summed_grade_by_shifts_per_day_constraint(["plymouth_twilight", "plymouth_bank_holidays"], 6)
|
||||||
|
|
||||||
Rota.add_min_summed_grade_by_shifts_per_day_constraint(["night_weekday"], 12)
|
Rota.add_min_summed_grade_by_shifts_per_day_constraint(["night_weekday"], 12)
|
||||||
Rota.add_min_summed_grade_by_shifts_per_day_constraint(["night_weekend"], 12)
|
Rota.add_min_summed_grade_by_shifts_per_day_constraint(["night_weekend"], 12)
|
||||||
|
|||||||
Reference in New Issue
Block a user