From cf48c3c168ac2fcc4678a9db3d0995315a70d1b2 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 7 Jul 2025 17:49:21 +0100 Subject: [PATCH] latest rotas --- gen.py | 26 ++++++++++++++------------ gen_cons.py | 41 ++++++++++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 19 deletions(-) diff --git a/gen.py b/gen.py index b937e7f..9ca33bd 100644 --- a/gen.py +++ b/gen.py @@ -19,8 +19,6 @@ sites = ( "proc", ) -NIGHT_REGISTRAR_NUMBER = 4 - from rota.workers import ( Worker, NotAvailableToWork, @@ -35,7 +33,7 @@ from rota.workers import ( def main( suspend: bool = False, solve: bool = True, - time_to_run: int = 60 * 60, + time_to_run: int = 60 * 60 * 4, ratio: float = 0.001, start_date: datetime.datetime = "2025-09-01", weeks: int = 16, @@ -425,16 +423,20 @@ def main( shift_fte_overrides = {} - if worker_name == "Ben Kemp": + #if worker_name == "Ben Kemp": + # shift_fte_overrides = { + # "plymouth_twilight": 100, + # "weekend_plymouth1": 50, + # "weekend_plymouth2": 50, + # } + #elif worker_name == "Joel Lim": + # shift_fte_overrides = { + # "plymouth_twilight": 100, + # "weekend_exeter": 50, + # } + if worker_name == "Nang Thiriphoo": shift_fte_overrides = { - "plymouth_twilight": 100, - "weekend_plymouth1": 50, - "weekend_plymouth2": 50, - } - elif worker_name == "Joel Lim": - shift_fte_overrides = { - "plymouth_twilight": 100, - "weekend_exeter": 50, + "weekend_exeter": 40, } w = Worker( diff --git a/gen_cons.py b/gen_cons.py index e00beb1..fd5d6ed 100644 --- a/gen_cons.py +++ b/gen_cons.py @@ -29,7 +29,7 @@ def main( time_to_run: int = 60 * 60, ratio: float = 0.001, start_date: datetime.datetime = "2025-09-01", - weeks: int = 12, + weeks: int = 22, bom: int = 1, ): rota_start_date = start_date.date() @@ -53,7 +53,7 @@ def main( name="oncall", length=12.5, days=days, - balance_offset=5, + balance_offset=2, assign_as_block=False, constraint=[ #{ @@ -84,8 +84,8 @@ def main( days=days[5:], balance_offset=2, constraint=[ - {"name": "pre", "options": 2}, - {"name": "post", "options": 2}, + {"name": "pre", "options": 1}, + {"name": "post", "options": 1}, ], display_char="b", ), @@ -137,13 +137,40 @@ def main( w.add_hard_day_dependency("Fri", "Sat", "Sun") else: w.add_hard_day_dependency("Fri", "Sun") - ## #w.add_hard_day_dependency("Sat", "Sun") + #w.set_max_shifts_per_week("weekend", 1) + # #w.add_hard_day_dependency("Sat", "Sun") print(w) Rota.add_worker(w) - for w in range(12, 21): + w13 = Worker(name=f"A13", site="rota a", grade=1, start_date="2025-10-01") + #w.prefer_multi_shift_together = 10 + #w.allow_shifts_together("oncall", "twilight") + #w.allow_shifts_together("oncall", "weekend") + + #w.add_hard_day_dependency("Fri", "Sat", "Sun") + + w13.add_force_assign_with("twilight", "oncall") + w13.add_force_assign_with("weekend", "oncall") + #w.set_max_shifts_per_week("twilight", 1) + + Rota.add_worker(w13) + + w13 = Worker(name=f"A14", site="rota a", grade=1, start_date="2025-12-01") + #w.prefer_multi_shift_together = 10 + #w.allow_shifts_together("oncall", "twilight") + #w.allow_shifts_together("oncall", "weekend") + + #w.add_hard_day_dependency("Fri", "Sat", "Sun") + + w13.add_force_assign_with("twilight", "oncall") + w13.add_force_assign_with("weekend", "oncall") + #w.set_max_shifts_per_week("twilight", 1) + + Rota.add_worker(w13) + + for w in range(14, 24): w = Worker( name=f"B{w}", site="rota b", @@ -155,7 +182,7 @@ def main( ], ) #w.add_hard_day_exclusion("Sat", "Sun") - w.set_max_shifts_per_week("twilight", 1) + w.set_max_shifts_per_week("twilight", 2) w.set_max_shifts_per_week("weekend b", 1) print(w)