-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimportTestDays.py
executable file
·64 lines (56 loc) · 1.58 KB
/
importTestDays.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
Author: Corneel den Hartogh
Course: Heuristics
Description: Script for analyzing the used slots per day
"""
import random
import copy
import json
import time
import glob
from decimal import Decimal
from csvFilesController import classrooms,subjects,students
from classes import Classroom,Subject,Activity,Student,Roster
import classesImport as ci
from scoreFunction import getScore
from studentOptimization import studentOptimization
from roomOptimization import roomOptimization
rosters = 0
activityTypes = {}
# select all rosters that score 99% of optimal score (=1360)
for filename in glob.glob('rosters_computer_1/*.json'):
if float(filename.split("_",4)[3]) >= 1360.00:
rosters += 1
monday,tuesday,wednesday,thursday,friday = 0,0,0,0,0
with open(filename) as jsonfile:
data = json.load(jsonfile)
for x in (data["roster"]["activities"]):
value = x["activity"]["slot"][0]
if value == 0:
monday += 1
elif value == 1:
tuesday += 1
elif value == 2:
wednesday += 1
elif value == 3:
thursday += 1
elif value == 4:
friday += 1
for filename in glob.glob('rosters_computer_2/*.json'):
if float(filename.split("_",4)[3]) >= 1360.00:
rosters += 1
monday,tuesday,wednesday,thursday,friday = 0,0,0,0,0
with open(filename) as jsonfile:
data = json.load(jsonfile)
for x in (data["roster"]["activities"]):
value = x["activity"]["slot"][0]
if value == 0:
monday += 1
elif value == 1:
tuesday += 1
elif value == 2:
wednesday += 1
elif value == 3:
thursday += 1
elif value == 4:
friday += 1