From an experiment
object, run an experiment by creating an XML file
of the experiment (save_to_gama
) and by calling gama
(call_gama
) and appends the results to the object
experiment
inputted in the column output
(one by simulation).
run_experiment(exp, hpc = 1, save = FALSE, path = NULL, display = FALSE, append = TRUE)
exp | an object of class experiment. |
---|---|
hpc | number of threads used by GAMA to run the experiment. |
save | save the outputs to disk or not, default = FALSE. |
path | directory to save the outputs, default = NULL.
If |
display | output images are saved or not, default = FALSE. |
append | append outputs to experiment, default = TRUE. |
We advice the user to validate their model in Gama Platform before using
rama.
When the argument save
is equal to TRUE
, a folder with the name
of the experiment of the object exp
is created. The folder contains
two folder: output
containing the result in XML and input
containing the model file associated in GAML and the XML associated to the
object `exp` inputted in the function.
If the argument display
is equal to TRUE
, the argument
save
is automaticaly set to TRUE
, a folder snapshot
is
add into the folder output
, and contained the display output from
GAMA.
If the object exp
contains no obs_rates
, the object exp
is returned without calling gama. In this case, the column output
is returned with NA
.
#load experiment gaml_file <- system.file("models", "sir.gaml", package = "rama") exp1 <- load_experiment("sir", gaml_file)#> Loading experiment "sir" from file "sir.gaml"...#>#> Periods of observation ("obsrates") are converted into integers.#>#> Final time step ("tmax") is converted into integer.#>#> Seed is converted into numeric.#>#> Parameters' types are cast according to model definition#># run experiment out <- run_experiment(exp1, hpc = 2)#> Running experiment plan...# for a more complexe example exp1 <- repl(exp1, 2) exp1$r_R <- 2L:3L exp1$tmax <- 2L output <- run_experiment(exp1, hpc = 2)#> Running experiment plan...output#> Experiment with 2 simulations of 5 parameters and 3 observed variables #> experiment name: sir #> input gaml file: /Users/mac/Desktop/rama/inst/models/sir.gaml #> model parameters: p_S0, p_I0, p_R0, p_beta, p_gamma #> observed variables: r_S, r_I, r_R #> Experiment overview: #> p_S0 p_I0 p_R0 p_beta p_gamma r_S r_I r_R tmax seed output #> 1 999 1 0 1.5 0.15 1 1 2 2 1 <data.frame[2,4]> #> 2 999 1 0 1.5 0.15 1 1 3 2 1 <data.frame[2,4]># to save the experiment input and output (by default in the working directory) output <- run_experiment(exp1, hpc = 2, save = TRUE)#> Outputs are saved to "/Users/mac/Desktop/rama/docs/reference" by default.#>#> Outputs are saved in " /Users/mac/Desktop/rama/docs/reference/sir_1 ".#>#> Running experiment plan...