Search code examples
anylogicsystemdynamics

Anylogic: Aggregation function applied to subdimension of System Dynamics array


Is it possible in Anylogic to use a system dynamics array aggregation function to sum just over a subdimension (i.e. not the whole index)?

For example if I have a SD array people with dimension Age which describes age by single year and I have subdimensions Child and Adult where Child includes Ages under 0 to 17, then I would like to just add up the number of children. Aggregation over all Ages is easy: people.sum(Index_Can_Vary), but I don't know how to do this for aggregation over a subdimension.


Solution

  • unfortunately you can't (as far as I know)... the aggration can be done for either one of all... not for a subset

    what I do is the following, maybe you can do the same

    double sum=0;
    for(int i=0;i<18;i++)
        sum+=people.sum(Child.indexes[i]);