This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Mode Consensus Algorithms With Finite Convergence Time

Chao Huang, Hyungbo Shim, Siliang Yu, Brian D. O. Anderson This work was supported in part by the National Natural Science Foundation of China under Grant 62373282, Grant 62350003 and Grant 62150026 and by the National Research Foundation of Korea grant funded by MSIT (No. RS-2022-00165417).Chao Huang and Siliang Yu are with the College of Electronic and Information Engineering, Tongji University, Shanghai 200092, China (e-mail: [email protected].)Hyungbo Shim is with ASRI, Department of Electrical and Computer Engineering, Seoul National University, Seoul, Korea (e-mail: [email protected])Brian D.O. Anderson is with the School of Engineering, Australian National University, Acton, ACT 2601, Australia. (e-mail: [email protected].)Manuscript received XX XX, 20XX; revised XX XX, 20XX.
Abstract

This paper studies the distributed mode consensus problem in a multi-agent system, in which the agents each possess a certain attribute and they aim to agree upon the mode (the most frequent attribute owned by the agents) via distributed computation. Three algorithms are proposed. The first one directly calculates the frequency of all attributes at every agent, with protocols based on blended dynamics, and then returns the most frequent attribute as the mode. Assuming knowledge at each agent of a lower bound of the mode frequency as a priori information, the second algorithm is able to reduce the number of frequencies to be computed at every agent if the lower bound is large. The third algorithm further eliminates the need for this information by introducing an adaptive updating mechanism. The algorithms find the mode in finite time, and estimates of convergence time are provided. The proposed first and second algorithms enjoy the plug-and-play property with a dwell time.

Index Terms:
Consensus, Mode computing, Blended dynamics, Plug-and-play

I Introduction

Distributed mode consensus, also known as majority voting or multiple voting, allows for the identification of the most frequent choice when dealing with categorical data like movies, car brands, or political candidates. Since it is not possible to directly calculate average or median values for such inherently nonnumerical data, distributed mode consensus provides a way to determine the central tendency. In the existing literature, achieving consensus on functions of interest, known as the ff-consensus problem [9, 5], has been successful for specific types of functions typically assuming real values such as finding average, max(min), median, or the kk-smallest element. While distributed convex optimization based protocols can handle consensus on these functions directly, the mode consensus problem seems an exception. In addition, the mode function cannot be represented as a composition of the functions mentioned above, presenting a non-trivial challenge for mode consensus.

Achieving mode consensus is not an entirely new problem of course. In the literature, Ref. [1] introduces a distributed method for computing the mode. In this method, the frequency of each element is aggregated from the leaves to the root along a spanning tree, and only the root node performs the mode calculation. By incorporating hash functions, the algorithm is able to find the mode with high probability and low time complexity. The binary majority voting problem, where there are only two distinct elements in the population, is addressed using the “interval consensus gossip” approach described in [2]. The state space used for this problem is {0,0.5,0.5+,1}\{0,0.5^{-},0.5^{+},1\}. Initially, nodes vote for either “0” or “11” with corresponding states of 0 or 11. When neighboring nodes come into contact, they exchange their states and update them based on a predefined transition rule. When the algorithm reaches convergence, all nodes are expected to have states within the set {0,0.5}\{0,0.5^{-}\} if “0” is the majority choice. Conversely, if “11” is the majority choice, all node states will belong to the set {0.5+,1}\{0.5^{+},1\}. Subsequently in [3], a Pairwise Asynchronous Graph Automata (PAGA) has been used to extend the above idea to the multiple choice voting problem, and sufficient conditions for convergence are stated. In [4], a distributed algorithm for multi-choice voting/ranking is proposed. The interaction between a pair of agents is based solely on intersection and union operations. The optimality of the number of states per node is proven for the ranking problem. Ref. [7] explores distributed mode consensus in an open multi-agent system. Each agent utilizes an average consensus protocol to estimate the frequency of each element and then selects the one with the highest frequency as the mode. Agents are free to join or leave the network, and the mode may vary during the process, but the agent that leaves the network needs to signal this intention to its neighbors beforehand.

In this paper, we present distributed mode consensus algorithms based on the concept of blended dynamics [6, 8]. Blended dynamics have the characteristic that the collective behavior of multi-agent systems can be constructed from the individual vector fields of each agent when there is strong coupling among them. As an example, [6] has demonstrated that individual agents can estimate the number of agents in the network in a distributed manner. The proposed mode consensus algorithms provide two main key benefits, over and beyond the inherent contribution. First, the algorithms can be easily implemented in a plug-and-play manner. This means that the system can maintain its mode consensus task without requiring a reset of all agents whenever a new agent joins or leaves the network. Second, we can demonstrate the intuitively satisfying conclusion that the frequency of the mode has an impact on the convergence rate of the mode consensus algorithm, in the sense that a higher mode frequency results in faster convergence of the algorithm.

The paper is organized as follows. In Section II, preliminaries on ff-consensus is introduced, and the mode consensus problem is then described. The direct mode consensus algorithm is described in Section III, along with its characterization of convergence rate. Section IV combines the direct algorithm with the kk-th smallest element consensus, resulting in two mode consensus algorithms that are applicable when the mode appears frequently. The performance of the proposed algorithms is evaluated in Section V. Finally, Section VI concludes the paper.

II Notation and Preliminaries

II-A Underlying network

Consider a group of NN agents labeled as 𝒱={1,,N}\mathcal{V}=\{1,\cdots,N\}. Every agent has an attribute, which can be thought of as a label. The attribute could be a positive integer, a real vector, a color, a gender, an age group, a brand of car, etc. Two or more agents may have the same attribute (and indeed, in many situations one might expect the number of distinct attributes to be much less than the number of agents). The attribute of agent ii will be denoted by aia_{i}. The vertex set is part of an undirected graph 𝒢\mathcal{G} with which is also associated a set \mathcal{E} of edges (i.e. vertex pairs), in the usual way. The neighbor set 𝒩i\mathcal{N}_{i} of agent ii is the set of vertices which share an edge with agent ii. The vertex set 𝒱\mathcal{V}, the edge set \mathcal{E}, the attributes aia_{i}, and 𝒩i\mathcal{N}_{i} are assumed to be time-invariant in the bulk of the paper, but at times we open up the possibility, to accommodate a “plug and play” capability, that, following certain rules, means they are piecewise constant. The state xix_{i} is updated by an out-distributed control algorithm, that is, at every time tt, the quantity x˙i\dot{x}_{i} is computed as some function of aia_{i}, xi(t)x_{i}(t), and xj(t)x_{j}(t) for all j𝒩i(t)j\in\mathcal{N}_{i}\left(t\right).111While we choose a continuous time setting in this paper, it seems very probable that a discrete-time setting could be used as an alternative, with very little change to the main assumptions, arguments and conclusions.

Assumption 1

The graph 𝒢=(𝒱,)\mathcal{G}=(\mathcal{V},\mathcal{E}) is undirected and connected, with |𝒱|=N|\mathcal{V}|=N.

The need for connectivity is intuitively obvious. The need for 𝒢\mathcal{G} to be undirected is less so; note though that virtually all blended dynamics developments rest on an assumption of undirectedness of the underlying graph.

II-B ff-consensus and broad problem setting

To explain the problem setting, we define first the particular generalization of consensus, viz. ff-consensus, with which we are working, and then indicate an explicit type of ff-consensus problem of interest in this paper for which we are seeking an update algorithm. Following this, we provide two illustrative examples of ff-consensus which are in some way relevant to the problem considered here. For an introduction and the development of ff-consensus, see e.g. [10, 9, 5].

Definition 1 (ff-consensus)

With Ω\Omega being the set of all possible distinct attributes, consider a collection of NN agents whose attributes take values in Ω\Omega. Suppose f:ΩNΩf:\Omega^{N}\to\Omega is a given function. An algorithm is said to achieve ff-consensus asymptotically if it is out-distributed and the solution of the overall system exists and satisfies, for every i𝒱i\in\mathcal{V}, limtxi(t)=f(a1,,aN)\lim_{t\to\infty}x_{i}(t)=f(a_{1},\cdots,a_{N}).

Average consensus, obtained by setting Ω=\Omega=\mathbb{R}, ai=xi(0)a_{i}=x_{i}(0) and f(a1,,aN)=i=1Nai/Nf(a_{1},\cdots,a_{N})=\sum_{i=1}^{N}a_{i}/N is a very well known example. Some others are detailed further below, starting with the problem of interest in this paper. In the meantime however, we shall make the following assumption:

