Skip to content
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

If the mod$run is executed again, would it continue from its previous state? #143

Open
apbarraza opened this issue Oct 8, 2020 · 1 comment

Comments

@apbarraza
Copy link

Hi,

I am interested in using your disease model to test a "dynamic" intervention policy.
I understand that the current simulation run allows for applying interventions. However, the intervention plan would have to be decided beforehand, it would be "static".

I would like to know if I can execute the simulation in small consecutive time periods. For instance, the model could first run 2 days, then a change on the intervention policy might occur, and then the goal would be to execute the next time period from where the last one left off including the new intervention, and so forth.

More specifically, I am wondering, in run.R, if the mod$run is executed again, would it continue from its previous state?
Setting replicates = 1 in the stochastic case.

Thank you,
Andrea

@OJWatson
Copy link
Collaborator

Hey, Sorry for the delay.

mod$run will run from the initial state it is given. So if you run it again, it will use the same starting condition. The way to do that would be to run the model and then pass in the model state back to mod$run. This is what we do in the projections function here:

https://github.com/mrc-ide/squire/blob/master/R/projections.R#L368-L371

However, if you know already wht your intervention is that you want to put in place after 2 days then you can just do that when you call run the first time. If, however, you want to have an intervention come in when some condition is reached then that is harder. However, I am currently writing some functionality for that in the triggering branch which should be ready shortly.

Hope that helps,

OJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants