You are here

Randmoness in the initialization of a new instance...

When searching from the source of unexpected randomness in a purely deterministic model, I discovered a very strange behavior, which can be reproduced in a very simple population model:
Consider a population submodel containing a single compartment with a constant initial value, say 100. Add an constant outflow of 0.01 and an immigration of 2. Run the model several times for a short period (10).
If you don't choose the run settings for a discrete model (i.e. Euler and dt=1), you will see that the initial values of the new instances are not constant as expected but vary randomly between 99.99 and 100.
Does it mean that populations submodels cannot be used in combination with differential equations requiring small dt and Runge-Kutta algorithm?


In fact, just after posting the previous message, I realized that the issue is not due to a wrong intialization of the compartment but to an anticipation of the immigration time when dt For example, when choosing dt = 0.1 and setting up display interval to the same value, I got new individuals before year 1.
So my question becomes: how to set up immigration so that new individuals appear simultaneously at fixed intervals and not randomly within these intervals?

Hi -- the random time at which the first individual immigrates is intentional, though some users find it inconvenient! To get them at an exact time, make the value of the immigration channel equal to n/dt() at that time step (where n is the number of individuals you want) and 0 at other time steps. Cheers