<< Click to Display Table of Contents >> Collections |
![]() ![]() ![]() |
A collection is a set of entities of the same type. A collection can be very inclusive (all entities of type "performer"). Or a collection can partition entities into sub collections based on their attributes. Partitioning by the "gender" attribute gives subcollections of male performers and female performers. Partioning by both "gender" and "talent" attributes will give subcollections of male dancers, male singers, male jugglers, female dancers, female singers, and female jugglers. Collections can be empty: for example, at certain times there may be no female singer entities in the model. If halfway through a simulation, a new performer arrives with talent "sword-swallower", then subcollections of male sword-swallowers and female sword-swallowers will come into existence as well.
A main collection is automatically created for each entity type that is not defined as a singular entity type. Sub-collections can be defined using 1 to 4 attributes contained in the base entity type. A mapping attribute can be created by using an attribute that is present in some other entity type that is referenced by one of the attributes in the base entity type.
Collections are also Entities
Each collection is also an entity. Each instance of a sub-collection is a unique entity. Thus, collections are defined using diagrams, variables, attributes, references, triggers, and actions.
Collections cannot be directly created. Main collections are automatically created for each non-singular entity. Sub-collections are created when an entity is added that has unique values for the key attributes of a sub-collection. Collections and sub-collections are never deleted, even if they become empty.
Count
A variable named "Count" is included in every collection. This variable represents the number of active entities in a colleciton. It is updated when entities are created, added by entity initialization, or deleted by an action. When "Count" is used in an Action for calculations or logical decisions, it will reflect any changes already made within that action.
Aggregate Variables
Aggregate variables provide an easy way to process a variable from each entity that is a member of the collection. The aggregate variable names are a concatenation of the aggreagation function name and the target variable name. For instance,
Sum_Sales
Each aggregation function performs an operation on the vector of Target Variable values among the collection members.
Function |
Description |
||
Sum |
Sum of target variable |
||
Average |
Average or mean |
||
Min |
Minimum value |
||
Max |
Maximum value |
||
Median |
Median value - this can berelatively expensive to compute on large lists, so you may wish to use it sparingly. |
||
StDev |
Standard deviation |
||
Prod |
Product of all values. This is typically used when each value contains an independent probability expressed as a fraction between 0 and 1. |
||
SumSq |
Sum of squares of the target variable (useful for computing errors or likelihoods) |
||
SumAbs |
Sum of absolute values of the target variable (useful for computing errors or likelihoods) |
||
PoissonBinomialCDF |
CDF of the PoissonBinomial distribution, where the target variable is a vector of success probabilities [0,1] for the set of trials. The CDF is formally P( X <= n required | trial probabilities ) where X is a random variable with the PoissonBinomial distribution. |
||
PoissonBinomialPMFrange |
PMF (probability mass function, often loosely known as density) of the PoissonBinomial distribution, over a range from Start to End. This is formally P( start <= X <= end | trial probabilities ). If start=end, the normal PMF, P(X=n) is obtained. |
Collections in Actions
Collections are important for the operation of Process List, Allocation, and Market Allocation functions.