Search code examples
anylogicagent

How to send an agent to a room once it becomes available in Anylogic


I am creating a simulation of a clinic and I currently have patients in a waiting room being sent to an exam room once their wait time is over in the delay block. However, rooms often become available prior to the agent's wait time being finished. How can I trigger the agent movement out of the delay block and to an available room?


Solution

  • What you really need to do is for your rooms that are available to be defined as resources, so instead of a delay time you have a seize block that takes the room as a resource. With a seize block, the agents will wait as long as needed until a room is available.

    Now, if you need the patient to wait anyways for a certain period of time, then you can add a delay after the seize block in order to wait that time before moving into the room... but the room will already be reserved to that patient with the seize.