{'fraction_non_alphanumeric': 0.024943760751621014, 'fraction_numerical': 0.00406907502977372, 'mean_word_length': 4.688558524651863, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Diversity under variability and extreme variability of environments

We conducted an investigation of the effect that extreme variability of the individual's environment has in the individual's adaptability and, in general, in the co-evolution of a population. First we assume that the individuals are a kind of perceptrons with a given memory size that adapt to their environment; second we consider co-evolution not only of the individual actions but also of the memory size, depending on the individual's fitness; and third we assume strong variability of the environment. We show that changes in the intensity of the environmental fluctuations introduce a phase transition in the frequency of cooperators and the diversity of the population. We also find out that extreme variability of the environment induces changes in the critical exponents and that this variability can promote more diversity in the population.


Introduction
An important aspect in ecology is the comprehension of the distribution of populations of different species in space and time as well as the effect of the fluctuating environment in this diversity. Both aspects concern the effort to conserve species, which should consider the extreme heterogeneous distribution of this diversity: from high diversity, like hot spots such as Choco or the West African coast, to less diverse systems, like the German forest. Not only the distribution, but also the extreme changes in the environment have a critical importance in forecasting the effect of extreme phenomena, such as global warming, in ecosystems [1].
The effect of fluctuating environments has suggested a kind of insurance mechanism in populations. According to this hypothesis, diversity can insure a population against decline in its functioning because there is a large set of actions that can give a response to these fluctuations (See Shigeo Yachi et al. [2]). However, other models show that more diversity cannot resist fluctuations in the environment, because the system fails to find, in a finite time, an equilibrium state (R. May [3]). This dispute is still open and restricted to the distribution of phenotypes. Less attention has been given to the distribution of genotypes among a population. In recent years some theoretical works have investigated the geographic distribution of genetic diversity and, in particular, how some species are unevenly distributed [4], but this analysis is restricted to single individuals and does not take into account its interplay with the environment. Because there is no clarity of what the effect is of the variability of the environment and individual selectivity on this distribution, it is then necessary to develop adequate models that allow this analysis. In this investigation we will focus on this specific problem.
If we want to consider, from a theoretical point of view, the effect of the environment on the population and, at the same time, the effect of the population on its environment, then a good starting point is to make use of game theoretical tools [5,6,7,8]. Some models implement a grade of variability to game theory assuming that the individuals can spatially change. Such changes induce effects in the co-evolutive dynamics [9]. This approach gives information about the natural behavior that some species may have in its population. For example, several species of birds migrate depending on seasonal circumstances or simply as a natural reaction to concurrence against other individuals.
Other works analyze the effect that the variation of the environment has in a population by means of analytical models considering phenotype switching. It has been shown that stochastic switching can be favored over sensing when the environment changes infrequently [10]. When the environment is considered, its statistics are of central importance and must be taken into account in the population dynamics. Such dynamics have an effect in the analysis of the phenotypic diversity (for social systems see for instance Huberman et al. [11]). But the population's genotypic diversity (or in general the relation to the memory size of individuals) is an overlooked component that has wide-ranging effects in the community structure and ecosystem processes [12]. Therefore, it is of fundamental interest to extend the analysis of the population of genotypes (memory sizes) in contrast with the conventional analysis of genotypes.
We focus on two behavioral aspects of the individuals: First, we consider adaptation and second we consider the individual ability to select the environment. The first aspect connects the genetics to the adaptability of individuals; in this case, each individual adopts an action as a function of the information it stores from the opponents as well as its own past actions (implying an individual learning process). This characteristic has allowed the construction of models that connect machine learning to genetics [13]. However, this particular aspect can be extended to other applications of game theory where agents with adaptation are modeled [14]. In machine learning the variability of the environment is represented as the noise when the information is processed. Naturally, the adaptability of the individual depends in this case on the individual's memory size. The diversity of the population is, therefore, related to the number of different individuals with different memory size competing in order to increase their utility.
In a theoretical game scenario, the environment could change in a periodical way. Indeed, either the environment can have extreme changes or the individuals can choose the best-suited environment. This last case can have an origin in the change of its spatial position or by changing the interaction with other species. If the individuals can choose their interactions, they must then possess some mechanism that allows them to make choices. In co-evolution a central brain conduces the actions of the individuals attempting to increase the individual's fitness. However, an important part of this argument is the role played by a decentralized brain [15]. A choice, which is related to a preference, can be located in two different levels: one (relevant for population dynamics and genetics) is a genetic level; the second (relevant for the behavior of populations of individuals) is a rational level. In the first case it has been found that a large portion of the human genetic code is composed by non-protein-coding introns, which are nucleotide sequences that do not code specific proteins [16]. This is a type of junk DNA called micro-satellites; a key feature is that some aspects in social behavior are apparently governed by repetitive micro-satellites found into the introns. The second level concerns the reaction in the brain within a decision making process, where the integration of emotional states with stored memories influence the way an individual define its choice [15].
The present work is divided in the following parts. In the second part we explain in three subsections the basic definitions of the game: in the first subsection we introduce basic aspects of game theory and individual's selectivity; in the second subsection we explain the mechanism for individual's adaptability; finally in the third subsection we explain the mutation mechanism in the population. In the third part we present the central results obtained within this work. In the final part we discuss these results and we present an outlook of subsequent contributions.

Game theory and individual's selectivity
The actions of each individual and its opponent are rewarded according a pay-off matrix. This pay off represents the fitness of the individual related to a given environment. In several cases, the individual's action can also shape the environment, implying a co-evolution of the population and its environment. Such co-evolution of individual's fitness and individual's action is mathematically represented by means of game theory.
The action of individual i is represented by an unitary vector σ i , that can be either σ i = (1, 0) for C (Cooperate) or σ i = (0, 1) for D (Defect). The pay-off of individual i relative to individual j is given by the following matrix [7] where σ j is the action of individual j and F p is the game matrix. The pay-off of the agent j is given by U ij = σ i F p σ j . In general U ji = U ij . In the present model only pair interactions are allowed. The fitness matrix is represented by The scenario implemented in this work is for a prisoner's dilemma game, i.e., the game matrix has the values Q > R > P > S, where Q is for temptation, R for reward, P for punishment and S for sucker. In this model Q = 5, R = 3, P = 2 and S = 0. Using eq.
(1), the total outcome for the individual i respect to its opponents can be computed as and the total outcome of the opponents respect to individual i is given by where K is the number of neighbors. The utility is a fundamental quantity that should determine the co-evolutionary process. Given that the structure of the pay-off matrix is in general non-commutative, then f ′i = f i . However, when the individual observes that its game does not increase its fitness, then it can choose either to play a different game or simply not to play (see fig.  1). Indeed, the individuals do not interact on a simple surface via a single pay-off matrix, but on a more complex landscape where the pay-off matrix is selected by the gamblers. The definition of non-absolute values in the interactions is made by means of an extended interaction matrix F p . Furthermore, an additional vectorζ k defines the preferred interaction of the agent i. This vector points into each one of the interaction sub-matrices to be fixed in each interaction. The utility matrix for the agent i has in this case the following form [17]  The games are characterized by three kinds of sub-matrices. One sub-matrix is defined under the restriction 2R > T + S. The second sub-matrix is defined as a chicken game, which means that the mutual defection is the worst possible outcome. Therefore, the values for this sub-matrix are T ′ > R ′ > S ′ > P ′ . The values were arbitrary defined, but in such a way that T ′ < R ′ , i.e., 'temptation' is not dramatically different to 'reward'. Additionally, T ′ < T , i.e. is a low risk game. A third sub-matrix representing a constant interaction is introduced, with the condition T ′′ = R ′′ = S ′′ = P ′′ = 1. This last sub-matrix implies for the agents a total risk aversion with low incomes. Hence, the agents interacting in the present model could basically choose between more or less risk. Simultaneously, these three fundamental options allow the game to switch between stable and unstable equilibrium states.

Adaptability
We consider adaptable individuals that select an action according to what they observe from other individuals. The dynamics for the adaptation are represented using methods inspired in machine learning (See for example [18,19]). The individuals store information from the actions of their neighbors as well as their own actions in order to decide a new action.This dynamic implies that the individual is adapting to the whole population. In the present model we consider two layers: σ I for the input information into the individual's memory and σ O for the individual's output action. In genetics, the first layer contains the information sequence of the grade in which two genes are inherited from a common ancestor [20]. We define a memory containing the information sequence shared by the individual and its opponent. In order to keep this model as simple as possible we propose a function S i (t) giving the grade of linkage of the individual's and its opponent's actions (alleles). In a similar way as the genetical affected-sib-pair (ASP) analysis, this function allows us to define a model similar to a one dimensional Ising model [20], where the probability to obtain an offspring σ O depending on the linkage of markers into the individual's memory sequence.
The opponent's as well as the individual's past action at time t − l (offspring at time t − 1) are defined as an input information (that can be either 1 for C or -1 for D, which is related to the allele correspondence to previous offspring). For example the inividual i stores the information of its opponent j in the following way: where the strength of the connectivity -between the individual's and its opponent's markers-is directly proportional to the memory size of the individual. Clearly, this is an oversimplification. However, we want to understand the effect that the fitness of the individual has on its adaptability; given that the memory size depends on this fitness through a game (see next subsection), then this option is a simple way to make an analysis of the interaction between adaptability and fitness.
The second layer is the output of the information process: the individual's action, i.e. the individual's offspring, that can be either The transition probability is given by where β = 1 Λ . Λ represents the extend of genetic linkages between markers and the effect of random genetic and environmental efects has on allele sharing [20], T is the period of time and The variability of the environment is related to the level of noise of the environment (similar to the case of a teacher in a noisy classroom [18]). For Λ → 0 the fluctuations of the information are small and the individual's actions relax to a cooperative behaviour; a case that can be related to a frozen system. Otherwise, if Λ → ∞, then the fluctuations of the system increase, avoiding the individual to find in a short time a stable answer. The relaxation time depends on the adaptation parameter β and the memory size M. The larger the memory, the more stable is the answer and the shorter is the relaxation

Mutation of memory size
The evolutionary dynamics is represented by a mutation process of the individuals. Each individual in the lattice is characterized by its memory M i . If the individual's fitness is not large enough, its memory size can mutate into a new memory size M ′i . In this mutation process we assume that the individual has no lost of information; the additional bit of information added to the memory after the mutation process is assigned in a random way.
This mutation process has the following form [6,21]: (i) selection -an individual is selected for reproduction with a probability related to its fitness-; (ii) reproduction -the individual produces one offspring-; (iii) the offspring replaces a randomly selected individual. The transition probability for the evolution of the memory size M i has the following form: where Θ(x) is a Heaviside step function, f i is the outcome given by eq.
(3) and f ′i is the outcome of the opponents to the individual i, given by eq. (4). The function χ i (ν) is the probability that the memory m i changes, where ν is the mutation frequency.

Results
We want to restrict the analysis to the effects that fluctuations of information have in the population and for this reason we avoid an analysis of a population in a complex topology. The population is therefore represented in a square lattice with periodic boundary conditions, where individuals interact with four individuals selected from their eight nearest neighbors. Along this work the results corresponds to computations performed in lattices with 60 × 60 individuals. We assume a co-evolutive process that starts from an initial configuration of individuals with small memories. First we make an analysis of the relaxation of the average number of individuals with a given memory size and of the relaxation of the frequency of cooperators. The density of individuals with a given memory size ρ m is given by where N is the total number of individuals in the population. Using this quantity, the mean of the memory size in the system G M is defined as the average of ρ m and is given by where M is the maximal memory size observed in the system. The frequency of cooperators is also defined by the probability density of individuals adopting the action C along the game, where Z 0 is the partition function on the storage distribution of the individual i given by This partition function is valid into the phase space defined by the individual's memory. The distribution function of elements of class C, G, in the whole population is given by The analysis of the results must account for the distribution of phenotypes (distribution of actions) and the distribution of memory sizes. Both distributions must be analyzed as a function of β and as a function of the variability of the environment (in this work this variability is defined as a plasticity of the game). It is important to remark that the game has direct influence on the memory size of the individuals, not on their actions. The actions are indirectly affected by the individual's memory and directly affected by the dynamics of the memory, which reach an equilibrium state after infinite simulation steps according to the dynamics defined for the individual's actions (Fig. 3).
First we want to make a characterization of the system. In Fig. 3 we present the distribution function of the mean memory G M as a function of the time for different β parameters. The higher the value of β, the more complex the distribution of memories in the population. Given that the simulation starts from some initial distribution of small memories, the system requires some relaxation time until the system reaches an equilibrium state. The relaxation time is also a function of β.
The parameter β is related to the level of noise that avoid the agents adapting to their neighborhood. Small memories adapt much slower than large ones. Hence, a change in the phase behavior of the number of cooperators (or memory size) depends on the noise level that the system is exposed to, i.e. large memories have a better chance to survive if the noise level is lower.
The noise has important implications in the evolution of a population: more adaptable individuals are best suited to environments with low levels of noise. In the same figure 3 we present an analysis of the frequency of cooperators G as a function of the time for different parameters β. Given that more adaptable individuals tend to cooperate, then the frequency of cooperators increase when β also increases, i.e. a population with more cooperators can survive in an environment with less noise. Finally three snapshots of the distribution of the memories in the lattice at large times are presented. For β above 0.18 the population is dominated by large memories. Below this value we observe dominance of individuals with small memory sizes. The interesting aspect in this distributions is that at β = 0.18 there is a separation between large and small memories. This kind of phase separation indicates that the system has a behavior similar to a phase separation of first order.
In the figure Fig. 4 we present the frequency of cooperators G and the diversity of the population I as a function of the noise level β = 1/λ, where the diversity were defined as where M is the maximal memory size that can be defined into the system. There are several measures for diversity [24,22,23]. We adopt a Shannon's index, which provides information not only about the population richness, but also the composition of the community [22,23]. When the parameter β is increased and thereafter is decreased we observe a hysteresis effect. In Fig. 4 the simulation is started for systems consisting on individuals with relatively small memories (arrow pointing to right). Each point was computed for the same initial configuration and different temperatures. A second group of simulations starting from initial configurations of agents with large memories were also started (arrow pointing to left). In this figure the frequency of co-operators and the re-scaled diversity index I are shown.
The first aspect of this plot is the high diversity contrasted to the low frequency of co-operators for 1/Λ < 2. When 1/Λ ∼ 2 both curves show a singularity. Above this critical value the value of diversity is now larger, whereas the frequency of co-operators decreases. The second aspect is the non-reversibility of the curves. This could be related to a phase transition of first order (formation of phase separation between individuals of different memory size) and to memory effects related in a direct form to the model of perceptons for the individuals. In order to make an analysis of the plasticity of the interactions in the population we make a comparison of the mean memory as a function of the time for fixed β parameters.
The remarkable result is the similitude between plastic and non-plastic games. However, the examination of the distribution of memories in the snapshots in the figure 5 shows that the separation between low and large memories dissolves.
This separation can be an artifact. The simulation starts in this case from an initial configuration with low memories; the aggregation of large memories has, however, relation to the willingness to cooperate of the individuals. When the environment is extremely variable, large memories have a worse chance than small memories. In such a case, mixed and less structured distributions emerges It is indeed possible to suggest some effects of the plasticity of the interactions in the relaxation process at short to intermediary time regimes. This result is also confirmed in Fig. 5. In this case the relaxation of the distribution function of the mean memory has been computed as a function of β for plastic as well as non-plastic pay-off matrices. The principal conclusion is that the plasticity introduces a retardation in the relaxation of phenotypes into the population.
In particular for β = 0.18 is possible to observe further relaxation for t > 2000. For this parameter, close to Λ c , the system with plastic interactions requires more time to overcome fitness barriers before the system relaxes, i.e. this is a metastable state. In contrast to this result, the system with rigid interactions has a simple relaxation curve. For β = 0.3 the system with plastic interactions reaches an equilibrium in the mean number of memories along a simple relaxation curve. We want to make a close analysis of the difference that flexible interactions may introduce into the diversity and frequency of cooperators. In Fig 6 the frequency of cooperators G as a function of 1/Λ is presented. Both kind of games preserve the critical point and confirm that it does not depend on the plasticity of interactions inside the game. However, the phase behavior for rigid games is different to plastic games. In the last case the frequency of cooperators is proportional to (1/Λ) γ , γ = 1, below the critical point, where there is a singularity. Above the critical point the phase behavior has a polynomial form. In contrast to this behavior, the rigid game has a kind of polynomial behavior below the critical point, with a critical exponent γ larger than one; above Λ c the frequency of cooperators reach a plateau. The diversity also has a different phase behavior for plastic games (See Fig. 7). For rigid games and 1/Λ < 1/Λ c the phase diagram of the diversity has a polynomial behavior. At the critical point there is a singularity and the diversity reaches a plateau. When we consider plastic games we observe again a remarkable difference with rigid games, in particular the value of the diversity is larger. This result confirms that the variability in the pay-off matrices can increase the diversity of the distribution of memories in the population. The second characteristic is that at Λ c there is a cross over in the phase diagram of I. Above this value there is a smooth relaxation of the value of the diversity, until it reaches a plateau. The snapshot of the distribution of memories at the critical point for both dynamics can explain the different behavior of both phase diagrams: whereas in the rigid case a phase separation between memories of different sizes emerges, in the plastic case there is a kind of solution of large and small memories, i.e., the plasticity of the interactions destroy the phase separation between memory sizes.
We establish a relation between the diversity index and the frequency of cooperators. The black line in circles in figure 8 represents a system with rigid interactions. The red line in squares represents plastic interactions. When the interactions are rigid it is possible to establish a relation that relates in an inverse proportion the diversity I to the frequency of co-operators G. This result is as a first approach a natural characteristic of a system with individuals doing an imitation of the actions of their neighbors. According to the rules of the system, cooperative individuals require larger memories. Hence, if the system is more cooperative, then it is also more homogeneous because it is dominated by individuals with larger memory sizes, implying at the same time less diversity. When the diversity I increases, then the willingness to cooperate decreases and a fusion of co-operators and defectors takes place. The frequency of defectors increases when G → 0 and simultaneously the diversity index I decreases. Therefore, the phase diagram shows a maximal value of I when the frequency of co-operators and defectors is equilibrated. Below some particular value of G the diversity of the system again decreases. This is because defectors dominate the system.
The implementation of flexible utilities introduces a dramatic change in the behavior of the system. If we allow the individuals to define their best outcome, then the diversity increases without changing the frequency of co-operators G. In particular above G ∼ 0.4 the phase diagram can be fitted using a function of the form d = G 0 + a × G − b × G 2 . We observe that b plastic → 0, i.e., the contribution of the quadratic term of this function decreases when the game is plastic. Assuming an ecosystem composed of different kinds of individuals, with different internal characteristics, this result proposes a mechanism that shifts the original phase diagram obtained for rigid interactions, helping the system to increase its frequency of diversity without bringing about a change in the frequency of cooperativity.
This result could bring some clues in the comprehension of the diversity of ecosystems. Assume for instance an ecosystem with rigid utilities together with an ecosystem with flexible interactions, both separated by a thin barrier. Both systems have the same intensity of fluctuation Λ. However, one system shows more diversity than the other one, despite both being very close. In this example the internal characteristics of the environment (the flexible utilities that can be selected by the individuals versus rigid utilities), and not the simple variability of the environment, are fundamental for the estimation of the value of diversity.

Discussion
The main result is the effect that variability of the pay-off matrix has in the co-evolution of large memories. In this work, as well as in previous works, we have shown that the larger this variability, the lower the chance that large memories have to co-evolve. If the external information source promotes the evolution of small memories, then this effect is more dramatic.
This result could be surprising but it is, however, very plausible. The larger the memory the more information an individual can store from previous events. This process requires a very stable environment. Once the environment fluctuates, the memory does not represent any advantage in evolution, producing an increase of the fitness of small memories. Indeed, this observation depends on the correlation of the fluctuations of the environment, i.e. for correlated fluctuations the memory represents again a clear advantage [10]. If moreover the external information favors small memories, then the diversity is again out of balance: instead of the evolution of large memories, the dynamics of the population show a prevalence of small memories. Hence, variability as well as information are two important parameters that affect the development of a population.
The plasticity in the interactions also has profound implications in the phase behavior of the system. First, it introduces additional fitness barriers that the system must overcome until it relaxes. Moreover, the plasticity deteriorates the phase separation between large and small memories, generating a much better mixture of individuals. From a qualitative point of view this also is an improvement of the diversity, because it helps to increase the entropy of the system. We can also establish a dependence of the diversity as a function of the number of cooperators. We can determine in this phase diagram a critical frequency of cooperators where the diversity is maximal; we also can observe an increase of diversity when the system is plastic. However, for a critical value of frequency of cooperators the phase behavior for plastic games converges to the phase behavior for rigid games, i.e. extreme variability not necessary improves the diversity of the system.
The results obtained in this investigation could be used as a mechanism that can improve diversity in a population. The implications range from ecology to social science and could explain why genetic diversity can be found in certain systems. In the frame of this investigation, the answer to this question is that diversity could be larger when individuals are allowed to decide their game, i.e., when individuals can search for their best interaction with other individuals in an ecology.
In social sciences it could be an interesting result for the analysis of cooperation. Some investigations have shown, for instance, that more cooperation requires less diversity [26]. However, the result presented in Fig. 8 shows that more cooperation can allow more diversity if agents can define their pay-off. Assuming adaptable individuals, this result implies that diversity and cooperativity depend on the degree of freedom that individuals have to move in a fitness landscape.