Assumption 2

The set Ω\Omega is finite, and there is a bijective mapping l:Ω𝒟:={1,2,,|Ω|}l:\Omega\to\mathcal{D}:=\{1,2,\dots,|\Omega|\}.

To illustrate the practical effect of this assumption, suppose that we are considering an attribute which is a 2-vector of real numbers, being the height and weight of a group of individuals. Such data is always quantized in the real world, with height for example usually being expressed to the nearest number of centimeters. So the vector entry corresponding to height might be an integer number somewhere between 25 and 250, and a number of say 180 would indicate the individual’s height lies in the interval [179.5,180.5). In effect Ω\Omega becomes a finite subset of 2\mathbb{R}^{2}. Then any such finite set Ω\Omega can always be bijectively mapped to {1,2,,|Ω|}=𝒟\{1,2,\cdots,|\Omega|\}=\mathcal{D}. While the possibly unordered set Ω\Omega is mapped to an ordered set 𝒟\mathcal{D} by the mapping ll, the order can be arbitrary for our purpose of computing the mode of the attributes.

II-C Two relevant examples of ff-consensus

There are two related problems treatable by ff-consensus which are similar to the problem just posed, and which have provided to the authors of this paper insights in the formulation of the solution of the mode consensus problem.

II-C1 Distributed computation of network size

In the literature, there exist consensus protocols that accomplish the task of distributed computation of the network size based on blended dynamics, see e.g. [6]. Inspired by [6], the following simple protocol estimates NN in finite time under the assumption that NN¯N\leq\bar{N} where N¯\bar{N} is a known upper bound of NN:

x˙1=hx[x1+1+γxj𝒩1(xjx1)],x˙i=hx[1+γxj𝒩i(xjxi)],i1,\displaystyle\begin{split}\dot{x}_{1}&=h_{x}\left[-x_{1}+1+\gamma_{x}\sum_{j\in{\mathcal{N}}_{1}}(x_{j}-x_{1})\right],\\ \dot{x}_{i}&=h_{x}\left[1+\gamma_{x}\sum_{j\in{\mathcal{N}}_{i}}(x_{j}-x_{i})\right],\quad\forall i\not=1,\end{split} (1)

where γx>0\gamma_{x}>0 is the coupling gain, and hx>0h_{x}>0 is the gain to control the speed of the algorithm. As can be shown in Theorem 1 of the next section, if xi(0)𝒦x:=[0.5,N¯+0.5]x_{i}(0)\in{\mathcal{K}}_{x}:=[0.5,\bar{N}+0.5] and γxN¯3\gamma_{x}\geq\bar{N}^{3}, the solution of the system (1) satisfies

xi(t)=N,t>𝒯x\langle x_{i}(t)\rangle=N,\quad\forall t>{\mathcal{T}}_{x}

where \left\langle\cdot\right\rangle is the rounding function, and

𝒯x=4N¯hxln4M𝒦xN¯22{\mathcal{T}}_{x}=\frac{4\bar{N}}{h_{x}}\ln\frac{4M_{{\mathcal{K}}_{x}}\sqrt{\bar{N}}}{2-\sqrt{2}}

where M𝒦y=N¯M_{{\mathcal{K}}_{y}}=\bar{N}.

Remark 1

The upper bound on the estimation time 𝒯x{\mathcal{T}}_{x} (which may be quite conservative) depends on N¯\bar{N} in the order of O(N¯lnN¯)O(\bar{N}\ln\bar{N}). If hxh_{x} grows linearly with N¯\bar{N}, one may even have O(lnN¯)O\left(\ln{\bar{N}}\right). However a large gain could also undermine the robustness of the protocol against high-frequency noise.

II-C2 kk-th smallest element consensus

Since 𝒟\mathcal{D} is a totally ordered set, suppose without loss of generality that l(a1)l(a2)l(aN)l(a_{1})\leq l(a_{2})\leq\cdots\leq l(a_{N}), then the kk-th smallest element is defined as aka_{k}. The kk-th smallest element (or kk-th order statistic) consensus problem is then an ff-consensus problem with f(a1,,aN)=akf(a_{1},\cdots,a_{N})=a_{k}.

Ref. [5] proposed a method to solve the kk-th smallest element consensus problem with distributed convex optimization algorithms. An example used in the following is

z˙i=ϕk(zi,ai,N)+γzj𝒩isgn(zjzi),\dot{z}_{i}=-\phi_{k}(z_{i},a_{i},N)+\gamma_{z}\sum\limits_{j\in{\mathcal{N}_{i}}}{\rm{sgn}}\left(z_{j}-z_{i}\right), (2)

where ϕk:×Ω×\phi_{k}:{\mathbb{R}}\times\Omega\times{\mathbb{N}} is defined by

