I Introduction
A multiagent system is a system formed by a number of interacting agents. Multiagent systems can be used to solve problems that are difficult or impossible to solve with a single agent or a monolithic system. Examples of such tasks are emergency response [1], modeling of social structures [2], and many others.
Movement of several agents to a given control point while maintaining a relationship between their states is an important problem in robotics. For example, in applications, including spaceships, unmanned aerial vehicles (UAVs), and mobile robots, agents often need to move to a landmark or target point while maintaining the shape of their formation.
The leaderfollower approach is one of the ways to solve this type of formation control problems [3].
Recently, several methods of solving the problems of choosing leaders in networked multiagent systems have been studied, in particular, within the framework of linear consensus protocols. Some graph indices, such as node degree, have been tested in terms of leader performance [4]. The problem of choosing leaders can be solved either ascendingly (choosing one leader and adding other leaders until the set of leaders becomes optimal) [5], or descendingly: the optimal set of leaders is sought by excluding agents from the entire set of agents [6]. To control UAVs, an “online” leader change was applied in order to improve the rate of convergence of agents’ positions [7].
The task of selecting leaders from the set of agents is similar to a node clustering task in a graph if each leader is treated as an agent responsible for its own cluster [8]
. Therefore, it is reasonable to compare existing leader selection algorithms with clustering methods combined with choosing the “main” node in each cluster. The most popular clustering methods are spectral clustering based on optimization of graph slices
[9] and the means method, which seeks to minimize the total quadratic deviation of cluster points from the centers of these clusters [10].In this paper, we consider the problem of choosing leaders in the case where they preserve their initial states, i.e., they are static. The problem of selecting mobile leaders was considered, for example, in [11].
The work consists of two main parts. The first one is a simulation in ideal conditions and the second one is a simulation in real conditions using a model of epuck2 mobile robots [12]. “Real conditions” means a system with some restrictions, for example, with a limited possible speed of the robots.
The aim of the paper is to compare existing algorithms for choosing leaders with the method based on graph nodes’ clustering with respect to accuracy and convergence time in ideal and real conditions.
Ii Model
We will consider a multiagent system with a corresponding connection graph . The graph is directed and represents the system structure. We will identify the node , , with the th agent. Agent depends on agent if there is a directed edge . Each edge has its weight , thereby we have a weighted adjacency matrix of the system [13].
Let matrix be the Laplacian matrix [14] of the graph with adjacency matrix . Each agent has its state . In this paper, denotes agent’s coordinate. The linear consensus protocol has the form
(1) 
where
is the state vector of the system.
Leaders represent stubborn agents: they get their states initially, and these states do not change over time. Respectively, we will divide the general state of the system into the state of leaders and the state of followers: where is the state of followers and is the state of leaders. Thus, the linear consensus protocol (1) can be rewritten in the following way:
(2) 
Leaders preserve their states, hence, and are zero, so that is zero and is constant. Then, is the grounded Laplacian of the system [15]. In this paper,
is assumed to be symmetric. Thus, the followers influence each other equally. The convergence rate of the system can be asymptotically measured by the smallest eigenvalue of the grounded Laplacian
[5], therefore, further in the paper we will identify these quantities.Next, for simulation purposes, we define convergence time as follows:
Definition 1.
Let be a limit state of the system. The system reaches with fixed error in convergence time , if
(3) 
where is the Euclidean norm of vector .
Iii Algorithms
We will compare six algorithms, also we will study the algorithmic complexity of them, after that we will consider two additional algorithms presented in [16, 17]. The algorithm in [16] is based on theoretical calculations, so it is optimal, however its algorithmic complexity is higher than that of the best realization of the greedy algorithm in [17], whose complexity in turn is higher than that of the kmeans algorithm.
These six algorithms are:

Choose kleader algorithm. A pseudocode description of Choose kleader algorithm is given in [5]. Its algorithmic complexity is between and due to the need to calculate the eigenvalues of the Laplacian matrix and then choose the smallest eigenvalue times.

Random leader selection. k
numbers are randomly selected without repetitions using uniform distribution from
to ; the corresponding agents are chosen as leaders. The algorithmic complexity is . 
Leaders with max degree. k nodes with maximum indegrees are chosen from the connection graph. The algorithmic complexity is , because we need to calculate the degree of each node.

Leaders with average degree. k nodes with average indegrees are chosen from the connection graph. The algorithmic complexity is as well.

kmeans algorithm. The connection graph is split into k clusters with means algorithm. Then, the closest node to the center of the cluster is chosen as the leader of this cluster. If this node is already chosen as leader for another cluster, then the second closest node is selected and so on. The means clustering is taken from Python library sklearn with default parameters; its average algorithmic complexity is , the worst complexity is [18]. However, the worst complexity is not reached because of the fixed maximum number of iterations.

Huge random selection. Firstly, 10000 numbers from 1 to are uniformly chosen and each number is an index in an imaginary list in which all possible selections of leaders are arranged in lexicographic order; knowing the index, a selection can be made. Thus, 10000 selections are chosen. The algorithm iterates over all selected sets of leaders and finds the set with the maximum smallest eigenvalues of the corresponding grounded Laplacian . If the number of different selections is not uniformly limited, then the algorithm has combinatorial complexity. Therefore, the upper bound of 10000 was taken in order to reduce the execution time to a reasonable one. Obviously, the algorithm does not guarantee the best result, but as we will see in the experiments, its results are better than those of the previous algorithms.
As for the remaining two algorithms, greedy algorithm in [17] with the best realization has an algorithmic complexity of and the complexity without these improvements in realization is . The exact algorithm in [16] for the leader selection problem has a polynomial algorithmic complexity of in the case of path or ring graphs taken.
Thus, it can be seen that the kmeans algorithm has the smallest average asymptotic complexity among nonrandom algorithms.
Iv Simulation
Consider a multiagent system containing 100 agents uniformly distributed in a m square. Let two agentsfollowers be symmetrically connected if and only if the initial distance between them is no more than m. The weights of these connections are chosen uniformly from the interval (0, 50]. The weighted adjacency matrix generated in this way does not change later.
In all experiments, we measured the convergence time (see Definition 1). Since agents had and coordinates, the total deviations along both axes from the limiting state were calculated, and when both of these deviations do not exceed the fixed error, we admit that the system reached the limit. Based on the obtained convergence times, we conclude that one algorithm is better than another. Additionly, we measure the convergence rates for all algorithms, which are identified with the smallest eigenvalues of the corresponding grounded Laplacian matrices ; the results are provided below.
Each experiment was repeated 30 to 100 times depending on the number of leaders (from to ); the obtained convergence time was averaged for each .
To bring the system closer to reality, physical limitations were imposed: these were the limits on the maximum speed. Simulation was performed in Webots, an open source robot simulator, which contains various robot models, including a model of epuck2 robots. The epuck2 model was used for simulation with physical constraints that the maximum speed is limited to
cm/s.Experiments with physical limitations were carried out in Webots on C language, without these restrictions on Python. More details about the experiments carried out can be found in the Appendix.
Iva Experiments’ settings
For all experiments, the convergence error (see Definition 1) was set to be cm. This error was chosen experimentally, as it allows to achieve fairly accurate results within a reasonable time.
The number of leaders ranged from to , but the charts show values only from to , since the results for larger numbers of leaders are similar. Convergence time slowly discreases and convergence rate slowly increases in the number of leaders for all dependencies.
The simulation time step for both experiments with physical limitations and without them was equal to 1 ms, which is the minimum available time step in Webots.
IvB Convergence time of the algorithms
In this section, we present the results on the convergence time depending on the number of leaders either with constraints on speed or without them.
First, we compare algorithms 1 to 5 because their complexities are much smaller than the complexity of huge random selection algorithm that is defined by constant number 10000. As Fig. 1 shows, kmeans algorithm gives the best result and random leader selection, choose kleader algorithm, and leaders with average degree give approximately similar results. Finally, leaders with max degree gives the worst result in the experiments with physical restrictions. However, the algorithm shows good results with a small number of leaders in the experiment without physical restrictions. These results should be investigated separately. Note that the difference between the algorithms is clearly seen in the experiments with physical limitations, however the convergence rate, which in this study is identified with the smallest eigenvalue of the grounded Laplacian, is the same in both experiments, therefore the convergence rate should not be the only decisive factor when choosing an algorithm.
Also the convergence time of experiments with physical limitations (see Fig. 0(b)) does not smoothly decrease with increasing number of leaders; this may indicate that more averaging is needed.
Second, we compare kmeans, choose kleader and random leader selection algorithms with huge random selection. We selected these algorithms because they gave the best or approximately similar results in the previous experiments and we do not compare all the algorithms so as not to clutter up the charts. As we can see in Fig. 1(a), huge random selection gives the best convergence rate and kmeans’ result is quite close to it. Also we can see from the simulation that these two algorithms give the best results concerning the convergence time, though kmeans algorithm is better in the experiments with physical restrictions. This is apparently related to the stop simulation criterion which depends on the convergence error (see Definition 1).
Finally, let us look at the scatter of the received data, which will give an understanding of the stability of the algorithm for real use. On Fig. 3, the difference between the maximum and the minimum convergence time is plotted along the time axis. It can be seen that the ranges of time for kmeans and huge random selection algorithms are much smaller than those of choose kleader and random leader selection algorithms; for the remaining algorithms the range is quite similar to the last two.
V Conclusion
In this paper, we compared several algorithms for solving the leader selection problem with regard to the leaderfollower consensus protocol for both systems with physical constraints and idealized ones. The following algorithms were compared:

