Distributed Data Clustering via Opinion Dynamics

. We provide a distributed method to partition a large set of data in clusters, characterized by small in-group and large out-group distances. We assume a wireless sensors network in which each sensor is given a large set of data and the objective is to provide a way to group the sensors in homogeneous clusters by information type. In previous literature, the desired number of clusters must be specified a priori by the user. In our approach, the clusters are constrained to have centroids with a distance at least 𝜀 between them and the number of desired clusters is not specified. Although traditional algorithms fail to solve the problem with this constraint, it can help obtain a better clustering. In this paper, a solution based on the Hegselmann-Krause opinion dynamics model is proposed to find an admissible, although suboptimal, solution. The Hegselmann-Krause model is a centralized algorithm; here we provide a distributed implementation, based on a combination of distributed consensus algorithms. A comparison with 𝑘 -means algorithm concludes the paper.


Introduction
The problem of grouping large amounts of data into a small number of subsets with some common features among the elements (often referred to as the data clustering problem) has attracted the work of several researchers in different fields, ranging from statistics to imagine analysis and bioinformatics [1][2][3].
Data clustering techniques are developed to partition an initial set of observation data into collections with small ingroup distances and big out-group distances.
Among the existing techniques, one of the most used is the -means algorithm or its successive extensions (e.g., fuzzy -means [4], mixture of Gaussians algorithms [5]).Given a set of initial observation data and a number  of desired clusters, the -means algorithm computes a suboptimal placement of  cluster centroids and assigns the observations to such centroids, alternating between an assignment phase, where each observation point is assigned to its nearest centroid, and refinement phase, where each centroid position is updated as the center of mass of all observations belonging to that centroid.
A well-known limitation of data clustering algorithms, such as the -means algorithm, is that the number of clusters has to be specified beforehand, based for example, on subjective evaluations or a priori analysis.Since this assumption is typically not feasible in practice, a typical solution consists of running several times the algorithm with a different number of clusters and then deciding the best obtained solution based on a posteriori evaluation [6].Another issue of traditional algorithms is that there is no guarantee that the clusters are sufficiently far from each other.To this respect, distance-constrained data clustering approaches have been devised in the literature: in [7,8] the considered constraints are the so-called must-links (i.e., an observation  must belong to a cluster ) and cannot-link (i.e., an observation  can not belong to a cluster ); in [9] the feasibility of a constrained problem involving the so-called -constraints (i.e., any two observations must have a distance greater than ) and the -constraints (i.e., for any observation  in cluster  there must be at least another observation ℎ in cluster  such that the distance between  and  is less than ) is given.To the best of our knowledge, nowadays, there is no methodology to specify a constraint on the distance between 2 International Journal of Distributed Sensor Networks cluster centroids, while this class of constraints might help finding a choice for the number  when such value is a priori unknown.
This problem has a particular relevance in a distributed setting, where a network of sensors has to classify information provided by several sensors without a central authority but using only local data exchange among neighbors in the network.Differently from community clustering in wireless networks (e.g., see [10]), here the nodes are clustered depending on the data they sense, with no particular dependency on the network topology.
In this paper, based on the preliminary results in [11], a novel approach to solve the data clustering problem with a distance constraint among cluster centroids is provided that does not require the specification of the initial number  of clusters and that is based on an extension of the Hegselmann-Krause (HK) opinion dynamics model [12,13], which handles scalar data, in order to handle data in R  .Such a model, similar to consensus [14,15], represents how a set of agents interacts in order to reach a local agreement, but the agents may split in several clusters depending on their "opinions." Within the proposed approach, rather than striving for a complete agreement among the agents, we exploit the peculiarity of HK model to generate several clusters, with the aim to map a large set of measurement data into few values (i.e, the opinion clusters).In this view, as it will be discussed in the following, HK models can be seen as a powerful methodology to determine the number of clusters while respecting the constraints on the distance among cluster centroids.The HK model, in its original setting, is a centralized algorithm [13]; hence we devise a distributed implementation based on a combination of consensus algorithms, which are an effective way to distribute complex operations, for example, time synchronization [16].
The outline of the paper is as follows: after some preliminaries, in Section 2, we provide a formulation of the problem at hand and in Section 3 we analyze the formulation of the standard data clustering problem and the -means algorithm; then in Section 4 the HK opinion dynamics model is reviewed, while in Section 5 the distributed consensus algorithms are examined; Section 6 is devoted to outline the proposed approach to solve the distance-constrained clustering problem, while Section 7 addresses the distributed implementation of the HK opinion dynamics model; Section 8 contains some numeric examples to show the potentialities of this method, while Section 9 contains some conclusive remarks.
A graph is said to be undirected if (V  , V  ) ∈  whenever (V  , V  ) ∈  and is said to be directed otherwise.Let the neighborhood N  of a node  be the set of nodes V  such that (V  , V  ) ∈ , and let the degree   = |N  |.A graph  is connected if for any V  , V  ∈  there is a path whose endpoints are in V  and V  .

