0
votes

How can I run agents simultaneously in Anylogic? when I define some agents in Anylogic and then run program, all agents did not run simultaneous. which means that all agent stay in first state then one of them go's some state and others wait until in their turn. is there solution for my problem? tanks.

1

1 Answers

0
votes

What you are asking will never happen, even if you do parallel processing of each agent.

Assuming that for example you have for each agent an initial state X with a timeout transition that will happen after 1 second to a state Y.

What's going to happen? Well, you will see that each agent will move from X to Y one after the other... yes, but if you check the time in which each of them move from X to Y, it will be exactly the same. use time() function to discover that all agents will move to state "Y" at the exact same millisecond.

In summary, your problem is probably not a problem and you are just confused about what is going on.

As an analogy, try to create a code equivalent to this where all the elements of "aux" are equal to 2 at the same time:

for(int i=0; i<100; i++){
     aux[i]=2;
}

how can you create a code that makes each one of the elements of "aux" equal to "2" at the same time? Well, it's not possible... because a computer runs everything sequentially, and even if you process everything in parallel, they will still not all be equal to "2" at the same time...

But in the virtual time of a simulation YES, all the agents will run at the exact same time. In the real time of your wrist watch, NO, they won't run at the same time...