The reason why many animals organize themselves within herds is not necessarily the result of gregariousness or social behaviour. One example is seals: On their own, they are easy prey for orcas or sharks. Instead, it is much safer within a group, because then the danger of an attack is spread out among many individuals. It is safest in the middle of the group where animals are crowding together in a very small space and an attack there is more likely to target a close neighbor than oneself. At the edge of the group with only a few neighbours, on the other hand, the predation risk is considerably larger. Each animal therefore tries to get to one of the coveted spots in the middle.
With the help of artificial intelligence (reinforcement learning), we studied how individuals must alter their positions optimally to keep the distance between themselves and others as small as possible, which, in turn, reduces their own risk of being attacked. Because this strategy increases the risk for neighbours, it is clearly considered a selfish motivation. Just as Hamilton predicted, we observed that individuals that were spread out at first then formed a dense herd, because this decreases their distance to neighbours and thus reduces the individual risk of being attacked.
Their simulations show that the time-averaged predation risk is exactly equal for all individuals. Obviously, members at the centre of the herd are not able to defend such advantageous positions as other animals push towards this coveted spot. This is a result of the high dynamics within the group which makes it impossible for individuals to maintain specific optimal positions. Another interesting observation is, that as a result of this permanent competition for the best positions within the group, the group begins to rotate around its gravitational centre, similar to what is observed in many herds of animals. Our study shows that the formation of groups must not necessarily result from their gregarious behaviors but can be also explained by entirely selfish motivations of individuals to gain an advantage at the expense of others. Apart from its consequences in understanding collective behaviors in living systems, the results may also be useful in context of finding optimal strategies how autonomous robotic devices have to be programmed to master collective tasks.