Skip to contents

An optimized simulation with faster loading. The corresponding .NET class is "OSPSuite.R.Services.ConcurrentRunSimulationBatch"

Super classes

ospsuite::Printable -> ospsuite::DotNetWrapper -> SimulationBatch

Active bindings

simulation

Underlying simulation used for the batch run. Read only.

runValuesIds

Ids of the run values that will be executed on next run

Methods

Inherited methods


    Method new()

    Initialize a new instance of the class

    Usage

    SimulationBatch$new(ref, simulation)

    Arguments

    ref

    .NET reference object.

    simulation

    Simulation used in the batch run

    Returns

    A new SimulationBatch object.


    Method addRunValues()

    Add a set of parameter and start values for next execution.

    Usage

    SimulationBatch$addRunValues(parameterValues = NULL, initialValues = NULL)

    Arguments

    parameterValues

    Vector of parameter values to set in the simulation (default is NULL)

    initialValues

    Vector of initial values to set in the simulation (default is NULL)

    Details

    Intended for the use with runSimulationBatches. The simulation batch is executed with the sets of parameter and initial values that have been scheduled. The set of run values is cleared after successful run.

    Returns

    Id of the values set that can be used to get the correct result from runSimulationBatches.

    Examples

    \dontrun{
    sim1 <- loadSimulation("sim1", loadFromCache = TRUE)
    sim2 <- loadSimulation("sim2", loadFromCache = TRUE)
    parameters <- c("Organism|Liver|Volume", "R1|k1")
    molecules <- "Organism|Liver|A"
    # Create two simulation batches.
    simulationBatch1 <- createSimulationBatch(simulation = sim1,
    parametersOrPaths = parameters,
    moleculesOrPaths = molecules)
    simulationBatch2 <- createSimulationBatch(simulation = sim2,
    parametersOrPaths = parameters,
    moleculesOrPaths = molecules)
    #Ids of run values
    ids <- c()
    ids[[1]] <- simulationBatch1$addRunValues(parameterValues = c(1, 2), initialValues = 1)
    ids[[2]] <- simulationBatch1$addRunValues(parameterValues = c(1.6, 2.4), initialValues = 3)
    ids[[3]] <- simulationBatch2$addRunValues(parameterValues = c(4, 2), initialValues = 4)
    ids[[4]] <- simulationBatch2$addRunValues(parameterValues = c(2.6, 4.4), initialValues = 5)
    res <- runSimulationBatches(simulationBatches = list(simulationBatch1, simulationBatch2))
    }
    


    Method finalize()

    Clears the reference to the wrapped .NET object

    Usage

    SimulationBatch$finalize()

    Examples

    
    ## ------------------------------------------------
    ## Method `SimulationBatch$addRunValues`
    ## ------------------------------------------------
    
    if (FALSE) {
    sim1 <- loadSimulation("sim1", loadFromCache = TRUE)
    sim2 <- loadSimulation("sim2", loadFromCache = TRUE)
    parameters <- c("Organism|Liver|Volume", "R1|k1")
    molecules <- "Organism|Liver|A"
    # Create two simulation batches.
    simulationBatch1 <- createSimulationBatch(simulation = sim1,
    parametersOrPaths = parameters,
    moleculesOrPaths = molecules)
    simulationBatch2 <- createSimulationBatch(simulation = sim2,
    parametersOrPaths = parameters,
    moleculesOrPaths = molecules)
    #Ids of run values
    ids <- c()
    ids[[1]] <- simulationBatch1$addRunValues(parameterValues = c(1, 2), initialValues = 1)
    ids[[2]] <- simulationBatch1$addRunValues(parameterValues = c(1.6, 2.4), initialValues = 3)
    ids[[3]] <- simulationBatch2$addRunValues(parameterValues = c(4, 2), initialValues = 4)
    ids[[4]] <- simulationBatch2$addRunValues(parameterValues = c(2.6, 4.4), initialValues = 5)
    res <- runSimulationBatches(simulationBatches = list(simulationBatch1, simulationBatch2))
    }