Problem Statement
Consider a collection of  sensors, each equipped with a dimensional measurement or piece of information  1 , . . .,   , with   ∈ R  .We want to select a number  of groups or clusters,  1 , . . .,   ,  ≤ .Every cluster   is assigned to a cluster centroid   ∈ R  , which represents the centroid of the observations allocated to that cluster.A data point   ∈ R  is said to belong to cluster   if its distance from the centroid  ℎ , with ℎ ̸ = , of every other cluster  ℎ is larger than its distance from   .If   belongs to   we can set a binary assignment variable   ∈ B to 1 and to 0 otherwise.The solution of a data clustering problem with distance constraints involves the computation of the optimal choice of cluster centroids   , for  = 1, . . ., , that minimizes the distance of every measurement data point   from the cluster it belongs to.More formally, we need to solve the following.
Problem 1 (distance-constrained data clustering).We want to find the number of clusters , the cluster centroids,   ∈ R  , and measurement data assignments,   ∈ R that minimize the index subject to the constraints ( The first set of constraints (I) along with the third one implies that each observation is assigned exactly to one cluster; the constraints (II) imply that  is a lower bound for the distance between any pair of centroids; finally constraints (III) imply that   are binary decision variables.This problem is novel, since in the literature, the set of constraints (II) is typically not considered.Including such constraints, however, is quite useful, since it may improve the algorithm's ability to detect homogeneous clusters.The problem is very hard to solve exactly and traditional methods as the -means algorithm [17] may fail even at finding an admissible solution, as it will be shown in the next section.
On the other side, the proposed algorithm uses an algorithm based on the Hegselmann-Krause model to choose an admissible, although suboptimal, solution, and it has a modest increase in computational complexity with respect to the -means algorithm, while allowing several advantages (further discussed later in the paper): (i) the algorithm provided in this paper always finds an admissible, although suboptimal, solution to the problem by means of the HK model, while the means algorithm may fail; (ii) the proposed approach does not require the user to define a priori the number of clusters, but it finds automatically a suitable number of clusters based on the parameter ; (iii) outliers can be automatically isolated, without any a priori data processing; this feature can be obtained by dropping out the clusters whose cardinality is significantly less than the others; (iv) the solution provided in this paper is deterministic, that is, for fixed  and fixed observations, the result is always the same, while the -means algorithm depends on the initial random choice of the centroids; (v) while traditional approaches are very computationally expensive when applied in a decentralized and distributed setting [18] (i.e., for a sensors network), this method can be distributed with a modest increase in computational complexity [19].

Distributed Setting.
In this paper we want to provide a solution to Problem 1, where a set of  agents solves the above problem in a distributed fashion, that is, by means of local information exchange among the agents instead of resorting to a centralized processing unit.Let  = {, } be a graph involving all the agents and without any loss of generality; suppose  is connected, undirected, and fixed.Moreover, it is assumed that each agent  in the network (1) has an associated observation   ∈ R  ; (2) knows  ∈ [0, 1] which is the same for all agents; (3) has a unique identifier; (4) can exchange directly information only with neighbors over ; (5) can act synchronously.
In the next section we briefly review the traditional data clustering problem and the -means algorithm.

Data Clustering
Let us discuss the following problem.

Problem 2 (standard data clustering problem). Given 𝑘 ≤ 𝑛, the data clustering problem consists in finding 𝑟
Problem ( 3) is hard to solve, and in the literature, several iterative algorithms have been devised.Among the others, the -means algorithm [17] proved its effectiveness.
Specifically, starting with a random set of  centroids  1 (0), . . .,   (0), the algorithm alternates for each step an assignment and a refinement phase.
During the assignment phase, each observation   is assigned to the set characterized by the nearest centroid, that is, Within the refinement phase each centroid   is updated as the centroid of the observations associated with the cluster   (), that is, The two steps are iterated until convergence or up to a maximum of  iterations.Figure 1 reports a simulation run of the algorithm for a set of  = 12 observations in R 2 and for  = 3. Specifically Figure 1(a) shows with circles the initial centroids, Figures 1(b) and 1(c) report the assignment and refinement phases for the first step, while Figure 1(d) depicts the assignment phase for the second step.
The -means algorithm is granted to converge to a local optimum value, while there is no guarantee to converge to the global optimum [17,20].
Since there is a strong dependency on the initial choice of the centroids, a common practice is to execute the algorithm several times and select the best solution.The algorithm, moreover, is extremely sensitive to outliers, which can significantly alter the results; to cope with this issue, the outliers have to be identified and excluded prior to the execution of the algorithm.
Note that, for each step, each of the  observations and for each of the  components of the observations, the algorithm calculates the difference with each of the  centers; hence the computational complexity is (   ), where  are the total number of iterations [20].Notice that in [18] a distributed implementation of the -means algorithm has been provided, with a computational complexity of (   2 ) for each agent.
Note further that, unfortunately, the -means algorithm is not able to solve Problem 1; hence we need to seek for other solutions.
In the following we discuss an alternative method based on the HK opinion dynamics model, which is granted to provide an admissible solution to Problem 1.One of the peculiar characteristics of this algorithm is that the number of clusters  has not to be imposed a priori but becomes an output of the algorithm.The HK opinion dynamics model is reviewed in the next section, while the proposed approach is outlined in Section 6.
International Journal of Distributed Sensor Networks

Hegselmann-Krause Opinion Dynamics Model
In this section we recall the so-called HK opinion dynamics model and revise some of the main theoretical results.Consider a group of  agents, each characterized by a discrete time dynamic equation.The opinions, represented by the state associated with each agent.Specifically, each agent is provided with a scalar initial opinion   (0) ∈ R, and the opinion of each agent varies depending on the opinion of the others.
The key idea of the HK model is that agents with completely different opinions do not influence each other, while some sort of mediation occurs among agents whose opinions are close enough.
Let   () ∈ R be the opinion of th agent at time step  and let () = [ 1 (), . . .,   ()]  be the vector of the opinions of all the agents.The th agent is influenced by opinions that differ from his own less than a given confidence level  ≥ 0.
Hence the neighborhood of an agent for each time step  can be defined as Note that, at each step , N  (  ()) contains the th agent itself.This models the fact that each agent takes into account also its current opinion to form a new one.
The HK dynamic model is in the form where ((), ) is the time-varying (actually statedependent)  ×  adjacency matrix whose entries are in the form where card(N  (  ())) is the cardinality of N  (  ()).Note that  is a stochastic matrix, and all its elements belong to the interval [0, 1/].
Several works can be found in the literature which attempt to characterize the properties of the HK model.Given the complexity of the above model, most of the studies consider simple initial opinion profiles (i.e., the initial condition (0)).Two different classes are considered in the literature [13,21]: (i) the equidistant profile, where   (0) = ( − 1)/( − 1) hence   (0) ∈ [0, 1]; (ii) the random profile, where the opinions are uniformly distributed within [0, 1].
In [13] it is conjectured that for every confidence level  there must be a number of agents  subject to the equidistant profile for which a consensus is obtained (i.e., a single shared opinion for all the agents), while in [21] it is conjectured that, for any initial opinion profile, there exists a finite time after which the topology underlying the matrix ((), ) (i.e., the structure of the mutual influence among agents) remains fixed.Recently this claim proved true, as in [22] it is proved that the convergence time is ( 2 ).In [23] it is proven that, during the evolution of the system, the order of the opinions is preserved, that is, Moreover it is proved that, if the initial opinion profile is sorted, the evolutions of the smallest opinion  1 () and of the largest opinion   () are nondecreasing and nonincreasing, respectively.Clearly, at any step , if |  () −  +1 ()| > , this remains true for any subsequent step, and the system splits into two independent subsystems.In [23][24][25] the stability of the dynamical model is investigated.In particular, the fact that the system converges to a steady opinion profile in finite time is proved in [23].However, the fact that the system might converge to a common opinion or split into clusters is still under investigation.Besides, evaluating a lower bound on the intercluster distance, some interesting conditions for the study of the equilibrium stability are established.Figure 2 shows an example of result of the HK model with  = 100 agents, equidistantly distributed within [0, 1], for different values of the parameter .It is noteworthy that the number of clusters decreases when  grows.Let us discuss the following property that will be used to solve the clustering problem with distance constraints.Property 1.  is a lower bound for the intercluster distance; in fact, when a steady state is reached, any two clusters have a distance which is necessarily greater than or equal to , otherwise they would have merged during the evolution of the model.
The above property justifies the adoption of the HK model to solve the data clustering problem with distance constraints.
Regarding the computational complexity, at each step of the algorithm the distance among the opinion of all agents is calculated.Thus the computational complexity is ( 2 ), where  is the maximum number of iterations.

Consensus Algorithms
In order to provide a distributed implementation of the HK model, let us discuss distributed consensus algorithms with reference to connected, fixed, and undirected graphs.
Suppose each node in a graph  represents an agent with an initial condition   (0) ∈ R; at each iteration  each node  updates its state as where U  is a function of the current state of the node V  and his in-neighborhood.

Max-Consensus.
Assuming the graph is connected and undirected, the problem is known to have a solution in finite time [15] (and specifically in no more than  steps) choosing In the following we will denote by the execution of  max iterations of the max-consensus procedure by the th agent in a network , starting from its own initial condition   (0) and the "unknown" initial conditions of the other agents, while   is the state of the th agent at iteration  max .Such a formalism just represents the execution of the max-consensus or min-consensus by the th agent, and we assume that all other agents are executing the same algorithm in a synchronous manner, each with its own initial condition.

Average-Consensus.
In the average-consensus problem the nodes are required to converge to the average of their initial conditions, that is, where   = (1/)1   and 1  is a vector with  components all equal to 1.
Let each node choose where   = 0 if (V  , V  ) ∉ .The update strategy for the entire system can be represented as where the  ×  matrix  contains the terms   .
According to [26], this choice of U  (⋅) yields an asymptotical solution if and only if (I)  has a simple eigenvalue at 1 and all other eigenvalues have magnitude strictly less than 1; (II) the left and right eigenvectors of  corresponding to eigenvalue 1 are 1  and   , respectively.
The above condition implies that, if the underlying graph is undirected, it needs to be connected.
A possible choice for , assuming that each node knows  (or an upper bound for ), is that each node  chooses independently the terms   as resulting in a matrix  that satisfies the conditions in [26].Several other choices that yield to asymptotic consensus are possible (e.g., see [27]).
As for the complexity, note that at each time step  each agent  calculates the contribution of each neighbor to the next state; hence we have (   max ).Notice that, however, the algorithm in its basic setting has asymptotic convergence, hence typically  max ≫ 1 in order to obtain a good approximation of the asymptotic result.An alternative is to resort to finite-time average-consensus algorithms like the one in [28], but we choose to omit the discussion for the sake of clarity.
In the following we will denote by the execution of  max iterations of the average-consensus procedure by the th agent in a network , starting from its own initial condition   (0) and the "unknown" initial conditions of the other agents, while   is the state of the th agent at iteration  max .Again, such a formalism just represents the execution of the max-consensus or min-consensus by the th agent, and we assume that all other agents are executing the same algorithm in a synchronous manner, each with its own initial condition.

Network Size Calculation.
Combining the max-consensus and the average-consensus algorithms, it is possible to calculate the number of agents  in the network in a distributed way [29].Specifically, suppose a leader is elected via max-consensus over  (e.g., the nodes, each, have a unique identifier and the node with maximum identifier is elected as leader via maxconsensus).Now, let the nodes execute an average-consensus algorithm with   (0) = 1 if node V  is the leader and   (0) = 0 otherwise: the average-consensus yields lim hence  can be calculated in a distributed way.

Data Clustering with Distance Constraints via Opinion Dynamics and 𝑘-Means
In this section we propose an algorithm for data clustering with measurement distance constraints, based on a generalization of the HK model.Specifically, measurement data is processed by an HKlike opinion dynamics "filter, " which eventually segments the data into  clusters.Moreover, based on the weight of each cluster (namely, represented by the amount of measurement data that has converged to that cluster), data outliers can be filtered out from the original set.More precisely, we assume that each agent  is provided with an initial measurement represented by a vector   ∈ R  .Every agent has an initial state   (0) ∈ R  , which is updated according to the following set of iterative rules: for  = 1, . . ., , where the adjacency matrix ((), ) is computed based on the following definition of neighborhood: where ‖ ⋅ ‖ is the Euclidean norm.Note that for  = 1 the standard HK model is obtained.
In [22] the HK model with vectorial opinions (i.e.,  ≥ 2) is shown to converge in polynomial time.
In order to give an idea of the actual time required for convergence,, we provide the simulation results of Figure 3, where the average instant in which a steady state is reached and the number of clusters obtained are reported in the case  = 2 for several choices of  = 50, 100, 200 agents and  ∈ [0.1, 0.5]; for each choice of , , the average of 100 runs with random initial opinions in [0, 1] is reported.Notice that all the executions reached an exact agreement in finite time.
The proposed approach, as discussed before, does not require the user to specify a value for the parameter , but it finds a suitable number of clusters based on the parameter .
A high value of  means very large and sparse clusters (eventually also very few of them) while a small value of  means very compact and small clusters (eventually, many of them).
Note that, as said before, one of the biggest problems of the -means-like algorithms is that the outliers have to be preprocessed and excluded; otherwise they would influence considerably the quality of the clustering.In the proposed approach, depending on the choice of , very far observation is not influenced by the others and is assigned to a singleton (or more in general to a cluster composed of very few elements).
Notice that it is always possible to execute a -means algorithm with  equal to the number of clusters obtained via HK, in order to attempt to refine the solution found, but this can be done only if the solution of the -means algorithm does not violate the constraints on the distance among cluster centroids.
The proposed algorithm, appears as a good candidate to allow the clustering of a set of sensors or mobile robots, based on perceived information such as position or other sensorial information (temperature, humidity, etc.).
As for the computational complexity of the extension of the HK model to opinions in R  , it can be noted that such complexity is the same as executing  scalar HK models; hence it is (  2 ); since the complexity of the centralized -means algorithm is (   ) [17], the proposed approach determines an increase in computational complexity with respect to the -means algorithm of a factor / ≥ 1.

Distributed HK Opinion Dynamics
As shown in the previous section, the HK opinion dynamics model can be used to provide an admissible, although suboptimal, solution to the distance-constrained data clustering problem.However, since the topology underlying the HK model is indeed a state-dependent topology, theoretically International Journal of Distributed Sensor Networks each agent may exchange information with another agent, depending just on the difference in their opinions.
In order to adopt the HK model in a distributed perspective, we need to provide a different implementation, as provided in Algorithm 1.
Since the agents have a unique identifier ℎ = 1, . . ., , for each time step and for each agent ℎ a distributed procedure is executed by all agents in order to calculate  ℎ ( + 1).Specifically, for a specific agent ℎ, each agent  selects    =  ℎ () if  =  and    = 0 otherwise.Then the agents execute a max-consensus procedure using    as initial condition; as a result of such an operation, each agent  knows  ℎ () and is able to determine wether ‖ ℎ () −   ()‖ ≤  or not.Such knowledge is stored in a variable   ℎ for each agent, while a variable   ℎ is equal to one if ‖ ℎ () −   ()‖ ≤  and zero otherwise.
Using average-consensus, multiplied by , in order to obtain the value   ℎ ( + 1) is obtained as for  = 1, .As for the computational complexity of the distributed version, note that, for each step  = 1, . . .,  and for each agent ℎ = 1, . . ., , the agents execute a max-consensus  (( ) steps) and two average-consensus algorithms ((  max ) steps), both with initial conditions in R  , and the complexity is (   max{ max , }) where  max is the number of iterations of the average-consensus algorithm.
Since, typically,  max > , the distributed setting has  max / times the complexity of the centralized algorithm.Moreover, since the computational complexity of the distributed -means algorithm is (   ) the proposed distributed International Journal of Distributed Sensor Networks algorithm has  max /( ) times the complexity of the distributed -means algorithm.

Numeric Examples
As discussed above, the -means algorithm is generally unable to solve the data clustering problem with distance constraints.In this section, some examples are reported in order to show the effectiveness of the proposed approach.A comparative simulation between the HK model and -means algorithm is first addressed.Afterwards the potentiality of the proposed mixed approach is showed; then the distributed implementation is discussed.Figure 4 shows an example in R 2 with  = 0.6 and  = 200 observations.The application of the HK opinion dynamics model yields  = 63 clusters and  ≈ 0.35.Unfortunately, the -means algorithm finds a solution for  = 63 which, although having  ≈ 0.29, is not feasible for Problem 1 (violations of the constraints are shown with red lines).
Figure 5 shows a case where  = 200,  = 0.18 and the HK opinion dynamics model gives  = 5 clusters.Using the -means algorithm for  = 5 a better solution is obtained, and the constraints are not violated; hence in this case postprocessing the result of the HK model via -means algorithm yields a better result.
Figure 6 shows the ability of the proposed methodology to isolate the outliers.For  = 200 and  = 0.1 the HK opinion dynamics model finds  = 7 clusters, of which 2 are singletons each containing an outlier.Executing a -means algorithm for  = 7 gives worse results in terms of the objective function with respect to the HK approach.If, conversely, the two outliers are removed ( becomes equal to 5), then the means algorithm has better results in terms of the objective function.
Figure 7, eventually, shows an example of application of the distributed HK model provided in Algorithm 1, in a case where  = 40 agents, each with a random position in [0, 1] 2 , having to be clustered depending on their positions in a way that the centroids are not closer than  = 0.1.The simulation was executed for  = 15 iterations, and the average-consensus algorithms were executed each  max = 100 steps.The topology of the network of agents is given in the upper left plot, while the middle plots show the results of the distributed HK model for the  and  coordinates.The consensus steps performed by each agent during one iteration of the distribute HK algorithm are reported in the upper central plot, where "AVG" stands for average-consensus and "MAX" stands for max-consensus, while the distribution of max-consensus and average-consensus steps over the entire execution of the algorithm is reported in the upper rightmost plot.The lower plots, eventually, show the results of the distributed HK model in terms of the clustering in [0, 1] 2 : the agents are divided in  = 20 groups, and the objective function has a value  ≈ 0.06.Notice that, in this case, the -means algorithm with  = 20 yields a worst solution both in terms of the objective function  ≈ 0.12 and in terms of violation of the constraints (5 constraints are violated and are highlighted with red thick segments).

Conclusions and Future Work
In this paper a distributed algorithm for a sensors network to solve a data clustering problem is provided, with the constraint that the centroids of the clusters must be within .
The proposed approach is based on the HK opinion dynamics model, which finds admissible, although suboptimal, solutions without requiring a user-specified number of desired clusters and applies the -means algorithm to find a better solution.
In its original application, the HK opinion dynamics model is a centralized algorithm.In this paper, a distributed implementation is provided instead, based on a combination of consensus algorithms.
Future work will focus on providing a bound for convergence time in high-dimensional spaces and testing the algorithm in a real world scenario, including noise and packet loss.

Figure 1 :
Figure 1: Example of execution of -means algorithm (source: Wikimedia Commons available under GNU Free Documentation License v. 1.2).

5 Figure 2 :
Figure 2: Simulation of opinion dynamics for  = 100 agents and for different values of .

Figure 3 :
Figure 3: Average instant in which a steady state is reached and the number of clusters obtained is reported for several choices of  = 50, 100, 200 agents and  ∈ [0.1, 0.5]; for each choice of , , the average of 100 runs with random initial opinions in [0, 1] is reported.

Figure 4 :Figure 5 :Figure 6 :
Figure 4: Clustering for  = 200 observations that are uniformly distributed in the interval [0, 1] and  = 0.06: the HK opinion dynamics model finds  = 63 clusters and  ≈ 0.35.The solution of the -means algorithm for  = 63 is better in terms of the objective function ( ≈ 0.29), but it does not respect the distance constraints (red thick lines represent violations).

Figure 7 :
Figure 7: Distributed clustering on the positions of  = 40 agents with  = 0.1: the distributed HK opinion dynamics model finds  = 21 clusters.The distributed implementation of the algorithm requires alternation between max-consensus algorithms and average-consensus algorithms, as shown by the upper rightmost figure.The solution of the -means algorithm for  = 21 is worse in terms of the objective function  and does not respect the distance constraints (red thick lines in the lower rightmost figure represent violations).