Search code examples
anylogic

How can I specify priority of agent type in ResourcePool in Anylogic?


I have a model, where I have a agent with parameter Type. There are Type1, Type2, and Type3.

I have one Service Station (ResourcePool) with capacity 2.

Now, I want to prioritize Type2 so that instead of FIFO policy in Seize Block, type2 should always be treated or served first in the process.


Solution

  • in the properties of the seize block there's a priority section

    in there you can do one of these 2 choices depending on what type of variable type is, using == for primitives (int, double, boolean) and .equals() if it's something else:

    agent.Type.equals(Type2) ? 2 : 0
    

    or

    agent.Type==Type2 ? 2 : 0