update for current rota
This commit is contained in:
@@ -30,8 +30,9 @@ solve = True
|
|||||||
# time_to_run = 508500
|
# time_to_run = 508500
|
||||||
# time_to_run = 2660000
|
# time_to_run = 2660000
|
||||||
time_to_run = 60 * 60 * 85
|
time_to_run = 60 * 60 * 85
|
||||||
|
time_to_run = 5000
|
||||||
# allow = 5000
|
# allow = 5000
|
||||||
ratio = 0.001
|
ratio = 0.5
|
||||||
# ratio = 0.9
|
# ratio = 0.9
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ start_date = datetime.date(2024, 3, 4)
|
|||||||
# start_date = datetime.date(2022, 10, 10)
|
# start_date = datetime.date(2022, 10, 10)
|
||||||
|
|
||||||
Rota = RotaBuilder(
|
Rota = RotaBuilder(
|
||||||
start_date, weeks_to_rota=26, balance_offset_modifier=1, name="proc rota"
|
start_date, weeks_to_rota=13, balance_offset_modifier=1, name="proc rota"
|
||||||
)
|
)
|
||||||
# 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_weekends"] = True
|
Rota.constraint_options["balance_weekends"] = True
|
||||||
@@ -66,14 +67,14 @@ Rota.add_shifts(
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
SingleShift(
|
SingleShift(
|
||||||
sites=("truro", "truro twilights"),
|
sites=("truro", "truro twilights", "truro twilights and weekends"),
|
||||||
name="truro_twilight",
|
name="truro_twilight",
|
||||||
length=12.5,
|
length=12.5,
|
||||||
days=days[:4],
|
days=days[:4],
|
||||||
balance_offset=4,
|
balance_offset=4,
|
||||||
),
|
),
|
||||||
SingleShift(
|
SingleShift(
|
||||||
sites=("torbay", "torbay twilights"),
|
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],
|
||||||
@@ -101,7 +102,7 @@ Rota.add_shifts(
|
|||||||
# constraint=[{"name": "pre", "options": 2}, {"name": "post", "options": 2},],
|
# constraint=[{"name": "pre", "options": 2}, {"name": "post", "options": 2},],
|
||||||
),
|
),
|
||||||
SingleShift(
|
SingleShift(
|
||||||
sites=("truro",),
|
sites=("truro", "truro twilights and weekends"),
|
||||||
name="weekend_truro",
|
name="weekend_truro",
|
||||||
length=12.5,
|
length=12.5,
|
||||||
days=days[4:],
|
days=days[4:],
|
||||||
@@ -112,7 +113,7 @@ Rota.add_shifts(
|
|||||||
# force_as_block_unless_nwd=True
|
# force_as_block_unless_nwd=True
|
||||||
),
|
),
|
||||||
SingleShift(
|
SingleShift(
|
||||||
sites=("torbay",),
|
sites=("torbay", "torbay twilights and weekends"),
|
||||||
name="weekend_torbay",
|
name="weekend_torbay",
|
||||||
length=12.5,
|
length=12.5,
|
||||||
days=days[4:],
|
days=days[4:],
|
||||||
@@ -259,7 +260,9 @@ if load_leave:
|
|||||||
if oop:
|
if oop:
|
||||||
formatted_oops = []
|
formatted_oops = []
|
||||||
for dates in oop.split(","):
|
for dates in oop.split(","):
|
||||||
|
print(dates)
|
||||||
s, e = dates.split("-")
|
s, e = dates.split("-")
|
||||||
|
try:
|
||||||
formatted_oops.append(
|
formatted_oops.append(
|
||||||
{
|
{
|
||||||
"start_date": datetime.datetime.strptime(
|
"start_date": datetime.datetime.strptime(
|
||||||
@@ -270,6 +273,12 @@ if load_leave:
|
|||||||
).date(),
|
).date(),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
except ValueError as e:
|
||||||
|
print(e)
|
||||||
|
print("WORKER", worker)
|
||||||
|
print("DATES", s, e)
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
oop = formatted_oops
|
oop = formatted_oops
|
||||||
else:
|
else:
|
||||||
@@ -337,7 +346,8 @@ if load_leave:
|
|||||||
solver_options = {"ratio": ratio, "seconds": time_to_run, "threads": 10}
|
solver_options = {"ratio": ratio, "seconds": time_to_run, "threads": 10}
|
||||||
|
|
||||||
#start_time = time.time()
|
#start_time = time.time()
|
||||||
Rota.build_and_solve(solver_options, export=True)
|
Rota.build_and_solve(solver_options, export=True, solve=True)
|
||||||
|
|
||||||
# Rota.solve_shifts_by_block(solver_options, block_length=13)
|
# Rota.solve_shifts_by_block(solver_options, block_length=13)
|
||||||
# Rota.solve_shifts_individually(solver_options)
|
# Rota.solve_shifts_individually(solver_options)
|
||||||
# Rota.solve_model(options=solver_options)
|
# Rota.solve_model(options=solver_options)
|
||||||
|
|||||||
@@ -21,11 +21,14 @@ def load_leave(Rota):
|
|||||||
"Pragma": "no-cache"
|
"Pragma": "no-cache"
|
||||||
}
|
}
|
||||||
|
|
||||||
download = s.get("https://docs.google.com/spreadsheets/d/e/2PACX-1vTQBxt0mHoVS1D5EkQcrekqGveWyTG2MCMyV1NnrSWkptqWbdI6_myaeLT1vpbkbujXJqU6Z5nrzTh9/pub?gid=0&single=true&output=csv", headers=headers)
|
download = s.get("https://docs.google.com/spreadsheets/d/e/2PACX-1vRYqSKq-OYW1tNnGJtx9LIMo_FXVfcHBRPF4HEMcBxWPfmXimWtr5oEDR_rIUSXrOndb9YjP3iC_4bS/pub?gid=0&single=true&output=csv", headers=headers)
|
||||||
decoded_content = download.content.decode('utf-8')
|
decoded_content = download.content.decode('utf-8')
|
||||||
|
|
||||||
reader = csv.reader(decoded_content.splitlines(), delimiter=',')
|
reader = csv.reader(decoded_content.splitlines(), delimiter=',')
|
||||||
|
|
||||||
|
#with open("/home/ross/Downloads/Draft PROC Rota March 24 - Sept 24 - Sheet1.csv") as f:
|
||||||
|
# reader = csv.reader(f.read().splitlines(), delimiter=',')
|
||||||
|
|
||||||
leave = {}
|
leave = {}
|
||||||
requests = {}
|
requests = {}
|
||||||
site_prefs = {}
|
site_prefs = {}
|
||||||
@@ -48,6 +51,9 @@ def load_leave(Rota):
|
|||||||
workers[name]["site_pref"] = []
|
workers[name]["site_pref"] = []
|
||||||
workers[name]["shift_balance_extra"] = {}
|
workers[name]["shift_balance_extra"] = {}
|
||||||
workers[name]["bank_holiday_extra"] = 0
|
workers[name]["bank_holiday_extra"] = 0
|
||||||
|
workers[name]["end_date"] = None
|
||||||
|
workers[name]["start_date"] = None
|
||||||
|
workers[name]["pair"] = None
|
||||||
|
|
||||||
for i in range(len(r)):
|
for i in range(len(r)):
|
||||||
try:
|
try:
|
||||||
@@ -64,10 +70,10 @@ def load_leave(Rota):
|
|||||||
if lower_item == "derriford twilights":
|
if lower_item == "derriford twilights":
|
||||||
lower_item = "plymouth_twilights"
|
lower_item = "plymouth_twilights"
|
||||||
|
|
||||||
if row_title == "PROC site":
|
if "PROC site" in row_title:
|
||||||
worker["site_pref"] = lower_item
|
worker["site_pref"] = lower_item
|
||||||
|
|
||||||
if row_title == "Rotation":
|
if row_title in ("Rotation", "Site"):
|
||||||
worker["site"] = lower_item
|
worker["site"] = lower_item
|
||||||
|
|
||||||
elif row_title == "Grade":
|
elif row_title == "Grade":
|
||||||
@@ -76,7 +82,7 @@ def load_leave(Rota):
|
|||||||
elif row_title == "%FTE":
|
elif row_title == "%FTE":
|
||||||
worker["fte"] = lower_item
|
worker["fte"] = lower_item
|
||||||
|
|
||||||
elif row_title == "NWD":
|
elif "NWD" in row_title:
|
||||||
worker["nwd"] = lower_item
|
worker["nwd"] = lower_item
|
||||||
|
|
||||||
elif row_title == "Flexible NWD":
|
elif row_title == "Flexible NWD":
|
||||||
@@ -97,7 +103,7 @@ def load_leave(Rota):
|
|||||||
else:
|
else:
|
||||||
worker["start_date"] = None
|
worker["start_date"] = None
|
||||||
|
|
||||||
elif row_title == "OOP":
|
elif "OOP" in row_title:
|
||||||
worker["oop"] = lower_item
|
worker["oop"] = lower_item
|
||||||
|
|
||||||
elif row_title == "Group":
|
elif row_title == "Group":
|
||||||
|
|||||||
Reference in New Issue
Block a user