AnyLogic supports a set of functions you can use to perform operations over arrays.
Sometimes you need performing aggregation operations on elements of arrays. Aggregation functions over arrays are listed in the table below.
Return type 
Function 
Description 
double 
average() 
The mean value of the aggregated elements:

boolean 
hasNegativeValues() 
Checks if there are any negative elements in the hyper array. Returns true if at least one element is negative, otherwise false. 
double 
max() 
Maximum value of the aggregated elements. 
double 
min() 
Minimum value of the aggregated elements. 
double 
prod 
The product of the elements: 
int 
size() 
Returns the total number of elements in the hyper array. 
double 
stddev() 
Standard deviation: 
double 
sum 
The sum of the aggregated elements:

You can perform calculations on
a subset of an array.
In this
case you should enumerate the dimensions forming the subarray as
function arguments. For example, if you have an array people
with dimensions (
Region, Gender, AgeGroup ),
calling:
will calculate the number of adults of both genders in the north region.
The following set of functions allows you to manage the values of
elements in a hyper array. You can use indexes to define to which
elements a value should be added or substracted from and the parameters
to define how much
exactly.
int
INDEX_CAN_VARY is a special
constant that, being placed at an index position, tells the methods
that perform operation over subsets of hyper array elements that they
can vary the corresponding index. Other indexes are fixed.
INDEX_CAN_VARY
can be used to increment, to decrement, or to multiply across all the
elements of a particular dimension.
Parameters:
indexes
 the array of indexes, INDEX_CAN_VARY
for varying ones
value
 the value to add to and to subtract from array elements
factor
 the factor to apply to array elements
Return type 
Function 
Description 
void 
increment(int... indexes) 
Increments (+1) element(s) with the given index(es). 
void 
incrementBy(double value, int... indexes) 
Increments element(s) with the given index(es) by the given amount (+value). 
void 
decrement(int... indexes) 
Decrements (1) element(s) with the given index(es). 
void 
decrementBy(double value, int... indexes) 
Decrements element(s) with the given index(es) by the given amount (value). 
void 
multiply(double factor, int... indexes) 
Multiplies element(s) with the given index(es) by the given factor. 
Please refer to AnyLogic API Reference to find more information about functions syntax and parameters.