Principles of collaborative development of complex agent-based simulation models
Table of contents
Principles of collaborative development of complex agent-based simulation models
Publication type
Статус публикации
Aleksandr Belianov 
Moscow State University
Address: Russian Federation, Moscow

This paper suggests an approach to organize complex agent-based models’ development process. Usually if a model is complex and several people or several teams of developers are involved an integration of parts of the model could be a challenging task. Sometimes this process can be more costly (in terms of time, labor or financial resources required) than development of separate parts. To address this issue, it is suggested to use a relatively simple approach that is based on the implementation of the inheritance mechanism in some object-oriented languages. The paper reviewes an implementation in Python as an example.

agent-based simulation, Python, collaborative development, modules, inheritance
Date of publication
Number of characters
Number of purchasers
Readers community rating
0.0 (0 votes)
Cite Download pdf

To download PDF you should sign in

1 Introduction
2 Even though the design of agent-based models can be very complex, at its core there is always a set of agents that operate within a certain environment. The nature of agents and their probable actions can differ from model to model, and so can the environment. When developing a complex model, it is possible to split it into relatively independent functional submodels that focus on certain aspects of the bigger problem. These separate parts usually have agents of the same type and sometimes - the same environment, but the properties and actions of the agents are different, and - if existent - external forces have an influence only on the aspects within this submodel, even though it still might have an indirect impact on other submodels as well.
3 Traditional Approach
4 Using traditional approach, we would have separate teams, and each would implement the conventional structure of the model (Falcone 2019). To illustrate the general setup of the software implementation of an agent-based model (ABM) I present an illustration from the (Masad 2015) that shows on a UML diagram the general structure of the MESA Python framework (Pic. 1). As it is easy to mention, usually ABM is implemented with two classes (Kinny 1996): a model class, that contains a list with agents, properties of the environment and related to them methods, and an agent class (Salamon 2011), that contains corresponding properties and methods.
5 Pic. 1 Part of the simplified UML diagram of Mesa architecture (Masad 2015)
6 In this paper we will not draw the line between agent-oriented programming and object-oriented programming of agent-based models since the implementation seems to be close in terms of architectural approaches. Also we are not going to focus on issues of agents interactions with each other and environment, and therefore, we will not discuss implementation of communication, perception, etc.
7 To add some clarification, let’s assume that we use sequential model (illustrated on Pic. 2). In this case, a loop within a model calls a method step() every time interval T. This step() method conducts all operations related to environment and contains another loop that iterates agents (or uses any other scheduling option).
8 If we have two teams that work on two aspects of the same model, we will have two sets of model and agent classes. Each would have its own constructor and there would be two step() methods. So, if we decide to integrate these two models into a single one, we would have to either merge these two sets of classes manually, either create two sets of models and agents and then sequentially or in a parallel manner call them and somehow sync with each other. Both options seem to be quite effort consuming.
9 Pic. 2 Flowchart scheme of a conventional agent-based model
10 Suggested Approach
11 What else we can do, is to create a model class that is inherited from existing two and do so for the agent class as it is presented on Pic. 3. (Parunak 2001).

Pic 3. Class diagram for the model that has two parts

13 By doing so we would have to call step() from the first model class and then step() from the second, so we would have to change the original naming of at least one method and call them directly. This seems to be better, as we would have only a single set of agents and we don’t need to conduct data synchronization. But the problem is that the more parts we have, the more changes we would have to make. It would be nicer to reduce our integration efforts.
14 Implementation
15 We can make all the teams use the same Model and Agent templates that utilize the same structure and have some equally named methods. So, we expect each team to create modules of suggested structure that will allow them to be used in a single model without additional integration procedures. In the program, this will be implemented by iteration of parents’ classes and calling methods of the same name. The implementation of such approach in Python is presented at Pic. 4. In this sample code three modules (demo, labor and user) are loaded. Each of them contains two classes: Model and Agent, the Model in each has a step(agents) method that receives a list of agents. After the modules are loaded the ExtendedModel and the ExtendedAgent classes are created based on a generic Model and Agent classes and by inheriting from loaded classes.

Pic. 4 Code sample of several modules being loaded and merged into a single model.

17 Generic Model class contains a simple method that calls for methods of its parent classes and provides them with a list of ExtendedAgent class objects. This method is presented in Pic. 5.
18 Pic. 5 Method that calls for parents classes’ methods and provides them with a list of ExtendedAgent class objects.
19 Opportunities, limitations and notes
20 Such approach allows to integrate easily several models into a single one. Obviously, there are significant limitations that come with this easiness. First, all classes must have agents of the same nature, otherwise it will all make no sense. Secondly, all parties should be cautious about using same variables and therefore additional costs on interactions and synchronization of the development process have to be considered.
21 As a side note it is worth mentioning the way to implement agents’ replication. The ExtendedAgent class has to be transferred to the ExtendedModel as a parameter so it is possible to either create new ExtendedAgent objects within the model, or - if we want greater realism - to transfer it further to the Agent within particular module during iterations over the parents’ classes. For example, within the Demographic module it would be possible to let Demographic agents have kids that are ExtendedAgents just like their parents are. Without this transfer there would be no way to create agents that inherit all properties of all Agent classes of all modules loaded.
22 Conclusion
23 All in all, it seems that such approach allows to speed up the development of complex agent-based models with significant simplification of the integration process. However, this comes at a cost of potential overlapping functionality that can disrupt an integrated model operation in an obscure manner.


1. Falcone J.-L. “Implementation of Agent Based Models” Lecture part of a University of Geneva course “Simulation and modelling of natural processes” Coursera. Retrieved from the web on June, 2 2019.

2. Masad, David, and Jacqueline Kazil. "MESA: an agent-based modeling framework." In 14th PYTHON in Science Conference, pp. 53-60. 2015.

3. Kinny, David, and Michael Georgeff. "Modelling and design of multi-agent systems." In International Workshop on Agent Theories, Architectures, and Languages, pp. 1-20. Springer, Berlin, Heidelberg, 1996.

4. Parunak, H. Van Dyke, and James J. Odell. "Representing social structures in UML." In International workshop on agent-oriented software engineering, pp. 1-16. Springer, Berlin, Heidelberg, 2001.

5. Salamon, Tomas. Design of agent-based models. Eva & Tomas Bruckner Publishing, 2011.