1
0
mirror of https://github.com/gsi-upm/soil synced 2025-08-24 12:02:20 +00:00

Add rescheduling for received

This commit is contained in:
J. Fernando Sánchez
2023-05-19 16:19:50 +02:00
parent ee0c4517cb
commit 189836408f
34 changed files with 674 additions and 260 deletions

View File

@@ -167,7 +167,7 @@ class RandomAccident(BaseAgent):
if self.prob(prob_death):
self.debug("I killed a rabbit: {}".format(i.unique_id))
num_alive -= 1
i.die()
self.model.remove_agent(i)
self.debug("Rabbits alive: {}".format(num_alive))

View File

@@ -142,13 +142,15 @@ class RandomAccident(BaseAgent):
prob_death = min(1, self.prob_death * num_alive/10)
self.debug("Killing some rabbits with prob={}!".format(prob_death))
for i in self.get_agents(agent_class=Rabbit):
for i in alive:
if i.state_id == i.dead.id:
continue
if self.prob(prob_death):
self.debug("I killed a rabbit: {}".format(i.unique_id))
num_alive -= 1
i.die()
self.model.remove_agent(i)
i.alive = False
i.killed = True
self.debug("Rabbits alive: {}".format(num_alive))