{'fraction_non_alphanumeric': 0.031318380743982493, 'fraction_numerical': 0.006017505470459519, 'mean_word_length': 4.730603448275862, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Learning of Coordination Policies for Robotic Swarms

Inspired by biological swarms, robotic swarms are envisioned to solve real-world problems that are difficult for individual agents. Biological swarms can achieve collective intelligence based on local interactions and simple rules; however, designing effective distributed policies for large-scale robotic swarms to achieve a global objective can be challenging. Although it is often possible to design an optimal centralized strategy for smaller numbers of agents, those methods can fail as the number of agents increases. Motivated by the growing success of machine learning, we develop a deep learning approach that learns distributed coordination policies from centralized policies. In contrast to traditional distributed control approaches, which are usually based on human-designed policies for relatively simple tasks, this learning-based approach can be adapted to more difficult tasks. We demonstrate the efficacy of our proposed approach on two different tasks, the well-known rendezvous problem and a more difficult particle assignment problem. For the latter, no known distributed policy exists. From extensive simulations, it is shown that the performance of the learned coordination policies is comparable to the centralized policies, surpassing state-of-the-art distributed policies. Thereby, our proposed approach provides a promising alternative for real-world coordination problems that would be otherwise computationally expensive to solve or intangible to explore.


I. INTRODUCTION
Biological swarms can act in coordination to perform tasks far beyond the capabilities of individuals [1]. In the absence of a centralized control mechanism and global observation, swarm intelligence emerges from the local behaviour of individual agents governed by simple, unified rules [2]. The distributed structure of swarm systems makes them less vulnerable to individual failures. When this robust nature is well-realized in robotic systems, robotic swarms can then be relied upon to solve complex real-world problems such as search and rescue, object transportation, and Mars exploration, where centralized control can be extremely costly or may be impossible [3]- [5].
To explore this domain, this work focuses on studying distributed robotic systems with the following properties: • All agents are identical (i.e., homogeneous).
• Each agent has only local interactions and observations. • Each agent follows an identical distributed policy with no presence of a leader. To coordinate individual agents towards achieving a mutual objective, a key challenge is to relay local actions and observations from agent to agent. A distributed policy, therefore, nication protocols in addition to the action policies, which completes the distributed policy we aim to learn. Since the input and output vectors for the communication information all have fixed sizes, the distributed policy network must learn how to aggregate information for effective communication. This also enables us to control the communication flow and analyze the communication information sent from agent to agent. This can be regarded as an analogy to controlling the size of the representation layer of an auto-encoder and analyzing the learned representation.
Our learning approach can be applied to a variety of distributed robotic tasks, provided that a well-designed centralized policy is available. On a rendezvous task with limited visibility, this approach consistently outperforms the stateof-the-art distributed control law for systems consisting of different numbers of agents. The generalizability of our proposed approach to other robotic tasks is demonstrated in a task for which no distributed solution exists. Our approach provides a tangible alternative for complex robotic tasks for which centralized policies can be designed. Moreover, we analyze the learned communication protocols and provide insights on their meaning. This analysis of learned coordination policies could potentially benefit the manual design of communication protocols for complex robotic swarm systems.
In the following sections, we begin discussions with a brief overview of related literature in Section II. Upon defining the control framework and the problem statement in Section III and IV, our learning approach is discussed in Section V. The simulation setup and the corresponding results are presented in Section VI and VII.

II. RELATED WORK
In the distributed control literature, most work focused on the manual design and analysis of distributed control laws for simple robotic tasks [6]. For example, [16] and [17] both study rendezvous and flocking tasks and analyze the performance of various distributed control laws. However, these studies are based on simplified robot dynamics (e.g., single or double integrator). Adapting these approaches to more complicated distributed robotic tasks can be challenging.
With little human expertise required, learning-based approaches provide alternatives for challenging distributed robotic tasks. The majority of these works focus on only learning the action policy, and assume pre-defined communication protocols or no communication among the agents at all [18]- [20]. These approaches lack the flexibility to adapt the communication information, thus, limiting the capability of the distributed robotic system. Our approach learns both the control policy and the communication protocols among the agents, allowing the emergence of more effective interagent communication.
Some recent work has explored learning communication protocols through reinforcement learning. Specifically, [15] and [7] perform independent learning where each agent learns solely from its local observations. Others assume that centralized learning can be performed [8]- [10] and [14]. In particular, [14], [9] and [13] assume that the communication channel can be differentiated during backpropagation. While [14] employs multiple communication cycles at each time step, [9] and [13] are similar to our control framework, which assumes that the communication emitted can only be received at the next time step.
Different from all the reinforcement learning approaches above, our approach makes use of pre-designed centralized policies and learns communication protocols by imitating the behaviour of the centralized policies. Compared to the reinforcement learning approaches, our approach can learn communication and action policies more efficiently using the guidance of the centralized policies. This approach is inspired by [14], which performs supervised learning on a simple lever-pulling task using multiple communication cycles at each time step. We perform learning in the distributed robotic domain using a different framework, which assumes a single communication cycle at each time step.

III. DISTRIBUTED CONTROL FRAMEWORK
Consider a group of K homogeneous agents that are to complete a task T with a dynamic connectivity network defined by a bidirectional graph represents an agent and each e(v i , v j ) ∈ E(t) represents a connection between agent v i and agent v j . We to be the set of all the neighbours of agent v i . For each neighbour v j ∈ N i (t), we can define c ij (t) to be the communication information sent from agent v i to agent v j at time t. In this work, we define c ij (t) ∈ R n as a communication vector, where n is the size of the communication information.
For convenience, we also define to be the communication inflow to v i , with c i in (1) = ∅, and to be the communication outflow from v i . This means that the communication information sent at the previous time step (t − 1) is received at the current time step t. When v i and v j are the same agent, the communication vector c ij is a special case, which allows the agent to leave information to itself. In this work, we allow this self-talking behaviour. At each time step, agent v i obtains an observation information o i local and receives information c i in . The agent then sends information, c i out , to its corresponding neighbours N i , and performs an action a i ∈ A, where A is the unified action space of all agents (see Fig. 2).
We define π d as a unified, distributed policy for all agents with the following equations holding true for all v i ∈ V : where Q i (t) is the probability distribution over the action space A used by v i at time t (see Fig. 3).

IV. PROBLEM STATEMENT
Consider K agents with the homogeneous, distributed control framework described in Section III. The problem targeted by this work is to learn a mapping from communication inflow c in and local observations o local to communication outflow c out and action probability distribution Q. This mapping is referred to as the distributed policy π d modelled by a DNN, which interprets the communication inflow and the local observations, and infers the communication outflow and the action probability distribution. The goal is to find a policy that optimizes the performance of the target task T . During the learning process, robot actions and observations of a centralized strategy are available (Fig. 1).

A. Neighbour Discretization
The amount of communication inflow and outflow for each agent is changing dynamically as the number of its neighbours changes. Since learning a model that has variable input and output dimensions can be challenging, we perform a neighbour discretization to provide constant input/output dimensions. In this process, each agent's neighbours are partitioned into P groups based on a discretization rule D: where each P i p ⊆ N i , p ∈ {1, 2, · · · , P }, represents a subset of neighbouring nodes and o i local may be used to obtain the discretization. To apply this discretization, we process the communication inflow and average the communication vectors within each group of agents. We also restrict the communication outflow such that the communication vectors sent to the agents in the same group are identical. To formulate this, we define the communication inflow c i,D in and outflow c i,D out after the discretization as follows: with p ∈ {1, 2, · · · , P }, where c i,D in (t) and c i,D out (t) are the concatenations of P communication vectors after discretization, and | · | represents the cardinality of a set. This renders the dimensions of the communication inflow and outflow constant. Thus, the distributed policy we aim to learn is transformed into In this work, we assume that the neighbour discretization is pre-designed and task-specific. Learning the discretization rule is left for future work.

B. Learning from a Centralized Policy
Using supervised learning, our approach builds upon a pre-designed centralized policy π c , which defines the action probability distributions of all agents based on global full observations. This can be formulated as follows: where • o global is the global observation, which includes all the local observations {o i local |v i ∈ V } in the global frame. • Q * i is the action probability distribution of agent v i suggested by the centralized policy π c .
The objective is to make the learned distributed policy π d behave as similar to the centralized policy π c as possible.
Directly learning the communication protocols among the agents from the centralized policy is difficult because the centralized policy does not provide correct and labelled communication protocols among the agents. Based on the problem setup, the communication vectors sent at the previous time step are received at the current time step, resulting in a communication information flow across multiple time steps. To learn such a flow of information, we require the learning process to operate across multiple time steps as well.
To formulate the learning target, we first assume π d can be parametrized by θ as π d,θ . Over the course of performing task T with L time steps using a distributed policy π d,θ , we can define the overall mapping we aim to achieve as This mapping is modelled by a neural network consisting of identical components connected by communication vectors among the agents across multiple time steps (see Fig. 4 for an example of the neural network). We recall that this neural network is a multi-step, multi-agent neural network (MSMANN), where the identical components are the distributed policy network for every agent at each time step. The backpropagation can be performed throughout the MSMANN to optimize the distributed policy with respect to a learning objective, which is minimizing J(θ): where K is the number of agents and L(Q, Q * ) is the loss function for evaluating the difference between two action probability distributions. By minimizing J(θ), we can learn the distributed policy π d such that it behaves similarly to the centralized policy. With the guidance of the centralized policy, we hypothesize that this supervised learning process is more efficient than the reward-based learning, which has no direct guidance. An interesting possibility is to use reward-based learning for improvement after having completed supervised learning from the centralized policy. This possibility is left as future work. Fig. 5. Radial discretization used in the rendezvous task. The visible area is discretized into 9 components. The vectors {∆s D 1 , ∆s D 2 , · · · ∆s D 9 } from the agent to the center of each area represent the discretized action space.

VI. SIMULATION SETUP: TWO DIFFERENT TASKS
In order to demonstrate our proposed learning approach, we consider two coordination tasks: (i) the rendezvous problem with limited vision range and (ii) the particle assignment task. The former is well-studied in the control literature and our solution is compared against the state-of-the-art distributed control law; the latter is a task that has not been solved in the framework of distributed control before.

A. Rendezvous with Limited Visibility
We demonstrate our learning approach on the rendezvous task with limited visibility given (i) its simplicity, and (ii) its assumption of local interactions which fit our framework.
1) Task Formulation: Consider K homogeneous agents located in a 2-dimensional plane with the position vectors {s 1 , s 2 , · · · , s K }. Each agent is governed by double integrator dynamics and its position is controlled by a PD-type controller. The input to the controller is the desired position vector relative to the agent's position, which corresponds to the action a of the agent. We define dynamic connectivity network G(t) = (V, E(t)) based on visibility: (12) where d lim is the visibility range.
We also define that each agent can only observe the relative positions of all its neighbours to itself as o i local . 1 To formulate the action space and observation space, we discretize the 2-dimensional visibility space S i of each agent into P different components: Fig. 5). The observation of agent v i can be approximated by the number of agents in each discretized component: with p ∈ {1, 2, · · · , P }. Using the same discretization, we restrict the action space to be the set of center points of the discretized components (see Fig. 5): The action probability distribution Q i (t) can be simplified into a vector of probabilities q i (t) for choosing each discretized action: where Q i (t, a = ∆s D p ) represents the probability of agent v i to choose action ∆s D p at time t for all p ∈ {1, 2, · · · , P }. The objective of this task is to make all agents converge to a common location as quickly as possible. We assume that the dynamic connectivity network G(t) is connected initially. The task performance is primarily evaluated based on the rendezvous time t RV , which is defined as the smallest t ∈ {1, 2, · · · , L} that satisfies the following condition: where is a small constant that defines the maximum distance of the two farthest agents. If the constraint can never be satisfied, we classify this as a failure to converge (t RV = ∞).
After evaluating the task for multiple trials, we can define the convergence rate as follows: CR% = n success /n tot × 100%, where n success is the number of successful trials and n tot is the number of total trials.
2) Neighbour Discretization: The neighbour discretization rule builds upon the space discretization performed in the task formulation. Using the relative positions to the neighbouring agents, we can define the partition as follows: for all p ∈ {1, 2 · · · , P }, v i ∈ V , where s k is the position vector of agent v k and P i p is the p th discretization group of agent v i 's neighbours N i under the discretization rule D.
Under this rule, all the neighbouring agents in the same discretized component belong to the same discretization group. The intuition behind this is that the neighbouring agents with similar relative positions should receive similar communication vectors, and the communication vectors they are sending back should also be similar.
3) Centralized Policy: The centralized policy we use computes an optimal rendezvous coordinate s optimal that minimizes t RV . It can be proved that s optimal is the center of the smallest circle that encloses all the agents (the smallest enclosing circle). By moving towards the optimal rendezvous coordinate, the optimal solution can be achieved. To adapt to the discrete action space A, the optimal action a * i (t) for each agent is the closest one to the optimal coordinate: Since this centralized policy is deterministic, we define the probability distribution Q * i over A as follows: where Q * i (t, a) is the probability of v i choosing action a at time t suggested by the centralized policy π c . This distribution can be represented by a vector q * i similar to Eq. 15.

