Search code examples
anylogic

Make two agents follow the same random number stream


So I have two agents, "Agent1" and "Agent2" both inheriting a statechart from the mother class "MotherAgent":

enter image description here

  • In the transition from "normal" to "down" I have added exponential() * 5 days
  • In the transition from "down" to "normal" I have added 1 day.

When I run the simulation, I see that "agent1" and "agent2" do not make transitions at the same time.

The end goal is to make the two agents have the exact same transitions (they move to "normal" at the same time, and they move to "down" at the same time)

How can this be achieved? I am open to other modelling approaches if they fit the problem better.


Solution

  • it's better to coordinate the transitions separately, using an event for example, and when the event is triggered, all the agents are sent a message that will trigger the transition.