While the Random selection mode is self-explanatory, i.e. the execution order is not regulated, the FIFO and LIFO modes may require clarification, since the order of the events depends on the way AnyLogic initializes the model and processes the schedules of the events.
To better understand FIFO and LIFO selection modes, keep the following in mind:
In the FIFO mode events run in the following order : A, B, A, B, A, B, A, B.
Simulation time |
Actions |
Events Schedule |
T = 0 |
A schedules itself for T = 1 |
T = 1: A |
B schedules itself for T = 1 |
T = 1: A , B | |
T = 1 |
A (first queue element) runs and schedules itself for T = 2 |
T = 1:
B
T = 2: A |
B
runs and schedules itself for
T = 2 |
T = 2: A , B | |
T = 2 |
A
(first queue element) runs and schedules itself for T = 3 |
T = 2:
B
T = 3: A |
B runs and schedules itself for T = 3 |
T = 3: A , B |
In the LIFO mode events run in the alternating order: B, A, A, B, B, A, A, B.
Simulation time |
Actions |
Events Schedule |
T = 0 |
A schedules itself for T = 1 |
T = 1: A |
B schedules itself for T = 1 |
T = 1: A, B | |
T = 1 |
B (last queue element) runs and schedules itself for T = 2 |
T = 1:
A T = 2: B |
A
runs and schedules itself for
T = 2 |
T = 2: B, A | |
T = 2 |
A
(last queue element) runs and schedules itself for T = 3 |
T = 2:
B
T = 3: A |
B runs and schedules itself for T = 3 |
T = 3: A, B |
The events end up running in this order: E5, E3, E4, E1, E2.
Simulation time |
Actions |
Events Schedule |
T = 0 |
E1
schedules itself for
T = 1 |
T = 1: E1 |
E2
schedules itself for
T = 1 |
T = 1: E1, E2 | |
E3
schedules itself for
T = 2 |
T = 1:
E1, E2
T = 2: E3 |
|
The data set is updated (AU) and schedules its next update for
T = 1 |
T = 1:
E1, E2, AU
T = 2: E3 |
|
T = 1 |
E1 (first queue element) runs. It creates the C agent instance, which initializes E4 and E5:
E1 has finished processing, so it schedules itself for T = 2. |
T = 1:
E2, AU
T = 2: E3, E4, E1 T = 3: E5 |
E2
runs and schedules itself for
T = 2 |
T = 1:
AU
T = 2: E3, E4, E1, E2 T = 3: E5 |
|
The data set is updated (AU) and schedules its next update for the T = 2 |
T = 2:
E3, E4, E1, E2, AU
T = 3: E5 |
|
T = 2 |
E3
runs (first queue element) and schedules itself for
T = 3 |
T = 2:
E4, E1, E2, AU T = 3: E5, E3 |
E4
runs and schedules itself for
T = 3 |
T = 2:
E1, E2, AU T = 3: E5, E3, E4 |
|
E1
runs and schedules itself for
T = 3 |
T = 2:
E2, AU T = 3: E5, E3, E4, E1 |
|
E2
runs and schedules itself for
T = 3 |
T = 2:
AU T = 3: E5, E3, E4, E1, E2 |
|
The data set is updated (AU) and schedules its next update for the T = 3 |
T = 3:
E5, E3, E4, E1, E2, AU |
Simulation time |
Actions |
Events Schedule |
T = 0 |
E1
schedules itself for
T = 1. |
T = 1: E1 |
E2
schedules itself for
T = 1. |
T = 1: E1, E2 | |
E3
schedules itself for
T = 2. |
T = 1:
E1, E2
T = 2: E3 |
|
The data set is updated (AU) and schedules its next update for the T = 1. |
T = 1:
E1, E2, AU
T = 2: E3 |
|
T = 1 |
The data set is updated (AU - last in queue), and schedules its next update for the T = 2. |
T = 1:
E1, E2 T = 2: E3, AU |
E2
runs and schedules itself for
T = 2. |
T = 1:
E1 T = 2: E3, AU, E2 |
|
E1 runs. It creates the C agent instance, which initializes E4 and E5:
E1 has finished processing, so it schedules itself for T = 2. |
T = 2:
E3, AU, E2, E4, E1 T = 3: E5 |
|
T = 2 |
E1
runs (last queue element) and schedules itself for T = 3. |
T = 2:
E3, AU, E2, E4 T = 3: E5, E1 |
E4
runs and schedules itself for
T = 3. |
T = 2:
E3, AU, E2 T = 3: E5, E1, E4 |
|
E2
runs and schedules itself for
T = 3. |
T = 2:
E3, AU T = 3: E5, E1, E4, E2 |
|
The data set is updated, and schedules its next update for
T = 3. |
T = 2:
E3 T = 3: E5, E1, E4, E2, AU |
|
E3
runs and schedules itself for
T = 3. |
T = 3:
E5, E1, E4, E2, AU, E3 |