ϕk(zi,ai,N)={β(zil(ai))gk,zi<l(ai),0,zi=l(ai),β(zil(ai))+g(N+1k),zi>l(ai),\phi_{k}(z_{i},a_{i},N)=\begin{cases}\beta(z_{i}-l(a_{i}))-gk,&z_{i}<l(a_{i}),\\ 0,&z_{i}=l(a_{i}),\\ \beta(z_{i}-l(a_{i}))+g\left(N+1-k\right),&z_{i}>l(a_{i}),\end{cases}

with β>0\beta>0 and g>βN¯|Ω|g>\beta\bar{N}\left|\Omega\right|.222In [5] the bound was given by g>βN|l(ak)1Ni=1Nl(ai)|g>\beta N\left|{{l(a_{k})}-\frac{1}{N}\sum\nolimits_{i=1}^{N}{{l(a_{i})}}}\right|, which can be loosened to g>βN|l(aN)l(a1)|=βN|Ω|g>\beta N\left|{{l(a_{N})}-{{l(a_{1})}}}\right|=\beta N\left|\Omega\right|.333System (2) admits unique solution in the sense of Filippov. For more details, refer to, e.g., [11, Proposition S2]. Initial conditions for the differential equations can be arbitrary. It can be shown following [12] that if

γz>N¯max1iNsupτ𝒦z|ϕk(τ,ai,N)|,\gamma_{z}>\bar{N}{\max_{1\leq i\leq N}}{\sup_{\tau\in{\mathcal{K}}_{z}}}\left|\phi_{k}(\tau,a_{i},N)\right|, (3)

the convergence rate of the protocol (2)–(3) satisfies V(t)eβtV(0)V(t)\leq e^{-\beta t}V(0), where V(t)=12i=1N|zi(t)l(ak)|2V(t)=\frac{1}{2}\sum_{i=1}^{N}\left|z_{i}(t)-l(a_{k})\right|^{2}. When 𝒦z=[0.5,N¯+0.5]\mathcal{K}_{z}=\left[0.5,\bar{N}+0.5\right], it can be obtained that the solution of (2)–(3) satisfies

zi(t)=l(ak),t>𝒯z\left\langle z_{i}(t)\right\rangle=l(a_{k}),\quad\forall t>{\mathcal{T}_{z}}

where

𝒯z=1βln2N¯|Ω|.{\mathcal{T}_{z}}=\frac{1}{\beta}\ln{2\bar{N}\left|\Omega\right|}.

By inverting the map ll, every agent can figure out the kk-th smallest element.

Remark 2

Although increasing β\beta renders a smaller 𝒯z\mathcal{T}_{z}, it also amplifies γz\gamma_{z} to a very large number for large N¯\bar{N}. To reach a balance between 𝒯z\mathcal{T}_{z} and γz\gamma_{z}, we select β=O(1N¯)\beta=O\left(\frac{1}{\bar{N}}\right), so that 𝒯z=O(N¯lnN¯)\mathcal{T}_{z}=O\left(\bar{N}\ln\bar{N}\right) and γz=O(N¯2)\gamma_{z}=O\left(\bar{N}^{2}\right).

Remark 3

Both of the examples above, the distributed computation of network size and the kk-th smallest element consensus, exhibit algorithms with a finite convergence time. Likewise, for mode consensus, we seek algorithms which also yield finite consensus time.

II-D The problem of interest: Mode consensus

Mode consensus is a special class of ff-consensus problem. Suppose the function fm:ΩNΩf_{\rm m}:\Omega^{N}\to\Omega returns the attribute aΩa^{*}\in\Omega that appear most often among a1,,aNa_{1},\cdots,a_{N} (when multiple distinct values equally appear most often, fmf_{\rm m} returns any of these values specified by the user). The mode consensus problem as studied in this paper is an ff-consensus problem with f=fmf=f_{\rm m}.

II-E Plug-and-play

In many circumstances, it may be advantageous to have a plug-and-play capability. Specifically, we are interested in a network that can change over time during its operation. Changes cannot be arbitrary, but rather admissible in accord with certain rules.

First, while the potential vertex set 𝒱¯\bar{\mathcal{V}} is taken as time-invariant, that is, 𝒱¯={1,,N¯}\bar{\mathcal{V}}=\{1,\cdots,\bar{N}\} is fixed over time for some N¯\bar{N}, the actual vertex set 𝒱\mathcal{V} which is an arbitrary subset of 𝒱¯\bar{\mathcal{V}} can be time-varying but piecewise constant; with N(t)N(t) denoting its cardinality, N¯\bar{N} is an upper bound for N(t)N(t). In this setting, our admissible changes are as follows:

  • The set of edges, written as (t)\mathcal{E}(t), is time-varying but piecewise constant. Therefore, at certain time instants, a new edge or edges can be created, and some existing edge or edges can be deleted.

  • There can be orphan nodes (meaning a node that has no incident edge). When all the edges that are incident to a node are deleted, we say the node leaves the network.

  • We assume that there is only one connected component in the network. In fact, even if there is more than one connected component, our concern is with just one of them. If a connected component of interest splits into two connected components (with some edges being deleted), one of these components still receives our attention, and all the nodes belonging to the other component are regarded as leaving the network.

  • The attribute of a node is permitted to be time-varying but must be piecewise constant.

  • The node dynamics stop integrating whenever the node is an orphan. One example of the node dynamics is:

    x˙i=sgn(|𝒩i(t)|)(gi(xi,t)+j𝒩i(t)(xjxi))\dot{x}_{i}={\mathrm{sgn}}(|\mathcal{N}_{i}(t)|)\cdot\left(g_{i}(x_{i},t)+\sum_{j\in\mathcal{N}_{i}(t)}(x_{j}-x_{i})\right) (4)

    where |||\cdot| for a set implies cardinality of the set. In this way, malfunctioning agents can also be represented by considering them as orphans.

The control algorithm for updating the states of agents is said to be plug-and-play ready if, whenever an abrupt admissible change of the network occurs, (a) the ff-consensus is recovered (to a new value reflecting the new situation) after a transient, and (b) the recovery is achieved by passive manipulation, together with local initialization of the newly joining agent if necessary. By passive manipulation we mean that, when an individual agent detects the changes in its incident edge set, or equivalently its neighbor set, associated with immediate neighbors leaving or joining the network, the agent can perform some actions that do not require reactions of neighboring agents. An example is (4) because, if 𝒩i(t)𝒩i(t+)\mathcal{N}_{i}(t^{-})\not=\mathcal{N}_{i}(t^{+}) at time tt, the manipulation simply resets the incident edge set or equivalently neighbor set, and this can be done by the individual agent. (Of course, neighbor agents may have to also reset in order to carry out their own updates.) By local initialization we mean that, any initialization following a change must be local only, i.e. it must be global initialization-free. This implies that the algorithm should not depend on a particular initial condition constraining two or more agents in some linked way. A constraint such as i=1Nxi(0)=0\sum_{i=1}^{N}x_{i}(0)=0 is an example of global initialization, while the constraint that xi(0)𝒦x_{i}(0)\in{\mathcal{K}}, i𝒱\forall i\in{\mathcal{V}}, where 𝒦\mathcal{K} is a compact set known to every agent, is considered as an example of local initialization (or equivalently it is global initialization-free), and a local initialization is required for the newly joining agent (or, in (4), when 𝒩i(t)\mathcal{N}_{i}(t) becomes non-empty so that the sign function changes from 0 to 1).

The property of plug-and-play ready basically requires that, when the change occurs, no further action is required except for the agents whose incident edge sets are changed. In particular, the requirement of passive manipulation is useful in the case when some agent suddenly stops working (without any prior notification) and cannot function properly anymore.

III Direct mode consensus algorithm

The following protocol, which is motivated by the algorithm for distributed computation of network size discussed above, lays the foundation of the mode consensus algorithm. It is also inspired by the notion of blended dynamics and calculates the number of agents with an arbitrary particular attribute aΩa\in\Omega, denoted by (a)\mathcal{F}(a), in a distributed manner:

y˙1=hy[y1+I(a,a1)+γyj𝒩1(yjy1)],y˙i=hy[I(a,ai)+γyj𝒩i(yjyi)],i1\displaystyle\begin{split}\dot{y}_{1}&=h_{y}\left[-y_{1}+I(a,a_{1})+\gamma_{y}\sum_{j\in{\mathcal{N}}_{1}}(y_{j}-y_{1})\right],\\ \dot{y}_{i}&=h_{y}\left[I(a,a_{i})+\gamma_{y}\sum_{j\in{\mathcal{N}}_{i}}(y_{j}-y_{i})\right],\qquad\forall i\not=1\end{split} (5)

where

I(a,ai)={1,ai=a,0,aia,I(a,a_{i})=\begin{cases}1,&a_{i}=a,\\ 0,&a_{i}\neq a,\end{cases} (6)

and analogous to (1), here γy>0\gamma_{y}>0 is the coupling gain, and hy>0h_{y}>0 is the gain to control the speed of the algorithm.

Theorem 1

Suppose Assumptions 1 and 2 hold. If γyN¯3\gamma_{y}\geq\bar{N}^{3}, then for any initial condition yi(0)𝒦y:=[0.5,N¯+0.5]y_{i}(0)\in{\mathcal{K}}_{y}:=[-0.5,\bar{N}+0.5], the solution of the consensus protocol (5)–(6) satisfies

yi(t)=(a),t>𝒯y,\left\langle y_{i}(t)\right\rangle=\mathcal{F}(a),\quad\forall t>{\mathcal{T}}_{y}, (7)

where, with M𝒦y=N¯+1M_{{\mathcal{K}}_{y}}=\bar{N}+1 (the size of 𝒦y{\mathcal{K}}_{y}),

𝒯y=4N¯hyln4M𝒦yN¯22.{\mathcal{T}}_{y}=\frac{4\bar{N}}{h_{y}}\ln\frac{4M_{{\mathcal{K}}_{y}}\sqrt{\bar{N}}}{2-\sqrt{2}}.

Proof of Theorem 1 is found in the Appendix.

Remark 4

If a=a1==aNa=a_{1}=\cdots=a_{N}, there is no essential difference between (1) and (5). Thus the proof of Theorem 1 is also applicable to the network size estimation protocol (1).

Remark 5

In the literature, (a)/N\mathcal{F}(a)/N can be estimated using average consensus protocols, see [7]. However, in order to run the protocol in an open multi-agent system, the agent that leaves the network must signal its intention to its neighbors beforehand. This is not required by the proposed Algorithm 1.

Remark 6

As is usual for algorithms based on using the blended dynamics approach, grounded in singular perturbation ideas, there are broadly speaking two convergence rates, the fast one being associated with the achieving of consensus between the agents (adjusted by γy\gamma_{y}), and the slower one being associated with the blended dynamics (adjusted by hyh_{y}). This behavior is apparent in the simulations discussed later.

Algorithm 1 Distributed mode consensus algorithm run at every agent ii
  1. 1.

    Run the distributed consensus protocol (5)–(6) with yi(0)𝒦yy_{i}(0)\in{\mathcal{K}}_{y} to estimate (a){\mathcal{F}}(a) for every aΩa\in\Omega;

  2. 2.

    Return the attribute defined by the mode:

    a=argmaxaΩ(a).a^{*}=\arg\max_{a\in\Omega}{\mathcal{F}}(a). (8)

Based on Theorem 1, Algorithm 1 for distributed computation of the mode can be formulated directly. Evidently, one can execute the second step of Algorithm 1 using parallel computations, with one for each attribute. Consider the following modification to (5)–(6):

ξ˙1=hξ[ξ1+el(a1)+γξj𝒩1(ξjξ1)]ξ˙i=hξ[el(ai)+γξj𝒩i(ξjξi)],i=2,,|Ω|,\displaystyle\begin{split}\dot{\xi}_{1}&=h_{\xi}\left[-\xi_{1}+e_{l(a_{1})}+\gamma_{\xi}\sum_{j\in\mathcal{N}_{1}}(\xi_{j}-\xi_{1})\right]\\ \dot{\xi}_{i}&=h_{\xi}\left[e_{l(a_{i})}+\gamma_{\xi}\sum_{j\in\mathcal{N}_{i}}(\xi_{j}-\xi_{i})\right],\qquad\forall i=2,\cdots,|\Omega|,\end{split} (9)

where ξi|Ω|\xi_{i}\in\mathbb{R}^{|\Omega|} is the state vector, and ei|Ω|e_{i}\in\mathbb{R}^{|\Omega|} is the unit |Ω||\Omega|-vector. Likewise, γξ\gamma_{\xi} and hξh_{\xi} are positive scalar gains. If each agent holds the set Ω\Omega and the map ll, then the execution of the third step of the algorithm is straightforward (and achievable by a single agent, or all agents). Any agent ii for which ai=aa_{i}=a^{*} by definition has an attribute which is the mode.

Remark 7

Indeed, if there is more than one attribute with the highest frequency of occurrence, Algorithm 1 is able to find all of these attributes. In that case the user has the option to return any one or several of them. This issue will not be examined any further in the remainder of the paper.

Algorithm 1 is attractive on several grounds. It offers finite convergence time with a bound available for that time, and it is plug-and-play ready. In particular, if the admissible changes discussed in Section II-E occur with the dwell time 𝒯y{\mathcal{T}}_{y} (i.e., any two consecutive changes do not occur within 𝒯y{\mathcal{T}}_{y}), then the mode is obtained after the time 𝒯y{\mathcal{T}}_{y} from the time of change. It is because, whenever yi(tj)𝒦yy_{i}(t_{j})\in{\mathcal{K}}_{y} where tjt_{j} is the jj-th time of change, it holds that 0.5+(a)<yi(t)<(a)+0.5-0.5+{\mathcal{F}}(a)<y_{i}(t)<{\mathcal{F}}(a)+0.5 for all ttj+𝒯yt\geq t_{j}+{\mathcal{T}}_{y} by Theorem 1. Thus, yi(tj+1)𝒦yy_{i}(t_{j+1})\in{\mathcal{K}}_{y} because (a)[1,N¯]{\mathcal{F}}(a)\in[1,\bar{N}], and this repeats. On the other hand, it has the potential disadvantage that every agent has to run the consensus protocols (5)–(6) multiple (in fact |Ω|)|\Omega|) times, which could be computationally burdensome (but may not be, even with large NN). For small |Ω||\Omega|, there is in fact no substantive disadvantage.

IV Mode consensus algorithm considering the frequency of mode

In this section, we consider two alternative algorithms based on knowledge, available a priori or acquired early in the algorithm, of a lower bound on the frequency of the mode.

This second style of mode consensus algorithm in both cases uses the following result.

Lemma 1

Let aΩa\in\Omega, and let KK be a positive integer. If (a)NK\mathcal{F}(a)\geq\left\lceil\frac{N}{K}\right\rceil, then there is an integer j{1,2,,K}j\in\left\{1,2,\cdots,K\right\} such that l(a)l(a) equals the jNKj\left\lceil\frac{N}{K}\right\rceil-th smallest element of {l(a1),,l(aN)}\{l(a_{1}),\cdots,l(a_{N})\}.

Proof:

The proof uses a typical pigeonhole principle argument. For notational convenience, let li:=l(ai)l_{i}:=l(a_{i}) and la:=l(a)l_{a}:=l(a). Suppose without loss of generality that l1lNl_{1}\leq\cdots\leq l_{N}. Moreover, let lN+1,,lKNKl_{N+1},\cdots,l_{K\left\lceil\frac{N}{K}\right\rceil} be additional attributes introduced temporarily just for the proof and such that

l1lNlN+1lKNK.l_{1}\leq\cdots\leq l_{N}\leq l_{N+1}\leq\cdots\leq l_{K\left\lceil\frac{N}{K}\right\rceil}. (10)

Partition the above sequence into subsequences

𝒟j={l(j1)NK+1,l(j1)NK+2,,ljNK}{\mathcal{D}}_{j}=\left\{l_{\left(j-1\right)\left\lceil{\frac{N}{K}}\right\rceil+1},l_{\left(j-1\right)\left\lceil{\frac{N}{K}}\right\rceil+2},\cdots,l_{j\left\lceil{\frac{N}{K}}\right\rceil}\right\}

for j=1,2,,Kj=1,2,\cdots,K. It follows that |𝒟j|=NK\left|{\mathcal{D}}_{j}\right|=\left\lceil{\frac{N}{K}}\right\rceil.

The result is then proved with a contradiction argument. Suppose, to obtain a contradiction, that laljNKl_{a}\neq l_{j\left\lceil{\frac{N}{K}}\right\rceil} for all j{1,2,,K}j\in\left\{1,2,\cdots,K\right\}. Then it must follow that la=l(j1)NK+sl_{a}=l_{\left(j-1\right)\left\lceil{\frac{N}{K}}\right\rceil+s} for some j{1,2,,K}j\in\left\{1,2,\cdots,K\right\} and s{1,,NK1}s\in\left\{1,\cdots,\left\lceil{\frac{N}{K}}\right\rceil-1\right\}. Combined with the fact that the values are ordered (see (10)), it must follow that the number of agents with attribute equal to aa is less than NK\left\lceil{\frac{N}{K}}\right\rceil, which yields a contradiction. ∎

Remark 8

In Lemma 1, if in addition, we have NK>NK\left\lceil{\frac{N}{K}}\right\rceil>{\frac{N}{K}}, the result of Lemma 1 can be mildly strengthened to requiring j{1,2,,K1}j\in\left\{1,2,\cdots,K-1\right\}, because the jNKj\left\lceil{\frac{N}{K}}\right\rceil-th smallest element with j=Kj=K is then out of the set {l(a1),,l(aN)}\{l(a_{1}),\cdots,l(a_{N})\}.

IV-A Algorithm with a priori knowledge of the least frequency of the mode

The message of Lemma 1 is that, if a lower bound of the frequency of the mode is known, that is, (a)f{\mathcal{F}}(a^{*})\geq f^{*} with a known ff^{*}, then, with KK such that fNKf^{*}\geq\lceil\frac{N}{K}\rceil, the integer l(a)l(a^{*}) for the mode aa^{*} should be one of the jNKj\left\lceil{\frac{N}{K}}\right\rceil-th smallest elements, j=1,,Kj=1,\dots,K, in {l(a1),,l(aN)}\{l(a_{1}),\dots,l(a_{N})\}. This message yields Algorithm 2, in which, Step 2) identifies the jNKj\left\lceil{\frac{N}{K}}\right\rceil-th smallest elements, j=1,,Kj=1,\dots,K, and then, Step 4) finds the mode by comparing the frequencies among the candidates.

