From d8cbfe2176718c9d385ae93d51bb2c8097142c94 Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 19 Jun 2023 17:24:16 +0100 Subject: [PATCH] . --- gen.py | 6 +++--- requirements.txt | 3 ++- rota/shifts.py | 8 +++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/gen.py b/gen.py index 5991908..9aadb49 100644 --- a/gen.py +++ b/gen.py @@ -29,9 +29,9 @@ suspend_on_finish = True solve = True #time_to_run = 508500 #time_to_run = 2660000 -time_to_run = 5000 +time_to_run = 100 #allow = 5000 -ratio = 0.01 +ratio = 0.41 #ratio = 0.9 @@ -40,7 +40,7 @@ start_date = datetime.date(2023, 9, 4) #start_date = start_date + datetime.timedelta(weeks=13) # start_date = datetime.date(2022, 10, 10) -Rota = RotaBuilder(start_date, weeks_to_rota=14, balance_offset_modifier=1) +Rota = RotaBuilder(start_date, weeks_to_rota=10, balance_offset_modifier=1) #Rota = RotaBuilder(start_date, weeks_to_rota=20, balance_offset_modifier=1) Rota.constraint_options["balance_weekends"] = True Rota.constraint_options["max_night_frequency"] = 3 # 3 diff --git a/requirements.txt b/requirements.txt index 20584be..70a39aa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,4 +9,5 @@ uvicorn fastapi-sqlalchemy alembic psycopg2 -python-dotenv \ No newline at end of file +python-dotenv +requests \ No newline at end of file diff --git a/rota/shifts.py b/rota/shifts.py index 895c2cc..9087b02 100644 --- a/rota/shifts.py +++ b/rota/shifts.py @@ -307,9 +307,15 @@ class RotaBuilder(object): ): console.print("Setting up solver") - #solver = "scip" + solver = "scip" if solver == "scip": + if "seconds" in options: + options["limit/time"] = options.pop("seconds") + if "ratio" in options: + options["limit/gap"] = options.pop("ratio") + if "threads" in options: + options.pop("threads") self.opt = SolverFactory(solver, executable="scip") else: self.opt = SolverFactory(solver)