I'm simulating abandonment by waiting customers in a queue environment. I'm assuming that a person will abandon a queue if they notice that people who were in the queue ahead of them have left the queue (amongst other things like their own time in queue). To do this, I need to capture the details of the people already waiting in a queue when a new person joins the queue. I figure I need a collection created in the customer agent that i can store agent details of those ahead of them in queue. I can then use code to "populate" this collection via the on enter action of the queue block. but I'm not sure how to progress. I am struggling with how to find the IDs of agents in a queue and collect values of their parameters. Any help will be appreciated! Thank you.
Asked
Active
Viewed 349 times
0
-
Please provide enough code so others can better understand or reproduce the problem. – Community Sep 20 '21 at 16:48
1 Answers
0
When a new agent enters the queue you can use a for loop to cycle through all the agents in the queue and add it to a variable inside the agent.
Take the following simple example.
There is a custom agent type MyAgent
it has a collection of type ArrayList accepting objects of type MyAgent.
Now when an agent enters a queue I can store the agents ahead of it in the queue in the following way
Please note the limit of the for loop is i < self.size()-1
, if you don't add the -1
the agent will add itself to the list. (assuming your queue is FIFO (First in first out) the new agent will be the last in the list.

Jaco-Ben Vosloo
- 3,770
- 2
- 16
- 33
-
1Thanks Jaco - I did this and it worked. I was using a service block so i made a slight tweak "agent.agentsInQueue.add(self.queueGet(i)); – DiaLaDia Sep 19 '21 at 18:06