Algorithm 2 Distributed mode consensus algorithm run at every agent ii
  1. 1.

    Estimate the network size, NN, with the distributed consensus protocol (1) with xi(0)𝒦xx_{i}(0)\in{\mathcal{K}}_{x};

  2. 2.

    For each j{1,2,,K}j\in\left\{1,2,\cdots,K\right\} (or j{1,2,,K1}j\in\left\{1,2,\cdots,K-1\right\} if NK>NK\left\lceil{\frac{N}{K}}\right\rceil>{\frac{N}{K}}), run the consensus protocol (2)–(3) with zi(0)𝒦zz_{i}(0)\in{\mathcal{K}}_{z} to estimate the jNKj\left\lceil{\frac{N}{K}}\right\rceil-th smallest element αjΩ\alpha_{j}\in\Omega. Collect them as 𝒜:={α1,,α|𝒜|}{\mathcal{A}}:=\{\alpha_{1},\dots,\alpha_{|{\mathcal{A}}|}\} where |𝒜|K|\mathcal{A}|\leq K or K1K-1.

  3. 3.

    Run the distributed consensus protocol (5)–(6) with yi(0)𝒦yy_{i}(0)\in{\mathcal{K}}_{y} to estimate (α){\mathcal{F}}(\alpha) for every α𝒜\alpha\in{\mathcal{A}};

  4. 4.

    Return the mode

    a=argmaxα𝒜{(α)}.a^{*}=\arg\max_{\alpha\in{\mathcal{A}}}\left\{{\mathcal{F}}(\alpha)\right\}. (11)

