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 Answers
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...

- 8,311
- 2
- 15
- 31
-
Thank you for your complete answer. I understand how it work now, but my problem is still go on. I want that all agent receive massage at same time, and then trig new state and so on... in this way some massage lost and agent can not use them. how can handle this? – soheil Jan 30 '18 at 16:14
-
You need to give more details then... your problem is probably something else... You need to create a small example that we can reproduce to understand what the problem is – Felipe Jan 30 '18 at 23:57