Skip to content

Commit

Permalink
use number_of_individuals instead of len(all_individuals)
Browse files Browse the repository at this point in the history
  • Loading branch information
geraintpalmer committed Apr 3, 2024
1 parent 9d00262 commit dfa7345
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ciw/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ def find_number_of_slotted_services(self):
Finds the number of slotted services to start in this slot
"""
if self.schedule.capacitated:
return min(max(self.schedule.slot_size - self.number_in_service, 0), len(self.all_individuals))
return min(self.schedule.slot_size, len(self.all_individuals))
return min(max(self.schedule.slot_size - self.number_in_service, 0), self.number_of_individuals)
return min(self.schedule.slot_size, self.number_of_individuals)

def interrupt_slotted_services(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion ciw/tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ def my_baulking_function(n, Q=None, next_ind=None, next_node=None):

def test_state_dependent_baulking(self):
def my_baulking_function(n, Q, next_ind=None, next_node=None):
total_population = sum(len(node.all_individuals) for node in Q.transitive_nodes)
total_population = sum(node.number_of_individuals for node in Q.transitive_nodes)
if total_population < 5:
return 0.0
return 1.0
Expand Down

0 comments on commit dfa7345

Please sign in to comment.