While Algorithm 2 outlines the distributed mode consensus algorithm, it also reveals the significance of KK in reducing the computational load. Depending on KK, sometimes Algorithm 2 may involve manipulating or storing fewer variables than Algorithm 1, but the reverse may hold. In fact, Step 2) in Algorithm 2 can be considered as a selection procedure to find an attribute to be inspected. By this, it is expected that the number of inspections in (11) (effectively, the cardinality of 𝒜\mathcal{A}) is smaller than that in (8) (the cardinality of Ω\Omega). This is indeed the case when, for example, with N=10N=10, [l(a1),,l(aN)]=[1,1,1,1,1,2,3,4,5,6][l(a_{1}),\dots,l(a_{N})]=[1,1,1,1,1,2,3,4,5,6], and |Ω|=6|\Omega|=6. That is, for (8), at least six attributes are inspected in Step 1) of Algorithm 1. For the case of Algorithm 2, assuming that f=5f^{*}=5 is known, K=2K=2 guarantees that f=510/2=5f^{*}=5\geq\lceil 10/2\rceil=5, and so two attributes are inspected by Step 3) of Algorithm 2. However, in order to identify the attributes to be inspected, Step 1)-2) of Algorithm 2 needs to be performed, as an overhead. So the total number of variables to be manipulated is 2K+1=52K+1=5 which is still less than |Ω|=6\left|\Omega\right|=6. As a second example, if [l(a1),,l(aN)]=[1,2,3,4,4,5,6,7,8,8][l(a_{1}),\dots,l(a_{N})]=[1,2,3,4,4,5,6,7,8,8] with N=10N=10 and |Ω|=8\left|\Omega\right|=8, then f=2f^{*}=2 and we have to choose K=5K=5. In this case, Algorithm 2 inspects five candidates while Algorithm 1 inspects eight candidates, but the count of the overhead is five so that the total count becomes 2K+1=112K+1=11, which is more than |Ω|=8|\Omega|=8.

A convergence time bound can be established as follows. Suppose Algorithm 2 is executed with parallel computations at Steps 2) and 4), for example at Step 2), each agent runs the jNKj\left\lceil{\frac{N}{K}}\right\rceil-th smallest element consensus protocol for every j=1,2,,Kj=1,2,\cdots,K in parallel. Then, the mode consensus is reached within the time 𝒯x+𝒯y+𝒯z{\mathcal{T}}_{x}+{\mathcal{T}}_{y}+{\mathcal{T}}_{z}.

It appears from Algorithm 2 that Step i+1)i+1) can only be implemented after Step i)i) has converged. This is actually not the case. All steps may start simultaneously, provided that the parameters used in any step are replaced with their estimated value generated in the previous steps. Indeed, the following equations are one alternative implentation of Algorithm 2 for agent ii:

x˙i=hx[cixi+1+γxj𝒩i(xjxi)]z˙1i=ϕ1K(z1i,ai,xi)+γzj𝒩isgn(z1jz1i)z˙Ki=ϕKK(zKi,ai,xi)+γzj𝒩isgn(zKjzKi)y˙1i=hy[ciy1i+(z1i,ai)+γyj𝒩i(y1jy1i)]y˙Ki=hy[ciyKi+(zKi,ai)+γyj𝒩i(yKjyKi)]m^i=argmax1jK{yji}\displaystyle\begin{split}\dot{x}_{i}&=h_{x}\left[c_{i}x_{i}+1+\gamma_{x}\sum_{j\in\mathcal{N}_{i}}(x_{j}-x_{i})\right]\\ \dot{z}_{1}^{i}&=-\phi_{1}^{K}(z_{1}^{i},a_{i},x_{i})+\gamma_{z}\sum_{j\in\mathcal{N}_{i}}{\mathrm{sgn}}(z_{1}^{j}-z_{1}^{i})\\ &\vdots\\ \dot{z}_{K}^{i}&=-\phi_{K}^{K}(z_{K}^{i},a_{i},x_{i})+\gamma_{z}\sum_{j\in\mathcal{N}_{i}}{\mathrm{sgn}}(z_{K}^{j}-z_{K}^{i})\\ \dot{y}_{1}^{i}&=h_{y}\left[c_{i}y_{1}^{i}+{\mathcal{I}}(z_{1}^{i},a_{i})+\gamma_{y}\sum_{j\in\mathcal{N}_{i}}(y_{1}^{j}-y_{1}^{i})\right]\\ &\vdots\\ \dot{y}_{K}^{i}&=h_{y}\left[c_{i}y_{K}^{i}+{\mathcal{I}}(z_{K}^{i},a_{i})+\gamma_{y}\sum_{j\in\mathcal{N}_{i}}(y_{K}^{j}-y_{K}^{i})\right]\\ \widehat{m}^{i}&=\text{argmax}_{1\leq j\leq K}\{y_{j}^{i}\}\end{split} (12)

where c1=1c_{1}=1, ci=0c_{i}=0 for all i1i\not=1, and

