You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Tutorial-II/tutorial_vii.rst
+29-23Lines changed: 29 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,33 +67,39 @@ Now we should see that no customer of Class 0 ever reached Node 3; and no custom
67
67
>>> set([r.node for r in recs if r.customer_class==1]) == visited_by_children
68
68
True
69
69
70
-
Now say we'd like to find the average waiting time at the reception, baby specialist's clinic, and children's specialist's clinic. We'll simulate for 24 hours, using 3 hour warm-up and 3 hour cool-down, for 16 trials. Let's collect the average waiting times at each node every time::
71
-
72
-
>>> average_waits_1 = []
73
-
>>> average_waits_2 = []
74
-
>>> average_waits_3 = []
75
-
>>> for trial in range(16):
76
-
... ciw.seed(trial)
77
-
... Q = ciw.Simulation(N)
78
-
... Q.simulate_until_max_time(30)
79
-
... recs = Q.get_all_records()
80
-
... waits1 = [r.waiting_time for r in recs if r.node==1 and r.arrival_date > 3 and r.arrival_date < 27]
81
-
... waits2 = [r.waiting_time for r in recs if r.node==2 and r.arrival_date > 3 and r.arrival_date < 27]
82
-
... waits3 = [r.waiting_time for r in recs if r.node==3 and r.arrival_date > 3 and r.arrival_date < 27]
Now say we'd like to find the average waiting time at the reception, baby specialist's clinic, and children's specialist's clinic. We'll simulate for 24 hours, using 3 hour warm-up and 3 hour cool-down, for 16 trials. Let's collect the average waiting times for each class at each node every time::
71
+
72
+
>>> average_waits_1_babies = []
73
+
>>> average_waits_1_children = []
74
+
>>> average_waits_2 = []
75
+
>>> average_waits_3 = []
76
+
>>> for trial in range(16):
77
+
... ciw.seed(trial)
78
+
... Q = ciw.Simulation(N)
79
+
... Q.simulate_until_max_time(30)
80
+
... recs = Q.get_all_records()
81
+
... waits1_babies = [r.waiting_time for r in recs if r.node==1 and r.arrival_date > 3 and r.arrival_date < 27 and r.customer_class == 0]
82
+
... waits1_children = [r.waiting_time for r in recs if r.node==1 and r.arrival_date > 3 and r.arrival_date < 27 and r.customer_class == 1]
83
+
... waits2 = [r.waiting_time for r in recs if r.node==2 and r.arrival_date > 3 and r.arrival_date < 27]
84
+
... waits3 = [r.waiting_time for r in recs if r.node==3 and r.arrival_date > 3 and r.arrival_date < 27]
0 commit comments