I'm developing an AnyLogic model where each agent holds approximately 2,000 data entries, including elements like graphs, comboboxes, LinkedLists, and presentation components. As I scale the project, I'm encountering significant memory consumption issues, which limit the size of the model.
To enhance efficiency, I've implemented strategies such as reducing embedded agents and centralizing definitions in the main agent. These measures have improved the model's speed but haven't sufficiently addressed the memory consumption challenge. I've observed that using a LinkedList instead of a traditional agent population effectively reduces memory usage. However, this approach complicates the access to the agents' presentation elements. The methods add_to_population and remove_from_population initially seemed promising, but they allow for only a single re-addition of an agent to the population. For instance, in the screenshot below, I can add agents by their index (defined in Main as LinkedList) to my custom population (located in a separate UI agent). But this process seems to function only once; attempting to add the same agent back to the custom population fails.
Is there an effective method to access individual agents' presentation elements without the need to define an entire population, thereby keeping memory usage at a minimum? Any suggestions or alternative approaches to handle this issue in AnyLogic would be immensely helpful.
Thank you!