mirror of
https://github.com/gsi-upm/soil
synced 2025-08-24 03:52:20 +00:00
Add rescheduling for received
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
|
@@ -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))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user