-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell_test.py
More file actions
30 lines (25 loc) · 764 Bytes
/
Copy pathshell_test.py
File metadata and controls
30 lines (25 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from class_timetable.utils import (
CLASS_CONFIG,
generate_timetable_for_class,
validate_workload_distribution,
)
import random
class_keys = list(CLASS_CONFIG.keys())
for attempt in range(5):
# clear all first
for k, cfg in CLASS_CONFIG.items():
cfg["timetable"].objects.all().delete()
random.shuffle(class_keys)
print(f"Order: {class_keys}")
# Generate
for key in class_keys:
generate_timetable_for_class(key, allow_extra=False)
deficits = {
k: validate_workload_distribution(k).get("total_practical_deficit", 0)
for k in class_keys
}
total = sum(deficits.values())
print(f"Attempt {attempt} deficits: {deficits}")
if total == 0:
print("PERFECT!")
break