{'fraction_non_alphanumeric': 0.03533120977702659, 'fraction_numerical': 0.009263472664629785, 'mean_word_length': 4.763769201948295, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Steering opinion dynamics via containment control

In this paper, we model the problem of influencing the opinions of groups of individuals as a containment control problem, as in many practical scenarios, the control goal is not full consensus among all the individual opinions, but rather their containment in a certain range, determined by a set of leaders. As in classical bounded confidence models, we consider individuals affected by the confirmation bias, thus tending to influence and to be influenced only if their opinions are sufficiently close. However, here we assume that the confidence level, modeled as a proximity threshold, is not constant and uniform across the individuals, as it depends on their opinions. Specifically, in an extremist society, the most radical agents (i.e., those with the most extreme opinions) have a higher appeal and are capable of influencing nodes with very diverse opinions. The opposite happens in a moderate society, where the more connected (i.e., influential) nodes are those with an average opinion. In three artificial societies, characterized by different levels of extremism, we test through extensive simulations the effectiveness of three alternative containment strategies, where leaders have to select the set of followers they try to directly influence. We found that, when the network size is small, a stochastic time-varying pinning strategy that does not rely on information on the network topology proves to be more effective than static strategies where this information is leveraged, while the opposite happens for large networks where the relevance of the topological information is prevalent.

a similar goal, some politicians aim to manipulate public opinion to gain and reinforce their power [8] or seek for an optimal opinion control strategy in the campaign problem [18].
Research on opinion dynamics also benefitted from the contribution of physicists, mathematicians, and engineers [9] interested in the study of complex systems. Starting from [10], where the first model of opinion dynamics in a probabilistic framework was presented, opinion dynamics models were designed by using an analogy with the Ising model in statistical mechanics [11][12][13].
An alternative approach is offered by sociodynamics [14,15], which aims at building mathematical models of a variety of different phenomena within the framework of social sciences [19,20]. Here, the opinion is modeled as a (possibly vectorial) state variable and the goal is to understand the nonlinear dynamics leading the system's state to consensus or to fragmentation on an issue [9]. In this perspective, a possible framework stems from the consensus problem formulated and solved in the pioneering work of DeGroot [16] and Friedkin [21], which stimulated a bulk of both theoretical and application-oriented research [22][23][24][25][26][27]. Moreover, inspired by the collective behavior of animal groups [28], as fish schools or birds flocking, leader-follower consensus protocols were developed and analyzed [22,29,30]. This setting, which is strictly related to pinning control in complex networks [31][32][33][34][35][36], well suits opinion dynamics [37,38], where the aim is to investigate whether the state of the system (the collective opinion) reaches consensus at the leaders' states. However, in the presence of multiple leaders with contrasting opinions, typically their common final goal is not anymore opinion consensus on a specific value (e.g., the opinion of a given leader), but rather the containment of the followers' opinion in a given range (e.g., they belong to the same coalition and want to win a referendum or an election) [39,40].
Starting from the above considerations, and combining the dynamical systems approach with complex networks theory [41][42][43], we explore the relationship between opinion dynamics and containment control [39,44,45]. In control systems theory, the latter refers to a consensus-like problem in which multiple leaders, interacting with the other agents (the followers) through an influencing network, aim to drive and maintain the followers in the convex hull spanned by their states (their opinions) [45,46]. The convex hull then becomes the mathematical representation of the opinion range, in which we want to contain the opinions of the followers. In addition, inspired by the bounded confidence models [47][48][49], in which an agent does not interact with agents whose opinion is too far from his, we propose an alternative model of opinion dynamics in terms of containment control, where multiple leaders populate the network and the communication is subject to a proximity rule: at each instant, node i will influence node j only if the distance between their opinion is below a state-dependent threshold. Departing from classical bounded confidence models, we consider alternative proximity thresholds, aiming at mimicking different kinds of societies permeated by different levels of extremism. Indeed, the observation of the potential consequences of the spreading of zealotry (e.g., the diffusion of terrorism) [50][51][52] spurred us to investigate how societies with different levels of extremism could react to the presence of multiple leaders.
In particular, in an extremist society, the most radical agents (i.e., those with the most extreme opinions) have a higher appeal and are capable of influencing nodes with very diverse opinion. The opposite happens in a moderate society, where the more connected (i.e., influential) nodes are those with an average opinion. Finally, we call neutral a society which is neither extremist nor moderate. Therefore, to evaluate how the leaders can control each of these artificial societies, we present and numerically compare different kinds of containment strategies, that is, different ways in which the leaders try to influence the opinion of the followers. In particular, some of them leverage information on the network topology (as for instance in [53]), while others benefit from the possibility of changing the set of followers the leaders try to influence.
We find that static control strategies only marginally benefit from the knowledge of the topological properties of the network. On the other hand, we observe a relevant increase of the performance in terms of the fraction of contained followers when the leaders are allowed to rewire the network of potential connection with the followers. In other words, if a leader can change at every time instant the followers they seek to directly influence, they become able to drag more opinions in the range of interest defined by the convex hull of the their opinion.
The remainder of our work is organized as follows: first, we model the problem of steering the opinion in a group of individuals as a containment control problem, and then we introduce the alternative containment strategies to control three artificial societies with their respective proximity rules. Afterwards, we describe the numerical setup and illustrate the results. Finally, we draw the conclusions and identify future directions.

Containment control and opinion dynamics
Here, our aim is to describe opinion dynamics in the framework of agent-based modeling. More specifically, we consider the case in which selected members of the society, that we will call leaders, try to steer the opinions of the other individuals, called followers. To this aim, we associate each individual to a node of a time-varying graph G(k) = {V, E(k)}, where V is the set of nodes (the individuals) and E(k) is the edge set, representing the influence relationships at time k. The set of nodes V is partitioned in two non-empty sets L and F that are the sets of leaders and of followers, respectively. We constrain G(k) to be a subgraph of P = {V, E ω }, which describes the potential interaction among nodes, with typically E ω ⊂ V × V, as the influence process is selective [54][55][56].
The state of a node, say i, represents the opinion of the i-th individual on a given matter of interest at time k, and is quantified by a scalar where O is the set of possible opinions. The state evolution of node i is given by being the in-neighbors set of i, with a ji (k) being the jith element of the time-varying binary adjacency matrix A(k) associated to the interaction graph G(k).
In what follows, we assume that the adjacency matrix A(k) coevolves with the node dynamics (see Fig. 1) according to a proximity rule: where ǫ(x i (k)) is a (possibly) state-dependent threshold. Differently from classical bounded confidence models [47][48][49], with which models (1), (2) share the concept of confidence level, we have that 1. the interaction among the agents is selective [54]: two agents, say i and j, may interact only if (i, j) ∈ E ω ; 2. there are opinion leaders, who try to influence the opinion of the others but never adjust theirs and 3. aim at containing the opinion of their neighbors in the convex hull of their opinions, without requiring the convergence towards a given consensus value.
In particular, point (3) implies that we study the problem of steering the opinions of a group of individuals as a containment control problem rather than a leader-follower consensus problem. Indeed, while the diffusive protocol well describes the process of opinion spreading in a group, it is sometimes unrealistic to assume full cooperation among the leaders with the aim of steering the group opinion towards the same asymptotic values. Indeed, in presence of polarization, antagonism, speculative behaviors, and cognitive biases, ideal cooperation is unrealistic [57], and therefore we allow for the existence of multiple leaders with contrasting opinions.
(2) a ji (k) = 1 if (j, i) ∈ E ω and | x j (k) − x i (k) |≤ ǫ(x i (k)), 0 otherwise, Fig. 1 Schematic of the coevolving network describing the interplay among the opinion dynamics, the proximity threshold, ǫ(x(k)), and the interaction graph, G(k) To clarify how point (3), together with points (1) and (2), impacts on the time-varying network topology, we notice that the binary adjacency matrix Ā (k) associated to the potential graph P = {V, E ω } can be decomposed in the following blocks: where A L→F ∈ R l×f describes the possible connection (i.e., direct influence) of the leaders on the followers, while A F ↔F ∈ R f ×f describes the possible mutual connections among the followers, with l = |L| and f = |F |.
In what follows, we assume A F ↔F to be given and constant, while we will focus on the selection of A L→F (k). In other words, in this paper we want to compare alternative selections for A L→F (k), given a constraint on (i.e., on the maximum out-degree of each leader), in terms of their ability in steering the opinions of the followers in the convex hull spanned by the leaders. Also, we define the set of pinned followers at time k as To formally state the problem, we first need to give some definitions.

Definition 1
The convex hull Co(S) of a finite set of points S = {x 1 , . . . , x m } ⊂ R is the minimal convex set containing all points z ∈ S, that is,

Definition 2
The opinion of the ith follower is asymptotically contained to those of the leaders if Assuming that the maximum out-degree of each leader is constrained, that is, d max out (k) =d < f , and that the number l of leaders is given, we compare alternative pinning strategies to test whether they can significantly improve the fraction of contained followers, φ = q f , if compared with the trivial strategy of randomly picking a constant set F r P of pinned nodes, that is, F P (k) = F r P for all k. This comparison will be made under different assumptions on the society, that is, under different assumptions on the possibly state-dependent threshold ǫ introduced in Eq. (2).

Alternative containment strategies
Here, we present two static containment strategies, in which the pinned followers are selected at the onset of the simulation, and a time-varying containment strategy, where the set of pinned nodes is updated at every time instant.
St.1. Pinning the hubs The set of pinned nodes is static and is composed by the set F h P of the d max out l nodes with highest degree (the hubs), that is, Pinning the leaves The set of pinned nodes is static and is composed by the set F ℓ P of the d max out l nodes with the lowest degree (the leaves), that is, F P (k) = F ℓ P for all k. St.3. Time-varying random pinning Inspired by [32], under this time-varying containment strategy each leader, at every time instant, randomly pins a set F r P (k) of d max out l followers, that is, F P (k) = F r P (k) for all k. 1 As anticipated above, the effectiveness of these containment strategies will be tested against the static random strategy St.0. Static random pinning The set of pinned nodes is static and is composed by the set F r P of the d max out l randomly selected nodes, that is, Also, as a further reference, we will consider the case in which the leaders do not try to influence any follower, that is, A L→F = 0 l×f . We emphasize that all the containment strategies only determine the set of nodes that are potentially influenced by the opinion of the leaders, while the influence will be actually exerted only if the proximity condition is fulfilled, and this also depends on the selected society model, in agreement with Eq. (2). In other words, we assume that the leader can only decide which agents he tries to influence, but there is no guarantee he will be actually capable of influencing them.

Alternative society models
The containment strategies presented above will be tested in three agent-based society models differing for the choice of the proximity threshold ǫ(x i (k)). These artificial societies are populated by agents affected by the confirmation bias [58], an ubiquitous psychological phenomenon that makes the agents reluctant to be influenced by individuals whose opinions are too different. Indeed, they are anchored to their beliefs and opinions and avoid the contrasts and the comparison with the diversity. However, the three scenarios are characterized by different levels of extremism, which translates into a different appeal of moderate (extremist) agents, which are agents with opinions closer to (further from) the average. Before proceeding with the description of the alternative scenarios, it is worth noticing that Eq. (1) can be rewritten as where x(k) = [x 1 (k), . . . , x l+f (k)] T , and Ã (k) is row-stochastic. Therefore, as the initial opinions are bounded in the set [x min , x max ], we know that the opinions of each agent will remain in that set for all k [59]. Therefore, we define the center x = (x max + x min )/2 of this interval as the average among all the possible opinions at time 0.

Moderate society
In a moderate society, we assume that opinions closer to x are accounted by a larger fraction of agents if compared with more extremist opinions (i.e., closer to x min or x max ). This mechanism mimics the opinion dynamics that often characterizes the society in western democracies [60,61]. To model this behavior, in a moderate society we set the proximity threshold that quantifies the ability of an agent to influence others, as where ρ > 0 is a parameter determining the average radius of interaction. Notice that

Extremist society
Historical examples [62], together with the empirical evidence [63,64] that extreme positions are sometimes the most effective in leading the opinions in a desired range, motivated us to also model an extremist society in which the proximity threshold is This scenario is diametrically opposed to the previous one. Indeed, the maximum value ρ(x max − x min )/2 of ǫ corresponds to extremist opinions (either x i (k) equal to x max or x min ), while a null amplitude of ǫ corresponds to x i (k) =x.

Neutral society
In an intermediate society, which we denote neutral and is closer to the classical bounded confidence model, the proximity threshold is independent from the agents opinion, and given by Remark 1 We point out that our definition of extremism differs from that given in [65][66][67], where it is considered as an attribute of the opinion, and therefore of the single agent. Differently, in our work the extremism is an attribute of the society, which can be measured by quantifying the appeal of extremist opinions.
Remark 2 The selection of the proximity threshold in the three scenarios is such that if the initial conditions are taken from a uniform distribution between x min and x max , the expected value for ǫ(x i (0)) is the same and equal to

Numerical analysis
Here, we design a set of numerical simulations to test the effectiveness of the alternative containment strategies in the three agent-based society models introduced above. We start by noticing that containment can be more or less easy to attain depending on the absolute and relative location of the leaders. Indeed, (i) the more packed their opinions are (the smaller their convex hull is), the more difficult the control goal will be, and (ii) depending on the considered scenario, also their distance from the average opinion may impact their capability of influencing (and then, of containing). Therefore, denoting by w(·) the width of an interval, we introduce the leaders' disagreement which is the higher the more the opinions of the leaders are spread, and the leaders' polarization which measures the average difference between the leaders' opinions and x.
To test the effectiveness of the proposed containment strategies, we performed extensive numerical simulations for a selected combination of δ ℓ and p ℓ .
Numerical setup We consider a group populated by f followers with initial opinions x i (0) = x i0 uniformly distributed in the interval [x min = 0, x max = 1] and l = 0.02f leaders. The latter are equally split in two groups with contrasting opinions, such that δ ℓ 0.5 and p ℓ 0.25. Moreover, the adjacency matrix A F ↔F corresponds to an undirected scale-free-like graph and, for each scenario, we set ρ = 1. We consider 861 combinations for the values of δ ℓ and p ℓ . Namely, we vary δ ℓ between 0 and 0.5 and p ℓ between 0 and 0.25, with step 0.0125, and then make the Cartesian product. Furthermore, to understand if and how the effectiveness of the containment strategies is affected by the network size, we first discuss their effectiveness when f = 100 and then discuss what happens when the network size increases.

f = 100
Here, for each parameter combination, scenario, and containment strategy, we perform a set of 100 simulations differing for the randomly generated initial conditions of the followers, and evaluate the average fraction φ (δ ℓ , p ℓ ) of contained followers.

Reference scenario: Strategy 0
Strategy 0 represents the simplest possible pinning strategy, as it is static and completely random. Indeed, it can be implemented when there is no information on the potential interconnections among the followers (i.e., on A F ↔F ) and when the potential influences from the leaders to the followers cannot be updated (i.e., A L→F (k) = A L→F ). Therefore, we consider the performance of this strategy as a reference for the more sophisticated Strategies 1-3.
From the numerical analysis, we observe that, even though the expected width of the proximity threshold is the same for all scenarios (see Remark 2), there is a palpable difference in the fraction of followers contained that decreases together with the level of extremism in the society. From Fig. 2b, it is evident that in a society populated by moderate agents, independently of the parameters δ ℓ and p ℓ , in average almost all the followers are contained (φ(δ ℓ , p ℓ ) ≃ 0.98). Moreover, the full opinion containment (q = |F | ) is achieved in the 58% of the cases, see Table 1. Indeed, in more extremist societies, opinions tend to be clustered on the extremes, with the network graph G(k) often split in at least two disconnected groups, while in moderate societies opinions are easier to be contained in a given set of interest, with G(k) often preserving weak connectivity as k increases.
In scenarios other than the moderate one, the impact of the parameter δ ℓ is evident, see Fig. 2b, c. As expected, both in the neutral and in the extremist scenario, we observe that the higher is the disagreement (and therefore the width of the convex hull where we aim at containing the followers), the higher is the fraction of contained followers. This is a consequence of the fact that the control goal becomes less and less challenging as δ ℓ increases. This is clearly illustrated by Fig. 3a,

Strategies 1 and 2: static pinning
Here, we assume that the leaders have information on the potential relations among the followers. Specifically, we assume that the leaders are aware of potential degree of each followers, that is, they know the row-sums of A F ↔F . In our numerical analysis, we tested two opposite strategies. Namely, Strategy 1 consists into pinning the followers that have the largest number of potential connections, while Strategy 2 proposes the opposite. While the rationale of the first strategy is apparent, that behind Strategy 2 is more subtle. Indeed, Strategy 2 proposes to pin the leaves as they are the easiest to be influenced: they will only perceive the influence of a small fraction of individuals other than the leaders. However, the numerical analysis shows that the impact of these targeted pinning strategies is mostly negligible, see Fig. 4. For Strategy 1, we observe a noticeable effect only in the extremist scenario when δ ℓ is high and p ℓ is low. This could be explained as a high value of δ ℓ makes the containment task relatively easier, and therefore even a small contribution from the leaders might be relevant. Moreover, the combination of a high value of δ ℓ and of a low value of the polarization p ℓ makes the proximity threshold of one of the two leaders negligible, almost nullifying its contribution to the achievement of containment. In this configuration, the possibility for the more extremist leader of pinning a b c Fig. 3 Difference between the average fraction of the f = 100 followers contained under Strategy 0 and the case A L→F = 0 l×f (i.e., the leaders cannot influence the followers). a Moderate scenario, b extremist scenario, c neutral scenario the hubs noticeably enhances the fraction of contained followers: its influence, although mitigated by the strong connectivity of the hubs with their peers, succeeds in steering additional followers in the convex hull spanned by the leaders, see Fig. 4b. On the other hand, analyzing the effectiveness of Strategy 2, we observe no noteworthy difference with Strategy 0, see Fig. 5. This is strictly related to the scale-free like topology of the graph (associated to A F ↔F ) describing the potential connections among the followers. Indeed, as the 70% of the nodes are only connected to one node (i.e., they are leaves), randomly selecting the pinned nodes (Strategy 0) is expected to be equivalent to pinning the leaves in the 70% of the simulations.

Strategy 3: Time-varying pinning
As observed above, the two static strategies are not capable of significantly affecting the fraction of contained followers, with the exception of Strategy 1 for specific values of the parameters in the extremist society. Therefore, we looked for alternative strategies capable of substantially improve the performance. We postulated that changing with time the set of leaders at every iteration could relevantly increase the number of followers directly affected by the leaders, thus enhancing the performance of the containment strategy. To test this hypothesis, we devised what we called Strategy 3, which prescribes to randomly select the pinned nodes at each iteration (independently from the selection at previous iterations). Notice that this simple strategy does not require any knowledge on the degree distribution of the network, differently from Strategies 1 and 2. Nonetheless, we observe a strong enhancement of the performance, see Figs. 6, 7 and Table 1 increases for any combination of the parameters. The improvement is particularly relevant in the neutral and extremist scenarios, which are more reluctant to containment. In particular, we observe that, even in the extremist case, for favorable combination of the parameters, full containment can be achieved (ψ > 0 in all scenarios, see Table 1). Moreover, even when full containment is not achieved, the fraction of contained followers significantly increases. For instance, in the extremist scenario, additional 20 and 23% of the total number of followers are contained if compared to Strategies 1 and 2, respectively, see again Table 1

Increasing the network size
Here, we investigate how the network size affects the performance of the proposed pinning strategies. Indeed, when the network is small, the effectiveness of the static strategies may be limited by the fact that the difference between the lowest and highest node degrees is reduced because of the network size. This observation is confirmed by looking at Table 1 that shows how the performance of Strategies 1 and 2 is comparable with that of the simplest and random Strategy 0. The situation instead changes when the number of nodes increases. As an example, we report in Table 2   For each scenario and containment strategy, we report the average fraction of contained followers (¯ ), the average fraction of the simulations in which full containment is achieved (¯ ), and the expected average degree of the pinned followers (< d > P ) a Here, the leaders are disconnected from the followers, and therefore there are no pinned nodes parameter combination, the results are averaged over 30 repetitions. We emphasize that the results are qualitatively unchanged when further increasing the network size. As it can be observed from Fig. 8  parameters δ ℓ and p ℓ are unchanged. However, the effect of the network size is indeed noticeable when comparing static versus time-varying pinning strategies. Indeed, we observed that the advantage of adopting a time-varying strategy is lost. As for lower number of nodes, the moderate scenario results to be the least challenging for the containment strategies: even the simplest Strategy 0 proves effective in containing almost all the agents, see Fig. 8. However, when the number of nodes is increased, we observe that in the extremist scenario the static strategies become significantly more efficient than Strategy 0 and, maybe more surprisingly, also of the time-varying Strategy 3. The clear differentiation from Strategy 0 is due to the fact that now the topological information leveraged by Strategies 1 and 2 indeed matters: as the network size increases, the degree distribution starts to approach to a power law, and the degree of the hubs and of the leaves starts to become significantly different. At the same time, we observe the degradation of the performance of the time-varying strategy with the increase of the network size. Indeed, continuously switching the set of nodes a leader tries to influence is rewarding only for small networks such that the blinking control signal can quickly propagate through the network. Differently, in large networks this blinking containment strategy loses its efficacy: the advantage of randomly sending inputs to all the network nodes is indeed canceled out by the slow propagation of these signals across the network.

Conclusions
In this paper, we have formulated the problem of steering the opinion of a group of individuals as a containment control problem. Differently from the consensus setting, we relax the aim of perfect opinions' convergence, and study the problem of containing them in the convex hull of the opinions of a set of leaders. The containment of opinion rather than their consensus is considered to model several real scenarios, such as a referendum, where those who vote yes (or equivalently no) do not share the exact same opinion, but their opinion is contained in a range leading to the same final decision of voting yes (no) [40]. Departing from the classical bounded confidence models, we have considered the case in which the possibility of an individual (be him a leader or a follower) of influencing the others depends on his state, that is, on his opinion. In particular, depending on the extent of the extremism permeating the society, individuals with more extreme opinions are more or less effective in promoting their views. Therefore, we have presented three alternative society models, a moderate, a neutral, and an extremist one. Assuming the presence of two leaders in the group, we numerically explored alternative selections of the pinned nodes, that is, of the nodes the leaders try to directly influence. In all the three society models, we numerically tested the effectiveness of three alternative containment strategies, for different values of the leaders' disagreement and polarization with respect to the average opinion. Specifically, two containment strategies are static, and prescribe to pin the most (the hubs) and the least (the leaves) connected followers, respectively. The third, instead, is time-varying and assumes to randomly select the pinned nodes at every time instant. Numerical evidence strongly supports the effectiveness of this time-varying strategy over the static ones when the network size is small (N ≈ 100), even in the extremist society where containment is harder to achieve. This excellent performance is obtained without relying on any information on the degree distribution of the network describing the potential communications among the followers: this comes at the price of requiring the ability of changing at every time instant the set of followers the leaders try to control. However, as the number of nodes increases, the relevance of the topological information becomes bigger and bigger, and therefore the informed static strategies start to outperform the non-informed time-varying strategies. Future works will (i) investigate alternative stochastic strategies to enhance the performance when local or global information on the topology of the followers is available and the number of network nodes increases; (ii) test the strategies in mixed societies, characterized by clusters of agents with different levels of extremism; (iii) reconstruct the influence path flow to quantify the extent of the direct (due to the links among leaders and followers) and indirect (due to the paths among leaders and followers) influence power of the leaders employing information theory concepts [68][69][70]; and (iv) validate the model through appropriate experiments designed leveraging the potential of the socalled Citizen Science [71].