View source: R/utilities-simulation.R
runSimulations | R Documentation |
Runs multiple simulations concurrently.
runSimulations(
simulations,
population = NULL,
agingData = NULL,
simulationRunOptions = NULL,
silentMode = FALSE,
stopIfFails = FALSE
)
simulations |
One |
population |
Optional instance of a |
agingData |
Optional instance of |
simulationRunOptions |
Optional instance of a |
silentMode |
If |
stopIfFails |
Whether to stop the execution if one of the simulations failed. Default is |
For multiple simulations, only individual simulations are possible. For single simulation, either individual or population simulations can be performed.
A named list of SimulationResults
objects with names being the IDs
of the respective simulations. If a simulation fails, the result for this
simulation is NULL
simPath <- system.file("extdata", "simple.pkml", package = "ospsuite")
sim <- loadSimulation(simPath)
# Running an individual simulation
# Results is a list with one object `SimulationResults`
results <- runSimulations(sim)
# Creating custom simulation run options
simRunOptions <- SimulationRunOptions$new()
simRunOptions$numberOfCores <- 3
simRunOptions$showProgress <- TRUE
# Running a population simulation
popPath <- system.file("extdata", "pop.csv", package = "ospsuite")
population <- loadPopulation(popPath)
results <- runSimulations(sim, population, simulationRunOptions = simRunOptions)[[1]]
# Running multiple simulations in parallel
sim2 <- loadSimulation(simPath)
sim3 <- loadSimulation(simPath)
# Results is a list of `SimulationResults`
results <- runSimulations(list(sim, sim2, sim3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.