Add float support to balarce offset modified

This commit is contained in:
ross
2026-01-06 09:57:29 +00:00
parent d66ddf29ad
commit 82868f8c22
3 changed files with 16 additions and 13 deletions
+11 -10
View File
@@ -50,7 +50,7 @@ def main(
ratio: float = 0.001,
start_date: datetime.datetime = "2026-03-02",
weeks: int = 26,
bom: int = 2,
bom: float = 1.5,
):
rota_start_date = start_date.date()
suspend_on_finish = suspend
@@ -59,17 +59,18 @@ def main(
rota_start_date,
weeks_to_rota=weeks,
balance_offset_modifier=bom,
name="proc_rota",
name="proc_rota1",
)
# Rota = RotaBuilder(start_date, weeks_to_rota=20, balance_offset_modifier=1)
Rota.constraint_options["balance_shifts"] = False
Rota.constraint_options["balance_shifts_quadratic"] = True
Rota.constraint_options["balance_weekends"] = True
Rota.constraint_options["max_night_frequency"] = 3 # 3
Rota.constraint_options["max_night_frequency"] = 4 # 3
Rota.constraint_options["max_night_frequency_week_exclusions"] = []
Rota.constraint_options["max_weekend_frequency"] = 2
Rota.constraint_options["max_weekend_frequency"] = 3
Rota.constraint_options["hard_constrain_pair_separation"] = True
# Rota.constraint_options["avoid_st2_first_month"] = True
Rota.constraint_options["max_days_per_week_block"] = [(5, 2), (6, 3), (8,4)]
#wr = [
# WorkerRequirement(
@@ -93,7 +94,7 @@ def main(
name="exeter_twilight",
length=12.5,
days=days[:5],
balance_offset=4,
balance_offset=2,
constraints=[MaxShiftsPerWeekConstraint(max_shifts=2)],
),
SingleShift(
@@ -115,7 +116,7 @@ def main(
name="torbay_twilight",
length=12.5,
days=days[:4],
balance_offset=4,
balance_offset=2,
assign_as_block=True,
),
SingleShift(
@@ -128,7 +129,7 @@ def main(
name="plymouth_twilight",
length=12.5,
days=days[:5],
balance_offset=4,
balance_offset=2,
workers_required=1,
constraints=[MaxShiftsPerWeekConstraint(max_shifts=2)],
),
@@ -143,7 +144,7 @@ def main(
name="weekend_exeter",
length=12.5,
days=days[5:],
balance_offset=3,
balance_offset=2,
rota_on_nwds=True,
force_as_block=True,
constraints=[PostShiftConstraint(days=2), PreShiftConstraint(days=2)],
@@ -172,7 +173,7 @@ def main(
name="weekend_torbay",
length=12.5,
days=days[4:],
balance_offset=3,
balance_offset=2,
rota_on_nwds=True,
force_as_block=True,
constraints=[PreShiftConstraint(days=2), PostShiftConstraint(days=2)],