Run simulation batches
Arguments
- simulationBatches
List of
SimulationBatch
objects with added parameter and initial values- simulationRunOptions
Optional instance of a
SimulationRunOptions
used during the simulation run.- silentMode
If
TRUE
, no warnings are displayed if a simulation fails. Default isFALSE
.
Value
Nested list of SimulationResults
objects. The first level of the list are the IDs of the simulations of SimulationBatches, containing a list of SimulationResults
for each set of parameter/initial values. If a simulation with a parameter/initial values set fails, the result for this run is NULL
Details
Runs a set of simulation batches. The simulation batches must be populated
with sets of parameter and start values with SimulationBatch$addRunValues()
prior to running. After the run, the list of parameter and start values is cleared.
Examples
# \dontrun{
sim1 <- loadSimulation("sim1", loadFromCache = TRUE)
#> Error in rClr::clrCall(simulationPersister, "LoadSimulation", expandPath(filePath), resetIds): Type: System.IO.FileNotFoundException
#> Message: Could not find file 'C:\Users\IndrajeetPatil\Documents\GitHub\OSPSuite-R\docs\reference\sim1'.
#> Method: Void WinIOError(Int32, System.String)
#> Stack trace:
#> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
#> at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
#> at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
#> at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
#> at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
#> at System.Xml.XmlTextReaderImpl.FinishInitUriString()
#> at System.Xml.XmlReaderSettings.CreateReader(S
sim2 <- loadSimulation("sim2", loadFromCache = TRUE)
#> Error in rClr::clrCall(simulationPersister, "LoadSimulation", expandPath(filePath), resetIds): Type: System.IO.FileNotFoundException
#> Message: Could not find file 'C:\Users\IndrajeetPatil\Documents\GitHub\OSPSuite-R\docs\reference\sim2'.
#> Method: Void WinIOError(Int32, System.String)
#> Stack trace:
#> at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
#> at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
#> at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
#> at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
#> at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
#> at System.Xml.XmlTextReaderImpl.FinishInitUriString()
#> at System.Xml.XmlReaderSettings.CreateReader(S
parameters <- c("Organism|Liver|Volume", "R1|k1")
molecules <- "Organism|Liver|A"
# Create two simulation batches.
simulationBatch1 <- createSimulationBatch(
simulation = sim1,
parametersOrPaths = parameters,
moleculesOrPaths = molecules
)
#> Error in isOfType(object, type, nullAllowed): object 'sim1' not found
simulationBatch2 <- createSimulationBatch(
simulation = sim2,
parametersOrPaths = parameters,
moleculesOrPaths = molecules
)
#> Error in isOfType(object, type, nullAllowed): object 'sim2' not found
# Ids of run values
ids <- c()
ids[[1]] <- simulationBatch1$addRunValues(parameterValues = c(1, 2), initialValues = 1)
#> Error in eval(expr, envir, enclos): object 'simulationBatch1' not found
ids[[2]] <- simulationBatch1$addRunValues(parameterValues = c(1.6, 2.4), initialValues = 3)
#> Error in eval(expr, envir, enclos): object 'simulationBatch1' not found
ids[[3]] <- simulationBatch2$addRunValues(parameterValues = c(4, 2), initialValues = 4)
#> Error in eval(expr, envir, enclos): object 'simulationBatch2' not found
ids[[4]] <- simulationBatch2$addRunValues(parameterValues = c(2.6, 4.4), initialValues = 5)
#> Error in eval(expr, envir, enclos): object 'simulationBatch2' not found
res <- runSimulationBatches(simulationBatches = list(simulationBatch1, simulationBatch2))
#> Error in isOfType(object, type, nullAllowed): object 'simulationBatch1' not found
# }