Search code examples
processqueueanylogic

AnyLogic release agents from queue within another proess block


In my process, I want that the agents waiting in the queue to be released, when the agent before has completed its process. Is there a simple way to activate the longest in the queue waiting agent, when a agent has entered the moveTo4 block? The agents may not move until they are released. enter image description here


Solution

  • Easiest way is to put a Hold block between the queue and moveTo2 blocks.

    Set it up so it is initially unblocked and it is blocked "Manual (use block(), unblock() methods)".

    In the moveTo4 block's "on at exit" code block, call myHoldBlock.unblock(). This will open the "flood gates" and all agents from queue will spill downstream (if possible).

    You may want to also call myHoldBlock.block() when an agent enters moveTo4, you will want to experiment a bit. Check the help on the Hold block, it is really powerful.