Animal grouping behaviors have been widely studied due to their implications for understanding social intelligence, collective cognition, and potential applications in engineering, artificial intelligence, and robotics. An important biological aspect of these studies is discerning which selection pressures favor the evolution of grouping behavior. In the past decade, researchers have begun using evolutionary computation to study the evolutionary effects of these selection pressures in predator-prey models. The selfish herd hypothesis states that concentrated groups arise because prey selfishly attempt to place their conspecifics between themselves and the predator, thus causing an endless cycle of movement toward the center of the group. Using an evolutionary model of a predator-prey system, we show that how predators attack is critical to the evolution of the selfish herd. Following this discovery, we show that density-dependent predation provides an abstraction of Hamilton's original formulation of domains of danger. Finally, we verify that density-dependent predation provides a sufficient selective advantage for prey to evolve the selfish herd in response to predation by coevolving predators. Thus, our work corroborates Hamilton's selfish herd hypothesis in a digital evolutionary model, refines the assumptions of the selfish herd hypothesis, and generalizes the domain of danger concept to density-dependent predation.
Over the past century, researchers have devoted considerable effort to studying animal grouping behavior, due to its important implications for social intelligence, collective cognition, and potential applications in engineering, artificial intelligence, and robotics . Indeed, grouping behaviors are pervasive across all forms of life. For example, European starlings (Sturnus vulgaris) are known to form murmurations of millions of birds, which perform awe-inspiring displays of coordinated movement [12, 19]. Western honeybees (Apis mellifera) communicate the location of food and nest sites to other bees in their group via a complex dance language . Even relatively simple bacteria exhibit grouping behavior, such as Escherichia coli forming biofilms that allow their group to survive in hostile environments .
Swarming is one example of grouping behavior, where animals coordinate their movement with conspecifics to maintain a cohesive group. Although swarmlike groups could arise by chance—as with little egrets (Egretta garzetta) pursuing a common resource in water pools —typically swarms are maintained via behavioral mechanisms that ensure group cohesion . As with many traits, swarming behavior entails a variety of fitness costs, such as increased risk of predation and the requisite sharing of resources with the group . With this fact in mind, significant effort has been dedicated to understanding the compensating benefits that grouping behavior provides . Many such benefits of grouping behavior have been proposed; for example, swarming may improve mating success [68, 8], increase foraging efficiency , or enable the group to solve problems that would be impossible to solve individually . Furthermore, swarming behaviors are hypothesized to protect group members from predators in several ways. For example, swarming can improve group vigilance [57, 27, 59, 46], reduce the chance of being encountered by predators [59, 22], dilute an individual's risk of being attacked [23, 58, 13, 18], enable an active defense against predators , or reduce predator attack efficiency by confusing the predator [24, 26, 29].
Unfortunately, many swarming animals take months or even years to produce offspring. These long generation times make it extremely difficult to experimentally determine which of the aforementioned benefits are sufficient to select for swarming behavior as an evolutionary response, let alone study the behaviors as they evolve [26, 3]. In this article, we use a digital model of predator-prey coevolution to explore Hamilton's selfish herd hypothesis . Briefly, the selfish herd hypothesis states that prey in groups under attack from a predator will seek to place other prey in between themselves and the predator, thus maximizing their chance of survival. As a consequence of this selfish behavior, individuals continually move toward a central point in the group, which gives rise to the appearance of a cohesive swarm. This article expands on earlier work  by studying the long-term evolutionary effects of differing attack modes, exploring a new attack mode that directly selects against swarming behavior, and providing an analysis of the control algorithms that evolved in the swarming prey.
2 Related Work
Hamilton's original formulation of the selfish herd hypothesis introduced the concept of domains of danger (DODs, Figure 1), which served as a method to visualize the likelihood for a prey inside a group to be attacked by a predator . Prey on the edges of the group would have larger DODs than prey on the inside of the group; thus, prey on the edges of the group would be attacked more frequently. Moreover, Hamilton proposed that prey on the edges of the group would seek to reduce their DOD by moving inside the group, thus placing other group members between themselves and the predator. Further work has expanded on this hypothesis by adding a limited predator attack range , investigating the effects of prey vigilance , considering the initial spatial positioning of prey when the group is attacked , exploring the role of prey body characteristics in shaping herd characteristics [31, 20], and even confirming Hamilton's predictions in biological systems .
Additional studies have focused on the movement rules that prey in a selfish herd follow to minimize their DOD . This line of work began by demonstrating that the simple movement rules proposed by Hamilton reduce predation risk for prey inside the group , then opened some parameters of the movement rules to evolution in an attempt to discover a more biologically plausible set of movement rules [49, 65]. Importantly, these studies demonstrated that it is possible for selfish herd behavior to evolve by natural selection on movement rules that rely on only local information for each agent, rather than global information about the entire group. This article builds on this work by studying the effects of coevolving predators and predator attack mode (i.e., how predators select a prey in a group to attack) on the evolution of the selfish herd.
That said, there are many other potential causes of swarming behavior that we do not address in this study. For example, some studies have investigated the evolution of predator behavior in response to prey density  and the role of relative predator and prey speeds in the evolution of grouping behavior , elaborated upon the interaction between ecology and the evolution of grouping behavior [55, 64], and explored the role of group vigilance (i.e., the “many eyes” hypothesis) in the evolution of grouping behavior [16, 43]. Two recent studies have explored the coevolution of predator and prey behavior in the presence of the predator confusion effect [40, 32], and found that the predator confusion effect is sufficient to select for the evolution of swarming behavior in the absence of any other group benefits. Further, it has been shown that predators can adapt composite tactics to improve their efficacy against swarms of prey, which greatly reduces the defensive benefit of swarming . It is therefore necessary to keep in mind that while this study investigates the evolution of swarming behavior according to Hamilton's selfish herd hypothesis, in natural populations there are often many interacting benefits and costs of swarming behavior that must be taken into account .
Of course, prior to this work there had been considerable research exploring the (co)evolution of animal behavior in agent-based models. Craig Reynolds' work on the evolution of prey behavior in response to simulated predation was one of the earliest articles to demonstrate that predation can directly select for aggregative behavior in prey populations . Similarly, Karl Sims' work in 1994 established a new paradigm for the coevolution of agent behavior and morphology , which is still an object of intense study to this day. The work in this article seeks to provide a stronger biological grounding to these kinds of agent-based evolution experiments, in particular by implementing specific selection pressures on the prey that are discussed in the animal behavior literature.
More broadly, in the past decade researchers have focused on the application of locally interacting swarming agents to optimization problems, called particle swarm optimization (PSO) . PSO applications range from feature selection for classifiers  to video processing  to open vehicle routing . A related technique within PSO seeks to combine PSO with coevolving predator and prey solutions to avoid local minima , and has proven effective in other evolutionary computation domains as well . Researchers have even sought to harness the collective problem-solving power of swarming agents to design robust autonomous robotic swarms . Thus, elaborations on the foundations of animal grouping behavior have the potential to improve our ability to solve engineering problems.
To study the evolution of the selfish herd, we developed an agent-based model in which agents interact in a continuous, toroidal virtual environment (736 × 736 virtual meters), shown in Figure 2. At the beginning of each simulation, we place 250 agents in the environment at uniformly random locations. These agents are treated as “virtual prey.” Each agent is controlled by a Markov network (MN), which is a probabilistic controller that makes movement decisions based on a combination of sensory input (i.e., vision) and internal states (i.e., memory) . We evolve the agent MNs with a genetic algorithm (GA) [11, 14] under varying selection regimes, which will be described in more detail below.
During each simulation time step, all agents read information from their sensors and take action (i.e., move) based on their effectors. In our first set of treatments, we simulate an ideal, disembodied predator by periodically removing prey agents from the environment and marking them as consumed—for example, when they are on the outermost edges of the group. Subsequent treatments introduce an embodied, coevolving predator agent that is controlled by its own MN. The data1 and source code2 from these experiments are available online for further analysis. In the remainder of this section, we describe the sensory-motor architecture of individual agents and present details related to the function and encoding of MNs.
3.1 Agent Model
Figure 3 depicts the sensory-motor architecture of the agents used for this study. A prey agent can sense predators and conspecifics with a limited-distance (200 virtual meters), pixelated retina covering its entire 360° visual field. Its retina is split into 24 even slices, each covering an arc of 15°, which is an abstraction of the broad, coarse visual systems often observed in grouping prey . Regardless of the number of agents present in a single retina slice, the prey agent only knows whether a conspecific or a predator resides within that slice, but not how many. For example, in Figure 3, the fourth retina slice to the right of the agent's heading (labeled “A”) has both the predator and prey sensors activated, because there are two predator agents and a prey agent inside that slice. Once provided with its sensory information, the prey agent chooses one of four discrete actions, as shown in Table 1. Prey agents turn in 8° increments and move 1 virtual meter each time step.
|Output L .||Output R .||Encoded action .|
|Output L .||Output R .||Encoded action .|
Notes. Each output pair encodes a discrete action taken by the agent. The agent's MN changes the values stored in output states L and R to indicate the action it has decided to take in the next simulation time step.
In our coevolution experiments, the predator agents can detect only nearby prey agents, using a limited-distance (200 virtual meters), pixelated retina covering its frontal 180° that works just like the prey agent's retina (Figure 3). Similarly to the prey agents, predators make decisions about how to move next using their MN, as shown in Table 1, but move 3 times faster than the prey agents and turn correspondingly slower (6° per simulation time step) due to their higher speed. This dramatically faster predator movement speed is meant to represent predators that perform rapid attacks on groups of prey, such as a peregrine falcon dive-bombing a swarm of starlings. Finally, if a predator agent moves within 5 virtual meters of a prey agent that is anywhere within its retina, the predator agent attempts an attack on the prey agent. If the attempt is successful, we remove the prey agent from the simulation and mark it as consumed.
3.2 Markov Networks
Each agent is controlled by its own Markov network (MN), which is a probabilistic controller that makes decisions about how the agent interacts with the environment and other agents within that environment. Since a MN is responsible for the control decisions of its agent, it can be thought of as an artificial brain for the agent it controls. Although we specifically use MNs as the artificial brains in these experiments, other artificial brains such as artificial neural networks, genetic programming, or many other evolvable substrates that can produce agent-based behavior based on sensory inputs could also be used in these experiments.
Every simulation time step, the MNs receive input via sensors (e.g., visual retina), perform a computation on inputs and any hidden states (i.e., memory), then place the result of the computation into hidden or output states (e.g., actuators). We note that MN states are binary and only assume a value of 0 or 1. When we evolve MNs with a GA, mutations affect (1) which states the MN pays attention to as input, (2) which states the MN outputs the result of its computation to, and (3) the internal logic that converts the input into the corresponding output.
3.2.1 How Markov Networks Function
When we embed an agent into the simulation environment, we provide sensory inputs from its retina into its MN every simulation step (Figure 3, labeled “retina” and “Markov network,” respectively). Once we provide a MN with its inputs, we activate it and allow it to store the result of the computation into its hidden and output states for the next time step. MNs are networks of Markov gates (MGs), which perform the computation for the MN. In Figure 4, we see two example MGs, labeled “Gate 1” and “Gate 2.” At time t, gate 1 receives sensory input from states 0 and 2 and retrieves state information (i.e., memory) from state 4. At time t + 1, gate 1 then stores its output in hidden state 4 and output state 6. Similarly, at time t gate 2 receives sensory input from state 2 and retrieves state information in state 6, then places its output into states 6 and 7 at time step t + 1. When MGs place their output into the same state, the outputs are combined into a single output using the or logic function. Thus, the MN uses information from the environment and its memory to decide where to move in the next time step t + 1.
In a MN, states are updated by MGs, which function similarly to digital logic gates, such as and and or. A digital logic gate, such as xor, reads two binary states as input and outputs a single binary value according to the xor logic. Similarly, MGs output binary values based on their input, but do so with a probabilistic logic table. Table 2 shows an example MG that could be used to control a prey agent that avoids nearby predator agents. For example, if a predator is to the right of the prey's heading (i.e., PL = 0 and PR = 1, corresponding to the second row of this table), then the outputs are move forward (MF) with a 20% chance, turn right (TR) with a 5% chance, turn left (TL) with a 65% chance, and stay still (SS) with a 10% chance. Thus, due to this probabilistic input-output mapping, the agent MNs are capable of producing stochastic agent behavior.
|PL .||PR .||P(MF) .||P(TR) .||P(TL) .||P(SS) .|
|PL .||PR .||P(MF) .||P(TR) .||P(TL) .||P(SS) .|
Notes. PL and PR correspond to the predator sensors just to the left and right of the agent's heading, respectively, as shown in Figure 3. The columns labeled P(X) indicate the probability of the MG deciding on action X given the corresponding input pair. MF = move forward; TR = turn right; TL = turn left; SS = stay still.
The MGs in this model can receive input from a maximum of four states, and write into a maximum of four states, with a minimum of one input and one output state for each MG. Any state (input, output, or hidden) in the MN can be used as an input or output for a MG. MNs can be composed of any number of MGs, and the MGs are what define the internal logic of the MN. Thus, to evolve a MN, mutations change the connections between states and MGs, and modify the probabilistic logic tables that describe each MG. Mutations act directly on the genetic encoding of the MN, which is described next.
3.2.2 Genetic Encoding of Markov Networks
We use a circular string of bytes as a genome, which contains all the information necessary to describe a MN. The genome is composed of genes, and each gene encodes a single MG. Therefore, a gene contains the information about which states the MG reads input from, which states the MG writes its output to, and the probability table defining the logic of the MG. The start of a gene is indicated by a start codon, which is represented by the sequence (42, 213) in the genome.
Figure 5 depicts an example genome. After the start codon, the next two bytes describe the numbers of inputs (Nin) and outputs (Nout) used in this MG, where each N = 1 + (byte mod Nmax). Here, Nmax = 4. The following Nmax bytes specify which states the MG reads from by mapping to a state ID number with the function (byte mod Nstates), where Nstates is the total number of input, output, and hidden states. Similarly, the next Nmax bytes encode which states the MG writes to with the same equation as Nin. If too many inputs or outputs are specified, the remaining sites in that section of the gene are ignored, designated by the # signs. The remaining 2Nin+Nout bytes of the gene determine the probabilities in the logic table.
The maximum number of states allowed and which states are used as inputs and outputs are specified as constants by the user. In these experiments, we provided 64 states for the MNs to work with: 24 sensory inputs, 2 outputs for the actuators, and 38 hidden states for optional internal computations. Combined with these constants, the genome described above unambiguously defines a MN.
All evolutionary changes such as point mutations, duplications, deletions, or crossover are performed on the byte string genome, with probabilities as shown in Table 3. During a point mutation, a random byte in the genome is replaced with a new byte drawn from a uniform random distribution. If a duplication event occurs, two random positions are chosen in the genome and all bytes between those points are duplicated into another part of the genome. Similarly, when a deletion event occurs, two random positions are chosen in the genome and all bytes between those points are deleted. Crossover for MNs is not implemented in this experiment, to allow for a succinct reconstruction of the line of descent of the population  (described further below), which is a useful tool in evolutionary studies that we harness in this article.
|GA parameter .||Value .|
|Per-gene mutation rate||1%|
|Gene duplication rate||5%|
|Gene deletion rate||2%|
|GA parameter .||Value .|
|Per-gene mutation rate||1%|
|Gene duplication rate||5%|
|Gene deletion rate||2%|
4 Artificial Predation
In all cases, we give the prey an initial 250 simulation time steps without predation to move around, so that prey starting on the exterior of the group have the chance to move toward the center of the group if they wish to. Once the initial 250 simulation time steps elapse, we apply artificial predation every 4 simulation time steps to simulate an ideal predator attacking the group. Artificial predators succeed in their attacks every time. We limit the artificial predator attack rate to one attack attempt every 4 simulation time steps, which is called the handling time. The handling time represents the time it takes the simulated predator to consume and digest a prey after successful prey capture, or the time it takes to refocus on another prey in the case of an unsuccessful attack attempt. We selected a handling time of 4 because it reduces the herd of prey down to 25% of its original size by the end of the simulation, therefore applying strong selection pressure for survivorship in the herd.
For each experiment, we characterize the grouping behavior by measuring the swarm density of the entire prey population every generation . We measure the swarm density as the mean number of prey within 30 virtual meters of each other over a life span of 1,000 simulation time steps, which we have experimentally shown to differentiate between swarming and non-swarming behavior in previous published experiments . Qualitatively, a swarm density ≥ 15 indicates cohesive swarming behavior, between 15 and 5 loosely grouping behavior, and ≤ 5 random, non-grouping behavior. Thus, the swarm density captures how cohesively the prey are swarming, or whether the prey are even grouping at all.
In the following sections, we study the effect of four different attack modes on the evolution of swarming behavior: uncorrelated random attacks (Figure 6a), correlated random attacks (random walk attacks, Figure 6b), peripheral attacks (Figure 6c), and attacks that target the densest area of the swarm (Figure 6d).
4.1 Random Attacks
Our initial study sought to verify Hamilton's selfish herd hypothesis by modeling evolving prey under attack by predators that ambush prey from a random location in the simulation environment. If the selfish herd hypothesis holds, we expect prey to minimize their domain of danger by placing as many conspecifics as possible around the predators . Similarly to previous models studying the selfish herd , a random attack proceeds by selecting a uniformly random location inside the simulation space, then attacking the prey closest to that location, as shown in Figure 6a.
As seen in Figure 7, swarming behavior is weakly selected for when the predators make uniformly random attacks on the prey3 (light gray triangles). In particular, we found that prey took upwards of 5,000 generations to evolve cohesive swarming behavior when experiencing random attacks, compared to less than 1,000 generations with the other attack modes. However, even random attacks selected for more cohesive swarming behavior than no attacks at all, which resulted in completely dispersive behavior (Figure 7, light gray stars).
This finding has an important implication, namely that one of the original assumptions of the selfish herd hypothesis—that the predator attack mode has no effect on the evolution of swarming behavior—is not corroborated by this model. Following this discovery, we hypothesized that the directionality of the predators' attacks plays a critical role in the evolution of the selfish herd. To test this hypothesis, we next explore two different predator attack modes, each with its own distinct directionality of predation.
4.2 Random Walk Attacks
Our next experiment alters the mode of predation from a predator that attacks randomly selected locations to a predator that follows a random walk within the simulation environment. As shown in Figure 6b, after each attack made by this predator, it is then moved to a random location within 50 virtual meters of its previous location. This models a predator that persistently feeds on a group of prey, rather than ambushing.
Figure 7 shows that swarming evolved quickly when prey were attacked by a predator following a random walk4 (dark gray circles). Notably, even by generation 40,000, prey experiencing random walk attacks formed significantly more cohesive swarms than prey experiencing random attacks. Thus, the random walk predator attack mode appears to capture an important aspect of predation that selects for swarming behavior.
4.3 Outside Attacks
In the last of our initial artificial predation experiments, we simulate a predator that always approaches from outside the group and attacks the prey nearest to it, as in . This predator attack mode effectively has the predators consistently attacking prey on the outer edges of the group. As shown in Figure 6c, we simulate this predator attack mode by first choosing a random angle outside the group for the predator to approach from. Once an angle is chosen, we convert the angle into a location on the edge of the visible simulation space and attack the prey nearest to that location.
As shown in Figure 7, this form of predation has the most significant influence on the evolution of the selfish herd so far. When attacked by predators that consistently target prey on the edges of the group, prey quickly evolve cohesive swarming behavior5 (black squares). Taken together, the results of these artificial predation experiments demonstrate another discovery of this work: The more predators attack prey in the outer parts of the group, the faster the selfish herd will evolve.
One translation of this finding is that in order for the selfish herd to evolve, prey must experience a higher predation rate in the outer parts of the group than in the middle of the group. While this phenomenon can be explained by each prey having a domain of danger (DOD) influenced by its relative position in the group [18, 25, 39], an alternative hypothesis is that of density-dependent predation.
4.4 Density-Dependent Predation
Figure 8 demonstrates the effect of density-dependent predation on the previous artificial predation experiments. Just as before, when predators did not preferentially attack prey in the outer parts of the group, as in the random attack experiment (light gray triangles), swarming behavior took much longer to evolve. In contrast, when the predators followed a random walk (dark gray circles) or always attacked from outside the group (black squares), prey experiencing density-dependent predation again quickly evolved swarming behavior. The most noticeable effect of density-dependent predation is on the random attack treatment, where the swarm density measurement at generation 5,000 increased from 11.19 ± 2.58 (mean ± 2 standard errors) to 17.61 ± 2.72, indicating significantly stronger selection for swarming.
4.5 High-Density Area Attacks
Thus far, we have explored attack modes that select for the evolution of swarming behavior. It is not surprising that there are also attack modes exhibited by natural predators that must select against swarming behavior in their prey. For example, blue whales (Balaenoptera musculus) are known to dive into the densest areas in swarms of krill, consuming hundreds of thousands of krill in the middle of the swarm in a single attack . We call this mode of attack a high-density area attack. Such an attack clearly selects against swarming behavior, because it targets the prey that swarm the most. If krill swarms consistently experience these high-density area attacks, then why do they still evolve swarming behavior?
It is important to note that krill swarms are also fed on by smaller species, such as crabeater seals (Lobodon carcinophagus), that consistently attack the krill from outside the swarm . Thus, krill swarms are experiencing two attack modes simultaneously: high-density area attacks from whales, and outside attacks from crabeater seals. Thus, it is possible that the selection pressure to swarm from outside attacks (Figure 7) could outweigh the selection pressure to disperse from high-density area attacks.
As shown in Figure 6d, we model high-density area attacks as an artificial attack that always targets the prey at the most dense area of the swarm (i.e., highest Adensity). We note that this attack mode is the opposite of the density-dependent mechanism explored in the previous section, which favors predators that target prey in the least dense area of the swarm. Once the target is selected, we execute the attack by removing the target prey and all other prey within 30 virtual meters of the target prey. Outside attacks are modeled as described above. To study the effect of high-density area attacks on the evolution of swarming behavior, we allow the prey to evolve while experiencing both attack modes simultaneously. We vary the relative handling times of both attacks (Table 4) to explore whether relative attack frequency could explain why some swarming animals evolved swarming behavior despite the fact that they experience high-density area attacks.
|HDAA? .||Outside attack frequency .||HDAA frequency .|
|HDAA? .||Outside attack frequency .||HDAA frequency .|
Notes. The values listed for each treatment are the handling times for the corresponding predator attack mode.
As shown in Figure 9, prey experiencing only outside attacks quickly evolve cohesive swarming behavior (light gray triangles). However, when we introduce infrequent high-density area attacks (dark gray circles), the selection pressure for prey to swarm is reduced. Finally, when we introduce frequent high-density area attacks (black squares), prey do not evolve swarming behavior at all. Thus, one possible explanation for animals evolving swarming behavior despite experiencing high-density area attacks is that the high-density area attacks are too infrequent relative to other attack types to exert a strong enough selection pressure for prey to disperse.
In summary, the artificial predation experiments provided us with two important findings regarding the evolution of the selfish herd: (1) attacks on prey on the periphery of the herd exert a strong selection pressure for prey to swarm, and (2) prey in less dense areas, such as those in the outer parts of the herd, must experience a higher predation rate than in areas of dense prey, such as those in the middle of the herd.
5 Predator-Prey Coevolution
Building upon the artificial predation experiments, we implemented density-dependent predation in a predator-prey coevolution experiment. Adding predators into the simulation environment enables us to observe how embodied coevolving predators affect the evolution of the selfish herd.
To evaluate the coevolved predators and prey quantitatively, we obtained the line of descent (LOD) for every replicate by tracing the ancestors of the fittest prey MN in the final population until we reached the randomly generated ancestral MN with which the starting population was seeded (see  for an introduction to the concept of a LOD in the context of digital evolution). We again characterized the prey grouping behavior by measuring the swarm density of the entire prey population every generation.
Figure 10 depicts the prey behavior measurements for the coevolution experiments with density-dependent predation6 (black circles; mean swarm density at generation 1,200 ± two standard errors: 26.2 ± 2.3) and without density-dependent predation (light gray triangles; 3.9 ± 0.8). Without density-dependent predation, the prey evolved purely dispersive behavior as a mechanism to escape the predators, even after 10,000 generations of evolution (see Figure S1 in the online supplement http://www.mitpressjournals.org/doi/suppl/10.1162/ARTL_a_00206). In contrast, with density-dependent predation, the prey quickly evolved cohesive swarming behavior in response to attacks from the predators, within 400 generations. As expected, the coevolving predators adapted to the prey swarming behavior in the density-dependent treatments by focusing on prey on the edges of the swarm, where the density of prey was lowest. As a caveat, density-dependent predation only selects for cohesive swarming behavior when the predators are faster than the prey (Figure S2 in the online supplement http://www.mitpressjournals.org/doi/suppl/10.1162/ARTL_a_00206), which corroborates earlier findings exploring the role of relative predator-prey speeds in the evolution of swarming behavior .
Here we see that density-dependent predation provides a sufficient selective advantage for prey to evolve the selfish herd in response to predation by coevolving predators, despite the fact that swarming prey experience an increased attack rate from the predators due to this behavior (see ; Figures S3 and S4 in the online supplement http://www.mitpressjournals.org/doi/suppl/10.1162/ARTL_a_00206). Accordingly, these results uphold Hamilton's hypothesis that grouping behavior could evolve in animals purely for selfish reasons, without the need for an explanation that involves the benefits to the whole group . Moreover, the discoveries in this work refine the selfish herd hypothesis by clarifying the effect that different attack modes have on the evolution of the selfish herd.
6 Evolved Prey Markov Network Analysis
Now that we have evolved emergent swarming behavior in an agent-based model under several different treatments, we can analyze the resulting Markov networks (MNs) to gain a deeper understanding of the individual-based mechanisms underlying swarming behavior. For this analysis, we chose the most-abundant prey MN from each of the outside attack artificial predation experiment replicates, resulting in 100 MNs that exhibit swarming behavior.
First, we analyze the structure of the 100 MNs by looking at the specific retina sensors that the MNs evolved to connect to. As shown in Figure 11, the prey MNs show a strong bias for connecting to the prey-specific retina sensors in front of the prey, but not to the sides. Strangely, there appears to be a strong preference to connect to the front right sensor but not the front left sensor, which is an artefact of the fact that the front right sensor is the only sensor that activates when other prey are directly in front of the prey. Additionally, some of the prey MNs show a preference for connecting to the prey-specific retina sensors behind the prey. From this analysis alone, we can deduce that the retina sensors that are most conducive to swarming behavior are in front of the prey agent.
To understand how prey make movement decisions based on their sensory inputs, we map every possible input combination in the prey's retina to the corresponding movement decision that the prey made. This mapping is accomplished by generating all 224 possible input combinations (000000000000000000000000, 000000000000000000000001, 000000000000000000000010, etc.) and passing them into the evolved MN as a simulated sensory input. Upon activating the MN, we receive an output that corresponds to the action that the prey decided to make in response to the simulated sensory input. Due to the stochastic nature of MNs, the prey agents do not always make the same movement decision when given the same input. Thus, we take the most likely output from 1,000 repeats as the representative decision for a given sensory input combination. Effectively, this process produces a truth table that maps every possible sensory input to its corresponding movement decision. An example truth table can be seen in Table 5.
|Sensory input .||Corresponding output .|
|Sensory input .||Corresponding output .|
Once we have the truth table of all 224 input-output mappings, we pass it to the logic minimization software espresso , which eliminates the inputs that have no effect on the outputs and provides the minimal representative logic of the truth table. This process results in a truth table that is reduced enough to make the evolved prey behavior comprehensible by humans. An example output minimal logic table can be seen in Table 6.
|Input 12 .||Input 19 .||Corresponding output .|
|Input 12 .||Input 19 .||Corresponding output .|
Notes. Input 12 corresponds to a frontal sensor, whereas input 19 corresponds to a back-right sensor, where 1 indicates that the sensor detects a prey agent and 0 means no prey are in that sensor. The output 01 translates into the agent turning right, and the output 00 translates into the agent moving forward. Thus, this example agent moves forward if it sees anything in its frontal sensor. Otherwise, the agent turns right if it sees another prey in its back-right sensor or if it sees nothing at all.
Surprisingly, the individual-based mechanisms underlying the emergent swarming behavior are remarkably simple. Most of the prey MNs evolved to make their movement decisions depend on only one prey sensor in front of the prey agent. If the prey sensor does not detect another prey agent, the agent repeatedly turns in one direction until it detects another prey agent in that sensor. Once the agent detects another prey agent in the sensor, it moves forward until the agent is no longer visible. This mechanism alone proved sufficient to produce cohesive swarming behavior in the majority of our experiments. Interestingly, this discovery corroborates the findings in earlier studies suggesting that complex swarming behavior can emerge from simple movement rules when applied over a population of locally interacting agents [40, 61, 50].
In a small subset of the evolved prey MNs, we observe MNs that occasionally connect to one of the prey sensors behind them. These MNs watch for a prey agent to appear in a single prey sensor behind the agent and turn repeatedly in one direction until a prey agent is no longer visible in that sensor. Once no prey agent is visible in the back sensor, the MN moves forward or turns, depending on the state of the frontal sensor. We note that this mechanism only evolved in prey MNs that already exhibited swarming behavior using one of the frontal sensors, which suggests that this mechanism does not play a major role in swarming behavior. Instead, this mechanism seems to cause the prey agent to turn toward the center of the swarm instead of swarming in a circle with the rest of the prey agents. This mechanism can be thought of as a “selfish herd” mechanism that attempts to selfishly move the agent toward the center of the swarm to avoid predation.
7 Conclusions and Future Work
The contributions of this work are as follows. First, we demonstrate Hamilton's selfish herd hypothesis in a digital evolutionary model and highlight that it is the attack mode of the predator that critically determines the evolvability of swarming behavior. Second, we show that density-dependent predation is sufficient for the selfish herd to evolve as long as the predators cannot consistently attack prey in the middle of the group. Finally, we show that density-dependent predation is sufficient to evolve grouping behavior in prey as a response to predation by coevolving predators. Consequently, future work exploring the evolution of the selfish herd in animals should consider not only the behavior of the prey in the group, but the attack mode of the predators as well. Following these experiments, we analyzed the evolved control algorithms of the swarming prey and identified simple, biologically plausible agent-based algorithms that produce emergent swarming behavior, including a mechanism that produces “selfish” behavior that drives the prey toward the center of the swarm.
Of course, the evolved prey behavior shown in the videos accompanying this article may not closely resemble the anti-predator behavior of many species of group-living prey that we observe in nature. We provide these videos to demonstrate that grouping-like behavior has indeed evolved—and to confirm that the swarm density count metric accurately captures when the prey evolve grouping-like behavior— but we do not seek to claim that we have evolved a particular behavioral phenotype that would match the grouping behavior we observe in nature. Presumably such grouping behavior has been selected for by a variety of environmental factors that are not completely captured in this model. Including those factors would make a fascinating venue of research in the future.
While this work shows one method by which the the evolution of grouping behavior can be studied, there remain many different hypotheses explaining the evolution of grouping behavior . Our future work in this area will focus on directly exploring these hypotheses in similar digital evolutionary models, as detailed in .
We thank the three anonymous reviewers for their many insightful comments and suggestions. This research has been supported in part by the National Science Foundation (NSF) BEACON Center under Cooperative Agreement DBI-0939454, by NSF grant OCI-1122617, and by Michigan State University through computational resources provided by the Institute for Cyber-Enabled Research. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the NSF.
Video: evolution of prey under random attack treatment: http://dx.doi.org/10.6084/m9.figshare.658857
Video: evolution of prey under random walk treatment: http://dx.doi.org/10.6084/m9.figshare.658856
Video: evolution of prey under outside attack treatment: http://dx.doi.org/10.6084/m9.figshare.658854
Video: prey from predator-prey coevolution treatment: http://dx.doi.org/10.6084/m9.figshare.658855
Department of Computer Science and Engineering, and BEACON Center for the Study of Evolution in Action, Michigan State University, East Lansing, MI 48824. E-mail: firstname.lastname@example.org
Department of Microbiology and Molecular Genetics, and BEACON Center for the Study of Evolution in Action, Michigan State University, East Lansing, MI 48824. E-mail: email@example.com
Department of Microbiology and Molecular Genetics, Department of Physics and Astronomy, and BEACON Center for the Study of Evolution in Action, Michigan State University, East Lansing, MI 48824. E-mail: firstname.lastname@example.org