.
This commit is contained in:
@@ -11,7 +11,7 @@ sites = (
|
||||
"torbay",
|
||||
"barnstaple",
|
||||
"plymouth",
|
||||
"taunton",
|
||||
#"taunton",
|
||||
"proc",
|
||||
)
|
||||
|
||||
@@ -25,26 +25,28 @@ from rota.workers import (
|
||||
)
|
||||
|
||||
|
||||
suspend_on_finish = True
|
||||
suspend_on_finish = False
|
||||
solve = True
|
||||
time_to_run = 458500
|
||||
time_to_run = 508500
|
||||
#time_to_run = 2660000
|
||||
#time_to_run = 458500
|
||||
time_to_run = 400
|
||||
# allow = 5000
|
||||
ratio = 0.05
|
||||
ratio = 0.01
|
||||
#ratio = 0.9
|
||||
|
||||
|
||||
start_date = datetime.date(2023, 3, 6)
|
||||
#start_date = datetime.date(2023, 5, 1)
|
||||
#start_date = start_date + datetime.timedelta(weeks=13)
|
||||
# start_date = datetime.date(2022, 10, 10)
|
||||
|
||||
Rota = RotaBuilder(start_date, weeks_to_rota=26, balance_offset_modifier=1)
|
||||
Rota = RotaBuilder(start_date, weeks_to_rota=6, 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
|
||||
Rota.constraint_options["max_night_frequency_week_exclusions"] = []
|
||||
Rota.constraint_options["max_weekend_frequency"] = 2
|
||||
Rota.constraint_options["hard_constrain_pair_separation"] = False
|
||||
Rota.constraint_options["hard_constrain_pair_separation"] = True
|
||||
# Rota.constraint_options["avoid_st2_first_month"] = True
|
||||
|
||||
Rota.add_shifts(
|
||||
@@ -57,7 +59,7 @@ Rota.add_shifts(
|
||||
constraint=[
|
||||
{
|
||||
"name": "max_shifts_per_week",
|
||||
"options": 1,
|
||||
"options": 2,
|
||||
}
|
||||
],
|
||||
),
|
||||
@@ -77,7 +79,7 @@ Rota.add_shifts(
|
||||
assign_as_block=True,
|
||||
),
|
||||
SingleShift(
|
||||
sites=("plymouth", "plymouth twilights"),
|
||||
sites=("plymouth", "plymouth twilights", "plymouth twilights and weekends"),
|
||||
name="plymouth_twilight",
|
||||
length=12.5,
|
||||
days=days[:5],
|
||||
@@ -93,7 +95,7 @@ Rota.add_shifts(
|
||||
balance_offset=3,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
constraint=[{"name": "post", "options": 2}, {"name": "pre", "options": 5}],
|
||||
constraint=[{"name": "post", "options": 2}, {"name": "pre", "options": 2}],
|
||||
# constraint=[{"name": "pre", "options": 2}, {"name": "post", "options": 2},],
|
||||
),
|
||||
SingleShift(
|
||||
@@ -119,33 +121,33 @@ Rota.add_shifts(
|
||||
# force_as_block_unless_nwd=True
|
||||
),
|
||||
SingleShift(
|
||||
sites=("plymouth",),
|
||||
sites=("plymouth", "plymouth twilights and weekends"),
|
||||
name="weekend_plymouth1",
|
||||
length=8,
|
||||
days=days[5:],
|
||||
balance_offset=3,
|
||||
balance_offset=2.9,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
constraint=[{"name": "pre", "options": 2}, {"name": "post", "options": 2}],
|
||||
),
|
||||
SingleShift(
|
||||
sites=("plymouth",),
|
||||
sites=("plymouth","plymouth twilights and weekends"),
|
||||
name="weekend_plymouth2",
|
||||
length=8,
|
||||
days=days[5:],
|
||||
balance_offset=3,
|
||||
balance_offset=2.9,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
constraint=[{"name": "pre", "options": 2}, {"name": "post", "options": 2}],
|
||||
),
|
||||
SingleShift(
|
||||
sites=("plymouth", "plymouth twilights"),
|
||||
sites=("plymouth", "plymouth twilights","plymouth twilights and weekends"),
|
||||
name="plymouth_bank_holidays",
|
||||
length=8,
|
||||
days=days[5:],
|
||||
balance_offset=3,
|
||||
balance_offset=1,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=False,
|
||||
@@ -156,7 +158,7 @@ Rota.add_shifts(
|
||||
name="night_weekday",
|
||||
length=12.25,
|
||||
days=days[:4],
|
||||
balance_offset=4.9,
|
||||
balance_offset=3.9,
|
||||
balance_weighting=1,
|
||||
# hard_constrain_shift=False,
|
||||
workers_required=3,
|
||||
@@ -176,7 +178,7 @@ Rota.add_shifts(
|
||||
name="night_weekend",
|
||||
length=12.25,
|
||||
days=days[4:],
|
||||
balance_offset=3.9,
|
||||
balance_offset=2.9,
|
||||
balance_weighting=1,
|
||||
# hard_constrain_shift=False,
|
||||
workers_required=3,
|
||||
@@ -236,7 +238,9 @@ if load_leave:
|
||||
nwd_end_date = Rota.rota_end_date
|
||||
|
||||
if "[" in i:
|
||||
print("Split nwd", worker_name, i)
|
||||
a, b = i.split("[")[1][:-1].split("-")
|
||||
print(f"{a=} {b=}")
|
||||
nwd_start_date = datetime.datetime.strptime(a, "%d/%m/%y").date()
|
||||
nwd_end_date = datetime.datetime.strptime(b, "%d/%m/%y").date()
|
||||
|
||||
@@ -326,6 +330,7 @@ solver_options = {"ratio": ratio, "seconds": time_to_run, "threads": 10}
|
||||
|
||||
start_time = time.time()
|
||||
Rota.build_and_solve(solver_options)
|
||||
#Rota.solve_shifts_by_block(solver_options, block_length=10)
|
||||
#Rota.solve_shifts_individually(solver_options)
|
||||
# Rota.solve_model(options=solver_options)
|
||||
end_time = time.time()
|
||||
|
||||
Reference in New Issue
Block a user