Anylogic – Combined multiple items back to original owner [closed]

This is how I would do it.

  1. obviously you will have agent types: passenger and bag
  2. you will create a connection between these 2 agents:
    passenger will have a link 1 to many to your bags… let’s call it bagsLink
    and bag will have a link 1 to 1 with a passenger… let’s call it passengerLink
    If you have no idea what connections are, check this article:
    benjamin-schumann.com/blog/2017/10/21/anylogic-agent-links-a-hidden-gem-for-your-connections
    and learn how to use connections
  3. you will replace queue and queue1 with wait blocks (passengerWait and bagsWait)
  4. On the passengerWait, on the onEnter action you will check if all the bags connected to the passenger are on the bagWait block… if they are… then you will free (wait.free(agent)) the passenger and the bags
  5. On the bagsWait, on the onEnter action you will check if the passenger connected to the bag is in the passengerWait block and if all the bags connected to the passenger are on the bagsWait block… if they are… then you will free (wait.free(agent)) the passenger and the bags
  6. add a small delay after the passenger block that represents the time it takes for the passenger to pick up the bags
  7. Use a pick up block after the delay on the passenger side (you will need a new queue after bagsWait in the bags side)
  8. Use the following condition to pick up the bags… agent.passengerLink.getConnectedAgent().equals(container)

A lot to do, but it should work because I have done this before like this 🙂

Leave a Comment