4) Existing Distributed Policies:
To the best of our knowledge, the circumcenter law is the state-of-the-art distributed policy for this task that guarantees convergence on single integrator dynamics [16]. This result can be simply extended to second-order systems with double integrator dynamics, which we consider for this task. The circumcenter law is defined as follows: At each time step, all agents pursue the circumcenter of the point set consisting of its neighbours and of itself (or the center of the smallest enclosing circle) [16]. To adapt this control law to our control framework described in Section III, we choose the agent's action a i based on the relative position of the agent to the circumcenter, equivalently to Eq. There are other existing distributed policies such as the averaging law and cyclic pursuit. The averaging law requires all agents to pursue the average coordinate of its neighbours and of itself. However, it suffers from convergence issues [17]. Cyclic pursuit usually assumes a fixed connectivity network, which is not given in this task [16].

B. Particle Assignment
We also propose a new distributed robotic task that has no existing solution, to the best of our knowledge. The objective is to move all agents to target points such that all target points are covered by an agent using agents' local observations of the neighbouring agents and target points, and communication. Different from the cooperative navigation task defined in [10] that assumes unlimited visibility range, we assume limited visibility range.
1) Task Formulation: We consider K homogeneous agents with position vectors {s 1 , s 2 , · · · , s K } in a 2dimensional plane. The agent dynamics, PD-controller, discrete action space A, connectivity network G(t) and discretization rule D are the same as described in the rendezvous task. Adding on top of these, we introduce K target pointsV = {v 1 ,v 2 , · · · ,v K } with the position vectors {s 1 ,s 2 , · · · ,s K }. We can defineḠ(t) = (V ,Ē(t)) as the connectivity of the target points based on the visibility: (20) where d lim is the limited visibility range.
We define the set of covered target pointsV cov as follows: where is a small constant that defines the distance requirement for covering a target point. We assume that G(t),Ḡ(t) are both connected initially, and at least one agent can observe one target point initially. Each agent also has a pre-defined potential field layer as a collision avoidance mechanism on top of the PD-controller. For convenience, we can define the neighbouring target points as follows: The observation of each agent is defined as the relative positions of its neighbouring agents and target points to itself.
Using the same space discretization in Section VI-A, we represent the observation as follows: (23) To evaluate the performance, we define t PA as the smallest t ∈ {1, 2, · · · , L} such thatV cov (t) =V . If the constraint can never be satisfied, t PA = ∞. The convergence rate CR% is defined as in the rendezvous task.
2) Centralized Policy: We design our centralized policy to be an optimal assignment of agents to target points so that the maximum distance travelled by any agent is minimized. This leads to the minimization of the completion time t PA . The optimization is done by using the Hungarian algorithm [21].

