Documentation > Plug
The
The
Preliminary remarks 🔗
GAMA is a modelling and simulation development environment for building spatially explicit agent-based simulations. OpenMOLE supports GAMA model natively through theGAMATask
.
The
GAMATask
uses the Singularity container system. You should install Singularity on your system otherwise you won't be able to use it.The
GAMATask
supports files and directories, in and out. Get some help on how to handle it by reading this page.
The GAMATask 🔗
GAMA by example 🔗
You can provide your .gaml file to theGAMATask
to run your model and explore it with OpenMOLE.
The example below illustrates an exploration of the predator-prey model of the GAMA model library using a direct sampling:
// Declare the variables
val numberOfPreys = Val[Double]
val nbPreysInit = Val[Int]
val mySeed = Val[Long]
// Gama task
// The first argument is the project directory
// The second argument is the relative path of the gaml file in the project directory
// The second argument is the Gama experiment name
// The third argument is the number of steps
val gama =
GAMATask(project = workDirectory / "predator", gaml = "predatorPrey.gaml", experiment = "prey_predatorExp", finalStep = 100, seed = mySeed) set (
inputs += (nbPreysInit mapped "nb_preys_init"),
outputs += (numberOfPreys mapped "Number of preys")
)
// Explore and replicate the model
DirectSampling(
evaluation =
Replication(
evaluation = gama,
seed = mySeed,
sample = 10,
aggregation = Seq(numberOfPreys evaluate average)) hook(workDirectory / "result"),
sampling = nbPreysInit in (0 to 200 by 50)
) hook display
Task arguments 🔗
The GAMA task uses the following arguments:project
the location of your GAMA project directory, mandatory, for instanceproject = workDirectory / "gamaproject"
gaml
the relative path of your .gaml file in your work directory, mandatory, for instancegaml = "model/model.gaml"
experiment
the name of your experiment as implemented in the .gaml file, mandatoryfinalStep
the last simulation step of you simulation, mandatoryframeRate
the frame rate to sample you simulation dynamics, in this case the outputs should be arrays, optionalseed
the OpenMOLE variable used to set the GAMA random number generator seed, optional the seed is randomly drawn if not setcontainerImage
the label of a container image or a container file containing GAMA headless, optional, the default value is "gamaplatform/gama:1.9.0"memory
the memory allocated to the gama headless, optional, for examplememory = 3000 megabytes
install
some command to run on the host system to initialise the container, for instanceSeq("apt update", "apt install mylib")
, optional