Plug your model

Suggest edits
Documentation

Content:

1 - Tasks
2 - Exploration method


Tasks 🔗

Tasks are the atomic computing elements of OpenMOLE: they describe what OpenMOLE should execute. There are a number of tasks in OpenMOLE especially designed to plug your own models and/or programs, depending on the language your model uses (binary executable, Java, R, etc.). You need to choose the adequate task for your model.
All the available tasks are documented in this section, just click on an item in the left menu list.

The execution of a given task depends on input variables, and each task produces output variables which can be transmitted as inputs of subsequent tasks. Below is a dummy task to illustrate this concept:

// Define two variables i and j of type Int
val i = Val[Int]
val j = Val[Int]

// Instantiate a simple task using the i variable as an input, and j as an output
// This task adds 2 to the input
val myTask = ScalaTask("val j = i + 2") set (
    inputs += i,
    outputs += j,

    // Default value for inputs
    i := 3
)

j contains the result of myTask, i.e. 5. Any task immediately following myTask in the workflow (i.e. linked to it with a transition) will be able to use j as an input.
It is also possible to specify default values for inputs, which are used by the task in case no input data was provided in the dataflow.

Once your model is properly plugged in an OpenMOLE task, you can use an exploration method on it, and delegate the multiple executions of the task on remote computing environments.

Exploration method 🔗

The composition of a full exploration experiment is achieved by writing a script in the OpenMOLE language. A working OpenMOLE exploration script needs to define: Let's take the previous task, that adds 2 to an input. You want to execute this task for a great number of different inputs and gather all the results in a single file. The way to do it is shown in the following example:

// Define two variables i and j of type Int
val i = Val[Int]
val j = Val[Int]

// Define a task that adds 2 to the input
val myTask = ScalaTask("val j = i + 2") set (
    inputs += i,
    outputs += j,

    // Default value for inputs
    i := 3
)

// Define an exploration task: a direct sampling varying i
val myExploration = DirectSampling(
    evaluation = myTask,
    sampling = (i in (0 to 1000 by 5))
)

// Execute the workflow
myExploration hook (workDirectory / "results")

In this script, myTask will be executed for each value of i from 0 to 1,000 with a step of 5. Each result j is written in the results.omr file through a hook.

You can find some working examples of simple exploration tasks in the Market Place. Be sure to also check out our Getting Started tutorial!