VII. SIMULATION RESULTS
In this section, we demonstrate the training details and our simulation results for the two distributed robotic tasks.

A. Training Details
To perform this learning task, we use a DNN as the distributed policy network to model the mapping we aim to learn: where o D local is the local observation after discretization (see Eq. 13 for the rendezvous task, Eq. 23 for the particle assignment task), q is the action probability vector after discretization (see Eq. 15), c D in and c D out are the communication vectors after discretization (see Eq. 6 and 7).
For both tasks, the DNN is a feedforward neural network (2 layers with 32 neurons per layer for the rendezvous task; and 4 layers with 128 neurons per layer for the particle assignment task). The probability distribution q is obtained by a softmax layer. The loss function between the two probability distributions q and q * is the cross entropy. To train the DNN, we run n batch simulations in parallel with different initial setups. During the simulations, each agent's action is sampled from the action distribution predicted by the distributed policy network. After every time steps, we construct the MSMANN model (using the DNN as the identical components) based on the dynamic connectivity of the agents in the past time steps. Using the action probability distribution from the centralized policy, we perform the Adam algorithm through backpropagation on this MSMANN to minimize the average of loss functions over n batch parallel simulations [22]. Each cost function is an approximation of the overall learning objective: where t c is the current time step and is the number of time steps we back-propagate. In this work, we choose n batch = 10 for both tasks and = 6 for the rendezvous task, and = 3 for the particle assignment task. For the rendezvous task, we further simplify the communication inflow as the sum of the P communication vectors after discretization ({c i,D in,1 , · · · , c i,D in,P }) instead of the concatenation of these P communication vectors as in Eq. 7. This allows us to better analyze the communication content learned.

