A Step by Step Introduction to OpenMOLE

Suggest edits
Documentation > Tutorials


Overview πŸ”—

OpenMOLE is a model exploration tool. It offers several methods to perform experiments on a model, in order to better understand its behavior and capabilities.
The composition of a full exploration experiment is achieved by writing a script in the OpenMOLE language, which is an extension of the Scala language. Such a script is called a workflow and should contain:

Installing OpenMOLE on your computer πŸ”—

The complete procedure to download and run OpenMOLE on your computer is explained in the Download section. Once OpenMOLE is up and running in your browser, you should see the GUI:

Importing a toy model: Ants πŸ”—

To illustrate this tutorial, we will be using the NetLogo Ants model. The model is available here.
Once you've downloaded the model on your computer, you need to import it in OpenMOLE. There are two ways to do that, either by using the "upload a file" button on the left series of icons to import the nlogo file as is, or by using the "New project" button and selecting "Import your model" to open the model wizard. The model wizard will automatically detect the language in which the file is written, and the input and output parameters of your model, see below:

Executing the Ants model in OpenMOLE πŸ”—

Workflow πŸ”—

Based on the automatically detected parameters and NetLogo commands, the model wizard creates an OpenMOLE script containing variables for the input/output and a basic worflow to run your model. If you didn't use the model wizard to import the Ants model, you will need to write a workflow to execute it, similar to the one generated by the wizard and containing all the basics.
The oms script generated for the ants model is shown here:

// Input values
val seed = Val[Int]
val diffusionRate = Val[Double]
val evaporationRate = Val[Double]
val population = Val[Double]
// Output values
val countFood = Val[Double]
val finalTicksFood1 = Val[Double]
val finalTicksFood2 = Val[Double]
val finalTicksFood3 = Val[Double]
// NetLogo command list
val launch = List("setup","go;;You should set your stopping criteria here instead")

// NetLogo task
val antsTask = NetLogo6Task(workDirectory / "ants.nlogo", launch, embedWorkspace = true,seed=seed) set(
  inputs += diffusionRate mapped "diffusion-rate",
  inputs += evaporationRate mapped "evaporation-rate",
  inputs += population mapped "population",
  outputs += countFood mapped "count-food",
  outputs += finalTicksFood1 mapped "final-ticks-food1",
  outputs += finalTicksFood2 mapped "final-ticks-food2",
  outputs += finalTicksFood3 mapped "final-ticks-food3",
  // Default values. Can be removed if OpenMOLEΒ Vals are set by values coming from the workflow
  seed := 0,
  diffusionRate := 21,
  evaporationRate := 9,
  population := 125)

// Workflow containing a hook to save execution outputs
antsTask hook DisplayHook()

Execution of the workflow πŸ”—

To execute a workflow you just need to have the oms script open in the GUI and click on the "Run" button. The execution panel will then open for you to monitor the execution, as shown below:

To go further πŸ”—

In the next tutorial, you will learn how to prepare and run a more complex experiment, in order to explore your model with OpenMOLE.

Get help πŸ”—

To get help you are more than welcome to contact the OpenMOLE community on our forum and post your questions. We're also present on the #openmole channel of the ISC-PIF's RocketChat.