Search code examples
anylogic

Why are agents not following attractors


So, I have a model where I want to insert a number of service stations to handle incoming aircrafts. "Main" looks like this:

enter image description here

In the properties of the serviceStations population I have set the "inital location" to "in the node" (the node surrounding the attractors). And the parameter "numberOfServiceStations" holds an integer of 6 in order to decide the initial number of agents.

However, when I run the model, the agents gets randomly scattered like so:

enter image description here

Is there a way to arrange the service station agents according to the attractors?


Solution

  • True, this does not work directly. You can force your agents to use attractors using a small trick:

    1. Create and Enter and Exit flow chart as below, make it accept your agent type: enter image description here
    2. Ensure to setup the Enter block as above on the "New Location" and "Node"
    3. The initial position in the agent population can stay at the default setting as below: enter image description here
    4. In the "on startup" code of the agent type, send them through the Enter block: enter image description here

    NOTE: Attractors work randomly and have no concept of being "full". You could see 100 agents on top of each other on 1 attractor.