Search code examples
anylogic

How to make condition for queue?


I want to make agents to not enter the queue if it's full (if it's full then go to sink) at the moment of arrival in selectOutput5. I tried to put "if-else" into "Actions" section enter image description here

But I don't really know which parameter to use (tried to use queue.size and queue.capacity but I don't know how to code this properly), please help. Not sure if I doing the right thing at all by trying to put if-else into actions of selectOutput5

The model look like this:

enter image description here


Solution

  • You need to code the conditions under which they should enter which queue and then if the conditions are not met it will assess the next out option.

    See example below

    enter image description here

    It will only go to queue 1 if the queue size is less than 5, else it will assess the queue size of queue 2 and if both are full then go to the exit.

    The Actions section is only for code you want to execute if they do exit one of the out options.