AutoVerse-ai / Verse-library

Library for modeling, simulation, and verification of interacting autonomous agents
https://autoverse-ai.github.io/Verse-library/
University of Illinois/NCSA Open Source License
29 stars 18 forks source link

Shared Variables? #11

Closed dassarthak18 closed 1 year ago

dassarthak18 commented 1 year ago

Is there any method to implement shared variables between multiple agents? I have tried to use global variables using Python's 'global' keyword, but this results in an error from the parser.

crides commented 1 year ago

Shared variables aren't implemented, and the parser error is expected. However, since agents can read other agent's variables (depending on the sensor), if you have a defined order of the values for each of the shared variables, you could use a variable in each agent that signals the others of an update to the shared variable, and use that as an approximate for shared variables for now.

dassarthak18 commented 1 year ago

If we have two different types of agents, A and B, and the scenario has a single copy of A and n-1 copies of B, is there a mechanism to implement a shared variable in A and access it from all copies of B, without having to explicitly implement the same variable in B?

lyg1597 commented 1 year ago

I think currently you have to had the same variable in all n-1 copies of B as the sensor require all agents having same set of variables.