-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EventQueueABM example giving incorrect results #1110
Comments
Hi, what is the thing that you believe is behaving "incorrectly"? Is it the event queing, the propensity timing estimation, or something else? The result of the continuous time implementation is: and the result of the discrete time, scaled to the same time units is: The blue and green curves to me seem very similar but for the continuous time case they need to be run for longer time, like tf=50. Is this the problem that you are reporting? I haven't read your source code in deep detail yet. |
@sdwfrost see epirecipes/sir-julia#153, I found our issue, sorry, not quite in time =) |
thanks @sdwfrost . Yes, the event queue is always a bit tricky to wrap your head around when moving from the discrete time. One needs to take care of when an event should be scheduled and when not, because for the continuous time scheduled event == triggered event. I assume this is safe to close now. |
That's why the two graphs look the same but the continuous time is "slower": even though the infect action function does check whether an agent is infected, it was still scheduled and triggered for non infected agents, essentially "wasting" some of the agents' time, if this makes any sense. As an event for an agent is scheduled always after a previous event has happened, this effectively slowed down the simulation. Does it make sense now? Its because for continuous time all events (actions) take time, regardless if they actually alter any agent property or not. |
By the way I'm pleased by the fact that our des works so much faster than the SimJulia one |
What's the numbers? I can't seem to find them at the repo now... |
I think they are https://github.com/epirecipes/sir-julia/blob/master/markdown/des/des.md#benchmarking and https://github.com/epirecipes/sir-julia/blob/master/markdown/des_agentsjl/des_agentsjl.md#benchmarking (maybe even slightly better by the latest fix) |
Oh yeah, that is almost 10x 🔥 |
Describe the bug
I'm trying out the continuous time version of a toy model I use for demonstrating simulation/inference capabilities in Julia. Previously, I have coded up a
StandardABM
, which works fine, and gives results comparable to a hand-coded exanmple. However, although my EventQueueABM runs without error, it is not giving the correct dynamics. A version of the same model, but using SimJulia, can be found here. The peak number of infected individuals in my model comes too late - I've checked with different population sizes/multiple runs, and this is a systematic effect, not a stochastic one. I think that I'm implementing the model correctly - do you have any suggestions?Minimal Working Example
Julia script: https://github.com/epirecipes/sir-julia/blob/master/script/des_agentsjl/des_agentsjl.jl
Julia Markdown: https://github.com/epirecipes/sir-julia/blob/master/tutorials/des_agentsjl/des_agentsjl.jmd
Agents.jl version
v6.1.12
The text was updated successfully, but these errors were encountered: