-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
42 lines (34 loc) · 1003 Bytes
/
main.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
"""
IDE: PyCharm
Project: buds-climatehack
Author: mosc5
Filename: main.py
Date: 13.11.2021
"""
import algorithms
import algorithms.simulation as simulation
import json
from datetime import datetime
from algorithms.fixed_schedule import FixedSchedule
def parse_customers(file_name):
"""
Parse customer JSON from data directory with specified name
:param file_name: "example.json"
:return:
"""
with open("data/"+file_name) as f:
data = json.load(f)
for customer in data:
# now song is a dictionary
for attribute, value in customer.items():
if 'time' in attribute:
customer[attribute] = datetime.strptime(value, '%Y-%m-%d %H:%M:%S')
return data
if __name__ == '__main__':
customers = parse_customers("customers.json")
with open("data/points.json") as p:
points = json.load(p)
alg1 = FixedSchedule("stop_a", [], points)
alg_list = []
sim = simulation.Simulation(alg_list)
sim.run()