-
Notifications
You must be signed in to change notification settings - Fork 1
/
CodeCraft-2019.py
41 lines (30 loc) · 1.06 KB
/
CodeCraft-2019.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
import logging
import sys
logging.basicConfig(level=logging.DEBUG,
filename='../logs/CodeCraft-2019.log',
format='[%(asctime)s] %(levelname)s [%(funcName)s: %(filename)s, %(lineno)d] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
filemode='a')
def main():
if len(sys.argv) != 5:
logging.info('please input args: car_path, road_path, cross_path, answerPath')
exit(1)
car_path = sys.argv[1]
road_path = sys.argv[2]
cross_path = sys.argv[3]
answer_path = sys.argv[4]
logging.info("car_path is %s" % (car_path))
logging.info("road_path is %s" % (road_path))
logging.info("cross_path is %s" % (cross_path))
logging.info("answer_path is %s" % (answer_path))
# to read input file
import trafficmap
sch = trafficmap.Schedule()
sch.read_file(car_path, road_path, cross_path)
motor_cade = trafficmap.Motorcade(2000)
# process
sch.calculator(motor_cade)
# to write output file
sch.output(answer_path)
if __name__ == "__main__":
main()