I am developing an agent based model simulating the growth in-vitro of a cell culture.
I am using the MASON library (Java), but I guess by question could be applicable to different implementations.
Essentially, my agents are programmed to divide every 12 +/- 2 timesteps after their creation. Every time an agent divides, a new one is added to the simulation.
This leads to a very rapid growth of the problem's complexity, which quickly makes the simulation particularly slow.
In order to solve this problem, I decided agents should 'die' after t timesteps from creation.
However, MASON's schedule is built on a BinaryHeap which does not easily allow the removal objects (agents) once they have been added. My solution has been to set a boolean flag:
dead = false;
Which is set to true after t time-steps.
So
if(t == 50)
dead = true;
I then begin my step method, that is the method called each time an agent is stepped, as follows:
if(dead)
return;
However, I understand that simply accessing the object in the schedule is enough to slow the simulation down.
Does anybody have any suggestions as to how I could unset the agent or prevent it from being called?
Thanks, Dario