1.. Introduction {#s1}
================

Many prey choose to live, forage and reproduce in groups---this is one of the most readily observed phenomena in biology. A common adaptive explanation for grouping behaviour is that it aids in anti-predatory defence. For instance, starlings (*Sturnus vulgaris*) are well known to forage in flocks in the presence of predators \[[@RSOS150135C1]\]. Shoaling fish, e.g. the eastern mosquitofish (*Gambusia holbrooki*), have been documented to identify predators more accurately in larger groups \[[@RSOS150135C2]\]. Ostriches (*Struthio camelus*) have been reported to experience anti-predatory benefits when foraging in groups \[[@RSOS150135C3]\]. Even when there is a correlation between grouping behaviour and protection from predators, however, it is difficult to pin down what benefits actually select for the evolution of grouping behaviour.

Several such fitness benefits have been proposed. For example, grouping can improve group vigilance \[[@RSOS150135C4]--[@RSOS150135C7]\], reduce the chance of being encountered by predators \[[@RSOS150135C5],[@RSOS150135C8]\], dilute an individual\'s risk of being attacked \[[@RSOS150135C9]--[@RSOS150135C14]\], enable an active defence against predators \[[@RSOS150135C15]\] or reduce predator attack efficiency by confusing the predator \[[@RSOS150135C16]--[@RSOS150135C20]\]. Other possible benefits not involving predation include improved mating success \[[@RSOS150135C21]\], increased foraging efficiency \[[@RSOS150135C22]\] and the ability for the group to solve problems that would be impossible to solve individually \[[@RSOS150135C23]\], for example through the division of labour \[[@RSOS150135C24]\].

With all of these interdependent factors potentially affecting the evolution of grouping, it is difficult to study the independent effects of each benefit in biological systems, let alone explore how they unfold over evolutionary time scales. However, recent research has shown that it is possible to explore the potential independent effects of each benefit by modelling them with digital models of evolution \[[@RSOS150135C25]\]. In previous work, we created several models to explore the predator confusion \[[@RSOS150135C20]\] and selfish herd \[[@RSOS150135C13],[@RSOS150135C14]\] hypotheses to find when these benefits do (and do not) independently select for grouping behaviour. One advantage of these models is that once the independent effects of the various grouping benefits are understood, we can then combine the benefits into a single model to study their relative importance and separate the adaptive benefits (that select for the evolution of grouping) from the incidental side effects of grouping.

Here, we focus on anti-predator vigilance (i.e. the many eyes hypothesis) as a possible selective mechanism for the evolution of gregarious foraging behaviour, and control for the influence of the other benefits described above. First proposed using a mathematical model \[[@RSOS150135C4]\] and explored experimentally a year later \[[@RSOS150135C1]\], the many eyes hypothesis makes two key predictions, both of which arise from the assumption that vigilance is costly, because it imposes a trade-off with foraging efficiency: (i) individual prey vigilance will decline as group size increases and (ii) because prey can more equitably divide the task of watching for predators in large groups, they will experience a fitness benefit from foraging more. Therefore, there will be a selective advantage for prey that forage in groups up to a certain group size. In the 40 years since its inception, these predictions have been examined in numerous species across hundreds of independent studies \[[@RSOS150135C2],[@RSOS150135C3],[@RSOS150135C26]--[@RSOS150135C28]\]. Furthermore, several game theoretical models have been applied to refine the predictions of when collective vigilance in foraging groups should evolve \[[@RSOS150135C29]\], and subsequently matched to experimental data \[[@RSOS150135C30]\].

These previous studies focus on the potential fitness consequences of vigilance in groups of animals, but they do not address the circumstances under which vigilance, and the advantages of being in a group with many watchful eyes, provides a sufficient selection pressure to favour group living, independent of other pressures. When considering the evolution of grouping behaviour, it is vital to take into account both the benefits *and* costs imposed by the behaviour \[[@RSOS150135C31]\]. To satisfy this requirement, several researchers have recently turned to digital models to study the evolution of animal behaviour \[[@RSOS150135C32]--[@RSOS150135C34]\]. These researchers use a digital model of evolution to evolve the behaviour of a population of locally interacting animats, enabling them to explore the evolution of behaviour in complex environments that are beyond the means of mathematical models \[[@RSOS150135C35],[@RSOS150135C25]\]. Additionally, these evolutionary model systems allow researchers to explicitly control for complicating factors, such as the dilution effect \[[@RSOS150135C27]\] and food density \[[@RSOS150135C36]\], that are commonly confounded with collective vigilance as factors benefiting group-living organisms.

In this study, we extend these digital evolution models to explore the conditions under which collective vigilance favours the evolution of gregarious foraging behaviour. We assume that vigilance has benefits (e.g. communicating the presence of a predator via alarm signals) but also costs (e.g. reduced foraging rates by watching for the predator). Under the many eyes hypothesis, grouping is beneficial because it reduces the cost of vigilance by sharing the cost of vigilance among the group, but it may have additional costs that must be considered, e.g. increased predation rates on larger groups \[[@RSOS150135C37]\]. Furthermore, this benefit would be diluted if some individuals can freeload on the vigilance of others (as in heterogeneous groups), but magnified if the group members are highly related. The benefits and costs would also be affected by the life history of the prey, in particular whether their reproduction is iteroparous (i.e. repeated) or semelparous (i.e. all at once): vigilance may be more beneficial in semelparous prey because a predation event can completely prevent them from reproducing, whereas iteroparous prey are more likely to have reproduced at least once prior to experiencing a predation event. To explore these issues, we manipulate the genetic relatedness and reproductive strategy of groups of prey that are under predation and observe the resulting behaviour after thousands of generations of digital evolution have taken place. A preliminary investigation of this work was published in the ALIFE 14 conference \[[@RSOS150135C38]\], which we expand significantly here.

2.. Methods {#s2}
===========

 [Figure 1](#RSOS150135F1){ref-type="fig"} depicts our model of predator--prey interactions in a disembodied model of artificial animals ('animats'), wherein prey must balance the trade-offs between foraging and vigilance \[[@RSOS150135C33]\]. In an embodied model, every animat is situated in the world, perceives the world via its sensors and can act on the world via behavioural or other responses \[[@RSOS150135C39]\]. While embodied models offer more detail and can capture potentially important aspects of the real world, they are also sensitive to implementation-specific details of the sensors and actuators, which can skew the results. We therefore focus on a disembodied model^[1](#FN1){ref-type="fn"}^ for the remainder of this study, which enables us to explore several factors affecting the evolution of group vigilance in isolation. Figure 1.Depiction of the disembodied simulation. Prey seek to forage as much as possible while avoiding being captured by the predator. If none of the prey in the group are vigilant, the target prey is captured 100% of the time.

In this model, prey fitness is directly related to the amount of time it spends foraging, where a single round of foraging increases prey fitness by 1.0. However, prey vigilance determines whether a predator\'s attack on the prey is successful. These two options (foraging and vigilance) are assumed to be mutually exclusive. Thus, prey must evolve to maximize their food intake while remaining vigilant enough to survive the entire simulation, which is akin to the maximum possible lifespan of the prey.

2.1. Simulation of predators and prey {#s2a}
-------------------------------------

We designed this model to capture certain features of natural predators and to control for potentially complicating factors. First, to ensure that predator attacks are not trivially predictable we simulate predators that attack at intervals that are normally distributed around a specific attack rate. Thus, predator attacks are randomly distributed throughout the 2000-time-step duration of the simulation. To model the observation that larger groups of prey often attract more attacks from predators---a realistic cost of group living known as the *attraction effect* \[[@RSOS150135C37]\]---we scale this attack rate with the group size, such that the group experiences approximately five predator attacks for every prey initially in the group over the course of the simulation. This scaling factor also allows us to control for the *dilution effect*, which has been suggested to allow prey to survive with lower vigilance levels in larger groups only because they are less likely to be the target of a predator\'s attack \[[@RSOS150135C27],[@RSOS150135C40],[@RSOS150135C41]\].

Each time a predator appears, we randomly select a target prey from the surviving prey of previous attacks. This is followed by a 10 time-step delay between the appearance of the predator in the simulation and the actual attack, representing the time it takes for a predator to close the distance to the prey. It is during this time that prey vigilance becomes important. If the target prey is vigilant at any time during this interval, then it spots the predator and the attack only has a 10% chance of success. If the target prey is not vigilant but one or more other prey in the group are vigilant, then the other prey communicate the presence of the predator via an alarm signal or other behavioural indicator and the predator will capture the target prey 30% of the time. These probabilities are chosen based on analytical models of group vigilance \[[@RSOS150135C33]\] such that group vigilance is not as effective as individual vigilance, and models the imperfect communication between members of the group \[[@RSOS150135C42]\]. Finally, if no members of the group are vigilant while the predator is closing the distance to its target, then the entire group is unaware of the predator and the attack will succeed 100% of the time. In all cases of a successful attack, the target prey is removed from the simulation and can no longer forage to increase its fitness.

Each individual prey makes the decision to forage or be vigilant every simulation time step. This decision-making process is modelled with a *Markov network* (MN), which is an 'artificial brain' that can stochastically make decisions based on sensory input, memory and previous actions \[[@RSOS150135C20],[@RSOS150135C43],[@RSOS150135C44]\]. Every prey MN is encoded by a list of numbers known as its genotype, such that changes to the genotype can result in changes in the function of the MN. Because we do not provide any sensory input to the prey in this simulation, we are effectively modelling the probability of a prey taking an action (e.g. be vigilant or forage) every simulation time step. More information on MNs---including details on their genetic encoding, mutational operators and functionality---is available in \[[@RSOS150135C14]\].

2.2. Evolutionary process {#s2b}
-------------------------

At the beginning of every experiment, we create a population of 100 individuals with random MNs. We repeat the evaluation procedure described above until all 100 individuals in the genetic algorithm (GA) population have been assigned a fitness (see \[[@RSOS150135C45]\] for a full description of GAs). Once all individuals have been assigned a fitness, we use fitness-proportional selection according to a Moran process \[[@RSOS150135C46]\] to produce the next generation\'s population of prey. Fitness-proportional selection ensures that prey with higher fitness values generally produce more offspring. The selected prey reproduce asexually, with a small probability of mutations (0.5% per site) affecting their offspring\'s genotype. We repeat this evaluation--selection--reproduction process for 2500 generations to ensure that the GA has reached an evolutionarily stable strategy \[[@RSOS150135C47]\] and replicate the experiments 100 times for each treatment---each with a distinct random number generator seed---to verify that we are capturing evolutionary trends rather than outlier scenarios.

2.3. Group size {#s2c}
---------------

Since the many eyes hypothesis predicts an inverse relationship between individual vigilance and group size \[[@RSOS150135C4],[@RSOS150135C1]\], we study prey populations across a range of group sizes: 5, 10, 25 and 50. In our first set of experiments, we observe the equilibrium vigilance levels when prey are forced to group. In our second set of experiments, we relax this assumption and allow the prey to choose to group (or not) every time step. In the latter case, we report the group size as the maximum initial group size. To provide a baseline for the optional grouping experiment, we compare its equilibrium vigilance levels to that of experiments where prey are forced to group and experiments where prey are forced to forage individually.

2.4. Genetic relatedness {#s2d}
------------------------

For all of the above experiments, we study the effect of genetic relatedness on group vigilance behaviour. Given that genetically related organisms are more likely to cooperate with each other than genetically unrelated organisms \[[@RSOS150135C48]\], we expect that genetic relatedness within the group will play a critical role in the evolution of group vigilance behaviour. To explore the two extremes of genetic relatedness, we form groups in two different ways.

In *homogeneous groups*, each individual in the GA population is evaluated separately. During an individual\'s fitness evaluation, we fill the group in the simulation with exact copies of the individual, and the fitness for that individual is the average fitness of all of its copies at the end of the simulation. Thus, for a GA with a population size of 100 individuals, we run 100 simulations every generation to acquire the fitness for each individual.

In *heterogeneous groups*, we use a subset of the GA population (which contains many prey with different genes) to study how the prey fare in direct competition (or cooperation) with each other. When forming a heterogeneous group, we randomly sample individuals from the GA population without replacement until we reach the desired group size for the current treatment. This group is then evaluated in the simulation, where each individual has only one copy and is assigned the fitness of that copy. Once the simulation finishes, we flag the evaluated individuals so they are not evaluated again in that generation. Since the desired group sizes (5, 10, 25 and 50) are always smaller than the GA population size (100), this procedure is repeated until all individuals have been evaluated. For example, if the desired group size is 25 and the GA population is composed of 100 individuals, then the randomly group-and-evaluate procedure is repeated four times. Thus, by following this procedure, all individuals in the GA population are evaluated only once per generation in a randomly assigned group.

Since vigilance indirectly benefits the vigilant individual in homogeneous groups by aiding its kin, we expect that group vigilance will be highly beneficial in homogeneous groups. By contrast, because the vigilance of one prey can potentially aid a rival prey in heterogeneous groups, we expect to observe lower levels of vigilance in heterogeneous groups.

2.5. Reproductive strategy {#s2e}
--------------------------

The benefits of making the right decision in this simulated environment are straightforward: the prey must maximize food intake by surviving the longest while minimizing the time spent being vigilant. But the cost of making the wrong decision can also depend on the life history of the prey. For example, two different reproductive strategies---semelparity and iteroparity---should incur different costs. Semelparous organisms sit on one end of the reproductive spectrum and are characterized by a single reproductive event prior to death. On the other end of the reproductive spectrum, iteroparous organisms continually reproduce throughout their lifetime. We explore these two extremes by simulating semelparous and iteroparous prey in separate treatments.

When simulating *semelparous* prey in our model, we assume that their reproductive event occurs at the end of the simulation. Therefore, if a semelparous prey is consumed by the predator before the end of the simulation, all of its gathered food counts for nothing: it will leave no offspring.

When simulating *iteroparous* prey in our model, we assume that the prey are constantly reproducing throughout their lifetime. Therefore, when a predator consumes an iteroparous prey, the prey can no longer increase its fitness via foraging, but any food it gathered prior to its death counts towards its fitness.

We hypothesize that the increased risk of genetic death introduced by the semelparous treatment will provide an evolutionary incentive for prey to invest in vigilance, whereas prey in the iteroparous treatment will be more likely to engage in risky, non-cooperative behaviour, because their demise does not necessarily doom their genetic lineage \[[@RSOS150135C49]\].

We note that these are highly simplified implementations of reproductive strategies and are meant to capture one key variable: the probability of reproduction occurring prior to a predation event. Our implementations of semelparity and iteroparity vary slightly from their typical use in life-history theory---which focuses on how an organism should allocate resources to growth versus reproduction---whereas here we use 'semelparity' and 'iteroparity' as shorthand for a manipulation of when the fitness consequences of predation are experienced during a life cycle. Some readers may also find our implementations of semelparity and iteroparity akin to capital and income breeding \[[@RSOS150135C50]\], respectively, which is also a viable interpretation of the reproductive strategies in our model.

2.6. Explicit cost of grouping {#s2f}
------------------------------

The model described so far includes a cost of vigilance (insofar as prey cannot forage at the same time that they are vigilant), but there is no explicit cost to choosing to group aside from the possibility of aiding a competing individual. In our final set of experiments, we implement such a grouping penalty in order to model the realistic constraints of limited resources and the resulting scramble competition for food \[[@RSOS150135C30],[@RSOS150135C36],[@RSOS150135C40],[@RSOS150135C51]\]. This grouping penalty is only assessed on prey who choose to forage in the group, and decreases the amount of food they receive in that simulation time step in proportion to the number of prey in the group. The group foraging penalty is imposed according to the following equation: $${Food} = \frac{1.0}{M \times G},$$where *G* is the number of prey in the group and *M* is the penalty multiplier that allows us to experimentally control the severity of the penalty. Given this penalty, prey foraging in larger groups receive less food every time they forage, but potentially enjoy the benefits of group vigilance.

3.. Results {#s3}
===========

We evolve the vigilance behaviour of prey by subjecting them to predation under a variety of treatments that vary reproductive strategy and group composition. Vigilance is measured as the per cent chance that a prey will be vigilant at a given moment in time, averaged across all of the prey in the population. These treatments are repeated across a wide range of group sizes, allowing us to study not only whether the selection for vigilance can be generalized to groups of varying sizes, but also whether we can observe the inverse relationship between group size and vigilance predicted by the many eyes hypothesis.

In our first experiment, all prey in the simulation are forced to forage in the same group, and the only trait that is evolving is the prey decision to be vigilant or not at every time step. Under these conditions, we find that prey living in homogeneous groups consistently evolve higher levels of vigilance than their counterparts living in heterogeneous groups ([figure 2](#RSOS150135F2){ref-type="fig"}). This finding suggests that organisms living in groups with high genetic relatedness are more likely to evolve cooperative strategies. Thus, in our model as in many natural systems, gregarious foraging is most favourable when genetic interests are aligned. Figure 2.Treatment comparison when prey are forced to forage in groups. Both group homogeneity and a semelparous reproductive strategy select for high levels of vigilance. However, only homogeneous groups experience an increase in fitness as group size increases. By contrast, vigilance behaviour breaks down in larger, heterogeneous groups of semelparous prey. Error bars indicate bootstrapped 95% CIs over 100 replicates; some error bars are too small to be visible.

 [Figure 2](#RSOS150135F2){ref-type="fig"} also shows that semelparous prey are more likely to evolve vigilant strategies than iteroparous prey. This is because semelparity selects more strongly than iteroparity for successful evasion of predator attacks, since prey death negates all previous foraging efforts in semelparous prey. This effect is seen across both homogeneous and heterogeneous groups, indicating that semelparity is a strong enough selective pressure to act independently of group genetic composition. Importantly, prey vigilance does not evolve at all in the absence of predation (electronic supplementary material, figure S1), and gradually reducing the predation rate leads to a correspondingly gradual decrease in prey vigilance levels (electronic supplementary material, figure S2). Therefore, we know that the selection pressure imposed by predation is the primary driving force behind this evolved vigilance behaviour.

All three treatments that evolve any level of vigilance also see the prevalence of vigilance decrease as group size increases. This pattern is important because it matches the pattern predicted by the many eyes hypothesis: as group size increases, individuals are able to rely more on collective rather than individual vigilance and can in turn devote more of their own time to foraging. Since we use a relative attack rate that scales the predator\'s attack frequency with group size, this phenomenon must be caused by group vigilance and not the dilution effect (i.e. fewer attacks per individual in larger groups) cited in other studies. We note that vigilance in the heterogeneous/semelparous treatment appears to evolve away almost entirely in a group size of 50. To explain why this trend might be due to something other than collective vigilance, we can instead look at trends in the fitness of the populations.

We observe several interesting trends when we look at the influence of group size on average group fitness. In both homogeneous treatments, there is a steady increase in fitness with increasing group size, suggesting that gregarious foraging behaviour is under positive selection. We see no significant fitness increase with group size in the heterogeneous/iteroparous populations, where the populations do not evolve vigilance behaviour (Wilcoxon rank-sum *p*=0.79 between group size 5 and 50). Unlike the other treatments, the heterogeneous/semelparous populations actually experience a significant *decrease* in fitness with increasing group size (Wilcoxon rank-sum *p*=2.77×10^−6^ between group size 5 and 50), which suggests that cooperative behaviour is not evolutionarily stable in larger heterogeneous groups. Accordingly, these findings suggest that heterogeneous populations are much more susceptible to non-vigilant, 'cheating' prey strategies that sweep the population and reduce the overall population fitness.

3.1. Optional grouping {#s3a}
----------------------

So far we have shown that prey appear to take advantage of collective vigilance to increase their fitness when they are forced to group. We might expect from this (and the many eyes hypothesis predicts) that grouping provides a selective advantage. To test this expectation explicitly, we relax the constraints of the previous experiment by allowing the prey to evolve whether to group or not at every simulation time step. Since there is no direct fitness trade-off for grouping in this model yet (as there was for foraging and vigilance), this allows us to study whether the evolutionary advantages of grouping are favourable enough for vigilance and grouping to co-evolve.

 [Figure 3](#RSOS150135F3){ref-type="fig"} shows that when we allow prey to choose to group, we find nearly the same results as before. This suggests that collective vigilance provides enough of a selective advantage to favour the evolution of grouping. It is not surprising that the homogeneous treatments evolve to group nearly 100% of the time, given that the population is genetically identical and any 'altruistic' action indirectly benefits the altruist as well. As in the forced grouping experiment, we observe a decline in fitness in the heterogeneous/semelparous populations as group size increases, to the point that the population is nearly driven extinct. The inability of the heterogeneous/semelparous populations to evolve consistently high levels of vigilance further supports the hypothesis that evolution is favouring selfish behaviour in heterogeneous populations. This phenomenon is commonly known as the tragedy of the commons \[[@RSOS150135C52],[@RSOS150135C53]\], where selfish actions that provide individuals short-term benefits lead to a decrease in overall group fitness. Figure 3.Treatment comparison when prey can choose to forage in groups. Allowing prey to decide whether they wish to be in the group produces very similar results compared to when they are forced to group. In homogeneous groups, prey choose to spend most of their time in the group. However, grouping breaks down (alongside vigilance) in heterogeneous groups of semelparous prey. This occurs despite there being no direct penalty assessed for choosing to group. Error bars indicate bootstrapped 95% CIs over 100 replicates; some error bars are too small to be visible.

3.2. Tragedy of the commons in heterogeneous groups {#s3b}
---------------------------------------------------

To explore this apparent tragedy of the commons scenario further, we directly compare vigilance and fitness values from the forced and optional grouping experiments alongside a third experiment where we force the population to forage and survive as individuals. [Figure 4](#RSOS150135F4){ref-type="fig"} shows that when given the choice to group in the homogeneous treatments, prey behaviour closely mirrors the behaviour observed when forced to forage in a group. This observation confirms the previous suggestion that collective vigilance in homogeneous groups provides a fitness benefit that positively selects for gregarious foraging behaviours. Figure 4.Vigilance in prey with and without the option to forage in groups. In homogeneous groups, prey with forced and optional grouping evolve similar vigilance behaviours. By contrast, individualistic (non-grouping) prey evolve vigilance behaviours that maximize individual fitness. Meanwhile, individuals in heterogeneous/semelparous populations with the option to group evolve to be less vigilant than either of the other two treatments. Error bars indicate bootstrapped 95% CIs over 100 replicates; some error bars are too small to be visible. (*a*) Heterogeneous, iteroparous; (*b*) heterogeneous, semelparous; (*c*) homogeneous, iteroparous; and (*d*) homogeneous, semelparous.

In contrast to the homogeneous populations, heterogeneous populations are much less likely to evolve gregarious foraging behaviours. Heterogeneous/iteroparous populations never evolve vigilance behaviour regardless of whether the prey are forced to group or not ([figure 4](#RSOS150135F4){ref-type="fig"}). Similarly, heterogeneous/semelparous populations only evolve vigilance behaviour in smaller groups, whereas the advantage of collective vigilance is lost in larger groups. At larger group sizes, prey with the ability to choose whether or not to forage in heterogeneous/semelparous groups instead evolve lower levels of vigilance than required to protect the group ([figure 4](#RSOS150135F4){ref-type="fig"}), which results in a decrease in overall group fitness relative to prey that always forage in groups ([figure 5](#RSOS150135F5){ref-type="fig"}). Figure 5.Fitness for prey with and without the option to forage in groups. In heterogeneous/semelparous groups, prey with the option to group have lower fitness than prey that are forced to group. Error bars indicate bootstrapped 95% CIs over 100 replicates; some error bars are too small to be visible.

3.3. Explicit cost of grouping {#s3c}
------------------------------

In our final treatment, we investigate the impact of assessing a direct cost of foraging in a group (e.g. competition for food). [Figure 6](#RSOS150135F6){ref-type="fig"} shows that except in the homogeneous/semelparous treatment, an explicit grouping cost selects against gregarious foraging behaviour even when the grouping penalty is small (*M*=1.0). Conversely, prey in the homogeneous/semelparous treatment maintain some level of gregarious foraging behaviour even when the penalty for foraging in groups is extreme (*M*=1000). Therefore, we conclude that in the presence of even a small penalty for foraging in a group and the absence of additional selection pressures that favour gregarious foraging (e.g. improved social status for sentinels), only the combination of high genetic relatedness within the group and a semelparous reproductive strategy select strongly enough for gregarious foraging behaviour to evolve in our model. Figure 6.Grouping behaviours in prey experiencing grouping penalties. Even with a small grouping penalty (*M*=1.0), all treatments except homogeneous/semelparous no longer evolve grouping behaviour. Prey in the homogeneous/semelparous treatment only evolve slightly lower levels of grouping behaviour, even with extreme penalties to foraging in a group (*M*=1000). Error bars indicate bootstrapped 95% CIs over 100 replicates; some error bars are too small to be visible. (*a*) Heterogeneous, iteroparous; (*b*) heterogeneous, semelparous; (*c*) homogeneous, iteroparous; and (*d*) homogeneous, semelparous.

4.. Discussion {#s4}
==============

We found that gregarious foraging behaviour can emerge under a variety of conditions when there is a benefit of vigilance and the spreading of information about predators. Prey that forage in homogeneous groups are more likely to evolve gregarious foraging behaviours compared to those in heterogeneous groups. The same is true for semelparous organisms (who reproduce only once before death) compared to their iteroparous counterparts (who reproduce continually), but group homogeneity selects much more strongly for gregarious foraging behaviour.

Clearly, there are numerous challenges to evolving any form of cooperative behaviour in a population with unconstrained genetic relatedness. However, we have shown here that when there is strong selection for survival (as in the heterogeneous/semelparous treatment), the benefit of information sharing via being vigilant and making alarm signals is sufficient to select for cooperative behaviour in heterogeneous groups. This finding demonstrates that kinship is not necessary for cooperative behaviour to evolve as long as there is some benefit to information sharing within the group, e.g. reducing predator attack efficiency.

Further, our results point to a heretofore unsuspected cost of gregarious foraging that is unique to heterogeneous groups. We call this the 'twofold cost of vigilance'. In our model, vigilance behaviour in heterogeneous groups is more than a trade-off with foraging on the individual level. By choosing to be vigilant, prey also risk aiding in the survival of rival prey, which then puts the vigilant prey at a fitness disadvantage because it sacrificed a round of foraging to aid the rival prey. Together, these costs could explain why prey in heterogeneous groups evolve to be less vigilant than those in homogeneous groups.

At the same time, it is also possible that there are some evolutionary advantages unique to heterogeneous groups that we have not yet addressed. For example, our model does not currently allow for any kind of specialization in roles between individuals, which could explain the presence of multi-species groups in nature \[[@RSOS150135C54],[@RSOS150135C55]\]. If the prey could evolve to preferentially pay attention to certain 'sentinel' members of the population (who, in turn, choose to be vigilant nearly always in order to receive some form of rewards, e.g. food or increased social status) then perhaps an evolutionarily stable form of gregarious foraging could be found in heterogeneous groups of all sizes. It is even possible that such a complex social structure could out-perform the relatively primitive cooperation in our homogeneous groups.

Alongside genetic relatedness, another positive selective pressure for the evolution of vigilance is a semelparous reproductive strategy. When prey must survive any and all predator attacks in order to reproduce, the impetus to be vigilant is much greater. Semelparous organisms are known to be more risk-averse than similar, iteroparous organisms \[[@RSOS150135C56]\], and the decision to forage instead of being vigilant is an example of one such risky behaviour. Thus, rather than spending most of their time foraging (as iteroparous prey evolve to do in our model), semelparous prey in our model tend to devote most of their time to watching for predators. When given the opportunity to group with other prey and take advantage of collective vigilance, semelparous prey are actually able to spend less time being vigilant. Thus, when semelparous prey evolve lower levels of vigilance in larger groups, we are observing the effect of collective vigilance.

Given that many animals who rely on vigilance for survival are iteroparous, our result that vigilance is less likely to evolve in iteroparous populations may seem to be contradicted by evidence. In our experiments, we explore the two extremes of reproductive behaviour: semelparous strategies where the prey reproduce only once at the end of their lifetime, and iteroparous strategies where the prey constantly reproduce throughout their lifetime. It is plausible that an intermediate strategy---where prey reproduce within a few breeding episodes throughout their lifetime---could select for vigilance behaviour while at the same time offering the benefits of a more reliable iteroparous reproductive strategy. Even though such an intermediate strategy is not explored in this work, it would make an interesting focus for future work to explore the continuum between the two reproductive strategies.

Although our results suggest that the risk-averseness of semelparity induces semelparous prey to evolve to take advantage of collective vigilance, this selective pressure does not appear to be as strong as the pressure we observed in homogeneous groups. Proof of this observation can be found in the heterogeneous/semelparous treatment, where most group members attempt to cheat their way into collective vigilance by evolving lower levels of vigilance behaviour than is observed in populations where prey are forced to forage in the group ([figure 4](#RSOS150135F4){ref-type="fig"}). Ultimately, this selfish behaviour results in lower fitness than the fitness of prey that are forced to forage in groups ([figure 5](#RSOS150135F5){ref-type="fig"}), but the tendency for selfish strategies to outcompete cooperative strategies prevents a cooperative vigilance strategy from taking hold in the population.

The breakdown of cooperation in the heterogeneous/semelparous populations suggests that the populations are succumbing to a tragedy of the commons \[[@RSOS150135C52],[@RSOS150135C53]\]. In our experiments, all prey are competing against each other to forage as much food as possible without being captured by the predator. However, because there is an unlimited amount of food, the only depletable group resource is vigilance, which protects the entire group from the predator. As the resulting non-cooperative behaviour in the heterogeneous/iteroparous populations demonstrates, absent any major selective pressures for collective vigilance, prey will evolve to selfishly forage 100% of the time. Therefore, group homogeneity and semelparity correspond to two previously established mechanisms for preventing a tragedy of the commons, namely kin selection and punishment for non-cooperative behaviours, respectively \[[@RSOS150135C52]\]. The relative efficacy of these mechanisms to prevent cheating merits further investigation; for example, does group homogeneity play a larger role than reproductive strategy in the evolution of collective vigilance?

In the presence of even a small penalty for foraging in groups, we observe that only prey in homogeneous groups with a semelparous reproductive strategy are capable of evolving gregarious foraging behaviour ([figure 6](#RSOS150135F6){ref-type="fig"}). This finding suggests that, in the absence of unlimited food resources or extreme predation rates, collective vigilance (i.e. the many eyes hypothesis) is insufficient to select for gregarious foraging. However, there may be important aspects of natural systems that select for gregarious foraging that we did not model here. For example, predators have been observed to preferentially attack non-vigilant prey in groups \[[@RSOS150135C57]\], which would require prey to be vigilant even without the benefit of collective vigilance. Thus, it would be informative in future work to model such a preference for non-vigilant prey and observe the evolution of gregarious foraging under those conditions.

The experimental platform presented here enables a plethora of hypotheses to be studied in future work. Given that there is considerable evidence suggesting that foraging and vigilance behaviours are not mutually exclusive in some species \[[@RSOS150135C58]--[@RSOS150135C60]\], it would be instructive to relax that assumption in this model and make foraging only a 'reduced vigilance' state. Furthermore, we assume here that prey cannot detect the size of their group; a useful extension would be to allow prey to detect their group\'s size and study collective vigilance in prey that evolved in varying group sizes. We also assume here that prey always communicate the presence of the predator to their group members. Given that it may not always be evolutionarily advantageous to aid other group members, another informative extension would be to allow prey to optionally make their alarm signals upon detection of the predator. Finally, there are several hypotheses other than the many-eyes hypothesis that could be explored with a model similar to the one presented here, such as the predator confusion hypothesis \[[@RSOS150135C20]\] and the selfish herd hypothesis \[[@RSOS150135C13],[@RSOS150135C14]\]. Once all of these hypotheses have been studied in isolation, we can then combine them into a single model to study their relative importance and separate the adaptive benefits (those that select for the evolution of grouping) from the chance side effects of grouping. Such experiments will further sharpen our understanding of the factors favouring grouping behaviour.

Supplementary Material
======================

###### Supporting data and figures

We thank Art Covert and the Freshman Research Initiative at The University of Texas at Austin for their support through the development of this project. This research has been supported by Michigan State University through computational resources provided by the Institute for Cyber-Enabled Research.

Model code: <https://github.com/phaley/eos/tree/non-embodied>.

Data accessibility {#s5}
==================

All data are reproducible from the open source code provided at <https://github.com/phaley/eos/tree/non-embodied>. Instructions are provided to ensure accurate replication of the experiments presented in this paper.

Author\' contributions {#s6}
======================

R.S.O. conceived and designed the experiments, analysed the data, wrote the paper, prepared figures and/or tables and reviewed drafts of the paper. P.B.H. designed and performed the experiments, analysed the data, wrote the paper, prepared figures and/or tables and reviewed drafts of the paper. F.C.D. designed the experiments, wrote the paper, and reviewed drafts of the paper. C.A. designed the experiments, wrote the paper, and reviewed drafts of the paper.

Competing interests {#s7}
===================

The authors have declared that no competing interests exist.

Funding {#s8}
=======

All the authors were supported by the National Science Foundation BEACON Center under Cooperative Agreement DBI-0939454.

[^1]: These authors contributed equally to this study.