The leader selection algorithm [5],

the random choice,

the choice of agents with the maximum indegrees in the agents’ dependency graph,

the choice of the agents with average indegrees in the agents’ dependency graph,

the means algorithm, with the subsequent selection of nodes that are closest to the center of each cluster.
Additionally, all algorithms were compared with huge random selection algorithm. It turned out that the clustering algorithm showed the best results in all experiments, except for huge random selection algorithm whose algorithmic complexity is determined by the upper bound on the number of different selections, without this bound, the complexity is combinatorial.
In future work, it would be interesting to apply other clustering algorithms, as well as an alternative version of means algorithm, where the leader in each cluster is chosen as the node with the maximum degree in the cluster.
In preliminary experiments, we observed that the agglomerative clustering algorithm gave similar results to those of the means algorithm, though the algorithm complexity of the agglomerative clustering is higher than the complexity of the means algorithm [19]. Thus, the main conclusion is that clustering algorithms are useful in solving the leader selection problem. However, we also tested the spectral clustering algorithm [20] and it gave results much worse than those of leaders with max degree algorithm.
In this work, we did not consider systems with mobile leaders or dynamic connections, systems with acceleration, or systems with shape preserving. The problems of leader selection for them are in many respects similar to the simplest problems studied in this paper, however, of course, they are more complicated both theoretically and experimentally. In a further development of this work, such problems can be analyzed by applying clustering algorithms.
Appendix
Simulation on Python and Webots consisted of 5 main steps:

Generation of coordinates;

Generation of the adjacency matrix based on these coordinates and the connection condition;

Generation of the Laplacian matrix;

A transformation of this Laplacian matrix according to the type of an algorithm (see Section III);