ϕkK(z,a,x)\displaystyle\phi_{k}^{K}(z,a,x)
={β(zl(a))gkxK,z<l(a),0,z=l(a),β(zl(a))+g(x+1kxK),z>l(a),\displaystyle\qquad=\begin{cases}\beta(z-l(a))-gk\left\lceil\frac{\langle x\rangle}{K}\right\rceil,&z<l(a),\\ 0,&z=l(a),\\ \beta(z-l(a))+g\left(\langle x\rangle+1-k\left\lceil\frac{\langle x\rangle}{K}\right\rceil\right),&z>l(a),\end{cases}
(z,a)={1,z=l(a)0,zl(a)\displaystyle{\mathcal{I}}(z,a)=\begin{cases}1,&\langle z\rangle=l(a)\\ 0,&\langle z\rangle\not=l(a)\end{cases}

in which, β\beta, gg, γx\gamma_{x}, γy\gamma_{y}, and γz\gamma_{z} are predetermined. (When NK>NK\left\lceil{\frac{N}{K}}\right\rceil>{\frac{N}{K}}, the KK in the above is interpreted as K1K-1.) Here, xix_{i} is the estimate of NN by the agent ii, zkiz_{k}^{i} is the estimate of the kk-th smallest element, ykiy_{k}^{i} is the estimate of the frequency of zkiz_{k}^{i}, and m^i\widehat{m}^{i} is the estimated integer for the mode, i.e., the estimated mode is aΩa\in\Omega such that l(a)=m^il(a)=\widehat{m}^{i}. In fact, although all the dynamics (12) run altogether, the estimates are sequentially obtained. That is, zkiz_{k}^{i} starts converging to its proper value after xi\langle x_{i}\rangle becomes NN, and ykiy_{k}^{i} starts converging to its proper value after zki\langle z_{k}^{i}\rangle becomes the kk-th smallest element. Therefore, the required time for getting the mode is still the same as 𝒯x+𝒯y+𝒯z{\mathcal{T}}_{x}+{\mathcal{T}}_{y}+{\mathcal{T}}_{z}.

Algorithm 2 that repeats forever, and the alternative algorithm (12) are plug-and-play ready as long as the admissible changes occur with the dwell time 𝒯x+𝒯y+𝒯z{\mathcal{T}}_{x}+{\mathcal{T}}_{y}+{\mathcal{T}}_{z}. This is because, with xi(tj)𝒦xx_{i}(t_{j})\in{\mathcal{K}}_{x}, zki(tj)𝒦zz_{k}^{i}(t_{j})\in{\mathcal{K}}_{z}, and yki(tj)𝒯yy_{k}^{i}(t_{j})\in{\mathcal{T}}_{y} at the time of change tjt_{j}, the same inclusion holds at the next time of change tj+1t_{j+1}; i.e., xi(tj+1)𝒦xx_{i}(t_{j+1})\in{\mathcal{K}}_{x}, zki(tj+1)𝒦zz_{k}^{i}(t_{j+1})\in{\mathcal{K}}_{z}, and yki(tj+1)𝒯yy_{k}^{i}(t_{j+1})\in{\mathcal{T}}_{y}.

From (12) we see the number of the state variables needed in Algorithm 2 equals 2K+12K+1 (or 2K12K-1 if NK>NK\left\lceil{\frac{N}{K}}\right\rceil>{\frac{N}{K}}). Thus Algorithm 2 uses less state variables than Algorithm 1 if 2K+1<|Ω|2K+1<\left|\Omega\right| (or 2K1<|Ω|2K-1<\left|\Omega\right| when NK>NK\left\lceil{\frac{N}{K}}\right\rceil>{\frac{N}{K}}). In particular, If K=1K=1, the mode consensus problem reduces to the max consensus of {l(a1),,l(aN)}\{l(a_{1}),\dots,l(a_{N})\} since l(a)l(a^{*}) is the NN-th smallest element; If K=2K=2, the problem reduces to finding the attributes having larger frequency between the median and the maximum of {l(a1),,l(aN)}\{l(a_{1}),\dots,l(a_{N})\} (if NN is odd, it is simply the median); If K=|Ω|K=|\Omega|, Algorithm 2 probably has to do the kk-th smallest element consensus |Ω||\Omega| times, and then it offers no advantage over Algorithm 1. Since fN|Ω|f^{*}\geq\left\lceil\frac{N}{|\Omega|}\right\rceil, it is not necessary to consider K>|Ω|K>|\Omega| because the condition fNKf^{*}\geq\left\lceil\frac{N}{K}\right\rceil is automatically fulfilled. Thus to choose Algorithm 2 over Algorithm 1 it is preferable to have 2K+1|Ω|2K+1\ll|\Omega|.

IV-B Algorithm with learned knowledge of the least frequency of the mode

When ff^{*} is unknown, we are not able to employ Algorithm 2. However, once we determine a value of (a){\mathcal{F}}(a) for some attribute aa, then we can immediately infer that f(a)f^{*}\geq{\mathcal{F}}(a). Based on this simple fact, we begin with an estimate FF of ff^{*} with F=1F=1, and update FF by (a){\mathcal{F}}(a) whenever an attribute aa such that (a)>F{\mathcal{F}}(a)>F is found. At the same time, we begin with K=1K=1 and repeatedly increase KK until it holds that FNKF\geq\lceil\frac{N}{K}\rceil. Once we have FNKF\geq\lceil\frac{N}{K}\rceil, it means that the integer corresponding to the mode aa^{*} is among the jNKj\left\lceil{\frac{N}{K}}\right\rceil-th smallest elements, j=1,,Kj=1,\dots,K, of {l(a1),,l(aN)}\{l(a_{1}),\dots,l(a_{N})\}, so that the previous algorithm can be applied. Putting all this together, we obtain Algorithm 3.

Algorithm 3 Distributed mode consensus algorithm run at every agent ii
  1. 1.

    Estimate the network size, NN, with the distributed consensus protocol (1) with xi(0)𝒦xx_{i}(0)\in{\mathcal{K}}_{x}. (If N=1N=1, stop because the mode is the same as the attribute.);

  2. 2.

    Set K=F=1K=F=1;

  3. 3.

    While F<NKF<\left\lceil{\frac{N}{{{K}}}}\right\rceil do

  4. 4.

    KK+1K\leftarrow K+1;

  5. 5.

    For each j{1,2,,K}j\in\left\{1,2,\cdots,K\right\} (or j{1,2,,K1}j\in\left\{1,2,\cdots,K-1\right\} if NK>NK\left\lceil{\frac{N}{K}}\right\rceil>{\frac{N}{K}}), run the consensus protocol (2)–(3) with zi(0)𝒦zz_{i}(0)\in{\mathcal{K}}_{z} to estimate the jNKj\left\lceil{\frac{N}{K}}\right\rceil-th smallest element αjΩ\alpha_{j}\in\Omega. Collect them as 𝒜:={α1,,α|𝒜|}{\mathcal{A}}:=\{\alpha_{1},\dots,\alpha_{|{\mathcal{A}}|}\} where |𝒜|K|\mathcal{A}|\leq K or K1K-1.

  6. 6.

    Run the distributed consensus protocol (5)–(6) with yi(0)𝒦yy_{i}(0)\in{\mathcal{K}}_{y} to estimate (α){\mathcal{F}}(\alpha) for every α𝒜\alpha\in{\mathcal{A}};

  7. 7.

    Fmax{F,maxα𝒜{(α)}}F\leftarrow\max\left\{F,\max_{\alpha\in{\mathcal{A}}}\{{\mathcal{F}}(\alpha)\}\right\};

  8. 8.

    End While

  9. 9.

    Return the mode

    a=argmaxα𝒜{(α)}.a^{*}=\arg\max_{\alpha\in{\mathcal{A}}}\left\{{\mathcal{F}}(\alpha)\right\}.

In the algorithm, Steps 5) and 6) can be made more efficient by storing data obtained in the previous loop, but in the worst case scenario, the “While” loop should be run KK^{*} times, where KK^{*} is the smallest positive integer such that fNKf^{*}\geq\lceil\frac{N}{K^{*}}\rceil. Analogously to the analysis for Algorithm 2, the number of state variables needed in Algorithm 3 equals 1+i=1K2i=K(K+1)+11+\sum\nolimits_{i=1}^{{K^{*}}}2i=K^{*}\left(K^{*}+1\right)+1. To choose Algorithm 3 over Algorithm 1 it is preferable to have K(K+1)+1|Ω|K^{*}\left(K^{*}+1\right)+1\ll|\Omega|. If in addition, Algorithm 3 is executed with parallel computations, the time to reach mode consensus is less than 𝒯x+K(𝒯y+𝒯z){\mathcal{T}}_{x}+K^{*}\left({\mathcal{T}}_{y}+{\mathcal{T}}_{z}\right).

V Simulations

Consider an undirected loop composed of N=40N=40 agents, where agent ii is connected to agent i+1i+1 for every i=1,2,,N1i=1,2,\cdots,N-1, and connected to agent i1i-1 for every i=2,3,,Ni=2,3,\cdots,N. Agent 11 and NN are also connected. Suppose that Ω={1,2,,10}\Omega=\{1,2,\cdots,10\}, and

[(1),(2),(10)]=[5,6,7,16,1,1,1,1,1,1].[\mathcal{F}(1),\mathcal{F}(2),\dots\mathcal{F}(10)]=[5,6,7,16,1,1,1,1,1,1].

Thus a=4a^{*}=4 is the mode, which is unique.

Algorithm 1 is examined first. For each aΩa\in\Omega, the initial condition of (5)–(6) at each agent (i.e., the initial guess of (a)\mathcal{F}\left(a\right) at each agent) is randomly and independently selected from 11 to 4040. According to Theorem 1, the coupling gain is selected as γy=N3=6.4×104\gamma_{y}=N^{3}=6.4\times 10^{4}. Set hy=103h_{y}=10^{3}. The simulation results are shown in Figs. 12. From Fig. 2 it is observed that consensus is reached rapidly, while the trajectories converge to the frequency of the mode with a relatively slow rate. This is in accord with expectations, given use of blended dynamics ideas.

Second, Algorithm 2 is examined. Suppose that N¯=50\bar{N}=50. With protocol (1) where hx=103h_{x}=10^{3} and γx=N¯3=1.25×105\gamma_{x}=\bar{N}^{3}=1.25\times 10^{5}, and the initial condition at each agent (i.e., the initial guess of NN at each agent) is randomly and independently selected from 11 to N¯\bar{N}, each agent asymptotically estimates the network size, as shown in Fig. 3. Next, assume that K=3K=3 is used in Algorithm 2 (this is valid since (a)=16>NK=14\mathcal{F}\left(a^{*}\right)=16>\lceil{\frac{N}{K}}\rceil=14). Thus only the 1414-th and 2828-th smallest element need to be estimated. Fig. 4 shows the corresponding estimation result by protocol (2), where β=1N¯=0.02\beta=\frac{1}{\bar{N}}=0.02, g=|Ω|=10g=\left|\Omega\right|=10, γz=gN¯2=2.5×104\gamma_{z}=g\bar{N}^{2}=2.5\times 10^{4} and the initial condition at each agent (i.e., the initial guess of the mode at each agent) is randomly and independently selected from Ω\Omega. It is shown that the 1414-th element converges to 33 while the 2828-th element converges to 44. Then, Fig. 5 shows that the frequency of the 1414-th smallest element converges to 77, and the 2828-th smallest element converges to 1616 by running protocol (5)–(6), where the gains and initial conditions are selected following the rules of the first simulation. Finally, Fig. 6 shows the mode estimated at each agent.

Lastly, Algorithm 3 is examined. Parameter settings follow Algorithms 1 and 2, and the iteration starts at K=1K=1 and F=1F=1. It is supposed that the criterion “F<NKF<\lceil{\frac{N}{K}}\rceil” is verified every 0.60.6s. Since F<NK=40F<\lceil{\frac{N}{K}}\rceil=40, KK is switched to 22 immediately, and NK=20\lceil{\frac{N}{K}}\rceil=20. Thus the 2020-th and 4040-th smallest element need to be estimated, and the corresponding result is shown in Fig. 7-8, in which the attribute estimation converges to 44 and 1010 and the frequency estimation converges to 1616 and 11. Then since F=16<NK=20F=16<\lceil{\frac{N}{K}}\rceil=20, KK is further switched to 33 in Fig. 9. As the situation at K=3K=3 is the same as the second simulation, simulation details are omitted. Note that the termination condition is satisfied since F=16>NK=14F=16>\lceil{\frac{N}{K}}\rceil=14. Finally, Fig. 10 shows the mode estimated at each agent during the iterations.

