Skip to content

Commit 7ced6d1

Browse files
committed
fix bug in which interrupted individuals note removed from interrupted list when restarting service
1 parent 0ca93db commit 7ced6d1

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

ciw/individual.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(self, id_number, customer_class=0, priority_class=0):
2424
self.queue_size_at_arrival = False
2525
self.queue_size_at_departure = False
2626
self.destination = False
27+
self.interrupted = False
2728

2829
def __repr__(self):
2930
"""

ciw/node.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def begin_interrupted_individuals_service(self, current_time, srvr):
144144
current_time)
145145
ind.service_end_date = self.increment_time(self.get_now(current_time),
146146
ind.service_time)
147+
ind.interrupted = False
147148
self.attach_server(srvr, ind)
148149
self.interrupted_individuals.remove(ind)
149150
self.number_interrupted_individuals -= 1
@@ -395,6 +396,10 @@ def release_blocked_individual(self, current_time):
395396
individual_to_receive_index]
396397
self.blocked_queue.pop(0)
397398
self.len_blocked_queue -= 1
399+
if individual_to_receive.interrupted:
400+
individual_to_receive.interrupted = False
401+
node_to_receive_from.interrupted_individuals.remove(individual_to_receive)
402+
node_to_receive_from.number_interrupted_individuals -= 1
398403
node_to_receive_from.release(individual_to_receive_index,
399404
self, current_time)
400405

@@ -425,6 +430,7 @@ def take_servers_off_duty(self):
425430
s.shift_end = self.next_event_date
426431
if s.cust is not False:
427432
self.interrupted_individuals.append(s.cust)
433+
s.cust.interrupted = True
428434
self.number_interrupted_individuals += 1
429435
self.interrupted_individuals[-1].service_end_date = False
430436
self.interrupted_individuals[-1].service_time = False
@@ -433,6 +439,7 @@ def take_servers_off_duty(self):
433439
for obs in to_delete:
434440
self.kill_server(obs)
435441

442+
436443
def update_next_event_date(self, current_time):
437444
"""
438445
Finds the time of the next event at this node

0 commit comments

Comments
 (0)