Search code examples
anylogic

How to limit the number of loop of one agent in a block in anylogic?


I am working on a model, where customer seize reception (order at reception for food) and then releases the reception and moves to seize dining table (sit at table). Now I have used select output (see image) which allows the customer to have another drink without seizing additional dining table because they already have seized one dining table.

Now I want to limit this loop to the number 8. That is one customer can have a maximum of 8 drinks (one agent can be in the system for 8 services/delay).

enter image description here


Solution

  • Put a int variable (name it counter) into your customer agent and add 1 to it every time the customer makes a loop.

    You need to setup the flow chart blocks to "know" that it is customers flowing through.

    Then, in one of the block's code sections, you can write agent.counter ++;