0
votes

Dear AnyLogic community,

I'm a novice AnyLogic user and hope someone of you can help me!

I have a simple process model, consisting of multiple sources, queue, seize, delay, release and sink (Process Model). The system I'm modelling is a server capacity problem. I have agents with differing service times and limited server capacity, the KPI I'm interested in is the number of customers that don't receive proper service when the resource pool is exhausted. Currently I'm letting customers timeout at the queue block when all resources are being used, but thats not an accurate representation of how the system performs in real life.

In reality a new incoming agent may preempt and terminate the service of an agent being served, more specifically the agent with the lowest service time remaining. I've seen the preemption options in the seize block, however I'm having trouble to define whose service should be terminated.

Would someone of you know how I can model the preemption of the agent with the lowest service time remaining while eliminating the queue entirely?

Many thanks for your time & help!

1

1 Answers

0
votes

I would actually write some script to completely control this. In the approach below, I have no seize/release blocks. AnyLogic's delay block can have a capacity and report back stats. I usually find it does what I need. I tend to only use the actual seize/release blocks if I have multiple areas pulling from the same resource pool. If it is like your diagram, I just use a capacitated delay block and avoid the seize/release.

On At Exit of queue, I call a function to determine if I want to pull someone out of the delay block. If I do, I sent them to another branch of code. The enterPreempted could be set up to come back into the delay, if needed.

One item to note is that you are probably going to want the queue to be sorted by some sort of priority or agent comparison. This will put newly arriving agents to the front of the queue (if that is where they should be). Otherwise, if you get one at the front of the queue that decides it is not important enough to preempt the delay, it will be stuck in the 1st position and block others from evaluating. If you use priority, be sure to use sortAgents() if priorities changes after agents have entered the queue.

This general approach of using a custom function could also work if you want to have seize/release blocks. You would just need to call the function from the seize, and make sure you release the resource both after the delay block and after the enterPreempted block.

Someone will likely reply with how to do what you want out of the box in AnyLogic. However, I tend to default to keeping the blocks as simple as possible and writing my own functions. As you can imagine, we could easily modify this function to look for other, much more advanced criteria in terms of who/when we would want to remove someone from the delay block.