update
This commit is contained in:
@@ -17,15 +17,28 @@ import operator
|
||||
|
||||
use_neos = False
|
||||
|
||||
weeks_to_rota = 26
|
||||
weeks_to_rota = 12
|
||||
|
||||
time_to_run = 1200
|
||||
allow = 3000
|
||||
|
||||
sites = ("truro", "exeter", "torquay", "barnstaple", "plymouth")
|
||||
|
||||
Rota = RotaBuilder(datetime.date(2020, 9, 7),
|
||||
weeks_to_rota=weeks_to_rota,
|
||||
balance_offset_modifier=1,
|
||||
max_weekend_frequency=1,
|
||||
max_night_frequency=1)
|
||||
balance_offset_modifier=8,
|
||||
max_weekend_frequency=2,
|
||||
max_night_frequency=2)
|
||||
|
||||
Rota.constraint_options["limit_to_1_st1_on_nights"] = False
|
||||
Rota.constraint_options["ensure_1_st4_plus_on_nights"] = False
|
||||
Rota.constraint_options["balance_nights"] = False
|
||||
Rota.constraint_options["constrain_time_off_after_nights"] = False
|
||||
Rota.constraint_options["balance_nights_across_sites"] = False
|
||||
Rota.constraint_options["balance_blocks"] = True
|
||||
Rota.constraint_options["balance_weekends"] = True
|
||||
Rota.constraint_options["prevent_monday_after_full_weekends"] = False
|
||||
Rota.constraint_options["prevent_fridays_before_full_weekends"] = True
|
||||
|
||||
Rota.add_shifts(
|
||||
# SingleShift(("exeter", ), "exeter_twilight", 12.5, days[:5]),
|
||||
@@ -107,7 +120,7 @@ Rota.add_shifts(
|
||||
"night_weekday",
|
||||
12.25,
|
||||
days[:4],
|
||||
balance_offset=4,
|
||||
balance_offset=2,
|
||||
balance_weighting=1,
|
||||
#hard_constrain_shift=False,
|
||||
workers_required=3,
|
||||
@@ -119,7 +132,7 @@ Rota.add_shifts(
|
||||
"night_weekend",
|
||||
12.25,
|
||||
days[4:],
|
||||
balance_offset=3,
|
||||
balance_offset=2,
|
||||
balance_weighting=1,
|
||||
#hard_constrain_shift=False,
|
||||
workers_required=3,
|
||||
@@ -208,19 +221,12 @@ else:
|
||||
Worker(Rota, n, name, site.lower(), int(grade[2]), int(fte),
|
||||
nwds, end_date, oop))
|
||||
|
||||
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"] = False
|
||||
Rota.constraint_options["balance_nights_across_sites"] = False
|
||||
Rota.constraint_options["balance_blocks"] = False
|
||||
Rota.constraint_options["balance_weekends"] = False
|
||||
|
||||
print(0)
|
||||
Rota.build_shifts_and_workers()
|
||||
|
||||
Rota.build_model()
|
||||
|
||||
#print(Rota.get_worker_details())
|
||||
print(1)
|
||||
opt = SolverFactory('cbc') # choose a solver
|
||||
#opt = SolverFactory('ipopt') # choose a solver
|
||||
@@ -234,8 +240,8 @@ else:
|
||||
Rota.model,
|
||||
tee=True,
|
||||
options={
|
||||
"seconds": 1200,
|
||||
"allow": 15,
|
||||
"seconds": time_to_run,
|
||||
"allow": allow,
|
||||
},
|
||||
logfile="test.log"
|
||||
) # solve the model with the, options="seconds=60" selected solver
|
||||
@@ -255,7 +261,11 @@ worker_timetable_brief = ResultsHolder.get_worker_timetable_brief(
|
||||
print(worker_timetable_brief)
|
||||
print(Rota.get_workers_total_fte())
|
||||
|
||||
ResultsHolder.get_night_details()
|
||||
ResultsHolder.get_weekend_details()
|
||||
#ResultsHolder.get_night_details()
|
||||
|
||||
with open("test.html", "w") as f:
|
||||
f.write(ResultsHolder.get_worker_timetable_html(True))
|
||||
|
||||
# for i in ResultsHolder.rota.model.blocks_worker_shift_count:
|
||||
# n = ResultsHolder.rota.model.blocks_worker_shift_count[i].value
|
||||
|
||||
Reference in New Issue
Block a user