Hi Steve,

I apply a similar strategy. These are Acceleo templates but you can still get an idea. An agent adds itself to a Garbage collection once it falls outside a certain criterion [0]. At the end of each time step the Garbage collection is iterated through [1] and "dead" agents are discarded.

Regards,

Luís

[0] https://github.com/MDDLingo/dsl3s.mdd3s/blob/41cfbfd544e33dfdc8a69ef2f1caa3ae06f2aed3/src/dsl3s/mdd3s/templates/operPerish.mtl#L42

[1] https://github.com/MDDLingo/dsl3s.mdd3s/blob/41cfbfd544e33dfdc8a69ef2f1caa3ae06f2aed3/src/dsl3s/mdd3s/templates/sim.mtl#L71