InspectorsAndMonitors - gama-platform/gama GitHub Wiki
GAMA offers some tools to obtain information about one or several agents. There are two kinds of tools:
- agent browser
- agent inspector
GAMA offers as well a tool to get the value of a specific expression: monitors.
The species browser provides information about all or a selection of agents of a species.
The agent browser is available through the Agents menu.
It displays in a table all the values of the agent variables of the considered species; each line corresponding to an agent. The list of attributes is displayed on the left side of the view, and you can select the attributes you want to be displayed, simply by clicking on it (Ctrl + Click for multi-selection).
By clicking on the right mouse button on a line, it is possible to perform some actions on the corresponding agent (the same actions as when we right-click on it in a display).
The Browse view provides also two interesting additional features:
- Browse a species: change the population displayed in the table.
-
Save the agents and their attributes in a
.csv
file: this allows the modeler to manipulate and analyze the agent population at will in external software.
The agent inspector provides information about one specific agent. It also allows the modeler to change the values of its variables during the simulation. The agent inspector is available from the Agents menu, by right_clicking on a display, in the species inspector or when inspecting another agent.
It is possible to "highlight" the selected agent, to focus on it in all the displays, or to kill it.
To change the color of the highlighted agent, go to Preferences/Display.
Monitors allow the user to follow the value of a GAML expression. For instance, the following ones monitor the number of prey and predator agents during the simulation (the model is available in the Prey Predator tutorial). The monitor is updated at each simulation step.
It is possible to define a monitor inside a model (see this page). It is also possible to define a monitor through the graphical interface.
To define a monitor, first choose Add Monitor in the Views menu (or by clicking on the icon in the Monitor view), then define the display legend and the expression to monitor. The expression is compiled when it is written in the text field: as long as the text field is surrounded by a red rectangle, it is incorrect. When the surrounding color becomes green, GAMA has accepted the expression and its value can be displayed in the monitor.
In the following example, we defined a monitor with the legend "Total number of agents" and its value is defined by the GAML expression computing the sum of the number of agents in each population: length(prey) + length(predator)
.
The expression should be written with the GAML language. See this page for more details about the GAML language.