0
votes

Good day! I tried to build the network model in AnyLogic 8.7.6. I have 2 sources with different priorities (the packets from the first source obtain priority 2, and the packets from the second source obtain priority 1). The packets from the sources are transmitted to the Queue. The Queue should sort them by Priority.

enter image description here

The priority parameters are defined in Agents at the Sources.

enter image description here

I made a simple experiment. The Source 1 generates 1 agent per sec and the Source 2 generates 10 agents per sec. We see that the queue is empty :(

enter image description here

I have no idea why. The Queue doesn't sort them according to their priority.

P.S. Sorry, I have russian language version of Anylogic.

1
How can we know if the sorting is not working if there is nothing in the queue? Please delete all the connections out of the queue so that there is a queue that builds up...if you have two queues connected to each other agents will enter the first one and immediately go to the next queue... so they are never prioritized because they never queue in the first queue, where I assume you set up the prioritization. - Jaco-Ben Vosloo
Thank you! I understand what was my problem. The queue can't sort anything since it doesn't collect anything. The agents leave the queue immediately. So simple.... However, the number of my agents starts with 39. Not 1.... - Ekaterina Pakulova
(That was my very first statement in my original answer ;-) ) You can ignore the agent number, or you can create your own function and choose what you want to display. Check my final picture in my updated question. (If my answer helped you solve your problem remember to accept it) - Jaco-Ben Vosloo

1 Answers

0
votes

Without seeing the queue capacities, if you have two queues connected to each other agents will enter the first one and immediately go to the next queue... so they are never prioritized because they never queue in the first queue, where I assume you set up the prioritization.

Try deleting the connection between the two queues and simply see if the agents get ordered according to your priority.

See a small test below

I have a custom agent type with a variable priority and a simple flow chart with 2 sources and a queue

enter image description here

As per your example, I am setting the priority variable of the agents generated in Source1 to 2, and in source 2 they are set to 1.

In the queue, I set my ordering to be based on priority and tell the block to use the priority variable inside the agents (the higher the higher the priority)

enter image description here

For the example, I set source1 to generate agents every minute and source 2 to generate every second.

The expectation is that as soon as an agent from source1 gets generated it will jump the queue and go stand first inline

When I run the model and I click to see the details of the queue, I can see that as soon as the agent from source1 gets created it jumps the line.

enter image description here

You can always create a custom toString() function to determine what must be displayed when you click on the queue block

enter image description here