Skip to content

Commit 2d47ffa

Browse files
committed
simultaneous events test yielded bug, fixed this
1 parent 6ac35e8 commit 2d47ffa

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

ciw/tests/test_simulation.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,29 @@ def test_writing_data_files(self):
666666
os.remove('ciw/tests/datafortesting/logs_test_for_mm1/data_1.csv')
667667

668668
def test_simultaneous_events_example(self):
669+
# This should yield 3 or 2 customers finishing service.
670+
# Due to randomly choosing the order of events, the seed has
671+
# a big affect on this.
672+
673+
set_seed(73)
674+
Arrival_distributions = [['Deterministic', 10.0], 'NoArrivals']
675+
Service_distributions = [['Deterministic', 5.0], ['Deterministic', 5.0]]
676+
Transition_matrices = [[1.0, 0.0], [0.0, 0.0]]
677+
Simulation_time = 36
678+
Number_of_servers = [2, 1]
679+
Q = ciw.Simulation(Arrival_distributions = Arrival_distributions,
680+
Service_distributions = Service_distributions,
681+
Transition_matrices = Transition_matrices,
682+
Simulation_time = Simulation_time,
683+
Number_of_servers = Number_of_servers)
684+
Q.simulate_until_max_time()
685+
inds = Q.get_all_individuals()
686+
recs = Q.get_all_records()
687+
self.assertEqual(len(inds), 2)
688+
self.assertTrue(all([x[6] == 5.0 for x in recs[1:]]))
689+
690+
691+
set_seed(74)
669692
Arrival_distributions = [['Deterministic', 10.0], 'NoArrivals']
670693
Service_distributions = [['Deterministic', 5.0], ['Deterministic', 5.0]]
671694
Transition_matrices = [[1.0, 0.0], [0.0, 0.0]]

0 commit comments

Comments
 (0)