Optimizing the performance of agent population

Agent population in AnyLogic is implemented as a Java collection. AnyLogic allows you to change Java type of collection. We give you this opportunity since one implementation gives best performance on adding and removing collection elements (i.e. agents of the population), while another - on accessing elements by index (searching by index, removing by index). For more details on collection types please refer here

Now you can choose the collection depending on your requirement options. 

 To change the type of collection used by AnyLogic for agent population
  1. Select the agent population in the graphical editor or in the Projects view.
  2. In the Advanced section of the Properties view, choose the required collection type using the Optimize for radio buttons. Options have intuitive names:
    Access by index (ArrayList) - Replicated object will be implemented as ArrayList collection. This implementation gives better performance when accessing and iterating elements and reduces the size of object.
    Add/remove operations (LinkedHashSet) - Replicated object will be implemented as LinkedHashSet collection. This implementation gives better performance when adding and removing elements of replicated object.

Related topics

 Dynamic adding/removing agents to/from a population