Aqeel Tariq
Aqeel Tariq

Reputation: 313

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.

Upvotes: 0

Views: 208

Answers (3)

Benjamin
Benjamin

Reputation: 12660

You should also understand why this happens: The conditions are computed sequentially, not at the same time.

So it first checks the first condition. Only if that is false will it even bother with the second, and so on.

So you'd need to have larger values from 1 condition to the next, which is not elegant.

Upvotes: 2

Felipe
Felipe

Reputation: 9431

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;

Upvotes: 1

Aqeel Tariq
Aqeel Tariq

Reputation: 313

Instead of using probability, I use the condition for selectOutput5.

For example:

If I have 3 racks, I want to split 18 agents equally among them. Then my conditions in selectoutput5 will look like this.

condition 1 : RackStore1.size() <6

condition 2 : Rackstore2.size() <6

condition 3 : Rackstore3.size() <6

condition 4 : false

The agents will split equally among the racks.

Upvotes: 0

Related Questions