Spatial eco-evolutionary feedbacks mediate coexistence in prey-predator systems

Eco-evolutionary frameworks can explain certain features of communities in which ecological and evolutionary processes occur over comparable timescales. Here, we investigate whether an evolutionary dynamics may interact with the spatial structure of a prey-predator community in which both species show limited mobility and predator perceptual ranges are subject to natural selection. In these conditions, our results unveil an eco-evolutionary feedback between species spatial mixing and predators perceptual range: different levels of mixing select for different perceptual ranges, which in turn reshape the spatial distribution of prey and its interaction with predators. This emergent pattern of interspecific interactions feeds back to the efficiency of the various perceptual ranges, thus selecting for new ones. Finally, since prey-predator mixing is the key factor that regulates the intensity of predation, we explore the community-level implications of such feedback and show that it controls both coexistence times and species extinction probabilities.


Results
We aim to investigate the interplay between the spatial structure and the evolution of the spatial range of interspecific interactions in ecological communities (see the diagram in Fig. 1). To this end, we build an individual-based model for a simple prey-predator system (see Methods for full details) in which individuals of both species move within a square environment of lateral length L with periodic boundary conditions. Movement is modeled using Brownian motions with diffusion coefficients D p and D v for predator and prey respectively (v stands for victims). The intensity of the diffusion influences the spatial distribution of the populations. Strong diffusion leads to homogeneously distributed populations, whereas clusters form for weak diffusion due to the existence of reproductive pair correlations 31 .
The composition of the community is characterized by the number of prey individuals, = N N t ( ) v v , and predators, = N N t ( ) p p . These population sizes change in time driven by an asexual, stochastic population dynamics in which prey reproduction and predator death occur with constant rates r and d respectively. The predation or catching rate of each predator, c, however, is dictated by the availability of prey and the efficiency of the predator at attacking them. Mathematically, this can be written as accounts for the number of prey individuals within predator's perceptual range, R, and E(R) is the attacking efficiency for a given perceptual range R. We have defined the perceptual range, different for each predator, as the maximum distance measured from the position of the predator at which a prey can be detected. Hence, the number of prey individuals detected by the predator increases as the perceptual range increases. We assume, however, that it does so at Figure 1. Schematic representation of the eco-evolutionary framework. Diffusion coefficients, D v and D p , control individual movement and act as control parameters of the emergent eco-evolutionary feedback (yellow box) between species mixing, measured using Shannon-entropy based metrics (green box), and the distribution of predators' perceptual ranges (orange box). Finally, the eco-evolutionary feedback determines prey-predator coexistence times  . Arrows indicate the influence between the different elements of the framework. the cost of a reduced predation likelihood, leading to a trade-off between prey detection and attacking efficiency. We implement this trade-off by assuming that the attacking efficiency E(R) is a decreasing function of the perceptual range. This trade-off between perception and attacking efficiency, as well as the choice of E such that predation rate maximizes at intermediate scales of perception, is grounded on previous theoretical studies showing that foraging success decreases when individuals have to integrate information over very large spatial scales [26][27][28]32,33 .
The specific shape of E(R) may depend on several factors related to prey behavior, predator behavior or environmental features. Here, we assume that it decays exponentially with the perceptual range as , where c 0 is the maximum efficiency and R c fixes how quickly this efficiency decays as the perceptual range increases. We expect similar results for other functional forms of E(R) as far as its decay with R is faster than the growth of M R ( ) v . Considering a homogeneous distribution of prey with density = v N L / v 2 , the number of prey detected by one predator is Then, the predation rate for that predator is  Fig. 2 for a plot of c R N ( )/ v , normalized to make it independent of the prey density). In the next sections, we will use this value ⁎ R h as a reference to measure the effect of non-homogeneous distributions of individuals on the optimal perceptual range. When the spatial distributions of the populations are heterogeneous, the predation rate per prey varies across the population because the number of prey perceived by each predator does so. In these cases, we measure the mean predation rate per prey, 〈 〉 c R N ( )/ v p , from numerical simulations of the non-evolutionary dynamics in which all predators have the same perceptual range R and there are no mutations. The notation 〈…〉 p indicates average over all predators in the system and over time and realizations. If individual diffusion is low, the spatial distribution of individuals deviates strongly from homogeneity, thereby leading to optimal perceptual ranges, R*, that are larger than in the well-mixed limit (see filled symbols in Fig. 2). Conversely, as diffusion increases, v v 2 2 and the system approaches the well-mixed limit (see empty symbols in Fig. 2). In this high-diffusion limit, however, small differences with the analytical result remain because our simulations consider finite populations that always show some spatial heterogeneity.
Finally, once a prey is consumed by a predator with the individual-specific predation rates defined above, there is a probability b for the predator to reproduce. Hence, predator's reproduction rates are determined by the interplay between their perceptual range and the spatial distribution of the prey population. Neglecting the phenotype-genotype distinction and the role of the environment in trait inheritance 34 , we assume that each newborn predator receives the perceptual range from its parent (i.e. clonal reproduction) plus some mutation that adds to R a random perturbation sampled from a Gaussian of zero mean and variance σ μ 2 . R remains unchanged during predators' lifetime. The intensity of mutations, σ μ , determines both the speed of the evolutionary process and the level of variability in the evolving trait, R. The mathematical details of the model and its implementation are provided in the Methods section.
In the following sections, we investigate how the coupling between limited mobility and evolution in the perceptual ranges influences the stability of the community. Hence, we keep constant all the model parameters (see Methods section) except the intensity of the mutations in R, σ μ , that drives the evolutionary processes, and the , see main text and Eq. (6)). The trade-off between prey detection and decaying attack efficiency leads to a value = ⁎ R R h (indicated by a vertical dashed line) at which the predation rate per prey is maximum. Symbols (with dashed lines as guides to the eye) are, for each value of R, average predation rates per prey, 〈 〉 c R N ( )/ v p (average over all the predators in the system and over time and realizations), from simulations in which all predators have the same perceptual range R. There is no evolutionary process, and the mobilities are low ( = = . diffusion coefficients, D v and D p , which determine the degree of mixing in the population and thus the intensity of the prey-predator interaction. Therefore, for a given pair of diffusion coefficients and a mutation intensity, three linked population and community-level features emerge: the spatial distribution of both species, the distribution of predator perceptual ranges (i.e., the outcome of the evolutionary dynamics) and the coexistence time of the populations. In the following sections, we study each of them separately.

Species spatial distributions.
If prey birth and predator death rates are kept constant, the spatial distribution of prey and predators is determined by three characteristic spatial scales, defined by D v , D p and R. Figure 3 shows typical spatial configurations obtained for low (panel A) and high (panel B) diffusion (see also Movies in the Supplementary Material). Clustering of individuals and species segregation occur at low diffusion. To quantify population clustering within each species, as well as interspecies mixing, we introduce the metrics v  and p  for the former and  for the latter. The three of them are defined in terms of the Shannon index or entropy [35][36][37] , conveniently modified to correct for the effect of fluctuations in population sizes (see Methods for the mathematical definitions and further details). The interspecies mixing, , takes values between 0 and 1, with 0 indicating strong species segregation and 1 the well-mixed limit.  p and v  also take values within the same range, but since they are applied to one single species,  = α 0 indicates a high level of clumping of species α (=v or p) and  = α 1 a uniform distribution of the corresponding species. We analyze the spatial distribution of species in the long-time regime, that is, once the distribution of perceptual ranges in the predator population has reached a stationary shape. In Fig. 4, we show the mean value (the notation 〈…〉 indicates average over time and realizations) of these mixing measures as a function of individual mobility for constant mutation intensity σ = .  Fig. 4B, prey mixing still increases monotonically with D v , but both interspecies and predator mixing show a maximum at intermediate D v . The prey population can be seen as a dynamical resource landscape that drives the spatial distribution of predators. Increasing D v always leads to a more uniform distribution of prey. However, the extent to which this also leads to a more uniform distribution of predators is limited by D p (which in Fig. 4B  Next, we explore the effect of the mutation intensity on the average interspecies mixing,  〈 〉. In Fig. 5, keeping = D D v p constant, we show how σ μ changes the prey-predator mixing curve shown in Fig. 4A. To quantify such change, we define the relative change in 〈 〉  with respect to a no-mutation case (σ → μ 0) in which all predators have the optimal perceptual range ⁎ R , where brackets indicate an average performed over time and realizations in the long-time regime. We find that, at low diffusion, interspecies mixing decreases as mutation intensity σ μ increases. This leads to more segregated , respectively. Gray circles delimits the area of perception of the predators, which is subject to evolutionary dynamics (σ = . prey-predator distributions for larger mutation intensities. At high diffusion, however, the trend is reversed and interspecies mixing increases with increasing mutation intensity. Finally, for a range of intermediate diffusion coefficients, the increase in interspecies mixing due to mutation is maximum. These results arise mainly from the mutation-induced variability in the values of R within the predator population, which will be discussed in the next section. Distribution of predator perceptual ranges. In our model, we assume that predator perceptual ranges (and thus predation rates and predator reproduction rates) are subject to natural selection. We assume that the value of the trait R of a predator is passed to its offspring, with some variation due to mutation. Then, the perceptual range remains unchanged during the individual lifetime. Natural selection is at work since, depending on the spatial distribution of prey, some perceptual ranges are favored against the others and hence tend to be over-represented within the population.
, the populations of prey and predators are randomly distributed in space and well-mixed with each other. In this homogeneous,  www.nature.com/scientificreports www.nature.com/scientificreports/ mean-field limit, it is possible to derive an equation for the dynamics of the distribution of perceptual ranges in the population, ρ R ( ) (see Supplementary Material for detailed calculations). In this limit, we can approximate the expected number of prey individuals within a radius R by / c . As long as the number of individuals used in the simulations is large, this theoretical prediction (see Eqs. (S2) and (S3) in the Supplementary Material) agrees with direct simulations of the individual-based dynamics (see Fig. 6). The infinite-diffusion, well-mixed limit is implemented in the simulations by randomly redistributing prey and predators in space at each time step. Starting from different initial distributions for R, the maximum of the time-dependent distribution ρ R ( ), which defines the dominant perceptual range ⁎ R , is driven close to ⁎ R h , that is, the perception range that gives the maximum predation rate in the homogeneous regime (Fig. 6A). This long-time dominant value corresponds exactly to the optimal one, ⁎ R h , when mutations are negligible. However, as the intensity of mutations, σ μ , increases, the long-time distribution ρ R ( ) becomes wider and its mode shifts towards larger values of R (Fig. 6B). This effect is due to the asymmetric form of the predation rate c R ( ) (Fig. 2). Thus, the dominant R in the homogeneous regime has a main component set by the optimal value and a small positive shift due to the effect of mutations. Lastly, note that because the diffusion coefficients are very high, any perturbation of the homogeneous spatial distribution is rapidly smoothed out. Thus, selection for a specific ρ R ( ) driven by the evolutionary dynamics has no effect on the spatial distribution of species. This is in contrast with the result for low mobility, which we discuss more in depth next.
Finite-mixing case. For the general case of limited dispersal, far from the well-mixed scenario, some of the features shown in Fig. 6 still persist, but modified due to the underlying spatial distribution of prey and predators. Since the analytical approximations derived for the infinite diffusion limit are not valid, we study this scenario via numerical simulations of the individual-based model. Starting from different initial distributions of R, the most frequent (probable) value of R, ⁎ R , evolves in time towards a value that depends on the mobility of both species (Fig. 7A), with lower mobility favoring larger ( > ⁎ ⁎ R R h ) perceptual ranges (Fig. 7B), while, in the well-mixed limit, it approaches the ⁎ R h as a power-law (see inset of Fig. 7B). The change in the long-time ρ R ( ), both with time and with diffusion coefficients, is shown in the Supplementary Fig. S1. We observe that the change in the dominant perceptual range due to species diffusion is well captured by the prey mixing parameter v  : Fig. 7C shows the dominant R in the long-time regime as a function of prey clumping generated varying D v . We extract that and mutation intensity σ = .
μ 0 1. This relation is valid for low mutation intensity, such that in the well-mixed scenario, Prey mixing is thus the main quantity that determines the dominant perceptual range, because it cap- www.nature.com/scientificreports www.nature.com/scientificreports/ tures the major contribution of the spatial structure of the landscape of resources experienced by predators. As prey form clusters, , predators typically find prey at distances that are larger than in the homogeneous case (see Fig. 3), which drives the evolution of ⁎ R to larger values. coexistence times and extinction probabilities. We have investigated in the previous sections the mutual influence between species mixing and the evolution of the perceptual ranges. Thus, since mixing controls the frequency of prey-predator interactions, we expect this interplay between ecological and evolutionary processes to mediate the stability of the community. To quantify this, we measure the mean coexistence time between prey and predators,  , and the probability that prey get extinct before predators, β, as a function of prey diffusion, predator diffusion, and the intensity of the mutations. The mean coexistence time,  , is defined as the time until either prey or predators get extinct, averaged over independent model realizations. Prey extinction probability, β, is obtained as the fraction of model realizations in which predators persist longer than prey. Since prey are the only resource for predators, predators will shortly get extinct following prey extinctions. On the contrary, when predator extinctions occur first, prey will grow unboundedly because we do not account for interspecific competition. For each realization of the model, we use initial conditions that lead to a very short transient after which the spatial structure of the populations and the perceptual-range distribution achieve their long-time shape. In most cases, an initial condition consisting of spatially well-mixed populations and a uniform distribution of perceptual ranges in L [0, /2] allows this to happen. Nevertheless, for small mutation rates (σ < . μ 0 1), the evolutionary time scales become comparable to the coexistence times and we need to speed up the evolutionary component of the transient dynamics by setting an initial condition for the perceptual-range distribution close to the one expected at long times.
In Fig. 8A we show the mean coexistence time  as a function of prey and predator diffusion coefficients, assuming = D D v p , for different mutation intensities. This curve depends, in a complex manner, on the values of the dominant perceptual range, the associated predation rate, and the degree of mixing that arises from limited dispersal. Long coexistence occurs when there is a balanced mixing between prey and predators, which results in intermediate levels of predation that preserve prey longer. For weak mutation, the coexistence time, which is maximum at low diffusion, decreases as the diffusion coefficients increase until reaching a minimum at intermediate mobility. Then,  increases slowly, approaching asymptotically the well-mixed case. As mutation increases, there is a clear change in the dependence of  with the diffusion coefficients. Beyond a value of σ μ , the maximum of  shifts to intermediate values of the diffusion coefficients. This is one of the central results of this paper, coming from the effect that mutation intensity (when non-negligible) has in prey-predator mixing, as shown in   www.nature.com/scientificreports www.nature.com/scientificreports/ Finally, we calculate the probability that prey become extinct before predators, β, as a function of D v (which is taken to be equal to D p ) for different values of σ μ (Fig. 8B). Even though the most likely event is that predators disappear before prey (β < . 0 5), as the diffusion coefficients increase from very small values, we observe an increase on β passing through a maximum at intermediate diffusion. Despite the nonlinear effects between predation rate and species spatial distributions, spatial mixing enhances predation and therefore β generally becomes larger as diffusion increases (see Fig. 8B). Note that, comparing Fig. 8A,B, the maximum β (high predation) is not related to longest coexistence, which indicates that species coexist longer when there is a balance between predation and prey reproduction. The influence of the intensity of mutations in the profiles shown in Fig. 8B, again, is due to the feedback in the interspecies mixing shown in Fig. 5, which regulates the level of predation. Hence, prey extinction is reduced at low mobility but increased at high mobility, shifting the profile.
Relationship with the non-evolutionary case. In order to better understand the origin of the spatial eco-evolutionary feedback and its importance to our results, we have thoroughly explored also a non-evolutionary simulation scenario in which all predators have the same, fixed value of R. We have scanned the − R D v parameter space (with = D D v p ) and measured the behavior of the different population and community-level properties studied in previous sections (spatial mixing, average predation rate, mean coexistence times, and prey extinction probability). The results, shown in Fig. S2, clarify the consequences of the eco-evolutionary process, specially at low mutation intensity. In this small-mutation regime, the evolutionary dynamics generates, when all the rest of system parameters remain constant, a narrow distribution of perceptual ranges that singles out a preferred ⁎ R . Thus, as the individual mobility is varied, the optimal perceptual range (driven by evolution) follows a specific Fig. S2) and the values of the different community metrics for this case can be read from the corresponding non-evolving result indicated by the color map. Along this curve, in contrast to the cases in which R is independent of D v , we can see, for instance, that the mean predation rate per prey is always close to its maximum value (Figs. S2B and 2) and, as a consequence, interspecific mixing is close to its minimum (see Figs. S2A and S4, which displays cuts of Fig. S2A at constant values of D v and includes an additional panel in which ≠ D D v p ). These constrains ultimately determine the behavior of the mean coexistence time and prey extinction probability as a function of D v (see Fig. S2D,E), which correspond to the σ = μ 0 case in Fig. 8.
Of course the approach above does not explain features occurring at high mutation intensity, such as the dependence of mixing on mutation (Fig. 5) or the maximum in  at intermediate mobility (Fig. 8A). Nevertheless, additional insight for these results can still be extracted from the non-evolutionary simulations: a maximum in  similar to the one present in the evolutionary case for high mutations is obtained by varying D v at a sufficiently large, fixed value of R (see Supplementary Fig. S3). This suggests that the occurrence of this maximum is linked to the generation of large values of R when mutation is large enough (see e.g. Fig. 6B). To check this, we have performed simulations in which there is a fixed distribution of perceptual ranges ρ R ( ) that is not evolving. This is achieved by assigning to each newborn predator a value of R sampled from that distribution, instead of being inherited from the parent with some mutation. We use for the fixed distribution of perception ranges a Gaussian with given mean value and standard deviation. In situations in which the mean value or the standard deviation is sufficiently large, we recover the maximum in the coexistence time for intermediate values of the mobility www.nature.com/scientificreports www.nature.com/scientificreports/ ( Supplementary Fig. S3). This confirms that large values of R, being they imposed, produced by mutation or by non-evolving variability, are responsible for the enhanced coexistence times. We have also checked (not shown) that the dependence of β on mobility is qualitatively reproduced under this non-evolving scenario if large values of R are present.
The exploration of the − R D v plane in the non-evolutionary case helps to understand how the outcome of the evolutionary dynamics (the selected value ⁎ R for each pair of diffusion coefficients) affects different population and community-level properties. A full understanding of the whole eco-evolutionary process (Fig. 1) requires also to address the other branch of the feedback loop, i.e. to understand how the ecological variables favor a particular perceptual range R. As we saw before (Fig. 7A), prey clumping and species segregation drive ⁎ R to values higher than in the homogeneous case, since this increases the number of prey individuals potentially detected by predators. At the same time, however, attacking efficiency decreases for larger perceptual ranges, so that a finite optimal perceptual range, ⁎ R , results from this trade-off. The specific balancing value of R is determined by the spatial distribution of the individuals in a way that we now try to elucidate. A first observation to be taken into account is that the selected ⁎ R is always close to the one that minimizes interspecific mixing (Figs. S2A and S4). Thus, the selected perceptual range is the one producing the largest segregation between predator and prey. This increases ⁎ R from its value at large mobility, ⁎ R h , towards larger values as mobility is decreased (see also Fig. 7). A mechanism behind the shift of ⁎ R with respect to ⁎ R h can be identified by realizing that the predation rate per prey, 〈 〉 c R N ( )/ v p , closely follows the shape of 〈 〉  in the − R D v plane. Indeed, the selected ⁎ R D ( ) v in the eco-evolutionary model closely follows the maximum of 〈 〉 c R N ( )/ v p for each D v (Fig. S2B). The shift in the maximum of this function towards higher values of R for decreasing D v was already seen in Fig. 2. Note that this shift is not present in the quantity 〈 〉 c R ( ) p (Fig. S2C). The ideas of adaptive dynamics 38 may be used to investigate the role of the predation rate per prey in selecting the optimal ⁎ R . ⁎ R will be an evolutionary stable strategy, and thus selected under weak mutation, if the expected fitness of a mutant with perceptual range R in a resident population with perceptual range ⁎ R has a local maximum when = ⁎ R R . The fitness is defined here as the average net growth rate of the mutant predator in the fixed environment determined by ⁎ R . This is with an exponential attacking-efficiency function E(R). The number of prey individuals available to the predator can be written as , where g pv is the radial pair correlation function 39 g r ( ) pv that gives the expected number of prey individuals at distance a r from a predator, relative to a random distribution with density = v N L / v 2 . v and the functional form of g pv will depend, in general, on the value of the perceptual range. In determining the evolutionary stable value ⁎ R , these quantities must be kept constant while maximizing 〈 − 〉 c R d ( ) p with respect to the remaining explicit dependence on R (which is a quantity exclusive to the mutant). One way to achieve that is to maximize the predation rate per prey, , so that the explicit dependence of the fitness on v or N v disappears. There will be still a residual dependence of g pv on R but our numerical results indicate that it is weak and that maximization of the predation rate per prey (the maxima in the curves of Fig. 2 or of Fig. S2B as a function of R for fixed D v ) gives a good approximation for the evolutionarily-stable selected perceptual range ⁎ R .

Summary and Discussion
Using an individual-based model, we have investigated whether the evolutionary dynamics of predator perceptual ranges influences the stability of spatially-structured prey-predator communities. First, we studied how different levels of interspecies mixing arise due to limited mobility and the variability in the perceptual range introduced by the intensity of mutations. Second, we evaluated the consequences of the interplay between species mixing and the predator perceptual range in community coexistence times and prey extinction probability. Our results reveal the existence of an eco-evolutionary feedback between interspecies mixing and predators perception: species mixing selects a certain distribution of perceptual ranges; in turn, the distribution of perceptual ranges reshapes species spatial distributions due to predation (predators eliminate prey from their surroundings). More specifically, when species mobility is low, prey and predators form monospecific clusters due to reproductive correlations 31 , but segregate from each other due to predation. Therefore, prey often inhabit regions of the environment that are not visited by predators, which drives the evolution of larger perceptual ranges. Conversely, as mobility becomes higher, species mixing increases and shorter-range predation is favored. At the community level, we show that this eco-evolutionary feedback strongly controls both community stability and diversity, characterized by the mean coexistence time and prey extinction probability. The average coexistence time is maximum when the interaction between species mixing and predator perceptual ranges yields a predation rate that is large enough to sustain the population of predators but low enough to avoid fast extinctions of prey. We have also connected these results with those obtained for a purely ecological model, in which perceptual ranges can either vary across the population or be a deterministic trait. The mean coexistence time and species extinction probabilities provide important information about the diversity of the community at different scales 40 . Each realization of our stochastic model can be seen as an independent dynamics taking place within a metapopulation or patch. In our setup, because model realizations are independent from each other, these patches are isolated (not coupled by dispersal events) and constitute a "non-equlibrium metapopulation" 41 . In this context, the mean coexistence time is a proxy for alpha (intra-patch) diversity, i.e. how long species coexist in each patch, whereas species extinction probabilities inform about the beta (inter-patch) diversity, i.e., how many patches are expected to be occupied by prey and how many by predators once one of the species has been eliminated. From a mathematical point of view, the fraction of patches in which prey and predators coexist at any time t is given by www.nature.com/scientificreports www.nature.com/scientificreports/ (except for coexistence times that are much smaller than the mean, see Supplementary Fig. S5). Therefore, − −  P t e ( ) 1 t/ . The fraction of patches occupied only by prey is given by β − −P t (1 )(1 ( )), and the fraction of patches in which overexploitation has caused prey extinction is given by β − P t (1 ( )). Hence, the mean coexistence time,  , and the prey extinction probability, β, quantify the diversity of the community at different spatiotemporal scales 35,40,42 , and might serve as important guides for the design of ecosystem management protocols 42,43 .
Since we were interested in studying whether the spatial coupling between movement and perception could lead to an eco-evolutionary feedback when both processes occur at comparable time scales 14,15 , we kept all the characteristic time scales of the system fixed except those related to individual movement and the evolutionary dynamics of perceptual ranges. We used parameter values such that evolution is fast enough so that both the spatial distribution of individuals and the distribution of perceptual ranges relax to their stationary values in timescales much shorter than the characteristic time scales at which community-level processes occur, defined by the mean coexistence time. Under this condition, the long-time regime is well-defined and can be characterized by constant quantities. A sensitivity analysis on reproduction probabilities (Supplementary Fig. S6) reveals that, as far as this relationship between time scales is maintained, both the existence of the eco-evolutionary feedback and its impact on community stability and diversity remain unaffected. This condition can be broken, for instance, if prey and predator birth-death rates are small, or too unbalanced, producing very short coexistence times (Fig. S6). Our results for the mean coexistence time are robust against changes in the source of individual-level trait variability, as individual-level trait variability affects mixing in a similar way. This work was motivated by and focused on the case in which variability is produced by mutation in the transmission of the trait. However, our results could also be relevant to cases in which variability arises from non-inheritable properties, such as body size, or individual internal state (level of hunger, attention…) 26 , and therefore do not introduce spatial correlations between trait values after reproduction. When sampling the perceptual range of newborn predators from an appropriated fixed distribution (being independent on the parents' trait), the results in Fig. 8 are qualitatively reproduced (Fig. S3). This implies that different processes that promote trait variability can control community coexistence.
Finally, although we have concentrated our investigation on a prey-predator dynamics, our results will more generally illuminate whether, and to which extent, the interplay between species spatial distributions and the range of ecological interactions may determine community-level properties. Therefore, our study opens a broad range of questions and directions for future research. First, we have limited to the case in which only one predator trait can evolve, whereas evolution of prey traits has been also shown to impact profoundly the population dynamics of both species in well-mixed settings 22 . A natural extension of our study would be to explore such scenario in a spatially-explicit framework as the one introduced here. More complex possibilities, such as the co-evolution of traits in both species, including the possibility of evolving mobility rates, could also lead to new population dynamics 20,44,45 . More general evolutionary processes, such as arms race in phenotype space (red queen-like dynamics) instead of trait distributions reaching a stationary configuration 46 also deserve further investigation. Our model considers that individuals undergo clonal reproduction. Extending it to the case of sexual reproduction can have important consequences for the evolutionary dynamics. On the one hand, sexual reproduction can speed-up evolution by increasing genetic diversity. On the other hand, sexual reproduction introduces a new range of additional processes, such as the cost of finding a mate and exposure to sexually transmitted diseases, that could change our results 17,45,47,48 . Finally, different movement models, such as Lévy flights instead of Brownian motion, can modify both the optimal range of the interactions 28 and the emergence of clusters of interacting individuals 49 , possibly leading to new community-level results. The existence of environmental features that could also affect the degree of mixing and its coupling with the range of interactions, such as the presence of external flows, would extend our results to a wider range of ecosystems in which the importance of rapid evolutionary processes has been already reported 50,51 .

Model details.
We propose an individual-based model for a prey-predator community in which each individual is represented by a point particle within a square environment of lateral length L and periodic boundary conditions. In addition, each predator has an individual-specific perceptual range R. In this context, we propose an eco-evolutionary framework whose updating rules can be grouped into three different types of dynamical processes: individual movement (spatial dynamics), population dynamics and evolution with mutation (dynamics in trait space).
1. Individual movement. We assume that both prey and predators follow independent two-dimensional Brownian motions with diffusion constants D v and D p respectively. We sample a turning angle for individual i, θ i , from a uniform distribution between π [0, 2 ), and a displacement,  i , defined as the absolute value of a normal random variable with zero mean and variance proportional to the individual diffusion coefficient. Mathematically, this updating in the position vector t x ( ) i of each individual can be written as www.nature.com/scientificreports www.nature.com/scientificreports/ reproduction occur with constant rates d and r respectively. Predation involves the encounter between one predator and one prey and therefore predation rates depend on predator-specific perceptual ranges, R, and the number of available prey individuals within it. A predator with perceptual range R may thus successfully catch one of the accessible prey individuals and eliminate it (prey death) with rate c(R). After prey elimination, the predator reproduces with probability b, which leads to a new individual at its position. The newborn individual inherits the parental perceptual range, R, plus a random contribution due to mutation. These three events can be written in the form of a set of biological reactions for prey, V, and predators, P, with probability with probability 1 , where we have added the notation  P to indicate the variability in perceptual range inheritance due to mutations (see Eq. (8) below). A key step in our model is the definition of the predation rate, since it determines the interaction between species and links predator perceptual ranges and their reproductive success. The total predation rate of a predator of perceptual range R, c R ( ), is equal to the number of prey individuals available within the predator perceptual range, M R ( ) v , multiplied by the attacking efficiency, E(R): is a monotonically increasing function of R, E must decrease sufficiently fast with R in order to bound the evolutionary dynamics in the perceptual range and prevent the evolution of unrealistic infinite perception. We write the attacking efficiency as 0 where c 0 is the maximum efficiency and f(R) is the dimensionless predator efficiency function. f(R) is considered to be a monotonically decreasing function of R such that = f (0) 1 and . R c fixes the characteristic spatial scale for the decay of the predation efficiency with the perceptual range. This simple form incorporates the essential ingredients to model the trade-off, but in general, to account for effects that might arise in the vanishing and large perceptual range limits (for example a plateau with constant value of efficiency for small R), forms beyond the exponential can be implemented 52 . Given our particular choices, in the limit in which prey is homogeneously distributed in space, the predation rate is maximum at an intermediate perceptual range ≡ ⁎ R R 2 h c . This optimal value ⁎ R h will be used as a reference in our results. In addition, its existence agrees with previous studies showing that, when information can be gathered over long distance, foraging performance is optimal for intermediate perceptual ranges [26][27][28]32 . The trade-off between perception and predation efficiency can also be motivated by the case of flying predators. The area where prey can be detected is generally increased by a higher flight altitude. However, efficiency in the attack may simultaneously be reduced if initiated from such a large height. We remark that our predator mobility model only describes the searching-for-prey phase. The attack process is assumed to be instantaneous. 3. Predator reproduction with mutation. Each predation event is followed by the possible reproduction of the predator, occurring with probability b. Besides inheriting the parental position, the newborn individual also receives the parental perceptual range, R, but with an added random perturbation, ξ μ , that accounts for mutations. Therefore, ξ μ is a zero-mean Gaussian variable whose variance, σ μ 2 , regulates the intensity of the mutations. In order to avoid perceptual ranges that exceed system size or are negative, mutations leading to < R 0 or > R L/2 are rejected.
Model implementation: the Gillespie algorithm. We implement the model stochastic birth-death dynamics (processes 2 and 3 above) following the Gillespie algorithm [53][54][55] . First, we compute the total event rate , summing each prey reproduction rate and each predator catching and death rates. Then, the simulation time-step is set to ζτ Δ = t , where ζ is an exponentially distributed random variable with unit mean and τ ≡ g 1/ is the average time to the next demographic event. At each iteration, a population dynamics event will occur chosen from all ( + N N 2 v p ) possible events (i.e. choosing one of the N v prey individuals for reproduction, or one of the N p predators for death, or one of them for a catching event). The probability of choosing a particular event is proportional to its relative contribution to the total rate g, i.e. each prey has probability r/g of generating a new prey, and each predator has probability d/g of dying and a probability c R g ( )/ i to catch a prey. If predator death or prey reproduction occur, we simply remove or generate a new individual at parents' position, www.nature.com/scientificreports www.nature.com/scientificreports/ respectively. And finally, if predation occurs, a prey randomly chosen within the perceptual range of the selected predator i (which was chosen proportionally to its rate c R ( ) i ) dies and, with probability b, a new predator is generated at the same location as the initial predator, with value of the perceptual range obtained from Eq. (8).
For simplicity, we fix across this paper the parameter values = = = = = r d c b R 1 c 0 and focus our study on the role of the diffusion coefficients D p and D p , and the mutation intensity, σ μ 2 , on determining the dynamics of the community (for computational convenience we use also different values of system size L). The impact of changing some parameter to other values is briefly addressed in the Summary and Discussion section.
Mixing measures. In order to quantify the spatial arrangement of the species, we define measures of mixing.
A possible way to proceed is to use the Shannon index or entropy, which has been applied to measure species diversity, racial, social or economic segregation on human population and as a clustering measure [35][36][37] . Based on these previous approaches, we propose a modification described below.
As usual, we start regularly partitioning the system in m square boxes with size δ = x L m / and obtaining for each box i the entropy index s i 36 , given by To really characterize the lack of inhomogeneity arising from interactions and mobility, one should compare the value of  〈 〉 m with the value  that would be obtained by randomly locating the same numbers of predators and prey individuals, N p and N v among the different boxes. At this point, approximations for  which are only appropriate if the number of individuals is large have been typically used. In our case, since predator and prey populations have large fluctuations, it is necessary to give a more precise estimation. In a brute force manner, one can obtain computationally the mixing measure for the random distribution simply by distributing randomly in the m spatial boxes the N v prey individuals and N p predators and averaging the corresponding results of Eq. (10) over many runs. On the other hand, this can be done analytically since we known that, for random spatial distribution, the number of individuals n q of type q (=p, v) in each box would obey a binomial distribution B n N ( , ) q q , where N q is the total particle number in the system. We have that with s the entropy index in a box containing n v prey individuals and n p predators, as defined in Eq. (9). Finally, a suitable measure of prey-predator mixing that characterizes spatial structure from the well-mixed case (=1) to full segregation ( = 0  ) is given by m    Also, we can define an analogous measure for each species' spatial distribution separately, which can be interpreted as a degree of clustering 37 ,   The mixing measures are certainly affected by the size of the box δx used, which should be tuned to obtain maximum sensibility to the spatial distribution. For very large as well as for very small box size, we see that different spatial distributions become indistinguishable. For instance, for the prey-predator mixing, if the box size is very large (of the order of system size), we will find that the predators and prey are well-mixed independently of the values of the diffusion coefficients. On the other hand, if box size is very small it will be either occupied by a single predator or prey, if not empty, indicating segregation independently on the individual mobility. In Supplementary Fig. S7, we show how the mixing measure changes with box size δx and system size L for low mobility ( = = . , which produces a highly heterogeneous spatial distribution. We identify that for δ  x 2 the maximum sensitivity with respect to the diffusion coefficients is attained (for = L 10). We used δ = x 2 in our results, being a suitable scale since it is also of the order of the typical values of the perceptual range attained under evolution. Regarding the system size, we found only weak variations in the mixing measures, which are shown in the inset of Fig. S7.

Data availability
No datasets were generated or analysed during the current study.