Skip to content

Commit 6ae3d84

Browse files
committed
taxi_sim (currently buggy, working on it...)
1 parent 7ec5f62 commit 6ae3d84

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

control/simulation/taxi_sim.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
import collections
44
import queue
55

6-
Event = collections.namedtuple('Event', 'time actor description')
7-
86
FIND_CUSTOMER_INTERVAL = 4
97
TRIP_DURATION = 10
108

9+
Event = collections.namedtuple('Event', 'time actor description')
1110

1211
def compute_delay(interval):
13-
return int(random.expovariate(1/interval))
12+
return int(random.expovariate(1/interval)) + 1
1413

1514

1615
def taxi_process(sim, ident):
@@ -30,6 +29,7 @@ def __init__(self):
3029
self.time = 0
3130

3231
def run(self, end_time):
32+
#import pdb; pdb.set_trace()
3333
taxis = [taxi_process(self, i) for i in range(3)]
3434
while self.time < end_time:
3535
for index, taxi in enumerate(taxis):
@@ -50,6 +50,9 @@ def run(self, end_time):
5050

5151

5252
def main(args):
53+
if 'debug' in args: # for testing...
54+
random.seed(0) # get reproducible results
55+
args.remove('debug')
5356
if args:
5457
end_time = int(args[0])
5558
else:

0 commit comments

Comments
 (0)