# On Managing Knowledge for MAPE-K Loops in Self-Adaptive Robotics Using a Graph-Based Runtime Model
## 1 Introduction
In the software architecture controlling the robot's behaviour, several loops will run in parallel in order to satisfy several goals (e.g., detecting and locating a roll container, meanwhile approaching in order to pick it up), all of them necessary for completing a task. In these scenarios, the scheme must be extended for supporting intra-loop and inter-loop coordination. Intra-loop coordination will enable MAPE computations within one loop to be coordinated. Inter-loop coordination will enable MAPE computations across multiple loops to coordinate with one another. This will allow the MAPE computations of different loops to coordinate the various phases of adaptations. On the other hand, as it was pointed out by [PERSON] et al. [4], the MAPE scheme must be slightly extended when runtime models are considered. A runtime model is a dynamic knowledge base that, in our case, can abstract useful information about the robot and its operational context. Thus, the runtime model augments the information available at design-time with information captured at runtime. This allows a system to successfully operate in a dynamic context [4]. This paper proposes to deal with both initiatives by implementing a runtime model as an internal representation including symbolic and metric information. The Deep State Representation (DSR) [5; 6] is a multi-labelled directed graph that holds symbolic and geometric information within the same structure. Symbolic tokens are defined as logic attributes related by predicates that are stored within the graph in nodes and edges. Geometric information is stored as predefined object types linked by 4 \(\times\) 4 homogeneous matrices. This information is also stored as nodes and edges of the graph. In our proposal, the DSR is a unique representation shared and updated by all software agents in the architecture. Synchronisation in the representation is addressed by means of messages that are annotated in the DSR [6]. At the perceptive level, nodes/edges are only updated by specific agents--this mapping is established at design time: for instance, only the PersonDetection agent can annotate in the DSR that the robot is detecting or not detecting a person or group of people. At the deliberative level, the decision-making agents annotate messages in the DSR that allow the other decision-making agents to know what the current running action and its execution state are. Thus, we can affirm that all steps from the MAPE loop are simultaneously running. The software agents in charge of detecting obstacles or people or updating the battery value are always updating the model (by modifying the values on nodes or edges or by adding new items to the graph). Using this (internal and external) contextual information, other software agents will estimate non-functional properties, such as safety or performance. Estimated as Quality-of-Service metrics, their values will be also annotated in the DSR. Thus, raw context values and estimated QoS metrics will be available to all task-based agents present in the architecture and, together with information about subgoals and actions, they constitute the basis for allowing intra- and inter-loop coordination. The Plan step will monitor the evolution of the context for suggesting modifications to the deliberative course of action, but this evolution will also modulate the behaviour of more reactive agents. The goal is to synchronize the activity of all agents in the architecture through the annotations on the DSR. The rest of the paper is organized as follows: Section 2 discusses related work on knowledge representation for robotics that can help their self-adaptation, focusing on those graph-based representations combining semantics and geometric concepts. Section 3 presents the DSR as a runtime model. Moreover, we will show how the DSR supports coordination of MAPE loops. The whole MAPE-K framework is described in Section 4. This section introduces the definition and interaction of the MAPE loops through the DSR.