-
Notifications
You must be signed in to change notification settings - Fork 0
/
bus.py
48 lines (39 loc) · 1.07 KB
/
bus.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
from collections import defaultdict
class Bus(object):
"""Bus Class ..."""
def __init__(self, bus_id, stop_num):
self.bus_id = bus_id # int
self.loc = 0.0
self.trajectories = defaultdict(float)
self.is_running = True
# None means not at the stop
self.current_stop = None
self.holding_time = None
# arrival times at each stop
self.arr_times = defaultdict(float)
# previous arrival times at each stops
self.prev_arr_times = defaultdict(float)
self.travel_speed_this_link = None
self.is_counted = True
def get_obs(self):
pass
if __name__ == "__main__":
pass
# 1.
# def set_loc(a, bus):
# bus.loc = a
# bus = Bus(15)
# print(bus.loc)
# set_loc(100, bus)
# print(bus.loc)
# buses = [Bus(15), Bus(20)]
# print(buses)
# for bus in buses:
# set_loc(100, bus)
# for bus in buses:
# print(bus.loc)
# 2.
# a = [3,4,5]
# b = [x for x in a if x > 100]
# assert b == []
# 3.