Issue
I am trying to free one waiting agent/pedestrian from a waiting room (overall there is a fixed number of agents waiting in that room), each time an agent from a different source (process modelling library) is generated. Thus, the number of waiting pedestrians decreases by 1 with each arrival in the other source. Ideally, I would like the pedestrians to be freed according to the attractor they are sitting on in the waiting room, but that wouldn't be my priority #1... I have tried calling pedWait.free(Pedestrian)
(and many similar versions) in the source from the process modelling library under the Actions properties "on before arrival", but keep getting the error "Pedestrian cannot be resolved or is not a field" (or the likes). Since googling or the AnyLogic help pages don't seem to be able to help me here, my question would be: What are the arguments that I need to pass to the free() function for it to run and how might I include the attractor order mentioned above?
Solution
You should be able to use pedWait.free(randomFrom(pedWait.getPeds()));
. This will remove a random ped from the block.
Learn how to use code-complete and how to understand the options you have. The free()
method wants to know exactly which ped to free, so you need to tell it. In the example above, we grab a random Ped from it.
Answered By - Benjamin