Run of the simulation.
The first four steps were the same for both types of the experiments and were implemented on Python.
After the generation of the coordinates and the Laplacian matrix the simulation started in a huge cycle, which can contain a maximum of iterations; in our experiments, .
Firstly the final limit state was calculated simply as , so if the system did not reach this limit state in steps or less, new coordinates and the corresponding Laplacian matrix were generated and simulation started again.
Experiments without physical limitations
On each step of the simulation on Python, agents’ coordinates were updated as:
where is a simulation time step and equals to 1 ms in our experiments. After this update, the distance between the current state and the limit state was calculated according to Definition 1 and compared with the fixed error. If this distance was less than the fixed error, the simulation stoped, otherwise the new iteration began.
Experiments with physical limitations
Simulation on Webots was similar to the one on Python with the difference that before the each simulation step , agents updated their new speeds as with 15.4 cm/s being the maximum speed. Webots updates the speed with the last speed, acceleration and motor torque taken into account. After a simulation time step, a predeterminated agent (“inspector”) obtained the other agents’ coordinates, calculated the distance from the limit state, compared it with the fixed error and decided if simulation required continuation. If so, the inspector recalculated the speeds of all agents, sent them back, and simulation step repeated again.
Due to the way of the simulation and the implementation, no time was wasted on exchanging information, this time must be taken into account when implementing the algorithm on real robots.
References
 [1] Schurr, N., Marecki, J., Tambe, M., Scerri, P., Kasinadhuni, N., & Lewis, J. P. “The future of disaster response: humans working with multiagent teams using DEFACTO.” AAAI Spring Symposium: AI Technologies for Homeland Security, pp. 916, 2005.
 [2] Sun, R., & Naveh, I. “Simulating organizational decisionmaking using a cognitively realistic agent model.” Journal of Artificial Societies and Social Simulation 7(3), 2004. http://jasss.soc.surrey.ac.uk/7/3/5.html
 [3] Mesbahi, M., & Egerstedt, M. “Graph Theoretic Methods in Multiagent Networks.” Princeton University Press, 2010.
 [4] Borsche, T., & Attia, S. A. “On leader selection in multiagent control systems.” In 2010 Chinese Control and Decision Conference, pp. 102107, IEEE, 2010.
 [5] Clark, A., Alomair, B., Bushnell, L., & Poovendran, R. “Leader selection in multiagent systems for smooth convergence via fast mixing.” In Proceedings of the 51st IEEE Conference on Decision and Control, pp. 818–824, 2012.
 [6] Sato, K. “Optimal leader selection and demotion in leaderfollower multiagent systems.” arXiv preprint arXiv:1802.06479, 2018.
 [7] Franchi, A., Bülthoff, H. H., & Giordano, P. R. “Distributed online leader selection in the bilateral teleoperation of multiple UAVs.” In 2011 50th IEEE Conference on Decision and Control and European Control Conference, pp. 35593565, IEEE, 2011.
 [8] Shah, D., & Zaman, T. “Community detection in networks: The leaderfollower algorithm.” In Proc. of Workshop on Networks Across Disciplines: Theory and Applications, pp. 1–8, 2010.
 [9] Meila, M., & Shi, J. “Learning segmentation by random walks.” In Advances in Neural Information Processing Systems, pp. 873879, MIT Press., 2001.

[10]
Gorban, A.N., & Zinovyev, A.Y. “Principal graphs and manifolds.” In Handbook of Research on Machine Learning Applications and Trends: Algorithms, Methods and Techniques, pp. 2860, 2009.
 [11] Lin, F., Fardad, M., & Jovanovic, M. R.,“Algorithms for leader selection in stochastically forced consensus networks,” IEEE Trans. Automat. Control, 59(7), pp. 1789–1802, 2014.
 [12] GCTronik, epuck2. [Online]. Available: https://www.gctronic.com/doc/index.php/epuck2, 2018
 [13] Horn, R. A., & Johnson, C. R. “Matrix Analysis.” Cambridge University Press, 2012.
 [14] Chebotarev, P., Agaev, R. “Forest matrices around the Laplacian matrix,” Linear Algebra and Its Applications, 356, pp. 253274, 2002.
 [15] Barooah, P., & Hespanha, J. P. “Graph effective resistance and distributed control: Spectral properties and applications.” In 45th IEEE Conference on Decision and Control, pp. 3479–3485, 2006.
 [16] Patterson, S., McGlohon, N., & Dyagilev, K. “Optimal kleader selection for coherence and convergence rate in onedimensional networks.” IEEE Trans. Control Netw. Syst., 4(3), pp. 523532, 2016.
 [17] Wang, Y., Yang, W., & Wang, X. “Optimal leader selection for fast consensus via consensus centrality.” In Proceedings of the 33rd Chinese Control Conference, pp. 1482–1487, IEEE, 2014.
 [18] Pedregosa et al., “Scikitlearn: machine learning in python,” JMLR 12, pp. 28252830, 2011.
 [19] Rokach, L., & Maimon, O.“Clustering methods.” In Data Mining and Knowledge Discovery Handbook, pp. 321352. Springer, Boston, MA, 2005.

[20]
Ng, A. Y., Jordan, M. I., & Weiss, Y. “On spectral clustering: Analysis and an algorithm.” In Advances in Neural Information Processing Systems, pp. 849856, 2002.
Comments
There are no comments yet.