How can i initialize agent variables conditioning to environment properties #1023
Replies: 1 comment
-
I would suggest you instead create the agents within a initialisation function. This gives you access to the https://docs.flamegpu.com/guide/host-functions/index.html If you are creating your agents outside of the model (e.g. before you call |
Beta Was this translation helpful? Give feedback.
-
How can I access environment Property in function def initialise_simulation
.......
I initialize agents variables based on value of an environment variable "probability-i=1"
Initialize nation states
p = pyflamegpu.environment.getPropertyFloat("probability-i=1") //This line gives error "AttributeError: module 'pyflamegpu' has no // attribute 'environment'"
r = pyflamegpu.random.uniform(0, 1)
if r < p:
ns.setVariableInt("has-i", 1)
else:
ns.setVariableInt("has-i", 0)
Beta Was this translation helpful? Give feedback.
All reactions