night shift balancing now works!
This commit is contained in:
@@ -77,31 +77,31 @@ Rota.add_shifts(
|
||||
# force_as_block=False,
|
||||
# rota_on_nwds=True,
|
||||
# constraints=["night"]),
|
||||
SingleShift(("exeter", ), "exeter_twilight", 12.5, days[:5]),
|
||||
SingleShift(("truro", ), "truro_twilight", 12.5, days[:5]),
|
||||
SingleShift(("torquay", ), "torquay_twilight", 12.5, days[:5]),
|
||||
SingleShift(("plymouth", ), "plymouth_twilight", 12.5, days[:5]),
|
||||
SingleShift(("exeter", ),
|
||||
"weekend_exeter",
|
||||
12.5,
|
||||
days[5:],
|
||||
assign_as_block=True),
|
||||
SingleShift(("truro", ),
|
||||
"weekend_truro",
|
||||
12.5,
|
||||
days[5:],
|
||||
assign_as_block=True),
|
||||
SingleShift(("torquay", ),
|
||||
"weekend_torquay",
|
||||
12.5,
|
||||
days[5:],
|
||||
assign_as_block=True),
|
||||
SingleShift(("plymouth", ),
|
||||
"weekend_plymouth",
|
||||
8,
|
||||
days[5:],
|
||||
workers_required=2,
|
||||
assign_as_block=True),
|
||||
# SingleShift(("exeter", ), "exeter_twilight", 12.5, days[:5]),
|
||||
# SingleShift(("truro", ), "truro_twilight", 12.5, days[:5]),
|
||||
# SingleShift(("torquay", ), "torquay_twilight", 12.5, days[:5]),
|
||||
# SingleShift(("plymouth", ), "plymouth_twilight", 12.5, days[:5]),
|
||||
# SingleShift(("exeter", ),
|
||||
# "weekend_exeter",
|
||||
# 12.5,
|
||||
# days[5:],
|
||||
# assign_as_block=True),
|
||||
# SingleShift(("truro", ),
|
||||
# "weekend_truro",
|
||||
# 12.5,
|
||||
# days[5:],
|
||||
# assign_as_block=True),
|
||||
# SingleShift(("torquay", ),
|
||||
# "weekend_torquay",
|
||||
# 12.5,
|
||||
# days[5:],
|
||||
# assign_as_block=True),
|
||||
# SingleShift(("plymouth", ),
|
||||
# "weekend_plymouth",
|
||||
# 8,
|
||||
# days[5:],
|
||||
# workers_required=2,
|
||||
# assign_as_block=True),
|
||||
SingleShift(
|
||||
(sites),
|
||||
"night_weekday",
|
||||
@@ -154,8 +154,13 @@ if use_test_workers:
|
||||
for i in range(9, 17)
|
||||
])
|
||||
Rota.add_workers([
|
||||
Worker(Rota, i, "Plym {}".format(i), "plymouth", 4, 80)
|
||||
for i in range(17, 19)
|
||||
Worker(Rota,
|
||||
i,
|
||||
"Plym {}".format(i),
|
||||
"plymouth",
|
||||
4,
|
||||
80,
|
||||
end_date="2020/10/05") for i in range(17, 19)
|
||||
])
|
||||
# Rota.add_workers([
|
||||
# Worker(
|
||||
@@ -196,16 +201,20 @@ else:
|
||||
end_date = end_date if end_date else None
|
||||
oop = oop.split("-") if oop else None
|
||||
#print(nwds, end_date, oop)
|
||||
# Rota.add_worker(
|
||||
# Worker(Rota, n, name, site.lower(), int(grade[2]), 100,
|
||||
# ))
|
||||
Rota.add_worker(
|
||||
Worker(Rota, n, name, site.lower(), int(grade[2]), int(fte),
|
||||
nwds, end_date, oop))
|
||||
|
||||
Rota.constraint_options["limit_to_1_st1_on_nights"] = True
|
||||
Rota.constraint_options["limit_to_1_st1_on_nights"] = False
|
||||
Rota.constraint_options["ensure_1_st4_plus_on_nights"] = True
|
||||
Rota.constraint_options["balance_nights"] = True
|
||||
Rota.constraint_options["constrain_time_off_after_nights"] = True
|
||||
Rota.constraint_options["constrain_time_off_after_nights"] = False
|
||||
Rota.constraint_options["balance_nights_across_sites"] = False
|
||||
Rota.constraint_options["balance_blocks"] = False
|
||||
Rota.constraint_options["balance_weekends"] = True
|
||||
Rota.constraint_options["balance_weekends"] = False
|
||||
|
||||
print(0)
|
||||
Rota.build_shifts_and_workers()
|
||||
@@ -226,7 +235,7 @@ else:
|
||||
tee=True,
|
||||
options={
|
||||
"seconds": 1200,
|
||||
"allow": 4000,
|
||||
"allow": 15,
|
||||
},
|
||||
logfile="test.log"
|
||||
) # solve the model with the, options="seconds=60" selected solver
|
||||
|
||||
Reference in New Issue
Block a user