Some problems require multi-dimensional data. Alike some other traditional system dynamics tools, AnyLogic supports arrays. Array is a storage of numbers that may have any number of dimensions. Each dimension has finite number of indexes - subscripts.
Arrays are used when it is necessary to store a large set of
coefficients and access them or when there are multiple model layers.
The latter case is useful when you have defined a model for some
subsystem and there are other subsystems, which have the same
structure, as the first one, but other numerical
can implement such multi-dimensional models making copies of the
default diagram and changing the parameters. Such approach has one
great disadvantage: if you want to change the model, you need do it so
much times, as many layers you have; the diagram grows and becomes
incomprehensive. Array allows you to create a single diagram for all
layers. Therefore, model remains compact, and changes you make
affect the whole model, but not a single layer.
For example, you create a model of a nation’s health, describing some social or health processes in respect to different groups of population. You may need to separate people by three characteristics: gender, age group, and social group. This example fits well in the array concept. Instead of dealing with multiple models describing different groups of people, you can just define an array with such enumerations: Gender(male, female), Age(child, teenager, adult, aged), and SocialGroup(wealthy, middleclass, deprived).The following variables can be made arrays in AnyLogic:
Demo model: Bass Diffusion Arrays
Defining an array variable
Initializing an array variable
Defining equations for array variables
API Reference: HyperArray Class