OFFIS-DAI / Mango.jl

Modular Julia-based agent framework to implement multi-agent systems
https://offis-dai.github.io/Mango.jl/stable/
MIT License
8 stars 2 forks source link

Role expose/import data models using a macro #24

Closed rcschrg closed 6 months ago

rcschrg commented 7 months ago

Imagine there is a role holding the neighborhood

@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.