this function accepts an initial simulation state as an argument, and returns the final state after running all of its timesteps. This allows one run to be resumed, possibly having changed some of the parameters.

run_resumable_simulation(
  timesteps,
  parameters = NULL,
  correlations = NULL,
  initial_state = NULL,
  restore_random_state = FALSE
)

Arguments

timesteps

the timestep at which to stop the simulation

parameters

a named list of parameters to use

correlations

correlation parameters

initial_state

the state from which the simulation is resumed

restore_random_state

if TRUE, restore the random number generator's state from the checkpoint.

Value

a list with two entries, one for the dataframe of results and one for the final simulation state.