'AnyLogic how to set attractor choice to both free and random

Is there a way to make attractor choice both free & random at the same time?

The problem I have with either on it's own is:

  • When the choice is set to Free - agents are using attractors in very predictable order based on attractor creation.
  • When the choice is set to Random - more than one agent is using an attractor at the same time, which I don't want.

Solution I found, but don't know how to implement correctly is in the following thread:

AnyLogic Attractor weird behavior

I tried to create an agent type (instead of a class) 'myAttractor' with a boolean variable inside (occupied or not occupied attractor), but I don't know how to assign that agent type to actual attractors within a node - if that is even possible?

Maybe there are other solutions to customise the attractor choice to achieve complete randomness with only one agent per attractor?

Many thanks in advance, Peter



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source