ukhsa-collaboration / pygom

ODE modelling in Python
GNU General Public License v2.0
27 stars 20 forks source link

Stochastic simulation could do with a break clause if specified populations reach 0. #30

Closed MGrunnill closed 1 month ago

MGrunnill commented 5 years ago

Depending on the nature of the stochastic simulation if certain class/es have gone extinct it is not necessary to continue running the simulation. A break clause could be added to stop a simulation if the population in certain class/es reached 0.

Within the module simulate.py following additions could be made:

twomagpi commented 5 years ago

Would halting occur when any class in the list went extinct or only if all classes went extinct?

I can think of cases where both would be helpful. How should the api look to allow eaither case?

Are there likely to be issues induced by having response variables of differing lengths from different runs?

twomagpi commented 4 years ago

Might be possible to make this a bit more generic and introduce stopping conditions for stochastic simulations. Perhaps the simulate api should accept an interable of stopping condition objects. These objects would then have state and conditional attributes. I.e. for the case outlined in @MGrunnill 's initial issue these might be 'S' and '<= 0'. There is also the thought that the condition itself should perhaps be an equation (like the transition objects) so that you could set up conditions like 'S' '< 2 R' to make this as flexible as possible.

twomagpi commented 4 years ago

With this the answer to the inital questions would be:

twomagpi commented 1 month ago

After consideration this significantly complicates the (already complicated) code. so will not happen at this stage.