B. Rendezvous with Limited Visibility
For the rendezvous task, we train our distributed policy network on 10 agents with random initial positions and limit the size of the communication vector c ij to be n = 25. We evaluate the performance of the DNN on scenarios with different number of agents where the agent density is similar to the training cases. Agent density is defined as the ratio of number of agents to the area of the smallest circle that encloses all the agents.
We compare the performance of our learning approach against the state-of-the-art circumcenter distributed control law and the centralized policy described in Section VI-A. We also show the performance of our learning approach without communication (i.e., n = 0). In Fig. 6, we demonstrate that our learning approach consistently outperforms the state-of-the-art distributed policy for different numbers of agents. However, the learning approach without communication performs poorly under almost all circumstances, which demonstrates the necessity of inter-agent communications in resembling the behaviours of the centralized policy (see Fig. 7). Note that the circumcenter control law does not require communication because it behaves qualitatively different than the centralized strategy.
However, the convergence rate can drop significantly for scenarios with large number of agents, not included in the training data. This is a generalization issue of the DNN learning as it might over-fit to the simple situations that the model is trained on. Provided this limitation, our learning approach  still demonstrates the ability to learn an effective distributed policy with reasonable scalability on this rendezvous task: we train with 10 agents and test on up to 100.

C. Analysis of Communication Learned
We demonstrate that reducing the size of the communication vectors leads to a decrease in task performance with a significant drop from n = 2 to n = 1 (see Fig. 8).
To provide more insights into this result, we choose to analyze the learned distributed policy with communication size n = 2 because it is relatively easy to visualize while achieving comparable performance. We keep the observation input of the model c D in constant and observe the change in the model output q with the changing communication input. For the constant observation input, we assume a hypothetical Fig. 9. The probability of choosing each discretized action (q 1 , q 2 , · · · , q 9 ) given the communication inflow values. We show five of them in this figure. "Channel 1" represents c 1 and "Channel 2" represents c 2 . It can be observed that in each discretized area, the direction of the increasing action probability is always opposite to the desired relative position of the corresponding action in the discretized area. situation where an agent has two neighbours that are located in exactly the opposite direction. For convenience, we define c D in (t) = c 1 c 2 T and q(t) = q 1 q 2 . . . q P T . In Fig. 9, we hypothesize that the two communication inflow values can be transformed into a 2-dimensional vector that is correlated to the tendency of choosing the action that is closest to the vector's direction. We can interpret the communication vector as an "intent vector", which influences the tendency of the moving direction of the agent that receives this "intent vector". This explains the sudden drop observed in performance from n = 2 to n = 1 since a onedimensional communication vector cannot fully represent a 2-dimensional direction vector.