Refer to caption
Figure 1: The mode aa^{*} estimated at each agent with Algorithm 1, converging to 44.
Refer to caption
Figure 2: The estimated frequency of the mode, i.e., (a)\mathcal{F}\left(a^{*}\right), at each agent with Algorithm 1, converging to 1616.
Refer to caption
Figure 3: The network size ,i.e. NN, estimated at each agent with protocol (1).
Refer to caption
Figure 4: Top figure: the estimated 1414-th smallest element at each agent with protocol (2), converging to 33; bottom figure: the estimated 2828-th smallest element at each agent with protocol (2), converging to 44.
Refer to caption
Figure 5: Top figure: The estimated frequency of the 1414-th smallest element at each agent with protocol (5)–(6), converging to 77; bottom figure: The estimated frequency of the 2828-th smallest element at each agent with protocol (5)–(6), converging to 1616;
Refer to caption
Figure 6: The mode aa^{*} estimated at each agent with Algorithm 2, converging to 44.
Refer to caption
Figure 7: Top figure: the estimated 2020-th smallest element at each agent with protocol (2), converging to 44; bottom figure: the estimated 4040-th smallest element at each agent with protocol (2), converging to 1010.

.

Refer to caption
Figure 8: Top figure: The estimated frequency of the 2020-th smallest element at each agent with protocol (5)–(6), converging to 44; bottom figure: The estimated frequency of the 4040-th smallest element at each agent with protocol (5)–(6), converging to 11.
Refer to caption
Figure 9: The time evolution of KK.
Refer to caption
Figure 10: The mode aa^{*} estimated at each agent with Algorithm 3, converging to 4.

VI Conclusion

It is shown in this paper that, by employing a blended-dynamics based protocol, distributed mode consensus can be reached in an undirected network. It is also shown that, if the frequency of the mode is no less than NK\lceil\frac{N}{K}\rceil for some positive integer KK satisfying 2K+1<|Ω|2K+1<\left|\Omega\right|, the number of distinct frequencies computed at every agent can be reduced.

To design the mode consensus algorithms, the upper bound of the network size, N¯\bar{N}, is required a priori information. The convergence time is always finite.

A nice feature of the proposed algorithms is the plug-and-play property. When a new agent plugs in or leaves the network, only passive manipulations are needed for the agents in order to restore consensus to a new mode.

Future works along this direction include extending the present results to the case of directed graphs, developing second (or higher) order algorithms to reach faster convergence, adaptively adjusting the gains so that the need for knowledge of N¯\bar{N} can be removed. While the piecewise-constant interaction graph is considered in this paper, gossip or other stochastic sorts of interactions are also of interest for future direction of research.

We shall prove Theorem 1 following the idea of [6]. By letting y=[y1,y2,,yN]Ty=[y_{1},y_{2},\cdots,y_{N}]^{T} and b=[I(a,a1),I(a,a2),,I(a,aN)]Tb=[I(a,a_{1}),I(a,a_{2}),\cdots,I(a,a_{N})]^{T}, the overall system (5)–(6) is rewritten as

y˙(t)=h[(γL+e1e1T)y(t)+b]\dot{y}(t)=h\left[-(\gamma L+e_{1}e_{1}^{T})y(t)+b\right] (13)

where e1=[1,0,,0]TNe_{1}=[1,0,\cdots,0]^{T}\in\mathbb{R}^{N}, and hyh_{y} and γy\gamma_{y} in (5) and N¯\bar{N} are written as hh, γ\gamma, and NN, respectively, for simplicity.

Let λ2(L)\lambda_{2}(L) denote the second smallest eigenvalue of the symmetric Laplacian matrix LL, which is nonzero under Assumption 1. Then, the following lemma is a key to the proof.

Lemma 2 (Lemma 1 in [6])

Suppose that Assumption 1 holds. If γ>0\gamma>0, then the matrix (γL+e1e1T)(\gamma L+e_{1}e_{1}^{T}) is positive definite. Moreover, if γN/λ2(L)\gamma\geq N/\lambda_{2}(L), then λmin(γL+e1e1T)1/(4N)\lambda_{\min}\left(\gamma L+e_{1}e_{1}^{T}\right)\geq 1/(4N), where λmin(A)\lambda_{\min}(A) is the smallest eigenvalue for a symmetric matrix AA.

Under Lemma 2, system (13) has the exponentially stable equilibrium

y=(γL+e1e1T)1b.y^{*}=\left(\gamma L+e_{1}e_{1}^{T}\right)^{-1}b.
Lemma 3

Let yiy_{i}^{*} be the ii-th element of yy^{*}. Under Assumption 1,

  1. 1.

    y1=1NTb=(a)y_{1}^{*}=1_{N}^{T}b=\mathcal{F}(a),

  2. 2.

    for i=2,,Ni=2,\dots,N,

    |yiy1|<1γ2N34.|y_{i}^{*}-y_{1}^{*}|<\frac{1}{\gamma}\frac{\sqrt{2}N^{3}}{4}. (14)
Proof:

Observe that 1NT(γL+e1e1T)=e1T1_{N}^{T}(\gamma L+e_{1}e_{1}^{T})=e_{1}^{T} because 1NTL=01_{N}^{T}L=0 and 1NTe1=11_{N}^{T}e_{1}=1. Then,

y1=e1Ty=1NT(γL+e1e1T)(γL+e1e1T)1b=1NTb,\displaystyle y_{1}^{*}=e_{1}^{T}y^{*}=1_{N}^{T}(\gamma L+e_{1}e_{1}^{T})(\gamma L+e_{1}e_{1}^{T})^{-1}b=1_{N}^{T}b,

which proves the first claim. Under Assumption 1, the matrix LL has exactly one zero eigenvalue and there exists an orthogonal matrix UN×NU\in\mathbb{R}^{N\times N} such that

U=[1N1NQ]andLU=U[000Λ]U=\begin{bmatrix}\frac{1}{\sqrt{N}}1_{N}&Q\end{bmatrix}\quad\text{and}\quad LU=U\begin{bmatrix}0&0\\ 0&\Lambda\end{bmatrix}

where QN×(N1)Q\in\mathbb{R}^{N\times(N-1)} is orthogonal, and Λ(N1)×(N1)\Lambda\in\mathbb{R}^{(N-1)\times(N-1)} is real and diagonal. Then, with a coordinate change

[η1η~]:=UTy=[1N1NTQT]y,\begin{bmatrix}\eta_{1}\\ \tilde{\eta}\end{bmatrix}:=U^{T}y=\begin{bmatrix}\frac{1}{\sqrt{N}}1_{N}^{T}\\ Q^{T}\end{bmatrix}y,

the equilibrium yy^{*} can be expressed by

y=1N1Nη1+Qη~y^{*}=\frac{1}{\sqrt{N}}1_{N}\eta_{1}^{*}+Q\tilde{\eta}^{*} (15)

where η1=limtη1(t)\eta_{1}^{*}=\lim_{t\to\infty}\eta_{1}(t) and η~=limtη~(t)\tilde{\eta}^{*}=\lim_{t\to\infty}\tilde{\eta}(t) whose existence follows from the fact that limty(t)=y\lim_{t\to\infty}y(t)=y^{*}. In fact, we observe that

η~˙\displaystyle\dot{\tilde{\eta}} =QTy˙=QT(γLye1e1Ty+b)\displaystyle=Q^{T}\dot{y}=Q^{T}(-\gamma Ly-e_{1}e_{1}^{T}y+b)
=γQTLQη~QTe1y1+QTb\displaystyle=-\gamma Q^{T}LQ\tilde{\eta}-Q^{T}e_{1}y_{1}+Q^{T}b

where QTLQ=ΛQ^{T}LQ=\Lambda which is positive definite. Therefore, we see that limtη~(t)=η~=(1/γ)Λ1QT(be1y1)\lim_{t\to\infty}\tilde{\eta}(t)=\tilde{\eta}^{*}=(1/\gamma)\Lambda^{-1}Q^{T}(b-e_{1}y_{1}^{*}). Now, by (15) and by y1=1NTby_{1}^{*}=1_{N}^{T}b, we have that

