I'd like to hear my fellow programmer's thoughts on the issue of parametrizing agent based simulations:
- Simulation core, including geometry, collision tests, some rules
- Different agents (modelled in OOP-fashion: has-a, is-a, abstract interfaces)
- Agents have different sensors, different actors, different controllers, ... All connected together by references/pointers and accessed using abstract interfaces.
So essentially, each agent is composed of an ownership tree (agent owns sensors, controller, actors), superimposed by a dataflow-graph (sensor connected to controller, connected to actor). The tree, the graph plus the parametrization of the things together form a simulation setup. Running a simulation amounts to:
- Read in simulation setup
- Instantiate a bunch of objects, parametrize and connect them together to form the tree and the graph
- Run simulation
- Output some data (statistics, signals, whatever)
The question is how best to save the simulation setup, and how to instantiate & parametrize stuff.
Requirements (some of them conflicting):
- The parametrization should probably be structured along the ownership tree, as it feels most natural.
- A lot of times I'd like to instantiate a bunch of similar agents with just the 1 or 2 parameters changed between instances. That needs to be easy.
- I'd like to keep parametrization and code close together. When experimenting with algorithms that are affected by parametrization, I wouldn't want the changes to be spread out over too many places.
- Conversely, I'd like to keep parametrization out of the code, so that it's easy to automate simulation runs in order to systematically sweep through parameter spaces.
- Parameters have meta-data: type, value range, physical unit, textual description, logical dependencies (e.g. if you specify X you must not specify Y)
- Parameters not only affect data (member variables) but also code (usage of a particular specialization of the abstract base)
Now my colleges and me are tasked with building a new agent-based simulation:
- Do you know any frameworks / libraries / techniques?
- Are any patterns applicable? Best practises?
- Abandon OOP altogether?
Looking forward to your thoughts.