Search code examples
anylogic

AnyLogic, how to change the batch size dynamically?


I have a model where the agents are created by the event but in random manner (uniform_discr(2, 4)). Each group of agents have it's unique number (batchNumber). The size of agents may be different. Then, the model creates the batches of the agents depends on the quantity of the created agents (batchSize). So in this case it may be 2,3 or 4 agents in the batch. It is the number of agents in the batch. Each batch obtains it's volume depends on the volume of it's agents (Resource_quantity).

How to change the batch size and it's volume dynamically?

I used the solution proposed here and used Wait and Batch blocks.

The peace of the model

Wait block Batch block

The problem is that under the running the model I receive the error (batch capacity must be greater than 0).

I understand that it must be greater than zero and I defined it in the wait block.

What's the problem here?

error


Solution

  • In your example you can set the initial batch size to any arbitrary number since no agents will be batched until they are released from the wait block and you set the batch size of the batch block before releasing any agents.

    Set the initial batch inside the batch size to any number greater than 0 and see if it works