49 KiB
49 KiB
In [1]:
from pyomo.environ import *
from pyomo.opt import SolverFactory
from shifts import SingleShift, RotaBuilder, days
from workers import Worker
import math
import scipy.stats as stats
import statistics
import datetime
import itertools
import operator
In [2]:
#night_balance_offset = 2
#twilight_balance_offset = 1
weeks_to_rota = 26
use_test_workers = FalseIn [3]:
sites = ("truro", "exeter", "torquay", "barnstaple", "plymouth")
Rota = RotaBuilder(datetime.date(2020, 9, 7), weeks_to_rota=weeks_to_rota, balance_offset_modifier=1)
rota_collections = {
#"current" : RotaBuilder(datetime.date(2020, 9, 7), weeks_to_rota=weeks_to_rota, balance_offset_modifier=2)
}
Rota.add_shifts(
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", 12.5, days, balance_weighting=1, workers_required=3, rota_on_nwds=True),
SingleShift((sites), "night", 12.5, days, balance_offset=2, balance_weighting=1, workers_required=3, rota_on_nwds=True),
)
#Rota2 = RotaBuilder(weeks_to_rota=weeks_to_rota)
#Rota2.add_shifts(
# SingleShift(("exeter",), "exeter_twilight", 12.5, days[:5], balance_offset=3),
# SingleShift(("exeter",), "weekend_exeter", 12.5, days[5:], balance_offset=3, balance_weighting=1),
# SingleShift((sites), "night", 12.5, days, balance_offset=2, balance_weighting=4, workers_required=3, rota_on_nwds=True),
#)
#Rota = Rota2
In [4]:
if use_test_workers:
# Enter workers ids (name, number, ...)
Rota.add_workers([Worker(Rota, i, "Truro {}".format(i), "truro", 3, nwd=['Fri', "Sat", "Sun"]) for i in range(1, 2)])
Rota.add_workers([Worker(Rota,i, "Truro {}".format(i), "truro", 4, pref_not_to_work=(("2020/09/07"),("2020/09/08"),("2020/09/09"),("2020/09/10")) ) for i in range(2, 14)])
Rota.add_workers([Worker(Rota,i, "Plym {}".format(i), "plymouth", 4) for i in range(16, 30)])
Rota.add_workers([Worker(Rota,i, "Exe {}".format(i), "exeter", 4, pref_not_to_work=(("2020/09/07"),)) for i in range(30, 40)])
Rota.add_workers([Worker(Rota,i, "Torq {}".format(i), "torquay", 4, pref_not_to_work=(("2020/09/07"),)) for i in range(50, 60)])
#workers.extend([workerClass(i, "Test Person {}".format(i), 4, 200, "") for i in range(48, 49)])
#workers.extend([Worker(Rota,i, "Test Person {}".format(i), "exeter", 4) for i in range(34, 45)])
#Rota.add_worker([Worker(Rota,i, "Test Person {}".format(i), "torquay", 4, pref_not_to_work=("2020/09/10","2020/09/7","2020/09/14","2020/09/23")) for i in range(45, 46)])
else:
# Import trainee data
import csv
with open('trainees.csv', newline='') as f:
reader = csv.reader(f, delimiter=',', quotechar='|')
next(reader) # skip header
n = 0
for row in reader:
n = n + 1
#print(row)
name, site, grade, fte, nwd, end_date, oop, extra = row
# Ignore trainees if fte == 0 (what are they doing here anyway)
if fte == 0:
continue
nwds = nwd.split(",").title() if nwd else None
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]), int(fte), nwds, end_date, oop))
In [5]:
Rota.build_shifts_and_workers()
print(Rota.sites)
Rota.build_model(){'exeter', 'truro', 'plymouth', 'barnstaple', 'torquay'}
In [6]:
opt = SolverFactory('cbc') # choose a solver
#opt = SolverFactory('ipopt') # choose a solver
results = opt.solve(Rota.model, tee=True, options={"seconds":3600, "allow": 3500}) # solve the model with the, options="seconds=60" selected solverWelcome to the CBC MILP Solver Version: 2.9.9 Build Date: Aug 7 2019 command line - /usr/bin/cbc -seconds 3600 -allow 3500 -printingOptions all -import /tmp/tmpf5i54yvl.pyomo.lp -stat=1 -solve -solu /tmp/tmpf5i54yvl.pyomo.soln (default strategy 1) seconds was changed from 1e+100 to 3600 allowableGap was changed from 1e-10 to 3500 Option for printingOptions changed from normal to all Presolve 53080 (-28899) rows, 22855 (-73242) columns and 199897 (-492588) elements Statistics for presolved model Original problem has 95524 integers (94640 of which binary) Presolved problem has 22765 integers (22453 of which binary) ==== 19020 zero objective 4 different 19020 variables have objective of 0 208 variables have objective of 20 1271 variables have objective of 100 2356 variables have objective of 1000 ==== absolute objective values 4 different 19020 variables have objective of 0 208 variables have objective of 20 1271 variables have objective of 100 2356 variables have objective of 1000 ==== for integers 19020 zero objective 4 different 19020 variables have objective of 0 208 variables have objective of 20 1271 variables have objective of 100 2266 variables have objective of 1000 ==== for integers absolute objective values 4 different 19020 variables have objective of 0 208 variables have objective of 20 1271 variables have objective of 100 2266 variables have objective of 1000 ===== end objective counts Problem has 53080 rows, 22855 columns (3835 with objective) and 199897 elements There are 1569 singletons with objective 852 singletons with no objective Column breakdown: 402 of type 0.0->inf, 0 of type 0.0->up, 0 of type lo->inf, 0 of type lo->up, 0 of type free, 0 of type fixed, 0 of type -inf->0.0, 0 of type -inf->up, 22453 of type 0.0->1.0 Row breakdown: 2124 of type E 0.0, 1528 of type E 1.0, 0 of type E -1.0, 799 of type E other, 0 of type G 0.0, 52 of type G 1.0, 334 of type G other, 1271 of type L 0.0, 45119 of type L 1.0, 1853 of type L other, 0 of type Range 0.0->1.0, 0 of type Range other, 0 of type Free Continuous objective value is 7026.09 - 11.42 seconds Cgl0002I 67382 variables fixed Cgl0003I 110 fixed, 208 tightened bounds, 41717 strengthened rows, 45229 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 1344 strengthened rows, 8755 substitutions Cgl0003I 488 fixed, 0 tightened bounds, 3602 strengthened rows, 26 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 150 strengthened rows, 0 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 268 strengthened rows, 0 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 167 strengthened rows, 0 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 167 strengthened rows, 0 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 166 strengthened rows, 0 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 165 strengthened rows, 0 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 162 strengthened rows, 0 substitutions Cgl0003I 0 fixed, 0 tightened bounds, 162 strengthened rows, 0 substitutions Cgl0004I processed model has 13820 rows, 13726 columns (13636 integer (13428 of which binary)) and 85182 elements Cbc0038I Initial state - 928 integers unsatisfied sum - 260.353 Cbc0038I Pass 1: (22.71 seconds) suminf. 130.17048 (361) obj. 54418.3 iterations 3281 Cbc0038I Pass 2: (22.78 seconds) suminf. 114.65515 (321) obj. 61548.2 iterations 714 Cbc0038I Pass 3: (22.82 seconds) suminf. 111.57450 (319) obj. 63556.3 iterations 146 Cbc0038I Pass 4: (22.85 seconds) suminf. 110.79486 (316) obj. 63527.3 iterations 76 Cbc0038I Pass 5: (22.87 seconds) suminf. 110.29486 (315) obj. 63577.3 iterations 4 Cbc0038I Pass 6: (22.90 seconds) suminf. 102.79486 (300) obj. 64327.3 iterations 21 Cbc0038I Pass 7: (22.92 seconds) suminf. 93.79486 (282) obj. 65227.3 iterations 24 Cbc0038I Pass 8: (22.95 seconds) suminf. 88.29486 (271) obj. 65777.3 iterations 11 Cbc0038I Pass 9: (22.97 seconds) suminf. 81.79486 (258) obj. 66427.3 iterations 18 Cbc0038I Pass 10: (23.00 seconds) suminf. 75.79486 (246) obj. 67027.3 iterations 19 Cbc0038I Pass 11: (23.03 seconds) suminf. 65.79486 (226) obj. 68027.3 iterations 38 Cbc0038I Pass 12: (23.05 seconds) suminf. 54.48204 (201) obj. 69116.3 iterations 125 Cbc0038I Pass 13: (23.08 seconds) suminf. 42.98204 (178) obj. 70266.3 iterations 29 Cbc0038I Pass 14: (23.15 seconds) suminf. 26.99681 (126) obj. 71658.8 iterations 545 Cbc0038I Pass 15: (23.18 seconds) suminf. 23.15673 (110) obj. 74088.5 iterations 62 Cbc0038I Pass 16: (23.23 seconds) suminf. 12.43064 (83) obj. 76945.6 iterations 459 Cbc0038I Pass 17: (23.27 seconds) suminf. 11.05741 (71) obj. 76158.1 iterations 220 Cbc0038I Pass 18: (23.31 seconds) suminf. 7.01292 (50) obj. 78595.2 iterations 378 Cbc0038I Pass 19: (23.34 seconds) suminf. 6.86964 (57) obj. 78751.1 iterations 89 Cbc0038I Pass 20: (23.37 seconds) suminf. 5.08719 (42) obj. 81358.4 iterations 288 Cbc0038I Pass 21: (23.40 seconds) suminf. 5.08719 (42) obj. 81358.4 iterations 4 Cbc0038I Pass 22: (23.43 seconds) suminf. 4.53125 (37) obj. 83406.5 iterations 160 Cbc0038I Pass 23: (23.46 seconds) suminf. 4.41533 (38) obj. 82267 iterations 71 Cbc0038I Pass 24: (23.50 seconds) suminf. 5.00933 (32) obj. 76370.5 iterations 406 Cbc0038I Pass 25: (23.53 seconds) suminf. 5.00933 (32) obj. 76370.5 iterations 90 Cbc0038I Pass 26: (23.58 seconds) suminf. 3.12866 (19) obj. 81141.9 iterations 521 Cbc0038I Pass 27: (23.60 seconds) suminf. 3.12866 (19) obj. 81141.9 iterations 2 Cbc0038I Pass 28: (23.65 seconds) suminf. 3.96820 (13) obj. 75644.8 iterations 302 Cbc0038I Pass 29: (23.68 seconds) suminf. 3.96820 (13) obj. 75644.8 iterations 7 Cbc0038I Pass 30: (23.71 seconds) suminf. 2.05382 (6) obj. 77470.6 iterations 129 Cbc0038I No solution found this major pass Cbc0038I Before mini branch and bound, 12420 integers at bound fixed and 21 continuous Cbc0038I Full problem 13820 rows 13726 columns, reduced to 770 rows 705 columns Cbc0038I Mini branch and bound did not improve solution (24.79 seconds) Cbc0038I After 24.79 seconds - Feasibility pump exiting - took 2.76 seconds Cbc0031I 175 added rows had average density of 83.977143 Cbc0013I At root node, 175 cuts changed objective from 16776.086 to 28416.154 in 10 passes Cbc0014I Cut generator 0 (Probing) - 1123 row cuts average 2.0 elements, 0 column cuts (37 active) in 4.086 seconds - new frequency is 1 Cbc0014I Cut generator 1 (Gomory) - 534 row cuts average 247.5 elements, 0 column cuts (0 active) in 2.320 seconds - new frequency is 1 Cbc0014I Cut generator 2 (Knapsack) - 606 row cuts average 2.2 elements, 0 column cuts (0 active) in 0.113 seconds - new frequency is 1 Cbc0014I Cut generator 3 (Clique) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.041 seconds - new frequency is -100 Cbc0014I Cut generator 4 (MixedIntegerRounding2) - 906 row cuts average 43.6 elements, 0 column cuts (0 active) in 0.246 seconds - new frequency is 1 Cbc0014I Cut generator 5 (FlowCover) - 0 row cuts average 0.0 elements, 0 column cuts (0 active) in 0.050 seconds - new frequency is -100 Cbc0014I Cut generator 6 (TwoMirCuts) - 1048 row cuts average 73.2 elements, 0 column cuts (0 active) in 1.688 seconds - new frequency is 1 Cbc0010I After 0 nodes, 1 on tree, 1e+50 best solution, best possible 28416.154 (45.59 seconds) Cbc0012I Integer solution of 37000.826 found by DiveCoefficient after 18584 iterations and 6 nodes (60.40 seconds) Cbc0038I Full problem 13820 rows 13726 columns, reduced to 158 rows 189 columns Cbc0012I Integer solution of 34382.245 found by RINS after 18584 iterations and 6 nodes (61.78 seconds) Cbc0038I Full problem 13820 rows 13726 columns, reduced to 147 rows 212 columns Cbc0012I Integer solution of 30728.276 found by RINS after 24677 iterations and 41 nodes (80.09 seconds) Cbc0011I Exiting as integer gap of 2312.1218 less than 3500 or 0%% Cbc0001I Search completed - best objective 30728.27563158896, took 24697 iterations and 42 nodes (80.23 seconds) Cbc0032I Strong branching done 938 times (36727 iterations), fathomed 0 nodes and fixed 0 variables Cbc0035I Maximum depth 22, 0 variables fixed on reduced cost Cuts at root node changed objective from 16776.1 to 28416.2 Probing was tried 57 times and created 2617 cuts of which 37 were active after adding rounds of cuts (4.375 seconds) Gomory was tried 57 times and created 706 cuts of which 0 were active after adding rounds of cuts (3.023 seconds) Knapsack was tried 57 times and created 1360 cuts of which 0 were active after adding rounds of cuts (0.537 seconds) Clique was tried 10 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.041 seconds) MixedIntegerRounding2 was tried 57 times and created 2057 cuts of which 0 were active after adding rounds of cuts (0.914 seconds) FlowCover was tried 10 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.050 seconds) TwoMirCuts was tried 57 times and created 1692 cuts of which 0 were active after adding rounds of cuts (2.318 seconds) ImplicationCuts was tried 14 times and created 1011 cuts of which 0 were active after adding rounds of cuts (0.031 seconds) Result - Optimal solution found (within gap tolerance) Objective value: 30728.27563159 Lower bound: 28416.154 Gap: 0.08 Enumerated nodes: 42 Total iterations: 24697 Time (CPU seconds): 81.01 Time (Wallclock seconds): 81.36 Total time (CPU seconds): 82.74 (Wallclock seconds): 83.24
In [7]:
results.solver.status
Out [7]:
EnumValue(<pyutilib.enum.enum.Enum object at 0x7fbee280c310>, 0, 'ok')
In [8]:
from shifts import RotaResults
ResultsHolder = RotaResults(Rota, results)In [9]:
#def get_workers_needed(needed):
# """Extract to a list the needed workers for the optimal solution."""
# workers_needed = []
# for worker in workers:
# if needed[worker.id].value == 1:
# workers_needed.append(worker.name)
# return workers_needed
#workers_needed = get_workers_needed(model.needed) # dict with the optimal timetable
week_table = ResultsHolder.get_work_table() # list with the required workers
worker_timetable = ResultsHolder.get_worker_timetable()
worker_timetable_brief = ResultsHolder.get_worker_timetable_brief(show_prefs=False)
#workers_no_pref = ResultsHolder.get_no_preference(Rota.model.no_pref) # list with the non-satisfied workers (work on Sat but not on Sun)
worker_night_block = ResultsHolder.get_night_blocks()
worker_shift_summary = ResultsHolder.get_shift_summary()
multi = ResultsHolder.get_multinight()exeter 1 weekend 1.0 0.0 0.0 exeter 2 weekend 1.0 0.0 0.0 exeter 3 weekend 0.0 0.0 1.0 exeter 4 weekend 1.0 0.0 0.0 exeter 5 weekend 0.0 0.0 1.0 exeter 6 weekend 1.0 0.0 0.0 exeter 7 weekend 1.0 0.0 0.0 exeter 8 weekend 0.0 0.0 1.0 exeter 9 weekend 1.0 0.0 0.0 exeter 10 weekend 1.0 0.0 0.0 exeter 11 weekend 1.0 0.0 0.0 exeter 12 weekend 0.0 0.0 1.0 exeter 13 weekend 1.0 0.0 0.0 exeter 14 weekend 1.0 0.0 0.0 exeter 15 weekend 1.0 0.0 0.0 exeter 16 weekend 0.0 0.0 1.0 exeter 17 weekend 1.0 0.0 0.0 exeter 18 weekend 1.0 0.0 0.0 exeter 19 weekend 1.0 0.0 0.0 exeter 20 weekend 1.0 0.0 0.0 exeter 21 weekend 1.0 0.0 0.0 exeter 22 weekend 1.0 0.0 0.0 exeter 23 weekend 1.0 0.0 0.0 exeter 24 weekend 0.0 0.0 1.0 exeter 25 weekend 1.0 0.0 0.0 exeter 26 weekend 1.0 0.0 0.0 exeter 1 weekday 0.0 0.0 1.0 exeter 2 weekday 0.0 0.0 1.0 exeter 3 weekday 0.0 0.0 1.0 exeter 4 weekday 1.0 0.0 0.0 exeter 5 weekday 1.0 0.0 0.0 exeter 6 weekday 1.0 0.0 0.0 exeter 7 weekday 0.0 0.0 1.0 exeter 8 weekday 1.0 0.0 0.0 exeter 9 weekday 1.0 0.0 0.0 exeter 10 weekday 1.0 0.0 0.0 exeter 11 weekday 1.0 0.0 0.0 exeter 12 weekday 1.0 0.0 0.0 exeter 13 weekday 1.0 0.0 0.0 exeter 14 weekday 1.0 0.0 0.0 exeter 15 weekday 0.0 0.0 1.0 exeter 16 weekday 1.0 0.0 0.0 exeter 17 weekday 0.0 0.0 1.0 exeter 18 weekday 0.0 0.0 1.0 exeter 19 weekday 0.0 0.0 1.0 exeter 20 weekday 0.0 0.0 1.0 exeter 21 weekday 1.0 0.0 0.0 exeter 22 weekday 0.0 0.0 1.0 exeter 23 weekday 0.0 0.0 1.0 exeter 24 weekday 1.0 0.0 0.0 exeter 25 weekday 0.0 0.0 1.0 exeter 26 weekday 1.0 0.0 0.0 truro 1 weekend 0.0 0.0 1.0 truro 2 weekend 0.0 0.0 1.0 truro 3 weekend 1.0 0.0 0.0 truro 4 weekend 1.0 0.0 0.0 truro 5 weekend 1.0 0.0 0.0 truro 6 weekend 1.0 0.0 0.0 truro 7 weekend 1.0 0.0 0.0 truro 8 weekend 1.0 0.0 0.0 truro 9 weekend 1.0 0.0 0.0 truro 10 weekend 0.0 0.0 1.0 truro 11 weekend 0.0 0.0 1.0 truro 12 weekend 1.0 0.0 0.0 truro 13 weekend 0.0 0.0 1.0 truro 14 weekend 0.0 0.0 1.0 truro 15 weekend 0.0 0.0 1.0 truro 16 weekend 1.0 0.0 0.0 truro 17 weekend 1.0 0.0 0.0 truro 18 weekend 0.0 0.0 1.0 truro 19 weekend 1.0 0.0 0.0 truro 20 weekend 0.0 0.0 1.0 truro 21 weekend 0.0 0.0 1.0 truro 22 weekend 1.0 0.0 0.0 truro 23 weekend 1.0 0.0 0.0 truro 24 weekend 1.0 0.0 0.0 truro 25 weekend 0.0 0.0 1.0 truro 26 weekend 1.0 0.0 0.0 truro 1 weekday 1.0 0.0 0.0 truro 2 weekday 1.0 0.0 0.0 truro 3 weekday 1.0 0.0 0.0 truro 4 weekday 0.0 0.0 1.0 truro 5 weekday 1.0 0.0 0.0 truro 6 weekday 0.0 0.0 1.0 truro 7 weekday 1.0 0.0 0.0 truro 8 weekday 1.0 0.0 0.0 truro 9 weekday 0.0 0.0 1.0 truro 10 weekday 1.0 0.0 0.0 truro 11 weekday 0.0 0.0 1.0 truro 12 weekday 1.0 0.0 0.0 truro 13 weekday 1.0 0.0 0.0 truro 14 weekday 0.0 0.0 1.0 truro 15 weekday 1.0 0.0 0.0 truro 16 weekday 0.0 0.0 1.0 truro 17 weekday 1.0 0.0 0.0 truro 18 weekday 1.0 0.0 0.0 truro 19 weekday 1.0 0.0 0.0 truro 20 weekday 1.0 0.0 0.0 truro 21 weekday 1.0 0.0 0.0 truro 22 weekday 1.0 0.0 0.0 truro 23 weekday 1.0 0.0 0.0 truro 24 weekday 1.0 0.0 0.0 truro 25 weekday 1.0 0.0 0.0 truro 26 weekday 1.0 0.0 0.0 plymouth 1 weekend 1.0 0.0 0.0 plymouth 2 weekend 1.0 0.0 0.0 plymouth 3 weekend 1.0 0.0 0.0 plymouth 4 weekend 1.0 0.0 0.0 plymouth 5 weekend 1.0 0.0 0.0 plymouth 6 weekend 1.0 0.0 0.0 plymouth 7 weekend 1.0 0.0 0.0 plymouth 8 weekend 1.0 0.0 0.0 plymouth 9 weekend 1.0 0.0 0.0 plymouth 10 weekend 1.0 0.0 0.0 plymouth 11 weekend 1.0 0.0 0.0 plymouth 12 weekend 1.0 0.0 0.0 plymouth 13 weekend 1.0 0.0 0.0 plymouth 14 weekend 1.0 0.0 0.0 plymouth 15 weekend 1.0 0.0 0.0 plymouth 16 weekend 1.0 0.0 0.0 plymouth 17 weekend 1.0 0.0 0.0 plymouth 18 weekend 1.0 0.0 0.0 plymouth 19 weekend 1.0 0.0 0.0 plymouth 20 weekend 1.0 0.0 0.0 plymouth 21 weekend 1.0 0.0 0.0 plymouth 22 weekend 0.0 0.0 1.0 plymouth 23 weekend 1.0 0.0 0.0 plymouth 24 weekend 1.0 0.0 0.0 plymouth 25 weekend 1.0 0.0 0.0 plymouth 26 weekend 1.0 0.0 0.0 plymouth 1 weekday 1.0 0.0 0.0 plymouth 2 weekday 1.0 0.0 0.0 plymouth 3 weekday 1.0 0.0 0.0 plymouth 4 weekday 1.0 0.0 0.0 plymouth 5 weekday 1.0 0.0 0.0 plymouth 6 weekday 1.0 0.0 0.0 plymouth 7 weekday 1.0 0.0 0.0 plymouth 8 weekday 1.0 0.0 0.0 plymouth 9 weekday 1.0 0.0 0.0 plymouth 10 weekday 1.0 0.0 0.0 plymouth 11 weekday 1.0 0.0 0.0 plymouth 12 weekday 0.0 0.0 1.0 plymouth 13 weekday 0.0 0.0 1.0 plymouth 14 weekday 1.0 0.0 0.0 plymouth 15 weekday 1.0 0.0 0.0 plymouth 16 weekday 1.0 0.0 0.0 plymouth 17 weekday 1.0 0.0 0.0 plymouth 18 weekday 1.0 0.0 0.0 plymouth 19 weekday 1.0 0.0 0.0 plymouth 20 weekday 1.0 0.0 0.0 plymouth 21 weekday 1.0 0.0 0.0 plymouth 22 weekday 1.0 0.0 0.0 plymouth 23 weekday 1.0 0.0 0.0 plymouth 24 weekday 1.0 0.0 0.0 plymouth 25 weekday 1.0 0.0 0.0 plymouth 26 weekday 1.0 0.0 0.0 barnstaple 1 weekend 0.0 0.0 1.0 barnstaple 2 weekend 0.0 0.0 1.0 barnstaple 3 weekend 0.0 0.0 1.0 barnstaple 4 weekend 0.0 0.0 1.0 barnstaple 5 weekend 0.0 0.0 1.0 barnstaple 6 weekend 0.0 0.0 1.0 barnstaple 7 weekend 0.0 0.0 1.0 barnstaple 8 weekend 0.0 0.0 1.0 barnstaple 9 weekend 0.0 0.0 1.0 barnstaple 10 weekend 0.0 0.0 1.0 barnstaple 11 weekend 0.0 0.0 1.0 barnstaple 12 weekend 0.0 0.0 1.0 barnstaple 13 weekend 0.0 0.0 1.0 barnstaple 14 weekend 0.0 0.0 1.0 barnstaple 15 weekend 0.0 0.0 1.0 barnstaple 16 weekend 0.0 0.0 1.0 barnstaple 17 weekend 0.0 0.0 1.0 barnstaple 18 weekend 0.0 0.0 1.0 barnstaple 19 weekend 0.0 0.0 1.0 barnstaple 20 weekend 0.0 0.0 1.0 barnstaple 21 weekend 0.0 0.0 1.0 barnstaple 22 weekend 0.0 0.0 1.0 barnstaple 23 weekend 0.0 0.0 1.0 barnstaple 24 weekend 0.0 0.0 1.0 barnstaple 25 weekend 0.0 0.0 1.0 barnstaple 26 weekend 0.0 0.0 1.0 barnstaple 1 weekday 0.0 0.0 1.0 barnstaple 2 weekday 0.0 0.0 1.0 barnstaple 3 weekday 0.0 0.0 1.0 barnstaple 4 weekday 0.0 0.0 1.0 barnstaple 5 weekday 0.0 0.0 1.0 barnstaple 6 weekday 0.0 0.0 1.0 barnstaple 7 weekday 0.0 0.0 1.0 barnstaple 8 weekday 0.0 0.0 1.0 barnstaple 9 weekday 0.0 0.0 1.0 barnstaple 10 weekday 0.0 0.0 1.0 barnstaple 11 weekday 0.0 0.0 1.0 barnstaple 12 weekday 0.0 0.0 1.0 barnstaple 13 weekday 0.0 0.0 1.0 barnstaple 14 weekday 0.0 0.0 1.0 barnstaple 15 weekday 0.0 0.0 1.0 barnstaple 16 weekday 0.0 0.0 1.0 barnstaple 17 weekday 0.0 0.0 1.0 barnstaple 18 weekday 0.0 0.0 1.0 barnstaple 19 weekday 0.0 0.0 1.0 barnstaple 20 weekday 0.0 0.0 1.0 barnstaple 21 weekday 0.0 0.0 1.0 barnstaple 22 weekday 0.0 0.0 1.0 barnstaple 23 weekday 0.0 0.0 1.0 barnstaple 24 weekday 0.0 0.0 1.0 barnstaple 25 weekday 0.0 0.0 1.0 barnstaple 26 weekday 0.0 0.0 1.0 torquay 1 weekend 1.0 0.0 0.0 torquay 2 weekend 1.0 0.0 0.0 torquay 3 weekend 1.0 0.0 0.0 torquay 4 weekend 0.0 0.0 1.0 torquay 5 weekend 1.0 0.0 0.0 torquay 6 weekend 0.0 0.0 1.0 torquay 7 weekend 0.0 0.0 1.0 torquay 8 weekend 1.0 0.0 0.0 torquay 9 weekend 0.0 0.0 1.0 torquay 10 weekend 1.0 0.0 0.0 torquay 11 weekend 1.0 0.0 0.0 torquay 12 weekend 1.0 0.0 0.0 torquay 13 weekend 1.0 0.0 0.0 torquay 14 weekend 1.0 0.0 0.0 torquay 15 weekend 1.0 0.0 0.0 torquay 16 weekend 1.0 0.0 0.0 torquay 17 weekend 0.0 0.0 1.0 torquay 18 weekend 1.0 0.0 0.0 torquay 19 weekend 0.0 0.0 1.0 torquay 20 weekend 1.0 0.0 0.0 torquay 21 weekend 1.0 0.0 0.0 torquay 22 weekend 1.0 0.0 0.0 torquay 23 weekend 0.0 0.0 1.0 torquay 24 weekend 1.0 0.0 0.0 torquay 25 weekend 1.0 0.0 0.0 torquay 26 weekend 0.0 0.0 1.0 torquay 1 weekday 1.0 0.0 0.0 torquay 2 weekday 1.0 0.0 0.0 torquay 3 weekday 1.0 0.0 0.0 torquay 4 weekday 1.0 0.0 0.0 torquay 5 weekday 0.0 0.0 1.0 torquay 6 weekday 1.0 0.0 0.0 torquay 7 weekday 1.0 0.0 0.0 torquay 8 weekday0.0 0.0 1.0 torquay 9 weekday 1.0 0.0 0.0 torquay 10 weekday 0.0 0.0 1.0 torquay 11 weekday 1.0 0.0 0.0 torquay 12 weekday 1.0 0.0 0.0 torquay 13 weekday 1.0 0.0 0.0 torquay 14 weekday 1.0 0.0 0.0 torquay 15 weekday 1.0 0.0 0.0 torquay 16 weekday 1.0 0.0 0.0 torquay 17 weekday 1.0 0.0 0.0 torquay 18 weekday 1.0 0.0 0.0 torquay 19 weekday 1.0 0.0 0.0 torquay 20 weekday 1.0 0.0 0.0 torquay 21 weekday 0.0 0.0 1.0 torquay 22 weekday 1.0 0.0 0.0 torquay 23 weekday 1.0 0.0 0.0 torquay 24 weekday 0.0 0.0 1.0 torquay 25 weekday 1.0 0.0 0.0 torquay 26 weekday 0.0 0.0 1.0
In [10]:
ResultsHolder.export_rota_to_csv()In [11]:
print(worker_timetable_brief)
-Day- MTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSS -Week- 11111112222222333333344444445555555666666677777778888888999999900000001111111222222233333334444444555555566666667777777888888899999990000000111111122222223333333444444455555556666666 Alex Wood --e----------------------------------------ee-----------ee--nnn--e-----------------------------nnn-----ww---e---e---nnn-----w----------e----e---ewwe-------ee--ww-e-------e-----e--nnn weekend_exeter: 7,night: 12,exeter_twilight: 17, Michal Tomek -----ww----nnn--e-------------e-----------e---ewwe--e--------ww----nnn-------nnnn----e-------------------eee-e------------e---------------ww----nnn------------------e--e---------e--- weekend_exeter: 8,night: 13,exeter_twilight: 15, Wijhdan Abusrewil e---nnn--------------nnnn------e--------ww---------e--------------e-------nnn---------e----e-e--ww---------------e--e--ee---------eww-------nnnn-------e-----ee-----e----------------- weekend_exeter: 6,night: 14,exeter_twilight: 16, Madalina Drumea ---------------------e---nnn-----ww--e-e------nnn----e-----ee------e----e-e-------ww----nnn---e-------nnn---------------------e-------e-e--------------nnn---------e---------wwe------ weekend_exeter: 6,night: 15,exeter_twilight: 15, Salma Aslam -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sayed Alqarooni -e--------ee------e-------ww-e------e-e-----------e---ww-------nnnn--------wwe---------e---nnnn------e---------------------nnn--e--------------e-----------------e----------nnn--e-e-- weekend_exeter: 6,night: 14,exeter_twilight: 16, Delilah Trimmer -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Rebecca Murphy -------e------e-------e-e---nnnn--------------------------e----e-------e-e-----e--------e---e-----e------nnnn------------e-e-w-e-----e---nnn------------------nnn-----ww----e-------ww weekend_exeter: 5,night: 14,exeter_twilight: 17, Tom Welsh ----e---e-----------------------e--nnnn-------------------------e---wwe-------------e----ww-----------------------ee-ww-----------nnn----e---ee-----eee----------nnnn----e-----nnnn--- weekend_exeter: 6,night: 15,exeter_twilight: 15, Jin Virdi ---e-----e---------ww--e-e--e------e---------e----------nnnn------------------------nnnn-------e---ee---------ww---------------------------------------------------------------------- weekend_exeter: 4,night: 8,exeter_twilight: 10, Tania King Mohammed ------------ww-e-e---------------------nnn-------nnnn-----------------nnnn----e-ee--------------------e--------------------------e----------------------wwe----------------e---------- weekend_exeter: 4,night: 11,exeter_twilight: 9, Tom Davies -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Alexander Sanchez ------------ww--p--------p--------------------p-----p----p-----p-----------ww-----ww-----------p------nnn-----w-------------ww----nnn--------------nnnn---p-------p-p---nnnn---------- weekend_plymouth: 9,night: 14,plymouth_twilight: 10, Hannah Lewis ----p-------wwp-------------nnnn----p-ppww-------nnnn---p--p----p-----nnnn-------------------p-----p----------ww-----------------------------p---------------p-ww--------------------- weekend_plymouth: 8,night: 12,plymouth_twilight: 12, Seren Peters ---p-ww------------------------p-ww---------pp-------nnn-------------------------nnn-------nnnn-----------pp---w----------------p-----p-p--------------pww-------nnnn--------ww------- weekend_plymouth: 9,night: 14,plymouth_twilight: 10, Adeola Omotade -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Amina Odeh ---------p----nnnn--------ww--p----nnnn--------ww----------------------p----------------p-------ww---p---p-------p--nnn------------------nnn-----ww--p--------p----p--------------p--- weekend_plymouth: 8,night: 14,plymouth_twilight: 11, George Edwards --------------------------ww------w--------p-----pp-----nnnn--------------------ppww-----ww-------p------nnnn-----p----p-------------nnnn----------p-----------------nnn--p-----p----- weekend_plymouth: 7,night: 15,plymouth_twilight: 11, Jean Sukumar -----ww---p--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- weekend_plymouth: 2,plymouth_twilight: 1, -Week- 11111112222222333333344444445555555666666677777778888888999999900000001111111222222233333334444444555555566666667777777888888899999990000000111111122222223333333444444455555556666666 -Day- MTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSS Jenn Fong -p-----nnnn-------p----------------------------ww-----ww----------------------------p-------------nnnn------p--------ww----p--pp--pww-----------nnn-----------nnn-------p---p--p------ weekend_plymouth: 8,night: 14,plymouth_twilight: 11, Safi Rahman -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Khalil Madbak ---------------p---------nnn-----------nnn---------p--------nnn----p------nnn------------ww-p---ww--p--ww------------ww------------------------ppw----p--------------p-------------nnn weekend_plymouth: 9,night: 15,plymouth_twilight: 9, Natasha Hougham ----nnn------------------------------------------------------ww---------pp--------------------p------------------------nnnn----------p----ww---------------pp-----------------------ww plymouth_twilight: 6,night: 7,weekend_plymouth: 6, Richard Chaytor p-------p--p----------------pp-----p------------------ww-----------nnn-----ww--------------------------------p--nnnn----------nnnn------------p-----------nnnn--------ww-p-p--------ww weekend_plymouth: 8,night: 15,plymouth_twilight: 10, S Ghauri --p---------------------p-------nnn-------------------------------p-ww------------------nnn------------ww------------------nnn--------------------w-p----------------------------p---- weekend_plymouth: 5,night: 9,plymouth_twilight: 5, Sophie McGlade -----------------p-ww-p--------------p--------nnn-----------p----p--wwp---p--------------------nnn------------------p----p--ww---------p----nnnn--------ww-------p----------nnn----p-- weekend_plymouth: 8,night: 13,plymouth_twilight: 12, Huub Witt -------p---nnn-------nnnn--------w--------nnnn-------p----p----nnnn------------------ppp---p--------------------p---------p------p--------wwp-------------------------ww-----ww------- weekend_plymouth: 7,night: 15,plymouth_twilight: 11, Jon Stokes -------------------wwp---------------------------------------------------------------------------------------------------------------------------------------------------------------- weekend_plymouth: 2,plymouth_twilight: 1, Karis McFeely nnnn--------------nnn--p--------p-------wwp------------------ww--------------ppp----------------------p------nnn---p----p----------ww----p---------------------ww--------------nnnn--- weekend_plymouth: 8,night: 14,plymouth_twilight: 10, Mirna Long -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Christian Greer -------nnnn----------t------------------------t-----------------------------------------------t-ww-----ww-t-----nnnn-----------t----------wwttt----t------nnnn----t--t------t---t----w torquay_twilight: 13,night: 12,weekend_torquay: 7, Max Ireland ---------ttt--t---t----------------nnnn-----------------nnnn------------------------nnnn----t------------t---tww-----------------t---t----------t---t---ww------------ww--t---------w- weekend_torquay: 7,torquay_twilight: 13,night: 12, Alan Eccles -----ww----------------t------------------nnnn-----t------t------------------------------wwt-t---------------nnn-------nnnn-----t--------------------------t-------tt----t------------ night: 11,torquay_twilight: 10,weekend_torquay: 4, Charles Finan tt-----------------ww-t---------tww-t--t-------------nnn----t---------nnnn------------------------tt---------------t----------nnnn----t-t----------------------------nnn-----ww------- night: 14,torquay_twilight: 12,weekend_torquay: 6, Chong Ng ----nnn----------t-------tww--t----t--t--------ww---------------t-tt----t-t----t--------nnn----------t------t--------------nnn---------------------nnnn-------t-------------------t--- torquay_twilight: 15,night: 13,weekend_torquay: 4, Matthew Thorley nnnn--------------nnn-------t---------------t---------wwt------------------wwt---t----t--------nnn----t----------t------t--t-------------nnn----------t-----t-----------t------t------ torquay_twilight: 14,night: 13,weekend_torquay: 4, Mo Babsail ---t--------------------t----t----------ww-----------------t-ww----nnn---t-------nnn---t------------t----nnnn-------t----t--------t----t---------ww----nnn-----------------------t-t-- night: 13,torquay_twilight: 13,weekend_torquay: 6, Neil McIntyre --------t---ww-------nnnn------t----------tt-t-----------------t----wwt---nnn---t----t----------------nnn---------------------t----------t-----------t----t------t------nnnn---------- night: 14,torquay_twilight: 14,weekend_torquay: 4, -Week- 11111112222222333333344444445555555666666677777778888888999999900000001111111222222233333334444444555555566666667777777888888899999990000000111111122222223333333444444455555556666666 -Day- MTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSSMTWTFSS Paul Jenkins ---------------t----------------nnn--t------------t--------------t-----t-----nnnn--------------t--nnnn----------t----wwt--t--------ww-----------nnn----t-----t-ww----------t---------- weekend_torquay: 6,torquay_twilight: 12,night: 14, Gana Kugathasan -----------nnn--t--------------------------------------------------------------------------------------------------------------------------------------------------------------------- torquay_twilight: 1,night: 3, Harriet Conley -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Jon Skinner --t-t--t------nnnn-------------------------------t--tt---t--------------------t---wwt---t--nnnn------------t------t---------ww-------nnnn------t----------------------------nnn------- weekend_torquay: 4,torquay_twilight: 13,night: 15, Nicolas Dziad nnnn-------t------nnn---t-ww-----------------------t-----------nnnn-----------------t-------------nnnn------------------t-t---------------ww---t-----ttt--t----ww-----------------tt-- weekend_truro: 6,truro_twilight: 13,night: 15, Vilim Kalamar t--t------t-----------------ttt--ww-----wwt--t--------------------t---------------ww----------------------t--nnn--t----nnnn----------nnnn----------t----------nnn--------t------------ weekend_truro: 6,truro_twilight: 13,night: 14, Amoolya Mannava ------------wwtt----------------t---t------------nnnn------t-------------t------------t----------------ww-------nnnn----------ttt-t----t-t------t---t------------nnnn--------ww------- weekend_truro: 6,truro_twilight: 15,night: 12, Chi Leung --------------nnnn----t---------------------------t--t------nnn--t-----------nnnn-------------t---t--------t----tt-------t------------------nnnn--------ww-tt-----t---ww---------t---- weekend_truro: 4,truro_twilight: 14,night: 15, Jenna Millington --------------------------------nnn---------t-t-------------------------t-t---ttt---nnnn-------------------------------------------ww-------------------------------------t--------nnn weekend_truro: 2,truro_twilight: 8,night: 10, Paul Ward -t------t----------------nnn--------------nnnn-------------------------------t---------tt---t-------tt---t--ttww-----ww-----ww----nnn------------------------t------t---nnnn---------- weekend_truro: 6,truro_twilight: 13,night: 14, Sarath Vennam ----------------t-twwt------nnnn-----t---------ww---------------------t-------------------wt---t------t------------t-------t-----t---t--t----tt-----------nnnn-----t-----------nnnn--- weekend_truro: 5,truro_twilight: 16,night: 12, Ross Kruger --t----nnnn------------t-t---------t-------t-----t---nnn--------t--t-------ww-------------------ww-t-------------------t--------------t------------nnnn--------------nnn---tt---t---ww weekend_truro: 6,truro_twilight: 14,night: 14, Jack Looker -----wwt---------t--------------------tt------nnn---t-wwtt-----t----ww-t---------nnn---------t----------------------nnn--------------------------------nnn----t--t---t--t------t------ weekend_truro: 6,truro_twilight: 15,night: 12, Pete Abernethy ----t----t---------------------t-------nnn----------------t-tww------------------t---t---w--------------------------t---------nnnn----------t----ww----------------------------------- weekend_truro: 5,truro_twilight: 9,night: 7, -Week- 11111112222222333333344444445555555666666677777778888888999999900000001111111222222233333334444444555555566666667777777888888899999990000000111111122222223333333444444455555556666666
In [12]:
#workers_needed
print(worker_shift_summary)
7 e 2 [36]: exeter_twilight (17), weekend_exeter (7), night (12) 6 e 2 [36]: exeter_twilight (15), weekend_exeter (8), night (13) 1 e 2 [36]: exeter_twilight (16), weekend_exeter (6), night (14) 18 e 3 [36]: exeter_twilight (15), weekend_exeter (6), night (15) 11 e 3 [0]: 19 e 3 [36]: exeter_twilight (16), weekend_exeter (6), night (14) 28 e 4 [0]: 27 e 4 [36]: exeter_twilight (17), weekend_exeter (5), night (14) 26 e 4 [36]: exeter_twilight (15), weekend_exeter (6), night (15) 43 e 5 [22]: exeter_twilight (10), weekend_exeter (4), night (8) 42 e 5 [24]: exeter_twilight (9), weekend_exeter (4), night (11) 41 e 5 [0]: 8 p 2 [33]: plymouth_twilight (10), weekend_plymouth (9), night (14) 3 p 2 [32]: plymouth_twilight (12), weekend_plymouth (8), night (12) 2 p 2 [33]: plymouth_twilight (10), weekend_plymouth (9), night (14) 12 p 3 [0]: 13 p 3 [33]: plymouth_twilight (11), weekend_plymouth (8), night (14) 35 p 3 [33]: plymouth_twilight (11), weekend_plymouth (7), night (15) 20 p 3 [3]: plymouth_twilight (1), weekend_plymouth (2) 21 p 3 [33]: plymouth_twilight (11), weekend_plymouth (8), night (14) 34 p 3 [0]: 31 p 4 [33]: plymouth_twilight (9), weekend_plymouth (9), night (15) 32 p 4 [19]: plymouth_twilight (6), weekend_plymouth (6), night (7) 33 p 4 [33]: plymouth_twilight (10), weekend_plymouth (8), night (15) 30 p 4 [19]: plymouth_twilight (5), weekend_plymouth (5), night (9) 29 p 4 [33]: plymouth_twilight (12), weekend_plymouth (8), night (13) 44 p 5 [33]: plymouth_twilight (11), weekend_plymouth (7), night (15) 46 p 5 [3]: plymouth_twilight (1), weekend_plymouth (2) 47 p 5 [32]: plymouth_twilight (10), weekend_plymouth (8), night (14) 45 p 5 [0]: 4 t 2 [32]: torquay_twilight (13), weekend_torquay (7), night (12) 9 t 2 [32]: torquay_twilight (13), weekend_torquay (7), night (12) 15 t 3 [25]: torquay_twilight (10), weekend_torquay (4), night (11) 14 t 3 [32]: torquay_twilight (12), weekend_torquay (6), night (14) 22 t 3 [32]: torquay_twilight (15), weekend_torquay (4), night (13) 23 t 3 [31]: torquay_twilight (14), weekend_torquay (4), night (13) 37 t 3 [32]: torquay_twilight (13), weekend_torquay (6), night (13) 36 t 4 [32]: torquay_twilight (14), weekend_torquay (4), night (14) 38 t 4 [32]: torquay_twilight (12), weekend_torquay (6), night (14) 50 t 5 [4]: torquay_twilight (1), night (3) 48 t 5 [0]: 49 t 5 [32]: torquay_twilight (13), weekend_torquay (4), night (15) 5 t 2 [34]: truro_twilight (13), weekend_truro (6), night (15) 10 t 2 [33]: truro_twilight (13), weekend_truro (6), night (14) 40 t 3 [33]: truro_twilight (15), weekend_truro (6), night (12) 25 t 3 [33]: truro_twilight (14), weekend_truro (4), night (15) 24 t 3 [20]: truro_twilight (8), weekend_truro (2), night (10) 17 t 3 [33]: truro_twilight (13), weekend_truro (6), night (14) 16 t 3 [33]: truro_twilight (16), weekend_truro (5), night (12) 39 t 4 [34]: truro_twilight (14), weekend_truro (6), night (14) 51 t 5 [33]: truro_twilight (15), weekend_truro (6), night (12) 52 t 5 [21]: truro_twilight (9), weekend_truro (5), night (7)
In [13]:
print(multi)None
In [14]:
#worker_night_blockIn [15]:
#[[worker, week, day, shift] for day in days for shift in ["night"]]In [16]:
1 if 4 in [4, 1, 0] else 0Out [16]:
1
In [17]:
(4 + 1) // 7Out [17]:
0
In [18]:
#for worker in workers:
# for shift in shifts:
# a = [model.works[worker.id, week, day, shift].value for week in weeks for day in days]In [19]:
a[0;31m---------------------------------------------------------------------------[0m [0;31mNameError[0m Traceback (most recent call last) [0;32m<ipython-input-19-3f786850e387>[0m in [0;36m<module>[0;34m[0m [0;32m----> 1[0;31m [0ma[0m[0;34m[0m[0;34m[0m[0m [0m [0;31mNameError[0m: name 'a' is not defined
In [20]:
0 % 7Out [20]:
0
In [21]:
-1 % 7Out [21]:
6
In [22]:
model.shift_count[(5, "night")].value[0;31m---------------------------------------------------------------------------[0m [0;31mNameError[0m Traceback (most recent call last) [0;32m<ipython-input-22-4d45c109f633>[0m in [0;36m<module>[0;34m[0m [0;32m----> 1[0;31m [0mmodel[0m[0;34m.[0m[0mshift_count[0m[0;34m[[0m[0;34m([0m[0;36m5[0m[0;34m,[0m [0;34m"night"[0m[0;34m)[0m[0;34m][0m[0;34m.[0m[0mvalue[0m[0;34m[0m[0;34m[0m[0m [0m [0;31mNameError[0m: name 'model' is not defined
In [23]:
[w.id for w in workers][0;31m---------------------------------------------------------------------------[0m [0;31mNameError[0m Traceback (most recent call last) [0;32m<ipython-input-23-2f761ca0465d>[0m in [0;36m<module>[0;34m[0m [0;32m----> 1[0;31m [0;34m[[0m[0mw[0m[0;34m.[0m[0mid[0m [0;32mfor[0m [0mw[0m [0;32min[0m [0mworkers[0m[0;34m][0m[0;34m[0m[0;34m[0m[0m [0m [0;31mNameError[0m: name 'workers' is not defined
In [ ]: