1 Introduction
Availability of large number of lowcost sensors and development of suitable network protocols has led to the development of modernday multiagent systems. In many practical domains, these multiagent systems are often designed to attain coordinated objectives such as movement coordination among a group of mobile autonomous vehicles for traffic optimization [jadbabaie2003coordination], task allocation among agents (nodes) such as unmanned aerial vehicles (UAVs) or autonomous underwater vehicles (AUVs) for search and survey operations [fax2002information],[olfati2007consensus]. Such systems are limited by their size and mobile (ad hoc) nature that restrict computational and sensing resources, rendering distributed algorithms wellsuited for coordination of these multiagent systems [mesbahi2010graph]. A number of works in the literature have proposed distributed coordination algorithms for multiagent systems achieving consensus on the average of agents' initial state values. The authors in [kempe2003gossip] introduced a novel gossipbased decentralized scheme called pushsum protocol to compute the average of the initial state values of nodes. The pushsum protocol has been shown to converge to the average exponentially fast. Authors of [dominguez2010coordination] have proposed a ratioconsensus protocol in which agents in a fixed topological network converge asymptotically to the ratio of the sum of initial value of the two states maintained by each agent. These algorithms have a significant advantage; convergence to the average value can be established where the protocol can be realized in a truly distributed manner without requiring any centralized dissemination of parameters making them suitable for plugandplay ad hoc networks. [charalambous2014average] extends this approach to the case where network topology is dynamic under the condition that the union of the communication graphs at different time instants remain strongly connected infinitely often. Convergence rate is an important performance indicator for consensus protocols [xiao2004fast],[olshevsky2009convergence]. As presented in [olfati2004consensus], convergence rate depends on the spectral properties of the interaction graph topology. Several researchers have endeavored to design interaction graphs amenable to faster convergence [kim2005maximizing],[xiao2004fast]. A consensus based distributed optimization scheme utilizing the subgradientpush over a timevarying graph topology was presented in [nedic2014distributed]. The subgradient iterations are shown to converge at a rate of . However, each node has to continue the subgradient iteration updates as there is no mechanism to distributively detect when the optimal solution is reached.
Above results do not provide any finite time stopping criterion for the consensus protocol. As multiagent systems with realtime applications, require the consensus value to be used by each agent for a subsequent task or action, a finitetime distributed stopping criterion is imperative. Moreover, if the agents can distributedly detect the convergence within a prespecified tolerance of the consensus value, they will avoid running the algorithm longer than necessary and save scarce power and computational resources. The authors in [sundaram2007finite] have presented a method to achieve the consensus value in a finite number of iterations. Here, each node can calculate the final consensus value using the minimal polynomial associated with the weight matrix in the state update iterations. However, to calculate the coefficients of the minimal polynomial each node has to run (total number of agents) different linear iterations each for at least timesteps. Also, every node should have enough storage and computation abilities to handle matrix inversions and rank calculations which makes it unsuitable for applications like ad hoc sensor networks.
To this end, authors in [ratio_consensus_lab],[yadav2007distributed],[prakash2019distributed] established that the sequence of global maximum (or minimum) state value of the agents following a consensus algorithm is a monotonic sequence converging to the consensus when network topology is fixed. A distributed maximum (and minimum) protocol was proposed to propagate these global maximum (and minimum) state values to achieve finitetime consensus within a prespecified tolerance margin. Having additional states corresponding to the global maximum and minimum values help each node to detect the progress toward consensus. Each node is able to simultaneously detect the convergence in finite time thus the consensus protocol is terminated by each node at the same iteration. Moreover the above methodology guarantees that each node will have access to the consensus value at the same time.
In this article, we show that the above approach is not directly applicable when the network topology is dynamic. Here, we propose an extension of this approach which can be applied to networks with dynamic topology. We introduce the concept of a "timepath" to incorporate the effect of current state value of an agent on other agents at the following time instants. We establish the existence of timepaths of finite length for all pairs of agents in the network. Leveraging the existence of timepaths, we propose a new MaximumMinimum protocol to propagate the global maximum and minimum state values. Now, we briefly describe some of the applications of the proposed protocol.
Ad hoc cognitive radio networks. In cognitive radio networks, secondary users can sense the spectrum to detect the presence of primary users. In a spectrumsensing consensus algorithm [li2009distributed], secondary users mutually transmit and receive their states according to the realtime (dynamic) network topology, regardless of whether primary users are present. The topology is created when secondary users establish communication links with their own neighbors to locally exchange information among them. The algorithm iterations are repeatedly done until all the individual states converge toward the average of the initial value of states to make a local decision.
Control of autonomous agents. It is often necessary to coordinate a collection of autonomous agents (e.g., cars or unmanned aerial vehicles). For example, consider a fleet of selfdriving cars where each car can communicate with its neighboring cars. One may wish for the cars to meet a global objective such as maintaining a particular formation where the neighbors of a car can change in realtime. A distributed decision is usually needed in such situations. All the cars can distributively agree on a direction or an average speed (or both). Such a coordination model was investigated in [fax2002information].
Statement of contribution:

This article presents an algorithm with a distributed stopping criterion for ratio consensus in the presence of directed switching topologies. We augment the ratio consensus algorithm with two additional states: global maximum and global minimum of the values held by agents. We show that these values are monotonic in nature and converge to the consensus value even when the network is dynamic. The stopping criterion can be set such that if the criterion is met by an agent then it has access to the consensus value within any prespecified tolerance margin. Here, the maximum and minimum consensus based distributed stopping approach [ratio_consensus_lab],[yadav2007distributed] is extended to the case of time varying topologies.

We provide an upper bound on the number of iterations required for a node in the network to influence all other nodes. In order to achieve this, we introduce a novel concept of timepath. We prove the existence of finitelength timepaths for every pair of nodes and present the MaximumMinimum protocol to propagate the global maximum and minimum state values in the network.

The scheme proposed here is shown to be scalable for implementation as it only requires each agent to have access to an upper bound on the number of nodes. The performance of the proposed algorithm is illustrated by experimentally realizing a network with dynamic topology created using a NodeJS framework. Here each node is implemented as a socket.io [mulder2016node] server. This validates the distributed stopping criterion experimentally in the presence of switching topologies, thus providing evidence that our algorithm is indeed applicable for realtime applications.
The rest of the paper is organized as follows. In Section 2, the basic definitions needed for subsequent development are presented. The setup for distributed averaging using ratio consensus is presented in Section 3. In Section 4, analytical results for distributed finitetime termination of ratio consensus in switching topology using maximum and minimum consensus algorithms have been discussed. Theoretical findings are validated with experiments presented in Section 5 followed by conclusions in Section 6.
2 Definitions
In this section we present basic notions of graph theory and linear algebra which are essential for the subsequent developments. Detailed description of graph theory and linear algebra notions are available in [Die06] and [horn2012matrix] respectively.
Definition 1.
(Cardinality of a set) Let be a set. The cardinality of a set denoted by is a measure of the number of elements of the set .
Definition 2.
(Directed Graph) A directed graph (denoted as digraph) is a pair where is a set of vertices or nodes and is a set of edges, which are ordered subsets of two distinct elements of . If an edge from to exists then it is denoted as .
Definition 3.
(Path) In a directed graph, a directed path from node to exists if there is a sequence of distinct directed edges of of the form
Definition 4.
(Strongly Connected Graph) A directed graph is strongly connected if it has a directed path between each pair of distinct nodes and .
Definition 5.
Definition 6.
(Irreducible Matrix) A matrix is said to be irreducible if for any , there exist such that , that is, it is possible to reach any state from any other state in a finite number of hops.
Definition 7.
(Primitive Matrix) A non negative matrix
is primitive if it is irreducible and has only one eigenvalue of maximum modulus.
3 Average Consensus in switching topology
In this section, the key result from [dominguez2010coordination], which enables reaching average consensus in the presence of dynamic topology is summarized. Consider a scenario where the network topology is dynamic but with a fixed set of nodes () i.e. at any given instant , the network is described by a digraph . Let be the weighted adjacency matrix associated with the digraph . Here is the set of all possible digraphs for a given set of nodes . Here we assume that a node always has access to its own information, i.e. for any node for all . Now we present a few definitions related to dynamic topology.
Definition 8.
(Union of digraphs) Given a collection of digraphs (for some ) of the form , , the union of digraphs is defined as .
Definition 9.
(InNeighborhood at instant k) The set of inneighbors of node at instant is denoted by
Definition 10.
(OutNeighborhood at instant k) The set of outneighbors of node at instant is denoted by
Each node maintains two states at time , denoted by (referred as numerator state of node ) and (referred as denominator state of node ). Node updates its state at the iteration according to the following policy:
(1) 
(2) 
where for all .
We consider the network with dynamic topology to satisfy the following assumptions throughout the rest of the paper.
Assumption 1.
For a sequence of digraphs , there exists an infinite sequence of time instants where , , , with the property that for any the union of digraphs is strongly connected.
Assumption 2.
for all is a columnstochastic, primitive and irreducible matrix.
Theorem 1.
Consider a sequence of digraphs of the form , satisfying Assumption 1 and Assumption 2. With the update rule (1) and (2), the ratio asymptotically converges to for all , that is, the ratio of the numerator and denominator states converge to the average of the initial conditions of variables (referred to as ratio consensus).
Proof. See [dominguez2010coordination] for proof. ∎
4 Distributed FiniteTime Termination
In this section, the definitions and convergence of maximum and minimum consensus algorithms are established. Subsequently, a finitetime termination criterion for average consensus in the case of switching topology is developed based on these algorithms. Let us consider the maximum and minimum value of the ratio of consensus protocols given by (1) and (2) over all nodes at any time instant be given by,
(3) 
(4) 
The following Lemma shows that the ratio of states at each node stays within the maximum and minimum for subsequent iterations.
Lemma 1.
Proof. We first prove the inequality for using induction. By definition of for the proof is trivial. Suppose it is asserted that for , for all Then we have,
It follows from the inductive assumption that,
Therefore, for all Other inequality is similar and is left to the reader. ∎
Next Lemma strengthens the result of Lemma 1 to a strict inequality.
Lemma 2.
Proof. The proof is based on induction and follows similarly to the proof of Lemma 1 and is left to the reader. ∎
The following definition and Lemmas introduce the concept of a timepath and derive a bound on number of iterations required for one node to access information of any other node in the network.
Definition 11.
(Timepath) In the case of switching topology, a timepath of length at time from node to is a sequence of nodes such that . In other words, node has access to node ’s information after time steps through the nodes starting at time .
Lemma 3.
Proof. Here, is the union of outneighborhoods of all the elements of at instant . Clearly, . Indeed, implies which in turn implies, .
Now for ,
If , the claim is proven. Suppose . Note that at time instant , the graph is strongly connected. Thus, there exists an outgoing edge between the set of nodes and . That is there exists such that for some . Thus, It follows that which implies that
Now, as we have,
which implies Note here is a proper subset of Following in the same manner we get,
and thus For , . However and thus for all . Thus, implying . Therefore, the claim is true. ∎
Lemma 4.
Consider the assumptions of Lemma 3. Then for any two nodes and at any time instant , there exist a timepath of length from to with . In other words, has access to information of in number of time steps.
Proof. It is to be noted here that is the set of nodes influenced by node ’s current state within next time steps. Now, we show the existence of a timepath. We have . Let be the smallest time step such that . From Lemma 3, . As, there exists such that As it follows that there exists such that Choosing ’s in this manner we get , … such that . Therefore, there exists a timepath with . ∎
Using Lemma 3 and Lemma 4, we next provide a sampling of the and such that the resulting subsequences are strictly monotonic and converge to the average of the initial conditions of variables.
Lemma 5.
Proof. As it follows that there exists a node such that Let be an arbitrary node, then from Lemma 4 there exist a timepath of length from node to node at instant where . Let this path be denoted as Then,
By definition of for all , thus It follows that,
Thus, Therefore, from Lemma 2 it follows that for all , Similarly, if , then and that for all Note that since it follows that The condition is independent of the index and where the node was chosen arbitrarily. Thus, it can be concluded that for all and for all This completes the proof for The other inequality for can be proven similarly and is left to the reader. ∎
Remark 1.1.
The following theorem shows that after a finite time, the maximum value of the ratio in the network decreases and the minimum value of the ratio in the network increases.
Theorem 2.
Proof. Let , then using Lemma 5, it follows that for for all Hence, This completes the proof of the inequality involving . The other inequality involving can be proved similarly and is left to the reader. ∎
Theorem 3.
Corollary 3.1.
Proof. The proof follows from Theorem 3 and is left to the reader. ∎
We next present MaximumMinimum consensus protocol in the case of dynamic topology and use the preceding theorems to design a finite time termination criterion.
4.1 MaximumMinimum Consensus Protocol
The Maximum and Minimum Consensus Protocol denoted by MXP and MNP computes the maximum and minimum of the given initial node conditions
in a distributed manner respectively. It takes and as an input and generates a sequence of node values based on the following update rules for node ,
(6)  
(7) 
Proposition 1.
MXP protocol given by (6) converges to in finite time for any
Proof. Let be a node with state value at . Then at , all nodes connected to at instant will have the maximum value . Then, from the definition of in Lemma 4, if then Similarly, at , all the nodes connected to the elements of the set at instant will have the maximum value, that is, if then and so on. At , if then . As , we have for all , Thus, at instant all nodes will have the maximum value. As , converges to in finite time ∎
Proposition 2.
MNP protocol given by (7) converges to in finite time for any
Proof. Similar to the proof of Proposition 1 ∎
4.2 Distributed FiniteTime Termination Algorithm for Ratio Consensus
Here, we propose an algorithm using the above MXPMNP protocol which allows each node to simultaneously detect the convergence of the ratio consensus within a prespecified threshold . In the proposed algorithm, the initial conditions for the MXPMNP protocol are set as ratio of the initial values held by the nodes.
Definition 12.
The MXPMNP protocol is reinitialized at every epoch that is , where , with and respectively. We define , and . Each node compares with at every epoch and if then it terminates the consensus protocol. Details of this scheme are given in Algorithm 1.
Theorem 4.
Algorithm 1 converges in finitetime simultaneously at each node.
Proof. From Corollary 3.1, it follows that as Thus, for any given there exists an integer such that for all for all nodes in the network. As each node has access to and , convergence is detected simultaneously by each node at the same iteration. ∎
Remark 4.1.
Notice that using the above protocol, the global maximum and minimum values at any instant are available to each node at instant . Further, the only global parameter needed for Algorithm 1 is the knowledge of number of nodes of the network. However, it should be noted that each node does not need to know the actual number of nodes but some upper bound. In most applications, an upper bound on the number of nodes is readily available.
()  () 
Iteration  Topology  Range of node 

This result is a non trivial extension of [ratio_consensus_lab],[yadav2007distributed] as these considered only static network where the finite time consensus is based on knowledge of upper bound on graph diameter. There it was derived that within iterations every node has access to global maximum and minimum where is an upper bound on the graph diameter. This is not applicable to a network with dynamic topology. The following counter example highlights the case where an upper bound on maximum diameter ( where is diameter of graph ) does not provide access to global maximum and minimum to all the nodes of the network. Let us consider a network of 6 nodes where the network topology can be either of undirected graphs or (see Figure 1), that is , with switching as described in Table 1. Here the diameter of both graphs . Range (as defined in Lemma 3) of node 1 starting from any instant is also shown in Table 1. It can be clearly observed that it takes iterations for range to contain all the nodes which is more than the bound on maximum diameter (). In other words, it requires at least iterations for any node to receive information from node which follows directly from Lemma 4. Therefore, if is set as in Proposition 1 and Proposition 2, and for a node will not converge to global maximum and minimum respectively and rather converge to local maximum and minimum of the neighborhood defined by . This will lead to two problems:

Theorem 2 gives strict monotonicity of global maximum/minimum and does not extend to local maximum/minimum. Thus, the resulting sequences may not be monotonic.

Some nodes in Algorithm 1 can detect local convergence (when the maximum and minimum of the neighborhood defined by are within tolerance) and terminate well before actual global convergence.
Above analysis is further bolstered by experimental results in Section 5.
5 Experimental Results
(a)  (b)  (c) 
Consider a network of agents with switching topology represented by a digraph chosen at random from a set of 100 strongly connected digraphs for every time instant. Three instances of these digraphs are shown in Figure 2. Here, each agent running the consensus Algorithm is implemented using a NodeJS socket.io server. Initial condition of the numerator states are chosen at random from . With and , Algorithm results in distributed finitetime termination of computations performed by the agents in iterations as shown in Figure 3.
Observe that the ratio of the nodal states are close to the average of the numerator initial conditions (consensus value). The consensus value for this instance is . This experiment was repeated multiple times by randomly choosing digraphs for each iteration as well as the initial values of the agents. The proposed MXPMNP protocol was able to distributively terminate the algorithm each time. As noted in Remark 4.1, the global maximum and minimum state values at are available at . This is shown in Figure 3 where shifting the MXP and MNP plots left by time instants we get the MXP and MNP plots which coincide with global maximum and minimum.
Remark 4.2.
It is worth noting that while running MXPMNP protocol, global maximum and minimum are available to each agent after every iterations. It entails that if all the node states were within tolerance margin at any epoch , algorithm will terminate at the next epoch resulting in a delay of iterations in detection of convergence. This delay in detection scales linearly with the number of nodes making the algorithm suitable for large networks.
We next present the specific example discussed in Section 4 where it was shown analytically that some of the nodes will not have access to global maximum and minimum within iterations. We consider a node network where the topology is given by the sequence with and as defined in Figure 1. Initial state value of the nodes is chosen as leading to a consensus value equal to . As earlier, each node is implemented using a NodeJS socket.io server. We use to reset
Comments
There are no comments yet.