File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 33import collections
44import queue
55
6- Event = collections .namedtuple ('Event' , 'time actor description' )
7-
86FIND_CUSTOMER_INTERVAL = 4
97TRIP_DURATION = 10
108
9+ Event = collections .namedtuple ('Event' , 'time actor description' )
1110
1211def compute_delay (interval ):
13- return int (random .expovariate (1 / interval ))
12+ return int (random .expovariate (1 / interval )) + 1
1413
1514
1615def 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
5252def 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 :
You can’t perform that action at this time.
0 commit comments