user3565521
user3565521

Reputation: 15

Already Batched Agents' Properties in Anylogic

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

Answers (1)

Tatiana Gomzina
Tatiana Gomzina

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

Related Questions