run: Run a GAMA experiment

Description Usage Arguments Details Value Author(s) Examples

Description

Run a GAMA experiment from an XML file.

Usage

1
run(experiment, Xms = 512, Xmx = 2048)

Arguments

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.

Details

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.

Value

A data frame with, for each column, the values of the model state variables for each time step.

Author(s)

Marc Choisy, Jean-Daniel Zucker

Examples

 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")

choisy/gamar2 documentation built on May 13, 2019, 5:30 p.m.