update for current rota
This commit is contained in:
@@ -30,8 +30,9 @@ solve = True
|
||||
# time_to_run = 508500
|
||||
# time_to_run = 2660000
|
||||
time_to_run = 60 * 60 * 85
|
||||
time_to_run = 5000
|
||||
# allow = 5000
|
||||
ratio = 0.001
|
||||
ratio = 0.5
|
||||
# ratio = 0.9
|
||||
|
||||
|
||||
@@ -41,7 +42,7 @@ start_date = datetime.date(2024, 3, 4)
|
||||
# start_date = datetime.date(2022, 10, 10)
|
||||
|
||||
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.constraint_options["balance_weekends"] = True
|
||||
@@ -66,14 +67,14 @@ Rota.add_shifts(
|
||||
],
|
||||
),
|
||||
SingleShift(
|
||||
sites=("truro", "truro twilights"),
|
||||
sites=("truro", "truro twilights", "truro twilights and weekends"),
|
||||
name="truro_twilight",
|
||||
length=12.5,
|
||||
days=days[:4],
|
||||
balance_offset=4,
|
||||
),
|
||||
SingleShift(
|
||||
sites=("torbay", "torbay twilights"),
|
||||
sites=("torbay", "torbay twilights", "torbay twilights and weekends"),
|
||||
name="torbay_twilight",
|
||||
length=12.5,
|
||||
days=days[:4],
|
||||
@@ -101,7 +102,7 @@ Rota.add_shifts(
|
||||
# constraint=[{"name": "pre", "options": 2}, {"name": "post", "options": 2},],
|
||||
),
|
||||
SingleShift(
|
||||
sites=("truro",),
|
||||
sites=("truro", "truro twilights and weekends"),
|
||||
name="weekend_truro",
|
||||
length=12.5,
|
||||
days=days[4:],
|
||||
@@ -112,7 +113,7 @@ Rota.add_shifts(
|
||||
# force_as_block_unless_nwd=True
|
||||
),
|
||||
SingleShift(
|
||||
sites=("torbay",),
|
||||
sites=("torbay", "torbay twilights and weekends"),
|
||||
name="weekend_torbay",
|
||||
length=12.5,
|
||||
days=days[4:],
|
||||
@@ -259,17 +260,25 @@ if load_leave:
|
||||
if oop:
|
||||
formatted_oops = []
|
||||
for dates in oop.split(","):
|
||||
print(dates)
|
||||
s, e = dates.split("-")
|
||||
formatted_oops.append(
|
||||
{
|
||||
"start_date": datetime.datetime.strptime(
|
||||
s.strip(), "%d/%m/%y"
|
||||
).date(),
|
||||
"end_date": datetime.datetime.strptime(
|
||||
e.strip(), "%d/%m/%y"
|
||||
).date(),
|
||||
}
|
||||
)
|
||||
try:
|
||||
formatted_oops.append(
|
||||
{
|
||||
"start_date": datetime.datetime.strptime(
|
||||
s.strip(), "%d/%m/%y"
|
||||
).date(),
|
||||
"end_date": datetime.datetime.strptime(
|
||||
e.strip(), "%d/%m/%y"
|
||||
).date(),
|
||||
}
|
||||
)
|
||||
except ValueError as e:
|
||||
print(e)
|
||||
print("WORKER", worker)
|
||||
print("DATES", s, e)
|
||||
raise
|
||||
|
||||
|
||||
oop = formatted_oops
|
||||
else:
|
||||
@@ -337,7 +346,8 @@ if load_leave:
|
||||
solver_options = {"ratio": ratio, "seconds": time_to_run, "threads": 10}
|
||||
|
||||
#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_individually(solver_options)
|
||||
# Rota.solve_model(options=solver_options)
|
||||
|
||||
Reference in New Issue
Block a user