Skip to content

Commit c00120d

Browse files
committed
tidy up find_next_individual
1 parent a6a2131 commit c00120d

3 files changed

Lines changed: 3 additions & 8 deletions

File tree

ciw/node.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def begin_service_if_possible_accept(self,
128128
def begin_interrupted_individuals_service(self, current_time, srvr):
129129
"""
130130
Restarts the next interrupted individual's service (by
131-
resampking service time)
131+
resampling service time)
132132
"""
133133
ind = [i for i in self.interrupted_individuals][0]
134134
ind.service_time = self.get_service_time(ind.customer_class,
@@ -268,9 +268,8 @@ def find_next_individual(self):
268268
"""
269269
Finds the next individual that should now finish service
270270
"""
271-
next_individual_indices = [i for i, x in enumerate(
272-
[ind.service_end_date for ind in self.all_individuals]
273-
) if x == self.next_event_date]
271+
next_individual_indices = [i for i, ind in enumerate(
272+
self.all_individuals) if ind.service_end_date == self.next_event_date]
274273
if len(next_individual_indices) > 1:
275274
next_individual_index = random_choice(next_individual_indices)
276275
else:

ciw/tests/test_node.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ def test_change_customer_class_method(self):
100100
self.assertEqual(ind.customer_class, 1)
101101
self.assertEqual(ind.previous_class, 0)
102102

103-
104103
# Test for case of having priorities
105104
ciw.seed(14)
106105
parameters_dictionary = ciw.load_parameters(
@@ -155,7 +154,6 @@ def test_change_customer_class_method(self):
155154
self.assertEqual(ind.priority_class, 0)
156155
self.assertEqual(ind.previous_class, 0)
157156

158-
159157
def test_block_individual_method(self):
160158
ciw.seed(4)
161159
Q = ciw.Simulation(ciw.create_network_from_yml(
@@ -215,7 +213,6 @@ def test_release_method(self):
215213
N.update_next_event_date(N.next_event_date)
216214
self.assertEqual(round(N.next_event_date, 5), 0.06447)
217215

218-
219216
def test_begin_service_if_possible_release_method(self):
220217
ciw.seed(50)
221218
Q = ciw.Simulation(ciw.create_network_from_yml(

ciw/tests/test_simulation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ def test_simultaneous_events_example(self):
354354
'Transition_matrices': [[1.0, 0.0], [0.0, 0.0]],
355355
'Number_of_servers': [2, 1]}
356356

357-
358357
ciw.seed(36)
359358
Q = ciw.Simulation(ciw.create_network(**params))
360359
Q.simulate_until_max_time(36)

0 commit comments

Comments
 (0)