Plugin Gama for OpenMole application
Scala Shell
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 113 commits ahead of gnoubi:master.
Latest commit aed6ca2 Mar 19, 2018

README.md

Drawing

Drawing

Using this plugin in OpenMOLE

Installation

This plugin works with the developpement version of OpenMOLE.

Usage

The minimum usage should look like that:

val gama = 
  GamaTask(
    workspace = workDirectory / "predator-prey",
    model = "PedatorPrey.gaml", 
    experiment = "preyPred", 
    maxStep = 100)

Alternatively, you can define a stopping condition:

val gama = 
  GamaTask(
    workspace = workDirectory / "predator-prey",
    model = "PedatorPrey.gaml",
    experiment = "preyPred", 
    maxStep = 100, 
    stopCondition = "empty(prey) and empty(predator)")

Then you can plug OpenMOLE input, output and set the seed of Gama to Gama ones in the set section:

val number_of_preys = Val[Int]
val nb_preys_init = Val[Int]
val seed = Val[Int]

val gama = 
   GamaTask(
    workspace = workDirectory / "predator-prey",
    model = "PedatorPrey.gaml", 
    experiment = "preyPred",
    maxStep = 100) set (
    gamaInputs += nb_preys_init,
    gamaOutputs += number_of_preys,
    gamaSeed := seed
  )

A full experiment would look like that:

// Declare the variable
val number_of_preys = Var[Int]
val nb_preys_init = Var[Int]

// Gama task
// The third argument of the GamaTask is the gama experiment name
// and the fourth argument is the number of steps
val gama = 
  GamaTask(
    workspace = workDirectory / "predator-prey", 
    model = "PedatorPrey.gaml", 
    experiment = "preyPred", 
    maxStep = 100) set (
    gamaInputs += nb_preys_init,
    gamaOutputs += number_of_preys,
    gamaSeed := seed,
    outputs += nb_preys_init
  )

DirectSampling(
  evaluation = Replication(gama, seed, 100),
  sampling = (nb_preys_init in (0 to 200 by 10))
)