-
|
Hi, I'm new to Mesa and had a question about how agents' actions are scheduled; Do agents perform their actions simultaneously, only using information available from the previous step? If yes, what is the point of A naive google search led me to find the deprecated My motivation for asking this is that some of the agents in my simulation make API calls and I'm trying to parallelize them. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Sorry for getting back so late. No, agents don't act simultaneously by default. When you use Why If you want actual simultaneous actions, you can use the two-phase approach that replaced self.agents.do("step") # Everyone decides what to do
self.agents.do("advance") # Everyone does itIn your agent class: def step(self):
# Look around, decide what to do, but don't change anything yet
self.planned_action = some_calculation()
def advance(self):
# Now actually do the thing
self.execute(self.planned_action)For your API calls: If you're trying to parallelize API calls, that's a different beast. You'd probably want to look into Python's async/threading capabilities. The See our Migration guide for even more detail. Does that answer your question? |
Beta Was this translation helpful? Give feedback.
Sorry for getting back so late.
No, agents don't act simultaneously by default. When you use
self.agents.do("step"), they go one by one in whatever order they're in the AgentSet. Each agent sees the changes from agents that went before them.Why
shuffle_do()exists: It just randomizes who goes first. This matters because if Agent A always acts before Agent B, that could create biases in your model. Shuffling keeps things fair and adds some randomness to the order.If you want actual simultaneous actions, you can use the two-phase approach that replaced
SimultaneousActivation:In your a…