Skip to main content
Version: 🚧 Alpha 🚧

Defining monitors and inspectors

Other outputs can be very useful to study better the behavior of your agents.

Define a monitor​

A monitor allows to follow the value of an arbitrary expression in GAML. It will appear, in the User Interface, in a small window on its own and be recomputed every time step (or according to its refresh facet).

Definition of a monitor:

monitor monitor_name value: an_expression refresh: boolean_statement;

with:

  • value: mandatory, the expression whose value will be displayed by the monitor.
  • refresh: bool statement, optional: the new value is computed if the bool statement returns true.

Example:

experiment my_experiment mode: gui {
output {
monitor monitor_name value: cycle refresh: every(1#cycle);
}
}

Define an inspector​

During the simulation, the user interface of GAMA provides the user the possibility to inspect an agent, or a group of agents. But you can also define the inspector you want directly from your model, as an output of the experiment.

Use the inspect statement in the output scope of a GUI experiment. Give it a label and specify the agent or set of agents to inspect with value:. The label is positional, rather than a name: facet.

inspect "inspector_name" value: the_value_you_want_to_display;

The value can be an agent, a species, or a collection of agents.

inspect opens individual agent inspectors by default. Use browse to show a collection in a table. The legacy type: facet accepts agent or table, but is deprecated.

The optional facet attributes is used to filter the attributes you want to display in your inspector.

Individual agent inspectors use a single inspector view; table browsers can be added for different collections.

Example of implementation:

model new

global {
init {
create my_species number:3;
}
}

species my_species {
int int_attr <- 6;
string str_attr <- "my_value";
string str_attr_not_important <- "blabla";
}

grid my_grid_species width: 10 height: 10 {
int rnd_value <- rnd(5);
}

experiment my_experiment mode:gui {
output {
inspect "my_species_inspector" value: first(my_species) attributes: ["int_attr","str_attr"];
browse "my_species_browser" value: my_species;
browse "my_grid_species_browser" value: 5 among my_grid_species;
}
}

Use browse for a collection and inspect for an individual agent.