e1Ty\displaystyle e_{1}^{T}y^{*} =y1=1Nη1+1γe1TQΛ1QT(Ie11NT)b,\displaystyle=y_{1}^{*}=\frac{1}{\sqrt{N}}\eta_{1}^{*}+\frac{1}{\gamma}e_{1}^{T}Q\Lambda^{-1}Q^{T}(I-e_{1}1_{N}^{T})b,

from which η1\eta_{1}^{*} is obtained. With the expressions for η1\eta_{1}^{*} and η~\tilde{\eta}^{*}, equation (15) yields that

y=1Ny1+1γ(I1Ne1T)QΛ1QT(Ie11NT)b.y^{*}=1_{N}y_{1}^{*}+\frac{1}{\gamma}(I-1_{N}e_{1}^{T})Q\Lambda^{-1}Q^{T}(I-e_{1}1_{N}^{T})b.

Therefore,

yiy1\displaystyle y_{i}^{*}-y_{1}^{*} =1γeiT(I1Ne1T)QΛ1QT(Ie11NT)b\displaystyle=\frac{1}{\gamma}e_{i}^{T}(I-1_{N}e_{1}^{T})Q\Lambda^{-1}Q^{T}(I-e_{1}1_{N}^{T})b
=1γ(eiTe1T)QΛ1QT(Ie11NT)b.\displaystyle=\frac{1}{\gamma}(e_{i}^{T}-e_{1}^{T})Q\Lambda^{-1}Q^{T}(I-e_{1}1_{N}^{T})b.

Noting that, for N2N\geq 2,

|(Ie11NT)b|2\displaystyle\left|(I-e_{1}1_{N}^{T})b\right|^{2} =(i=2Nbi)2+i=2Nbi2\displaystyle=\left(\sum_{i=2}^{N}b_{i}\right)^{2}+\sum_{i=2}^{N}b_{i}^{2}
(N1)i=2Nbi2+i=2Nbi2=Ni=2Nbi2<N2\displaystyle\leq(N-1)\sum_{i=2}^{N}b_{i}^{2}+\sum_{i=2}^{N}b_{i}^{2}=N\sum_{i=2}^{N}b_{i}^{2}<N^{2}

we finally obtain

|yiy1|<1γ21λ2(L)N.\displaystyle|y_{i}^{*}-y_{1}^{*}|<\frac{1}{\gamma}\cdot\sqrt{2}\cdot\frac{1}{\lambda_{2}(L)}\cdot N.

Recalling that λ2(L)4/N2\lambda_{2}(L)\geq 4/N^{2} [13], (14) follows. ∎

Now, it follows from (13) that

y(t)y=eh(γL+e1e1T)t(y(0)y).y(t)-y^{*}=e^{-h(\gamma L+e_{1}e_{1}^{T})t}(y(0)-y^{*}).

Here we note that, since the matrix (γL+e1e1T)(\gamma L+e_{1}e_{1}^{T}) is symmetric,

eh(γL+e1e1T)tkeλmin(γL+e1e1T)htwith k=1.\|e^{-h(\gamma L+e_{1}e_{1}^{T})t}\|\leq ke^{-\lambda_{\min}(\gamma L+e_{1}e_{1}^{T})ht}\quad\text{with $k=1$}.

Recalling that the assumption γN3\gamma\geq N^{3} of Theorem 1 implies γN3/4N/λ2(L)\gamma\geq N^{3}/4\geq N/\lambda_{2}(L) by the fact that λ2(L)4/N2\lambda_{2}(L)\geq 4/N^{2} [13] so that Lemma 2 guarantees λmin(γL+e1e1T)1/(4N)\lambda_{\min}(\gamma L+e_{1}e_{1}^{T})\geq 1/(4N). The assumption γN3\gamma\geq N^{3} also implies that |yiy1|<2/4|y_{i}^{*}-y_{1}^{*}|<\sqrt{2}/4 by (14), with which we note that 2/4<yi<N+2/4-\sqrt{2}/4<y_{i}^{*}<N+\sqrt{2}/4 for all 1iN1\leq i\leq N because 0y1=(a)N0\leq y_{1}^{*}={\mathcal{F}}(a)\leq N. This implies that y(0)y<M𝒦yN\|y(0)-y^{*}\|<M_{{\mathcal{K}}_{y}}\sqrt{N} where M𝒦y=N+1M_{{\mathcal{K}}_{y}}=N+1 that is the size of the interval 𝒦y=[0.5,N+0.5]{\mathcal{K}}_{y}=[-0.5,N+0.5] since yi(0)𝒦yy_{i}(0)\in{\mathcal{K}}_{y} by the assumption. Putting together, we obtain

|yi(t)y1|\displaystyle|y_{i}(t)-y_{1}^{*}| |yi(t)yi|+|yiy1|\displaystyle\leq|y_{i}(t)-y_{i}^{*}|+|y_{i}^{*}-y_{1}^{*}|
y(t)y+|yiy1|\displaystyle\leq\|y(t)-y^{*}\|+|y_{i}^{*}-y_{1}^{*}|
<eh4NtM𝒦yN+24.\displaystyle<e^{-\frac{h}{4N}t}\cdot M_{{\mathcal{K}}_{y}}\sqrt{N}+\frac{\sqrt{2}}{4}.

Therefore, when

t>4Nhln4M𝒦yN22=:𝒯y(N),t>\frac{4N}{h}\ln\frac{4M_{{\mathcal{K}}_{y}}\sqrt{N}}{2-\sqrt{2}}=:{\mathcal{T}_{y}}(N),

we have that |yi(t)(a)|<1/2|y_{i}(t)-{\mathcal{F}}(a)|<1/2 for all ii.

References

  • [1] Kuhn F, Locher, T and Schmid, S. Distributed computation of the mode. Proceedings of the twenty-seventh ACM symposium on Principles of distributed computing, 2008, 15–24.
  • [2] Bénézit, F. and Thiran, P. and Vetterli, M. Interval consensus: From quantized gossip to voting. Proc. IEEE Int. Conf. Acoust. Speech Signal Process. (ICASSP’09), 2009, 3661–3664.
  • [3] Bénézit, F. and Thiran, P. and Vetterli, M. The distributed multiple voting problem. IEEE Journal of Selected Topics in Signal Processing, 2011, 5: 791–804.
  • [4] Salehkaleybar, S. and Sharif-Nassab, A. and Golestani, S. J. Distributed voting/ranking with optimal number of states per node. IEEE Transactions on Signal and Information Processing over Networks, 2015, 1: 259–267.
  • [5] Huang, C. and Anderson B. D. O. and Zhang H. and Yan, H. Distributed convex optimization as a tool for solving ff-consensus problems. Automatica, 2023, 115: 111087.
  • [6] Lee, D. and Lee, S. and Kim, T. and Shim, H. Distributed algorithm for the network size estimation: Blended dynamics approach. 2018 IEEE Conference on Decision and Control (CDC), 2018, 4577–4582.
  • [7] Dashti, Zoreh Al Zahra Sanai and Oliva, Gabriele and Seatzu, Carla and Gasparri, Andrea and Franceschelli, Mauro. Distributed Mode Computation in Open Multi-Agent Systems. IEEE Control Systems Letters, 2022, 6: 3481–3486.
  • [8] Lee, Jin Gyu and Shim, Hyungbo. Design of Heterogeneous Multi-agent system for Distributed Computation. Trends in Nonlinear and Adaptive Control: A Tribute to Laurent Praly for his 65th Birthday, Springer, 2021, 83–108.
  • [9] Cortés J. Distributed algorithms for reaching consensus on general functions. Automatica, 2008, 44: 726–737.
  • [10] Olfati-Saber R. and Fax J. and Murray R. Consensus and Cooperation in Networked Multi-Agent Systems. Proceedings of the IEEE, 2007, 95: 215–233
  • [11] Cortés J. Discontinuous dynamical systems. IEEE Control systems magazine, 2008, 28: 36–73.
  • [12] Li, Weijian and Zeng, Xianlin and Liang, Shu and Hong, Yiguang. Exponentially Convergent Algorithm Design for Constrained Distributed Optimization via Nonsmooth Approach. IEEE Transactions on Automatic Control, 2022, 67: 934-940.
  • [13] Mohar, Bojan. Eigenvalues, diameter, and mean distance in graphs. Graphs and Combinatorics, 1991, 7: 53–64.