Description Usage Arguments Details Value Author(s) Examples
Run a GAMA experiment from an XML file.
1 | run(experiment, Xms = 512, Xmx = 2048)
|
experiment |
Either an R experiment object or the path to an XML file describing the experiment. |
Xms |
Initial memory allocation pool for the Java Virtual Machine. |
Xmx |
Maximal memory allocation pool for the Java Virtual Machine. |
If _experiment_ is an XML, it should contains the path to a GAML file that describes the model. A GAML file starts with a model name and should contain three sections defining (1) the world (global), (2) the species (species), and (3) the experiments (experiment). The XML file should contain a Simulation header and two slots: (1) Parameters et (2) Outputs. See the _demo_ folder of the _gamar_ library for examples of such files. See https://github.com/gama-platform/gama/wiki/G__Headless for more detailed information on how these XML and GAML files should be structured.
A data frame with, for each column, the values of the model state variables for each time step.
Marc Choisy, Jean-Daniel Zucker
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Running an SIR epidemic model.
# Copying the example files to the working directory:
file.copy(system.file("examples/sir.xml",package="gamar"),".")
file.copy(system.file("examples/sir.gaml",package="gamar"),".")
# Running the experiment:
simulation <- run("sir.xml")
# Removing the example files from the working directory:
file.remove("sir.xml","sir.gaml")
# Plotting the simulations output:
with(simulation, {
plot(Susceptible,col="blue",type="l",xlab="time",ylab="number of individuals")
lines(Infectious,col="red")
lines(Recovered,col="green")
})
# Adding the legend:
legend("right",c("susceptible","infected","recovered"),
col=c("blue","red","green"),lty=1,bty="n")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.