.
This commit is contained in:
@@ -13,21 +13,22 @@ import os
|
||||
|
||||
use_neos = False
|
||||
use_cplex = False
|
||||
solve = False
|
||||
solve = True
|
||||
|
||||
weeks_to_rota = 26
|
||||
|
||||
time_to_run = 158500
|
||||
time_to_run = 258500
|
||||
# allow = 5000
|
||||
ratio = 0.05
|
||||
ratio = 0.01
|
||||
|
||||
use_live_rota = False
|
||||
suspend_on_finish = False
|
||||
suspend_on_finish = True
|
||||
|
||||
|
||||
sites = ("truro", "exeter", "torbay", "barnstaple", "plymouth", "proc", "truro no proc")
|
||||
|
||||
Rota = RotaBuilder(
|
||||
# datetime.date(2022, 6, 6),
|
||||
datetime.date(2022, 3, 7),
|
||||
# Rota = RotaBuilder(datetime.date(2021, 12, 6),
|
||||
# Rota = RotaBuilder(datetime.date(2021, 11, 8),
|
||||
@@ -35,6 +36,8 @@ Rota = RotaBuilder(
|
||||
balance_offset_modifier=1,
|
||||
max_weekend_frequency=2,
|
||||
max_night_frequency=2,
|
||||
use_shift_balance_extra=True,
|
||||
use_bank_holiday_extra=True,
|
||||
)
|
||||
|
||||
Rota.constraint_options["limit_to_1_st2_on_nights"] = True
|
||||
@@ -44,19 +47,27 @@ Rota.constraint_options["constrain_time_off_after_nights"] = True
|
||||
Rota.constraint_options["balance_nights_across_sites"] = True
|
||||
Rota.constraint_options["balance_blocks"] = True
|
||||
Rota.constraint_options["balance_weekends"] = True
|
||||
Rota.constraint_options["balance_shifts"] = True
|
||||
Rota.constraint_options["balance_bank_holidays"] = True
|
||||
Rota.constraint_options["avoid_st2_first_month"] = True
|
||||
Rota.constraint_options["avoid_st2_first_month"] = False
|
||||
Rota.constraint_options["hard_constrain_pair_separation"] = True
|
||||
Rota.constraint_options["max_weekends"] = 20
|
||||
Rota.constraint_options["max_weekends"] = 7
|
||||
Rota.constraint_options["prevent_monday_and_tuesday_after_full_weekends"] = [
|
||||
"truro",
|
||||
"torbay",
|
||||
"exeter",
|
||||
"plymouth",
|
||||
"plymouth no proc",
|
||||
"truro no proc",
|
||||
]
|
||||
Rota.constraint_options["prevent_monday_after_full_weekends"] = ["plymouth"]
|
||||
Rota.constraint_options["prevent_fridays_before_full_weekends"] = ["plymouth"]
|
||||
Rota.constraint_options["prevent_monday_after_full_weekends"] = [
|
||||
"plymouth",
|
||||
"plymouth no proc",
|
||||
]
|
||||
Rota.constraint_options["prevent_fridays_before_full_weekends"] = [
|
||||
"plymouth",
|
||||
"plymouth no proc",
|
||||
]
|
||||
Rota.constraint_options["prevent_thursdays_before_full_weekends"] = [
|
||||
"truro",
|
||||
"torbay",
|
||||
@@ -70,11 +81,12 @@ Rota.add_shifts(
|
||||
"exeter_twilight",
|
||||
12.5,
|
||||
days[:4],
|
||||
balance_offset=1.5,
|
||||
constraints=["max_2_shifts_per_week"],
|
||||
),
|
||||
SingleShift(("truro", "truro no proc"), "truro_twilight", 12.5, days[:4]),
|
||||
SingleShift(
|
||||
("torbay",),
|
||||
("torbay", "torbay twilights"),
|
||||
"torbay_twilight",
|
||||
12.5,
|
||||
days[:4],
|
||||
@@ -86,7 +98,7 @@ Rota.add_shifts(
|
||||
"plymouth_twilight",
|
||||
12.5,
|
||||
days[:5],
|
||||
balance_offset=3,
|
||||
balance_offset=1.5,
|
||||
workers_required=1,
|
||||
constraints=["max_2_shifts_per_week"],
|
||||
),
|
||||
@@ -95,7 +107,7 @@ Rota.add_shifts(
|
||||
"weekend_exeter",
|
||||
12.5,
|
||||
days[4:],
|
||||
balance_offset=3,
|
||||
balance_offset=3.5,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
),
|
||||
@@ -104,7 +116,7 @@ Rota.add_shifts(
|
||||
"weekend_truro",
|
||||
12.5,
|
||||
days[4:],
|
||||
balance_offset=3,
|
||||
balance_offset=3.5,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
# force_as_block_unless_nwd=True
|
||||
@@ -114,7 +126,7 @@ Rota.add_shifts(
|
||||
"weekend_torbay",
|
||||
12.5,
|
||||
days[4:],
|
||||
balance_offset=3,
|
||||
balance_offset=3.5,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
# force_as_block_unless_nwd=True
|
||||
@@ -124,7 +136,7 @@ Rota.add_shifts(
|
||||
"weekend_plymouth1",
|
||||
8,
|
||||
days[5:],
|
||||
balance_offset=3,
|
||||
balance_offset=2.5,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
@@ -134,7 +146,7 @@ Rota.add_shifts(
|
||||
"weekend_plymouth2",
|
||||
8,
|
||||
days[5:],
|
||||
balance_offset=3,
|
||||
balance_offset=2.5,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True,
|
||||
@@ -144,7 +156,7 @@ Rota.add_shifts(
|
||||
"plymouth_bank_holidays",
|
||||
8,
|
||||
days[5:],
|
||||
balance_offset=3,
|
||||
balance_offset=1.5,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=False,
|
||||
@@ -155,7 +167,7 @@ Rota.add_shifts(
|
||||
"night_weekday",
|
||||
12.25,
|
||||
days[:4],
|
||||
balance_offset=4,
|
||||
balance_offset=5,
|
||||
balance_weighting=1,
|
||||
# hard_constrain_shift=False,
|
||||
workers_required=3,
|
||||
@@ -168,7 +180,7 @@ Rota.add_shifts(
|
||||
"night_weekend",
|
||||
12.25,
|
||||
days[4:],
|
||||
balance_offset=3,
|
||||
balance_offset=4,
|
||||
balance_weighting=1,
|
||||
# hard_constrain_shift=False,
|
||||
workers_required=3,
|
||||
@@ -203,10 +215,10 @@ if use_test_workers:
|
||||
[
|
||||
Worker(
|
||||
Rota,
|
||||
i,
|
||||
"Truro {}".format(i),
|
||||
"truro",
|
||||
4,
|
||||
id=i,
|
||||
)
|
||||
for i in range(1, 9)
|
||||
]
|
||||
@@ -298,10 +310,10 @@ else:
|
||||
Rota.add_worker(
|
||||
Worker(
|
||||
Rota,
|
||||
n,
|
||||
worker_name,
|
||||
site.lower(),
|
||||
int(grade[2]),
|
||||
n,
|
||||
int(fte),
|
||||
nwds,
|
||||
end_date,
|
||||
@@ -311,6 +323,8 @@ else:
|
||||
proc_site=site_pref,
|
||||
previous_shifts=previous_shifts,
|
||||
pair=pair,
|
||||
shift_balance_extra=w["shift_balance_extra"],
|
||||
bank_holiday_extra=w["bank_holiday_extra"],
|
||||
)
|
||||
)
|
||||
|
||||
@@ -329,11 +343,7 @@ if not solve:
|
||||
ResultsHolder.export_rota_to_html()
|
||||
sys.exit(0)
|
||||
|
||||
solver_options = {
|
||||
"ratio" : ratio,
|
||||
"seconds" : time_to_run,
|
||||
"threads" : 10
|
||||
}
|
||||
solver_options = {"ratio": ratio, "seconds": time_to_run, "threads": 10}
|
||||
|
||||
Rota.solve_model(options=solver_options)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user