{'fraction_non_alphanumeric': 0.034541069497962464, 'fraction_numerical': 0.019044714883708038, 'mean_word_length': 4.816510802966785, 'pattern_counts': {'":': 0, '<': 0, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
The role of homophily in opinion formation among mobile agents

Understanding the evolution and spread of opinions within social groups gives important insight into areas such as public elections and marketing. We are specifically interested in how psychological theories of interpersonal influence may affect how individuals change their opinion through interactions with their peers, and apply Agent-Based Modelling to explore the factors that may affect the emergence of consensus. We investigate the coevolution of opinion and location by extending the Deffuant– Weisbuch bounded confidence opinion model to include mobility inspired by the psychological theories of homophily and dissonance, where agents are attracted or repelled by their neighbours based on the agreement of their opinions. Based on wide experimentation, we characterize the time it takes to converge to a steady state and the local diversity of opinions that results, finding that homophily leads to drastic differences in the nature of consensus. We further extend our mobility model and add noise in order to check the model’s robustness, finding that a number of opinion clusters survive even with high levels of noise. ARTICLE HISTORY Received 1 April 2020 Accepted 19 May 2020


Introduction
Human behaviour, and particularly the interactions we have with our peers, has a profound effect on the nature of consensus that emerges within social groups. Due to the rise of on-line social networks, it is increasingly easy to widely share opinion on a given subject and thereby influence peers. Understanding how the individual interactions between agents lead to the formation of shared opinions is vitally important, particularly in light of the potential for malicious influence around political decisions. In this paper, we investigate the role of mobility in changing interactions groups and guiding the dynamics of opinion formation in such systems.
A wide range of models for opinion dynamics have been considered, which can be broadly categorized into discrete and continuous representations. Notable discrete approaches include voter models (Galam, 2000) or those inspired by physics such as the Ising model (Sznajd-Weron & Sznajd, 2000). More complex models are less commonly studied, but include those that attempt to capture the interaction of opinions across multiple topics represented as continuous (Deffuant et al., 2000) or discrete vectors (Axelrod, 1997). A thorough review of the breadth of approaches can be found across several surveys (Abid et al., 2018;Castellano et al., 2009;Lorenz, 2007;Xia et al., 2011;Xie et al., 2016).
In our work, we apply one of the most widely studied models, where agents hold a single opinion represented by a real value in [0, 1] and interact with their peers, adjusting their opinion whenever the difference between their respective opinions is within a specified threshold. Restricting our attention to a single opinion allows us to clearly demonstrate the impact of homophilous mobility across a wide breadth of simulation results and compare to the large and broad literature of similar models.
Despite the wide range of different approaches in the literature, very few take into account the fundamental principle of human mobility, which forms the basis of investigation in this paper. Mobility is commonly implemented through models in which the agents move constantly at random, such as Galam et al. (1998); Sousa et al. (2008); Zhang et al. (2018). In contrast, Schweitzer and Hołyst (2000) present a model of discrete opinions based on Brownian motion, while Pfau et al. (2013), Gracia-Lázaro et al. (2009) consider a lattice model in which movement is triggered by disagreement. Disagreement is also used to trigger changes in structure by Gargiulo and Huet (2010), however, this is based on social group membership without including location.
As highlighted by Castellano et al. (2009), it is important that the mathematical rules used to model social mechanisms and simulate opinion dynamics are referenced to psychological and/or sociological studies. In this paper, we address this by drawing on the well-studied psychological theories of homophily (McPherson et al., 2001) and dissonance (Festinger, 1957) to motivate our rules.
The aim of this paper is to investigate the effect of homophily and dissonance on the speed and structure of opinion convergence among agents that are free to move within a two-dimensional region. Comparisons are made with a random mobility model, evaluated over a range of parameters, highlighting clear differences in behaviour.
The paper introduces an extension to a widely studied framework of opinion modelling, which adds agent mobility inspired by psychological and sociological studies. As described in Alraddadi et al. (2019), we evaluate and discuss the impact of different types of mobility on the nature of consensus that emerges. In addition, in this paper we have extended the model by incorporating noise in order to investigate robustness under uncertainty.

Related work
The Deffuant-Weisbuch BC model (denoted DW) of opinion dynamics (Deffuant et al., 2000) builds upon the previous work of Axelrod (1997) (which was framed in terms of the evolution of culture rather than opinion). Axelrod described the culture (opinion) space as a vector of discrete multiple features and studied the interactions that were most effected between similar people. The DW model was inspired by this notion of homophilic attraction, however, represented opinions as a value in the continuous interval [0,1]. DW is one of the most well-studied models, since it represents a number of common scenarios, such as where the political spectrum of an individual is not restricted to an extreme right or left wing but also positions in between (Castellano et al., 2009;Deffuant et al., 2000;Lorenz, 2007) with one and zero representing the two extremes (Martins, 2008). The Hegselmann-Krause model (Hegselmann & Krause, 2002) was developed based on the DW model, by extending influence to groups rather than pairwise interactions, and has also led to a wide body of related research.
We now briefly highlight the key features of opinion models within a general framework (see Figure 1 a). More detail can be found in a number of comprehensive survey papers (Abid et al., 2018;Castellano et al., 2009;Lorenz, 2007;Xia et al., 2011;Xie et al., 2016).
Many opinion models do take locality into consideration (e.g. Axelrod, 1997;Chen et al., 2017;Grabowski, 2009;Sznajd-Weron & Sznajd, 2000). However, in reality people's location and opinions are dynamic, but although social interactions are not static, models that include mobility are rare (Castellano et al., 2009;Gracia-Lázaro et al., 2009;Schweitzer & Hołyst, 2000;Sobkowicz, 2009;Xia et al., 2011). Given the breadth of social psychological research on the relationship between impact and distance (proximity-influence relationship) to date, the shortage of research on opinion evolution in natural dynamic settings is surprising.
One of the main determinants of social influence is similarity (Axelrod, 1997;McPherson et al., 2001). We believe influence can be modelled and mapped on location just as opinions. Mobile agents were implemented in different social context. One, is the study of pedestrian crowd (Helbing et al., 2002), this area started off with models on cellular automata and shifted to models where agents can move in continuous space successfully (Castellano et al., 2009). Furthermore, mobility has been also studied for residential housing patterns (Gracia-Lázaro et al., 2009;Schelling, 1971) and emerging communities (Pfau et al., 2013). Others propose a two-dimensional factorization of perceived personality in crowd simulations with mobile agents (Guy et al., 2011).

Interaction scheme
One of the important features in opinion formation models is the interaction scheme, which defines how agents are selected to interact. Approaches in the literature include random selection on a global basis (Deffuant et al., 2000), various measures of local selection (Axelrod, 1997;Deffuant et al., 2000;Galam et al., 1998;Grabowski, 2009;Gracia-Lázaro et al., 2009;Grauwin & Jensen, 2012;Hegselmann & Krause, 2002;Kozma & Barrat, 2008;Pfau et al., 2013;Schweitzer & Hołyst, 2000;Sousa et al., 2008;Sznajd-Weron & Sznajd, 2000;Zhang et al., 2018), or some combination of both local and global (Gargiulo & Huet, 2010;Guo et al., 2015). Global interactions as in the original DW model mean that an agent has the same probability to interact with anybody within the entire space, lattice or network, counter to these sociology theories. Empirical evidence from social psychology highlights geographical proximity as an indicator of increased interactions between peers (Latané, 1981) or increased probability of friendship (Festinger et al., 1950).

Influence scheme
Many theories of social interaction are based on interpersonal communication and characterized by mutual attraction and proximity among local individuals sharing similar characteristics, such as age, gender or social class. The psychological theory of homophily (McPherson et al., 2001) describes the tendency of an individual to interact with other peers that share similar interests. This is often expressed by the proverb 'Birds of a feather flock together'. The original DW model is based on this concept, whereby agents that are similar in opinion will interact, and shift their opinion to become more similar. In our model, we will also apply this concept to mobility, as such, when a pair of agents agree in opinion they will move closer in distance to each other.
A further profound concept is social impact theory (Latané, 1981), which explains that the amount of influence a person experiences in group settings depends on (a) strength (power or social status) of the group, (b) immediacy (physical or psychological distance) of the group, and (c) the number of people in the group exerting the social influence (i.e. number of sources). Latane found that the impact exerted by a source decreases with increasing distance, however, this work has also been criticized for neglecting a number of realistic features of social interaction, such as the possibility to actually move in physical space (Castellano et al., 2009;Schweitzer & Hołyst, 2000).
The final psychological theory we note is that of cognitive dissonance (Festinger, 1957), which describes our subconscious desire for internal consistency. More specifically, it is the cognitive discomfort experience by a person who has two contradicting beliefs. Due to this psychological discomfort, a person tends to act to reduce the cognitive dissonance, either adding new parts to the cognition, by actively avoiding social situations (e.g. by moving away) or contradicting information. Other papers have considered such psychological behaviour in opinion dynamics context (Bagnoli et al., 2007;Carletti et al., 2008;Groeber et al., 2014;Page et al., 2007).

Mobility scheme
Several approaches to mobility have been taken in the literature on opinion dynamics. The most structured of these consider agents that are located on a lattice (e.g. Gracia-Lázaro et al., 2009;Pfau et al., 2013;Sousa et al., 2008;Zhang et al., 2018), in which agents move to an empty space (when available). Although this allows computationally efficient simulations, the limited space available greatly constrains movement, which impacts on the formation of groups with any significant similarity. Different topologies of network based models have been applied in the literature. These include adaptive network based models, where agents are able to rewire their links, such as Gargiulo and Huet (2010); Grauwin and Jensen (2012); Guo et al. (2015); Kozma and Barrat (2008); Qiang et al. (2008); Sousa et al. (2008), while other models have utilized Erdos and Renyi random graphs (Gargiulo & Gandica, 2016;Kozma & Barrat, 2008). Guo et al. (2015) considered small 2D lattices, similar to Sousa et al. (2008), who modelled opinion dynamics through lattices and triad networks. Further studies have compared opinion spreading in a scale free network to the lattice (Qiang et al., 2008). While these models allow more realistic social structures, they share similar issues to lattices, such as the absence of free group formation.
There are only limited approaches in the literature that consider unconstrained or freespace movement, which may overcome some of these limitations in previous studies (Schweitzer & Hołyst, 2000).

Contribution
Inspired by the theory of cognitive dissonance, we propose a new model (Figure 1 b) for the co-evolution of opinion and location. An agent's decision to move is influenced by their interaction, either to be attracted to a similar peer, or to repel where there is disagreement. Our model introduces a fixed interaction radius to describe the neighbourhood of an agent, which is modified as agents move freely within the space.
The use of free Euclidean space contrasts with forced interactions with the same neighbours for the entire simulation as in the static opinion formation models implemented in network/lattice models of social structures (Deffuant et al., 2000;Hegselmann & Krause, 2002;Sznajd-Weron & Sznajd, 2000). Agents in our model do not form or break explicit links, but interact with their local peers at any point in time. Finally, we investigate the robustness of our model under the presence of noise.

Methodology
Our investigation is based on Agent-Based Modelling (ABM), an approach that works as electronic laboratory especially for cases where high quality data of opinion spread is not available (Banisch et al., 2010;Bruch & Atwell, 2015;Latané, 1981).

Model
In this section, we propose a model for the co-evolution of opinion and location. We consider a population of n agents, A = {a 1 , . . . , a n }, where each agent a i is defined by a location xy i = (x i , y i ) and opinion op i [ [0, 1]. Following the DW model (Deffuant et al., 2000), a pair of agents a i , a j will interact if and only if their respective opinions (op i , op j ) are within an opinion threshold ϵ. If this is the case, they each update their opinion as shown in Algorithm 1, where μ is a global parameter controlling the effect of a peer's opinion (termed convergence rate in the original model Deffuant et al., 2000).
We modify the DW model by only allowing interactions between agents that are close in both opinion and location, and similarly updating both opinions and location following an interaction. Let d(i, j) denote the Euclidean distance between agents a i and a j , and let ≤ d} be the set of agents that are at most distance d from agent a i . For each interaction, we select an agent a i at random from the population A, and select an a peer at random from N(i, d). The opinions of i and j are the updated following the DW model, before updating the location of i as the instigator of the interaction. We compare the effect of two mobility models: 3.1.1. Random mobility (RM) Under this model, agent a i relocates to a random location within a local neighbourhood with probability p if an interaction with a peer is unsuccessful (Figure 2 b). However if they agree, both agents remain in their current locations (Figure 2 b). More formally, let λ be a constant input parameter, and let U(0, 1) denote a random number uniformly selected from [0, 1]. If agent a i selects another agent a j to interact with, then a i updates its location according to Algorithm 2. Algorithm 1. Simulation framework. # Set input parameters (n, limit, r s , e, m, p, l, d, N f ) Input: Create population A of n agents for each iteration in range(limit) do Select agent a i and neighbour a j [ N(i, r s ) at random (skip iteration if a i has no neighbours)

. Homophilous mobility (HM)
Our second model (shown in Algorithm 3) is inspired by the psychological theory of homophily (McPherson et al., 2001), where agents are more attracted towards similar peers. Following an interaction, agent a i moves closer to their peer ( Figure 3a) if they are close in opinion, and further away if they differ (Figure 3 b). A parameter λ is applied to control the scale of movement, with l = 0 leading to no movement and denoting that a i moves to the same position as a j .

Evaluation metrics
We consider four metrics to assess emergent behaviours. Convergence time measures the number of iterations required before a steady state of opinions is reached. The convergence time of a simulation run is defined to be the lowest value of t such that no agent changes their opinion by more than δ between iteration t and t + N F (with N F and δ set as input parameters).
The DBSCAN algorithm (Ester et al., 1996) is used to identify clusters of agents that are close in opinion and/or location once the system has converged. Note that the algorithm detects clusters a minimum of five agents, otherwise the agents are considered as unclassified ('loners'). Clusters based on opinion only were identified by considering the distance between two agents a i and a j to be |op i − op j |, and setting the DBSCAN threshold to be δ. To identify clusters that are close in both opinion and location (geographical opinion clusters), the distance between a i and is set to the Euclidean distance between xy i and if |op i − op j | , d, and an arbitrary large value otherwise. A threshold of 2 3 lr s is then used within the DBSCAN algorithm to identify adjacent agents. For DW we use the default value of 2 3 r s , where r s = 10 to replicate a fully connected network and allow the interaction range to reach its maximum. Finally, we define two metrics to measure the distribution of opinion in the immediate locality of each agent, looking at both the number of agents that disagree and the size of this disagreement. Local disagreement is calculated as the mean percentage of local agents that hold a different opinion once convergence has occurred.
Local diversity measures the average difference of opinion among the neighbours of each agent:

Results
Experiments were conducted with a population of n agents located in a 10 × 10 bounded 2D space. The initial position of each agent i [ n was chosen uniformly randomly within the region, with xy i = (U(0, 10), U(0, 10)), and an opinion op i = U(0, 1). When an agent's mobility would take it beyond the confines of the region, it bounces back to remain within boundaries. A general property (Deffuant et al., 2000) of the DW model is that when e ≥ 0.3 then the system reaches complete opinion consensus (only one opinion exists), and that e ≤ 0.2 leads to polarization, where two opinions survive. Further study of the model (Gargiulo & Huet, 2010) shows that an opinion threshold above 0.267 leads to complete consensus. We therefore restrict our attention to the cases e = 0.1, 0.2 and 0.3, and for each case vary the probability (p) and scale (λ) of movement.
Simulations were run for a maximum of 40, 000 iterations and the results presented are averaged over 20 independent simulation runs with different random seeds. Other simulation parameters are listed in Table 1. We obtain qualitatively similar results for both a 20 × 20 space with the same population density, and an average over 40 random seeds. As a baseline for comparison, all figures show results for the corresponding DW model as a constant line (as this does not depend on λ, therefore for assessment we replace l = 1). Results are shown for both RM and HM movement and a range of values for p. For p = 0, both mobility models are identical, hence only the random case is shown. Figure 4 shows the convergence times for both models over a range of opinion thresholds, probability of movement (p), and distance moved (λ). For both models, convergence is quicker when agents are more mobile (i.e. as the probability of movement p increases), with the highest mobility approaching the convergence time of the standard DW model with global interactions (denoted DW in the figures). As may be expected, convergence is quickest with no movement (p = 0), where there are limited opportunities for agents to interact and change their opinion.

Convergence time
The impact of λ as a control on the distance moved is more pronounced for lower opinion thresholds (e = 0.1, 0.2), but interestingly, shows an increasing correlation for RM, but a decreasing relationship for HM.
As with the original DW model, there appears to be a step change in behaviour when moving from an opinion threshold of 0.1 to 0.2 or 0.3, with the effect of mobility drastically reducing. Figure 5 highlights that the faster convergence for HM is also associated with lower local disagreement. In particular, for e ≥ 0.2, HM results in each agent being surrounded by local groups that entirely agree with their opinion (i.e. with opinion differences below δ), while RM allows limited diversity to persist. In contrast, the behaviour of RM is extremely consistent across all values of p and λ, which is similar to the case when agents are stationary (p = 0). Similar differences between RM and HM are also seen in the mean local diversity shown in Figure 6.

Clusters
Finally, we investigate how agents are clustered following convergence, considering only opinion (Figure 7) and then the opinion combined with location ( Figure 9).  Restricting interactions (p = 0) to a local area allows consensus to form around a larger number of opinions than the original DW model (Figure 7), confined to geographic groupings.
When allowing mobility (p > 0), more opinions clusters are identified under HM but less in RM. In HM agents have higher chances to attract similar opinions, forming a larger/more supported opinions avoiding the cluster size limitation. So when movement is directed they are able to recruit more similar opinionated agents that can be detectable. However, this leads to a larger numbers of 'loners' (Figure 8) for the lowest values of λ due to the repulsion. In comparison to RM, lower numbers of 'loners' exist. Actually, the number of unclassified agents for RM is closer to the DW, behaving as if its a fully connected network, the same goes for the number of identified opinion clusters.   We then continue the investigation to show the geographical opinion clusters (Figure 9). HM is able to detect a number of geographical opinion cluster. For p = 0, the DBSCAN barely detects any opinion groups (Figure 9) and the DBSCAN typically classifies all agents as unclassified agents (Figure 10), and is unable to identify any clusters, this is also valid for RM.
The geographical opinion clustering threshold depends the scale of mobility λ, see Section 3.2. In the model, unclassified agents can be mitigated with larger λ. This is because with larger λ a wider area is scanned to find more (potentially similar) agents. We can observe that the level of unclassified agents in both opinion and location decreases as a function of the λ (Figure 10) and the number of geographical opinion clusters increases to detect more clusters (Figure 9).   In general, when the geographical opinion clusters show large number of unclassified agents, this can either mean that there isn't any neighbours that can be detected or they are indeed not enough local supporters for the opinions as the number of agents in the cluster doesn't complete five members (minimum cluster size). However, when this number is low it means that most of the agents are classified in groups of uniform opinion in geographical space.
When we allow a sufficient degree of mobility (p > 0) HM is effective to mitigate the numbers of 'loners' in geographical opinion clustering (Figure 10). This is because 'loners' have a higher chance to be attracted to others with similar opinions resulting in more supported/detectable opinion group. However, RM is insensitive to any level of p > 0, showing large numbers of unclassified agents ( Figure 10). However, this is especially interesting because even though RM allows movement when there is a disagreement it barely forms any structure of geographical opinions.

Discussion
In conclusion, a marked difference between the mobility models, with RM behaving similarly to no movement while HM allows the formation of geographically separate clusters with similar opinions. The results consistently show that RM produces very similar effects to the original static DW model with global selection of interactions, with very little variation due to the probability p or scale λ of movement. Differences are only evident for the speed of convergence, and the interesting formation of geographically distinct clusters which nevertheless share similar opinions. Our new model based on HM results in radically different results for all evaluation measures, demonstrating a greater propensity for clusters of distinct opinions to survive, which each show greater levels of consensus.

Homophilous mobility with noise
When modelling human behaviour and social agents, it is important to allow some level of randomness, representing the natural variability demonstrated in an individual's behaviour. The DW opinion formation mechanism represents a balanced compromise between a pair of agents in agreement. However, when they are in disagreement their opinions do not diverge. As a result, opinion clusters slowly disappear as ϵ is increased, leading to a central consensus of one single opinion. In our model, this result can be avoided when the agents are mobile, allowing distinct opinion clusters to maintain their existence. In this section, we investigate the impact of adding noise to an agents decision making process.
We first highlight and discuss three notable approaches to modelling noise from the literature. In addition to proposing their own approach, Grauwin and Jensen (2012) provide a useful summary of different models of noise applied to the BC model. One of the ideas that was proposed by Kozma and Barrat (2008) is to add a probability that two agents might actually interact and influence each other even if they are in disagreement. The noise is more of a probability, which decreases when increasing opinion distance, than a quantifiable noise parameter. When interacting peers exceed the ϵ threshold of agreement there is still a chance of influence.
A second form of noise was introduced by Pineda et al. (2009), which describes the consistent presence of dynamic behaviour through time. They model this using a probability to assign a random opinion to a random agent over time. As a consequence, there always remains a chance that individual opinions will reappear and form new clusters.
The final type of noise is proposed in Grauwin and Jensen (2012) as an improvement to the model in Kozma and Barrat (2008), which suggests adding a thermal factor, analogous to Glauber dynamics, where the thermal noise is a function of the difference in opinion instead of energy. The scale of the probability to change opinion is inversely proportional to this difference, with volatility controlled by a temperature parameter. They argue that this natural, thermal noise is more symmetrical in the sense that the inconsistency in behaviour is applied to both agreement and disagreement. Thermal noise has also been applied to discrete opinion models (Grabowski, 2009;Guo et al., 2015).
The outcome of experiments with these noisy models varies depending on the level of local adaptation that takes place. Complete consensus occurs where networks are locally static (Grauwin & Jensen, 2012;Kozma & Barrat, 2008). Kozma and Barrat (2008) also found that both consensus and polarization were possible for locally adaptive networks, however, Grauwin and Jensen (2012) claimed that this was due to the asymmetrical nature of the noise rather than adaptation, finding complete consensus under their symmetric model. Finally, the more uniform application of noise in Pineda et al. (2009) resulted in complete fragmentation.

Model
We have added thermal noise to our model, since it is symmetrical in the sense that it can occur when either agreement or disagreement is encountered. This noise represents the unexpected or imprecise behaviour that might occur in communication. The purpose of this work is to study the effect of noise on the general evolution of opinions for agents that have the opportunity to move while interacting within a restricted area around them, rather than focus specifically on divergence in opinion.
In this section, we limit our attention to the HM model and extend Algorithm 3 by adding thermal noise (Grauwin & Jensen, 2012), as described in Algorithm 4.

Results
We evaluate the effect of adding noise to the HM model using the same structure of experiments as in Section 3.3. Attention is restricted to the case where e = 0.1, since the earlier results show that this value gives the widest range of opinion clusters and local disagreement, in contrast to higher values that lead to rapid convergence to complete consensus. In this section, we are interested in whether the addition of noise results in more consensus, as widely reported in existing studies (Grauwin & Jensen, 2012;Kozma & Barrat, 2008).
Results are presented for three temperature values. When T = 0 represents the deterministic HM model, with no uncertainty in the decision to interact. Noise is then applied with low (T = 0.1) and high (T = 1) temperatures. Further experiments with higher temperature (T = 10) showed similar results to T = 1, therefore are not presented here.
We first note that the convergence times for low temperature (Figure 11) is similar to the deterministic case. However, increasing temperature results in faster convergence, similar to the larger value of e = 0.3 in the deterministic case ( Figure 4).
This pattern is repeated when considering the local distribution of opinions. For both local disagreement ( Figure 12) and local diversity (Figure 13), low noise (T = 0.1) results in only a slight drop in metrics compared to when the noise is off (T = 0). Conversely, adding high noise (T = 1) sees no variation in the opinions of the agents with proximity, in a similar fashion to high values of ϵ for the deterministic model ( Figures 5 and 6).
Finally, we consider clusters, finding that even high noise is able to maintain a high number of both opinion ( Figure 14) and geographic clusters (Figure 16), with increasing mobility (p) maximizing the number of classified clusters. As with high ϵ in Figures 8 and 10, more noise results in almost all agents being classified in a cluster (Figures 15  and 17). However, for both the case of DW, and when mobility isn't applied (p = 0), together with high temperature (T = 1), we observe the formation of a single opinion (see Figure 14 c), in-line with the literature when noise is considered in static networks (Grauwin & Jensen, 2012;Kozma & Barrat, 2008). This shows that high noise levels diminish Algorithm 4. Simulation Framework with HM and Noise Input: Population A of n agents Input: Temperature T for each limit iterations do Select agent a i and neighbour a j [ N(i, r s ) at random     the effect of interacting locally in the stationary model (p = 0), which is now behaving similarly to the DW with global interaction. These contrasts with the deterministic model that even when is stationary (p = 0) produced more opinion clusters than DW.

Discussion
Previous work considering noise in adaptive networks of opinion (where links can be rewired) suggests two extreme outcomes result, either complete consensus (Grauwin & Jensen, 2012) or polarization (Kozma & Barrat, 2008). This difference is due to the fact that the rewiring algorithm in Kozma and Barrat (2008) does not allow bonds between agents in agreement to be broken (asymmetrical noise). In Grauwin and Jensen (2012), symmetrical noise is implemented, which allows agents to rewire by forming a link at random with any other agent in the network, with no geographical restriction, in either cases of agreement or disagreement.
However, in our model, agents have the ability to move (in a homophilous fashion) with link formation (i.e. interaction) restricted to peers within the local area. As a consequence, we do not see high levels of consensus in our results even if we applied substantial level of symmetrical noise, in contrast to Grauwin and Jensen (2012). This property allows distinct clusters to be maintained both in terms of opinion and location, even in the deterministic scenario without any noise applied. Other effects apparent in our model are consistent with the literature (Grauwin & Jensen, 2012), tending to speed up convergence when a form of noise is considered.

Conclusion
We have demonstrated that the nature of mobility plays an important role in how groups of shared opinions evolve. In-line with other studies that consider opinion formation with models of some form of mobility (e.g. Sousa et al., 2008;Zhang et al., 2018), we find that increased mobility (either manifested through higher probability of relocating or larger range of movement) leads to faster convergence. However, we have also shown that the opinion groups formed under RM are similar to the static case, with relatively high local diversity and low numbers of distinct opinions surviving.
As an alternative to RM, we have proposed HM, a model for the co-evolution of opinion and location based on the psychological principles of homophily and dissonance, whereby agents move towards peers with a similar opinion, and away from those they disagree with. Results show this model allows a greater number of opinions to survive, with groups separating geographically to avoid conflict. Increased mobility in this case leads to less local diversity and more opinion clusters.
We find that the adjustments of the agents structure in geographic space have a major effect on both the opinion dynamics and in the topology. More specifically showing the dramatic effect of considering a directed movement instead of a randomly directed movement.
The HM model has shown a robustness to high levels of noise since both restricting the interaction range and allowing the agents to move with a homophilous mechanism allow multiple opinion clusters to be maintained. Although convergence in opinion space is always achieved, we neither obtain full consensus to one opinion nor disorderly opinion states, without any collective structure.
In conclusion, the DW model naturally tends to converge to complete consensus due to its attractive mechanism ignoring divergences in behaviour. In contrast, adding mobility that applies attraction and repulsion demonstrates that diversity at the macroscopic level of the opinion space can be maintained. Furthermore, extending the model to apply noise and uncertainty in behaviour has shown that a model robustness in maintaining distinct opinion clusters.
This highlights the importance of considering mobility and our psychological behaviour in modelling opinion, with implications for scenarios where individuals have control over their social structures.
Our results on a simple, but well-studied model, motivate further study of more complex scenarios, such as considering agents that hold multiple opinions on different topics, more realistic models of mobility that include a desire to maintain personal space, and an investigation of how continuous opinions relate to discrete voting behaviour on a topic. Recent world events, such as the Brexit vote and US elections, have demonstrated the power of social media in facilitating widespread opinion change, and highlight the importance of understanding the mechanisms by which this takes place, together with the potential for misuse by malicious or impartial agents. In particular, further work is vital to recognize the social and communication structures that allow polarized and possibly harmful extremist opinions to evolve and survive, and propose techniques to ensure that opinions are influenced by a breadth of peers that supports informed decision making.