1
votes

Dear AnyLogic community,

I have created a model to evaluate different methods of autonomous control.

I have agents with different due dates and want the agent with the soonest due date to be served first. At the moment the incoming agents are not sorted in any way but served according to the FIFO rule.

Is there a possibility to modify the sequence of the agents in a service block without adding a seperate queue?

Many thanks for your time & help!

2
use priorities... The sooner the due date, the higher the priority. Agents will be served according to their priorities. Have you tried that out? - Felipe
I assigned priorities now, but I don't know how to call them up within the service block? - Marie
In a service block, you can only use priorities to call up resources by their priority. You cannot sort the embedded queue within the service object. You need to add another queue object ahead of the service, only there can you make it sort by priority (or agent comparison as suggested below). Also, make sure to set the service-object queue size to 1 (0 is impossible) so there is no queing happening within service. - Benjamin
Does that mean that setting the task priority according to the agent's priority like suggested by Felipe does not ensure that the order with the highest priority gets served first? - Marie
I think it might not, actually. It isn't clear from the help on the Service block. Suggest you just create your own manual test to see how it really works :-) You could be right that the priority for service blocks actually sorts the queue. I never use it as the queue-seize-delay-release blocks allow me greater flexibility :-) sorry for the confusion - Benjamin

2 Answers

0
votes

You can map due dates to priorities, as Felipe suggested.

Alternatively, a more direct approach would be to use the queue priorisation mode "Agent comparison". Lets say your agents have a parameter "myDueDate" of type Date.

Then you can simply arrange agents with the most urgent due date as below, essentially saying "prefer the incoming agent1 to an existing agent2 if it is more urgent". The incoming agent will jump ahead of each of the queue members until it finds one that is even more urgent. enter image description here

0
votes

Benjamin's solution is good, but if you insist in not wanting to use a queue before the service block, and that you need to use a service block no matter what then you can set up priorities like this:

how to set priorities

Your agent's priority will be higher when the due date is closer.

Since you have already set up the priorities inside your agent, then there is nothing else to do but this (unless you want preemption).

But the priority can just be this if you want to set it up (priority being a parameter defined in your agent): priority setting