@role NeighborhoodRole begin
neighbors::Array{AgentAdress{Any}}
end
There are reasons to share this data to other roles who also work on the environment. This can be done with
get_model(role, WrapperModel) in setup, then setting the array. However this is boilerplate we might wanna reduce
if we wanna share often used data in roles.
It is desirable to do this declarative, we declare shared data and we declare shared data, e.g.
@role OperatingOnNeighborhoodRole begin
@shared neighbors::Neighbors
end
The @shared would just initialize the Neighbors model with a similar function as get_model(), and remember to assign the instance to the role handler when added to an agent.
Imagine there is a role holding the neighborhood
There are reasons to share this data to other roles who also work on the environment. This can be done with
get_model(role, WrapperModel)
in setup, then setting the array. However this is boilerplate we might wanna reduce if we wanna share often used data in roles.It is desirable to do this declarative, we declare shared data and we declare shared data, e.g.
The
@shared
would just initialize the Neighbors model with a similar function as get_model(), and remember to assign the instance to the role handler when added to an agent.