Code refactoring for behaviors
The code structure of agent behaviors is currently a little messed up.
- An agent behavior always requires a logic function
execute_agent_behavior()
that defines what the agent does in every simulation time step based on knowledge and incoming messages of other agents that have been received via MPI (Message Routers). - An agent behavior can OPTIONALLY use an instance of
villas_interface
to exchange data with external systems. This interface also requires a logic defining the interface initialization and its behavior in each simulation time step
We need to refactor the code structure so that it is clear where agent behavior logic and where agent VILLAS interface logic are implemented. It should be possible to use one VILLAS interface logic with multiple agent behavior logics and vice versa. Code duplication should be avoided as much as possible.
My first idea is separating the interface init + logic from the behaviors and moving it to separate classes that can be used by agent behaviors and are optionally called during agent behavior logic init and during execute_agent_behavior()
.