Принципы коллективной разработки многофункциональных агентно-ориентированных моделей
Принципы коллективной разработки многофункциональных агентно-ориентированных моделей
Аннотация
Код статьи
S207751800005393-1-1
Тип публикации
Статья
Статус публикации
Опубликовано
Авторы
Белянов Александр Александрович 
Аффилиация:
Центральный экономико-математический институт РАН
МГУ им. М.В. Ломоносова
Адрес: Российская Федерация, Москва
Аннотация

В данной работе предлагается подход к организации процесса разработки сложных агентно-ориентированных моделей. Обычно, если модель сложная и в её разработке участвует несколько человек или несколько команд разработчиков, интеграция частей модели (или нескольких небольших моделей в одну большую) представляется непростой задачей. Иногда этот процесс может быть более затратным (в части требуемого времени, усилий или средств), чем разработка отдельных частей. Чтобы решить эту проблему, предлагается использовать относительно простой подход, основанный на особенностях реализации механизма наследования некоторых объектно-ориентированных языков. В статье в качестве примера рассматривается реализация на Python.

Ключевые слова
агентно-ориентированное моделирование, коллективная разработка, модули, наследование
Классификатор
Получено
17.06.2019
Дата публикации
08.07.2019
Всего подписок
92
Всего просмотров
2102
Оценка читателей
0.0 (0 голосов)
Цитировать Скачать pdf
Доступ к дополнительным сервисам
Дополнительные сервисы только на эту статью
Дополнительные сервисы на все выпуски за 2019 год
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).
12

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

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. https://www.coursera.org/lecture/modeling-simulation-natural-processes/implementation-of-agent-based-models-196XP

2. Kinny D., Georgeff M. "Modelling and design of multi-agent systems." // In International Workshop on Agent Theories, Architectures, and Languages, Springer, Berlin, Heidelberg, 1996, p. 1-20.

3. Masad D., Kazil J. "MESA: an agent-based modeling framework." // In 14th PYTHON in Science Conference, 2015, p. 53-60.

4. Parunak H.V.D., Odell J.J. "Representing social structures in UML." // In International workshop on agent-oriented software engineering, Springer, Berlin, Heidelberg, 2001, p. 1-16.

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

Комментарии

Сообщения не найдены

Написать отзыв
Перевести