Reputation: 15
I have a very short question regarding the batching process in Anylogic.
I would like to print out the IDs of the agents that already exited the previous batch element where they were batched together. As a result, they are at a different element (Release to be precise) and I am struggling to reach their ID inside the batch. The only idea I have is to first unbatch and then print out the IDs.
Is there a way to do it without unbatching them?
Thank you very much in advance.
Kind regards
Upvotes: 0
Views: 376
Reputation: 273
All batched (not permanently) or picked up agents are stored in the collection named 'contents' inside a batch/container agent. So, you can access IDs of the agents stored in this collection using the code like:
for(int i = 0; i < agent.contents().size(); i++)
traceln(((MyAgent)agent.contents().get(i)).id);
Upvotes: 1