diff --git a/R/simulation.R b/R/simulation.R index 5453ad6..cee2cb0 100644 --- a/R/simulation.R +++ b/R/simulation.R @@ -6,6 +6,7 @@ #' @param processes a list of processes to execute on each timestep #' @param timesteps the end timestep of the simulation. If `state` is not NULL, timesteps must be greater than `state$timestep` #' @param state a checkpoint from which to resume the simulation +#' @param restore_random_state if TRUE, restore R's global random number generator's state from the checkpoint. #' @examples #' population <- 4 #' timesteps <- 5 @@ -100,6 +101,7 @@ checkpoint_state <- function(timesteps, variables, events) { #' @param state the simulation state to restore, as returned by \code{\link[individual]{restore_state}}. #' @param variables the list of Variables #' @param events the list of Events +#' @param restore_random_state if TRUE, restore R's global random number generator's state from the checkpoint. restore_state <- function(state, variables, events, restore_random_state) { timesteps <- state$timesteps + 1 diff --git a/man/Event.Rd b/man/Event.Rd index 6d23ec4..799fc9f 100644 --- a/man/Event.Rd +++ b/man/Event.Rd @@ -7,7 +7,7 @@ Describes a general event in the simulation. } \section{Super class}{ -\code{individual::EventBase} -> \code{Event} +\code{\link[individual:EventBase]{individual::EventBase}} -> \code{Event} } \section{Methods}{ \subsection{Public methods}{ diff --git a/man/TargetedEvent.Rd b/man/TargetedEvent.Rd index b691293..d12f2c0 100644 --- a/man/TargetedEvent.Rd +++ b/man/TargetedEvent.Rd @@ -8,7 +8,7 @@ Describes a targeted event in the simulation. This is useful for events which are triggered for a sub-population. } \section{Super class}{ -\code{individual::EventBase} -> \code{TargetedEvent} +\code{\link[individual:EventBase]{individual::EventBase}} -> \code{TargetedEvent} } \section{Methods}{ \subsection{Public methods}{ diff --git a/man/restore_state.Rd b/man/restore_state.Rd index 44bfad4..abfdfe1 100644 --- a/man/restore_state.Rd +++ b/man/restore_state.Rd @@ -4,7 +4,7 @@ \alias{restore_state} \title{Restore the simulation state} \usage{ -restore_state(state, variables, events) +restore_state(state, variables, events, restore_random_state) } \arguments{ \item{state}{the simulation state to restore, as returned by \code{\link[individual]{restore_state}}.} @@ -12,6 +12,8 @@ restore_state(state, variables, events) \item{variables}{the list of Variables} \item{events}{the list of Events} + +\item{restore_random_state}{if TRUE, restore R's global random number generator's state from the checkpoint.} } \description{ Restore the simulation state from a previous checkpoint. diff --git a/man/simulation_loop.Rd b/man/simulation_loop.Rd index e809ee6..5b2b887 100644 --- a/man/simulation_loop.Rd +++ b/man/simulation_loop.Rd @@ -9,7 +9,8 @@ simulation_loop( events = list(), processes = list(), timesteps, - state = NULL + state = NULL, + restore_random_state = FALSE ) } \arguments{ @@ -19,9 +20,11 @@ simulation_loop( \item{processes}{a list of processes to execute on each timestep} -\item{timesteps}{the number of timesteps to simulate} +\item{timesteps}{the end timestep of the simulation. If \code{state} is not NULL, timesteps must be greater than \code{state$timestep}} \item{state}{a checkpoint from which to resume the simulation} + +\item{restore_random_state}{if TRUE, restore R's global random number generator's state from the checkpoint.} } \description{ Run a simulation where event listeners take precedence