D. Particle Assignment
For the particle assignment task, we also train our DNN on 10-agent scenarios and test our approach on various numbers of agents up to 20. Fig. 10 demonstrates some examples of the performance achieved with 2 and 15 agents and the emergence of distributed behaviours. In Fig. 11, we also show that the average performance of our learned distributed policy is comparable with the centralized policy when there are fewer agents. This approach suffers from convergence issues for larger swarms. We hypothesize that this could be attributed to the inherent complexity of the particle assignment task. There are multiple aspects of the task that must be achieved: exploring, resolving assignment conflict, and staying connected with other agents. Achieving all aspects at once can be much more challenging as the number of agents increases.

VIII. CONCLUSIONS AND FUTURE WORK
We present a DNN-based approach that learns distributed action and communication policies from well-designed centralized policies for homogeneous, distributed robotic system. The main advantages of our proposed approach are summarized: (i) this approach can be applied to various distributed robotic tasks given pre-designed centralized policies Fig. 10. A behaviour comparison of the centralized policy and the learned distributed policy for 2-agent (top) and 15-agent (bottom) scenarios. Dots represent the agents; lines represent the trajectories of the agents; small circles represent the cover range of the agents; large dashed circles represent the visibility of the agents; and diamonds represent the target points. We demonstrate that agents controlled by our learned distributed policy are able to (1) follow other agents who see the targets when there is no target in its sight, (2) explore neighbouring targets rather than stopping at the nearest target, and (3) resolve target assignment conflicts. These distributed behaviours emerge from the learning of a centralized policy. are available; (ii) it requires little human expertise for taskspecific control law and communication protocol designs; and (iii) this approach is computationally efficient compared to other reward-based learning approaches. Moreover, the learned communication protocols reveal that meaningful messages are conveyed, which could potentially inspire the coordination and communication designs for real-world distributed robotic systems. Future work will address some of the observed convergence issues in the more complex scenarios, which may be due to over-fitting.