anylogic

Seized resources don't correspond to agent location in workflow


The agents that are currently in the delay after a seize block are not the same agents that are shown as holding the resource.

Agents 52, 53, 54 are in the delay, agents 48, 49, 50 are holding the workers
Agents 52, 53, 54 are in the delay, agents 48, 49, 50 are holding the workers

I seize two resources as at once and release them separately with a fixed delay between each step.

resources:

Workers are released first.

I let the simulation run until the first three agents release both resources and new agents had been seized.
I expect the agents in the first delay block (delay) to always be the same as the agents that hold the workers.
Instead the agents in the first delay (52, 53, 54) are still shown in the request queue of both resources.


Solution

  • The agents in the delay block are the same as those who've seized the workers; it's just to do with how those AnyLogic orange callout boxes refer to the agents and because all agents are coming from the (changing) default population.

    (i) Unless you specify otherwise, all agents created by Source blocks, Resource Pools, etc. are lumped into the 'hidden' default population. Because you have Sink blocks in your main flow, the position of the (fixed) worker agents in that population changes over time.

    (ii) The Resource Pool callout blocks show the agents making requests by reference (note the root.<population> syntax) so they always show the current position in the population. It looks like things like the Delay callout box shows agents inside by their ID number on entering the block (note not using the reference syntax). So they were originally ID numbers 52,53,54 but are now not.

    This is one good reason to have a 'clean' set of populations for different things. You can also assign your own ID numbers as attributes of the agents you create (requires custom agent types) which is sometimes a better option too. The orange callout boxes are not very intuitive and effectively use a lot of 'internal' detail in what they represent.