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 3
3
import collections
4
4
import queue
5
5
6
- Event = collections .namedtuple ('Event' , 'time actor description' )
7
-
8
6
FIND_CUSTOMER_INTERVAL = 4
9
7
TRIP_DURATION = 10
10
8
9
+ Event = collections .namedtuple ('Event' , 'time actor description' )
11
10
12
11
def compute_delay (interval ):
13
- return int (random .expovariate (1 / interval ))
12
+ return int (random .expovariate (1 / interval )) + 1
14
13
15
14
16
15
def taxi_process (sim , ident ):
@@ -30,6 +29,7 @@ def __init__(self):
30
29
self .time = 0
31
30
32
31
def run (self , end_time ):
32
+ #import pdb; pdb.set_trace()
33
33
taxis = [taxi_process (self , i ) for i in range (3 )]
34
34
while self .time < end_time :
35
35
for index , taxi in enumerate (taxis ):
@@ -50,6 +50,9 @@ def run(self, end_time):
50
50
51
51
52
52
def main (args ):
53
+ if 'debug' in args : # for testing...
54
+ random .seed (0 ) # get reproducible results
55
+ args .remove ('debug' )
53
56
if args :
54
57
end_time = int (args [0 ])
55
58
else :
You can’t perform that action at this time.
0 commit comments