Metrics

Your first step is to define Metrics that you are interested in plotting. Each Metric is an output of your simulation, represented as an array of data. Metrics are defined as a series of Operations which transform your simulation data into an array of specific data, typically by filtering for specific agents, then retrieving a certain value from each agent. The available Operations are listed below.

Operator Name

Additional Arguments

Operator Description

"filter"

"field" "comparison"

"value"

Filter the current output with the given comparison and value on the given field of each element

"count"

n/a

Count the number of agents in the current output

"get"

"field"

Retrieve the field value from each agent in the current output

"sum"

n/a

Sum over the elements of the current output

"min"

n/a

Return the minimum of the elements in the current output

"max"

n/a

Return the maximum of the elements in the current output

"mean"

n/a

Return the mean of the elements in the current output

Many of these operations are aggregators: they will reduce the current output array to a single value.‌

Like many data pipelines you first filter your data to the set you're interested in, and then aggregate it into a final metric.‌

The Metrics Wizard will help you construct your metrics and fill in the appropriate parameters.​‌

For example, if you have a collection of agents with an age attribute in your simulation, you might want to count the number over 50. You will chain together operations like so:​‌

It's likely that the most common operation you'll use is "filter". You can filter with numeric, boolean, and string values. The valid comparisons are listed below:

Comparison Name

Comparison Description

eq

Equal to (===)

neq

Not equal to (!==)

lt

Less than (<)

lte

Less than or equal to (<=)

gt

Greater than (>)

gte

Greater than or equal to (>=)