Search code examples
simulationanylogic

Split the agents equally using SelectOutput5 in AnyLogic


I am using selectOutput5 in my model.

enter image description here

On the basis of the probability being equal for all the output ports, The number of agents who came out should be equal, but that is not the case.

enter image description here

Please let me know how I can split the agents equally.


Solution

  • if you want them to be split equally you can use the "Exit Number" option and use a counter that will increment everytime, and when it reaches 3, the counter goes back to 1

    so the counter starts with 1 Exit Number is equal to counter

    then whenever an agent exits, you do

    counter++;
    if(counter==4) counter=1;