## 1 Introduction  
Among the many approaches proposed to engineer systems featuring distributed intelligence, a relevant one is _self-organization_[1], by which global structure and behavior are robustly achieved by continuous local interaction of simple individual components. This is generally meant to promote inherent adaptation to unexpected (or not completely foreseeable) contingencies, supporting applications in contexts such as human social behavior, swarm robotics, and task allocation. Therefore, in this paper we deal with artificial (software-based) self-organizing systems. Self-organization was first observed in nature, in natural systems such as ant colonies or bird flocks, and the first mechanisms for self-organization engineering were largely inspired by such systems [1]. In recent decades, the engineering of self-organization has been widely researched in various areas including multi-agent systems [2], autonomic computing [3], self-managing and adaptive systems [4],and resource management [5]. Self-organization is generally understood as the ability of a system to sustain its internal order, in face of change and without any external control--few formalization attempts exist, e.g., via a notion of entropy of the population of system components [6]. Often, it is common in the literature to refer to artificial systems endowing the ability to self-regulate their internal structures and behavior (e.g., by mimicking self-organization mechanisms observed in nature) as simply _self-organizing_[3; 6; 7; 8; 9]. Following this convention, in this paper we use term \"self-organizing (cyber-physical) system\" to mean an \"artificial (cyber-physical) system featuring self-organizing logic\". When self-organizing approaches are applied to distributed cyber-physical systems (CPS), they are essentially used to collect and process information generated by sensors distributed over the environment, and use it to control the system behavior itself [10]--often in a purely decentralized fashion. There, individual system components form a flat space that interact with each other based on physical proximity. In these settings, direct communications with centralized servers are unpractical, expensive, or even impossible. Recent advances in technology foster pervasiveness of computing and communication, providing opportunities for novel services and applications, which then turn into new engineering and research challenges. Current trends are making modern CPS increasingly large-scale, heterogeneous, and dynamic, requiring increasingly complex and heterogeneous infrastructures [11]. On the one hand, remote clouds provide virtually unlimited on-demand resources (computing, storage, services), provided that costs (both in money and latency) and data protection procedures can meet the requirements of the application at hand. On the other hand, edge computing brings resources closer to users, reducing latency (increasing reactivity) and managing concerns about data dissemination. These two complementary architectures are often intertwined with other communication technologies, such as proximity interaction (e.g., Bluetooth or Near-field communication), and long-range wireless communication (e.g., Sigfox [12] or LoRaWAN [13]). Such intricate and dynamic infrastructures complicate the task of solid engineering of distributed intelligent systems, whose logic tends to be significantly dependent on it. In particular, this hampers the possibility of reusing design elements across different application scenarios, and exploiting the available ICT resources opportunistically (e.g., for optimization, graceful degradation, or customization purposes). To that end, in this paper we investigate the following problem:  
_How to design and implement the self-organization logic of CPS in a deployment-independent way?_  
With \"deployment-independent\" we mean a separation of concerns between the self-organization logic and the deployment context.