Resource Availability and the Evolution of Cooperation in ...

9
Resource Availability and the Evolution of Cooperation in a 3D Agent-Based Simulation Lara Dal Molin University of St Andrews St Andrews, United Kingdom [email protected] Jasmeen Kanwal University of St Andrews St Andrews, United Kingdom [email protected] Christopher Stone University of St Andrews St Andrews, United Kingdom [email protected] ABSTRACT There is evidence of a relationship between the dynamics of re- source availability and the evolution of cooperative behaviour in complex networks. Previous studies have used mathematical mod- els, agent-based models, and studies of hunter-gatherer societies to investigate the causal mechanisms behind this relationship. Here, we present a novel, agent-based software system, built using Unity 3D, which we employ to investigate the adaptation of food shar- ing networks to fluctuating resource availability. As a benefit of using Unity, our system possesses an easily customisable, visually compelling interface where evolution can be observed in real-time. Across four types of populations, under three environmental condi- tions, we performed a quantitative analysis of the evolving structure of social interactions. A biologically-inspired gene-sequencing func- tion translates an arbitrarily extendable genome into phenotypic behaviour. Our results contribute to the understanding of how re- source availability affects the evolutionary path taken by artificial societies. It emerges that environmental conditions have a greater impact on social evolution compared to the initial genetic config- urations of each society. In particular, we find that scenarios of periodically fluctuating resources lead to the evolution of stable, tightly organised societies, which form small, local, mutualistic food-sharing networks. CCS CONCEPTS Computing methodologies Modelling and simulation; Applied computing Life and medical sciences; Computa- tional biology. KEYWORDS Artificial Life, Evolution of Cooperation, Social Networks, Resource Availability, Dynamic Environments School of Computer Science School of Biology School of Computer Science All authors contributed equally to this research. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. GECCO ’21, July 10–14, 2021, Lille, France © 2021 Copyright held by the owner/author(s). Publication rights licensed to ACM. ACM ISBN 978-1-4503-8350-9/21/07. https://doi.org/10.1145/3449639.3459380 ACM Reference Format: Lara Dal Molin, Jasmeen Kanwal, and Christopher Stone. 2021. Resource Availability and the Evolution of Cooperation in a 3D Agent-Based Simula- tion. In 2021 Genetic and Evolutionary Computation Conference (GECCO’21), July 10–14, 2021, Lille, France. ACM, New York, NY, USA, 9 pages. https: //doi.org/10.1145/3449639.3459380 1 INTRODUCTION In this study, we present an agent-based model to investigate the evolution of cooperation under fluctuating resource availability. The primary objective of this model is to provide insight into the interplay between genetics and the environment in complex co- operative networks. The model is instantiated through a software system for simulating social evolution build with Unity 3D [24], a game engine equipped with high-quality physics and rendering capabilities. The system, still under development, is part of our long-term endeavour to contribute to the development of highly reusable software platforms for the analysis of social evolution. The experiments we present in this study illustrate one usage of the platform, that is to investigate how environmental factors influ- ence the evolution of complex social networks. We implement four types of artificial societies, each with initial gene values that reflect different levels of social bonding and resource sharing behaviour. All four societies are examined under three environmental condi- tions: a uniform supply of resources over time, a rapidly fluctuating periodic supply, and an increasingly scarce supply. We present two main findings. First, we observe that the environment in which the populations exist has a greater impact on their evolutionary path- way compared to their initial gene values. Indeed, all four types of populations within a single resource-availability scenario converge to similar configurations after approximately 40 generations. This shows strong adaptive capability across all societies, and suggests that environmental conditions play a critical role in the evolution of cooperation. Second, we find that, in cases of periodically fluctuat- ing resources, societies tend to evolve into tightly-organised, small, mutualistic communities, resembling the structure of families or clans. In the following sections, we provide relevant background to this research and subsequently delve into the details of the experi- ments’ design and results. 2 BACKGROUND The appearance of design in living organisms can be explained by natural selection: heritable traits associated with greater individual reproductive success tend to accumulate in a population, and in- dividuals thus appear as if designed to maximise their own fitness [4]. However, as it may be be observed within natural systems, this 93

Transcript of Resource Availability and the Evolution of Cooperation in ...

Resource Availability and the Evolution of Cooperation in a 3DAgent-Based Simulation

Lara Dal Molin∗University of St Andrews

St Andrews, United [email protected]

Jasmeen Kanwal†University of St Andrews

St Andrews, United [email protected]

Christopher Stone‡University of St Andrews

St Andrews, United [email protected]

ABSTRACTThere is evidence of a relationship between the dynamics of re-source availability and the evolution of cooperative behaviour incomplex networks. Previous studies have used mathematical mod-els, agent-based models, and studies of hunter-gatherer societies toinvestigate the causal mechanisms behind this relationship. Here,we present a novel, agent-based software system, built using Unity3D, which we employ to investigate the adaptation of food shar-ing networks to fluctuating resource availability. As a benefit ofusing Unity, our system possesses an easily customisable, visuallycompelling interface where evolution can be observed in real-time.Across four types of populations, under three environmental condi-tions, we performed a quantitative analysis of the evolving structureof social interactions. A biologically-inspired gene-sequencing func-tion translates an arbitrarily extendable genome into phenotypicbehaviour. Our results contribute to the understanding of how re-source availability affects the evolutionary path taken by artificialsocieties. It emerges that environmental conditions have a greaterimpact on social evolution compared to the initial genetic config-urations of each society. In particular, we find that scenarios ofperiodically fluctuating resources lead to the evolution of stable,tightly organised societies, which form small, local, mutualisticfood-sharing networks.

CCS CONCEPTS• Computing methodologies → Modelling and simulation; •Applied computing → Life and medical sciences; Computa-tional biology.

KEYWORDSArtificial Life, Evolution of Cooperation, Social Networks, ResourceAvailability, Dynamic Environments∗School of Computer Science†School of Biology‡School of Computer Science

All authors contributed equally to this research.

Permission to make digital or hard copies of all or part of this work for personal orclassroom use is granted without fee provided that copies are not made or distributedfor profit or commercial advantage and that copies bear this notice and the full citationon the first page. Copyrights for components of this work owned by others than theauthor(s) must be honored. Abstracting with credit is permitted. To copy otherwise, orrepublish, to post on servers or to redistribute to lists, requires prior specific permissionand/or a fee. Request permissions from [email protected] ’21, July 10–14, 2021, Lille, France© 2021 Copyright held by the owner/author(s). Publication rights licensed to ACM.ACM ISBN 978-1-4503-8350-9/21/07.https://doi.org/10.1145/3449639.3459380

ACM Reference Format:Lara Dal Molin, Jasmeen Kanwal, and Christopher Stone. 2021. ResourceAvailability and the Evolution of Cooperation in a 3D Agent-Based Simula-tion. In 2021 Genetic and Evolutionary Computation Conference (GECCO’21),July 10–14, 2021, Lille, France. ACM, New York, NY, USA, 9 pages. https://doi.org/10.1145/3449639.3459380

1 INTRODUCTIONIn this study, we present an agent-based model to investigate theevolution of cooperation under fluctuating resource availability.The primary objective of this model is to provide insight into theinterplay between genetics and the environment in complex co-operative networks. The model is instantiated through a softwaresystem for simulating social evolution build with Unity 3D [24],a game engine equipped with high-quality physics and renderingcapabilities. The system, still under development, is part of ourlong-term endeavour to contribute to the development of highlyreusable software platforms for the analysis of social evolution. Theexperiments we present in this study illustrate one usage of theplatform, that is to investigate how environmental factors influ-ence the evolution of complex social networks. We implement fourtypes of artificial societies, each with initial gene values that reflectdifferent levels of social bonding and resource sharing behaviour.All four societies are examined under three environmental condi-tions: a uniform supply of resources over time, a rapidly fluctuatingperiodic supply, and an increasingly scarce supply. We present twomain findings. First, we observe that the environment in which thepopulations exist has a greater impact on their evolutionary path-way compared to their initial gene values. Indeed, all four types ofpopulations within a single resource-availability scenario convergeto similar configurations after approximately 40 generations. Thisshows strong adaptive capability across all societies, and suggeststhat environmental conditions play a critical role in the evolution ofcooperation. Second, we find that, in cases of periodically fluctuat-ing resources, societies tend to evolve into tightly-organised, small,mutualistic communities, resembling the structure of families orclans. In the following sections, we provide relevant background tothis research and subsequently delve into the details of the experi-ments’ design and results.

2 BACKGROUNDThe appearance of design in living organisms can be explained bynatural selection: heritable traits associated with greater individualreproductive success tend to accumulate in a population, and in-dividuals thus appear as if designed to maximise their own fitness[4]. However, as it may be be observed within natural systems, this

93

GECCO ’21, July 10–14, 2021, Lille, France Lara Dal Molin, Jasmeen Kanwal, and Christopher Stone

does not translate exclusively into selfish behaviours. The divisionof labour into reproductive and non-reproductive castes of someinsect species, known as eusociality, is perhaps the most strikingexample of this [26]. Other instance are: alloparenting, where in-dividuals care for others’ offspring [13]; fruiting body formation,where microbes in a colony work together to help only a smallproportion disperse [2]; and costly signalling, where an individ-ual endangers themselves to warn others of a threat [5]. Hamiltonfamously proposed that traits evolve to maximise not individualfitness, but inclusive fitness [9]. Inclusive fitness is the sum of anindividual’s direct fitness and her indirect fitness, which is thecomponent pertaining to her social partners, modulated by theirrelatedness to her. In this case, higher relatedness means a greaterindirect fitness component. Hamilton’s theory of social evolutionthus predicts that relatedness is a key explanatory element in theevolution of cooperative behaviour, defined as actions that benefitthe fitness of another individual [25].

Theoretical models in several studies have hypothesised a re-lationship between environmental resources and the evolution ofcooperation [8, 20, 23]. Notably, Gurven et al. suggest that varia-tions in resource sharing may be based on social group size andindividual proximity, and Rautman observes that social and environ-mental factors foster the establishment of connections in local areas[7] [18]. Human population studies lend support to these findings.A cross-cultural analysis of hunter-gatherer societies has shown acorrelation between population density, available resource density,and socio-economic complexity [12]. Further studies find a correla-tion between variations in resource sharing and both group size andproximity [7, 10]. Research conducted on prehistoric populationsindicates that the formation of social networks within a region mayhave reduced the risk of resource stress by allowing food sharingduring periods of poor local productivity [18]. A laboratory studywith human participants interacting in a virtual world found thatpeople are predisposed to form reciprocal trading relationships insituations with highly variant resource availability [11].

Particularly relevant for this study are previously implementedcomputer simulations and agent-based models. In the evolutionarycomputing community, common experimentation platforms forsuch purposes include NetLogo [22] and Avida [1]. The 1990s sawthe rise of simulation- and agent-based models within the field ofartificial life. Prominently, Ray and Hart presented Tierra, a sim-ulation in which self-replicating machine code programs evolve,interact and differentiate [19]. In 1994, Yaeger proposed Polyworld,a simulation environment in which artificial agents evolve accord-ing to natural selection [27]. Additionally, in a similar traditionto our platform, Rouly employ agent-based models to investigateproperties of complex social networks, highlighting the appropri-ateness of agent-based models for the investigation of biologicalphenomena [15, 21]. The relationship between resource availabilityand the evolution of cooperation has also been studied throughagent-based models. A recently implemented model investigatesthe relationship between resource availability and environmentalconditions: Pereda et al. finds that when a certain level of envi-ronmental pressure, in the form of resource instability, is reached,cooperative food sharing behaviour is favoured to evolve within anon-reproducing population [17]. Another model finds that whenagents compete for finite, non-stationary resources, the properties

of the system depend on the rate of change of resource availabil-ity [14]. In contrast to our study, the two previously mentionedemploy fully numerical, non-spatial models. Here, we use a novel,biologically-inspired artificial life software system, to explore morefine-grained characteristics of the relationship between resourceavailability and the evolution of cooperation.

3 METHODOLOGY3.1 Software systemOur software system is built using Unity 3D, a game engine withbuilt-in physics and a high degree of customisability. Our systemconsists of two main components: a set of editable C# scripts, thatgovern the behaviour of objects within the simulation, and a graph-ical interface. When a simulation is run, the graphical interface re-flects the state of the system in real-time through simulated physics.Within this framework, we built an enclosed space called an “arena”,in which a single artificial society develops as an isolated system.The number of separate arenas can be specified before running thesimulation, and each can be instantiated with different parametersassociated with the environment and the population demographics.In this study, we instantiate parallel arenas to observe in real-timethe divergences and convergences between artificial societies underthe different configurations of food availability. Additionally, thesystem allows to navigate through the environment and changethe speed of the simulation. Within each arena, agents can searchfor food, collect it, and share it with one another across both hi-erarchical and mutualistic social networks. Each agents’ physicaland interactive behaviour is governed by its individual genome.Throughout execution, data about the environment and the pop-ulation is gathered and saved, ready to be analysed with any toolof choice. Overall, this system aims to capture the complexity ofsocial evolution through the use of a real-time, highly customisable,and visually compelling simulation platform. Screenshots of thesimulation in action can be seen in Figures 1 and 2.

3.1.1 Genomics. In biological systems, an organism’s genome isstored in DNA molecules known as chromosomes. The genomeis defined as the complete set of genetic information required forthat organism to function. The phenotypic behaviour of an organ-ism is determined in part by its genotype, in interaction with thesurrounding environment. Accordingly, each agent in our simu-lation has a genotype: a sequence of genes—in this case, a set ofinteger numbers starting from 0—describing its characteristics. Afunction called “Codesome”, based on the principles of grammaticalevolution and genetic optimisation, translates genetic instructionsinto behaviours [3, 16]. This function is inspired by the biologicalactivity of ribosomes, which contribute to the translation of geneticmaterial by synthesising proteins [6]. The function takes as an in-put a gene sequence and activates different functions based on eachgene, as summarised by the table below (Table 1). In other words,a specific function is called for each occurrence of a particulargene, overall contributing to the creation of an agent’s behaviour.Synthesised at birth, the genome of each agent is subjected to themechanism of evolution through selection and mutation, as well asthrough the “Codesome” function itself.

94

Resource Availability and the Evolution of Cooperation in a 3D Agent-Based Simulation GECCO ’21, July 10–14, 2021, Lille, France

Figure 1: A screenshot of agents sharing resources in onearena. The white lines represent energy transfers occur-ring in real-time. In this rendering, phenotypic sharing be-haviour is shown. Greener agents have given more energythan received, while redder agents have received more en-ergy than given. Yellow cubes are food. In this particularcase it thus appears that many of the network connectionsare one-way rather than reciprocal.

As part of this process, some genes affect the agents’ motion.Within the system, agents move towards another object when a tar-get is specified, and otherwise move randomly. Eligible objects fortargeting can be food items as well as other agents. Throughout thesimulation, agents regularly check for objects in their surroundingsand select them as targets for motion. As the “Codesome” functionaffects targeting capabilities through genes 6, 7, 8, 9, and 10, anagents’ directed motion is subjected to evolution and selection.

3.1.2 Agents’ life cycle. Similarly to living beings, agents within thesystem have a lifespan, reproduce, and draw energy from consum-ing food. Additionally, simulating natural circumstances, actionssuch as reproducing, moving, and gathering food have an associatedenergy cost. As a result, agents can only clone themselves after anenergy threshold has been reached. During cloning, the new agentinherits the genotype from the parent, as well as a portion of itsenergy resources. When the genes are copied, a chance of mutationmay change the value of the specific gene to a new random valuebetween 0 and the number of gene functions available. The newgene is sampled from a uniform random distribution. Illustrationsof the basic food gathering and cloning functions performed by theagents are shown in Figures 3a and 3b. When an agent exhaustsall of its resources, or when it gets to the end of its life cycle, itceases to exist. In the system, parameters associated with the agents’life cycle are specified as environmental variables. Therefore, theycannot be changed over the course of a simulation.

3.1.3 Food sharing networks. In this system, cooperation betweenagents is implemented through resource sharing. Throughout their

Gene Function0 Adds a random gene to the sequence1 Removes a gene from the sequence2 Creates a mutual connection with a random agent3 Creates a mutual connection with a nearby agent4 Creates a one-way connection with a random agent5 Creates a one-way connection with a nearby agent6 Adds an agent to the list of targets7 Adds a unit of food to the list of targets8 Adds a random target (food or agent) to list of targets9 Lengthens amount of time to stay focused on a single

target10 Shortens the amount of time to stay focused on a single

target11 Increases the preference for food sharing by 50%12 Decreases the preference for food sharing by 50%13 Increases tendency to share food with any random

agent in one’s network14 Increases tendency to share food with two preferred

agent in one’s networkTable 1: List of genes and their effects. Several copies of thesame gene can be present across the genome.

lifetime, agents may share resources with agents they are connectedto, as long as they are not too far away (see Figure 3c). In thesimulation, connections are social ties established at birth, of whichthe quality and quantity is determined by the genotype via genes 2,3, 4, and 5. Although connections are instantiated between pairs ofagents, the evolutionary nature of the system allows for complexnetworks of social relationships to emerge. Between two agents, aconnection can be “one-way” or “mutual”: in mutual connections,both agents can act as sharers and receivers, while in one-wayconnections, one agent shares while the other only receives.

Whenever an agent picks up a food item, the probability ofsharing this, as opposed to keeping it for oneself, is determined bythe agent’s “sharing preference”, which is controlled by genes 11and 12. Resource sharing can happen over a network in one of twoways: “random” or “preferential”, determined by genes 13 and 14.In randomly sharing agents, every time a unit of food is shared, arandom agent in its social network is selected to receive the food.In preferentially sharing agents, agents have a higher probabilityof sharing their resources with two select agents in their network,as shown in Figure 3d. Each agent stores a list of its connections,and the agents selected for preferential sharing are the first two inthe list. Specifically, the agent tries to share food with the first ofits preferred connections, if in the “sharing radius” range, and thenwith the second. If none of them is in range, it consumes the food.As a result of these genes, across generations, complex sharingbehaviours are able to evolve in response to environmental andsocial factors. See Figure 1 for an illustration of resource sharingoccurring in the simulation.

3.2 Experiment designWithin the described framework, we initialised four different artifi-cial societies, under three environmental conditions. As summarised

95

GECCO ’21, July 10–14, 2021, Lille, France Lara Dal Molin, Jasmeen Kanwal, and Christopher Stone

Figure 2: Panoramic view of four different arenas at the start of a simulation run. Starting from the arena in the bottom left,the populations contained within are initialised as: high connectivity, high sharing preference; high connectivity, low sharingpreference; low connectivity, high sharing preference; and low connectivity, low sharing preference. Yellow cubes are food.White lines represent energy transfers taking place across social networks in real-time. In this rendering, colour is used toencode the genotypic sharing preference—agents with a higher sharing preference are cyan while agents with a lower sharingpreference are magenta.

(a) Agents can eat food, yel-low cubes, to acquire energywhich makes them grow insize

(b) Energy can be used to cre-ate clones

(c) Energy can be transferredamong connected agents ifthey are close enough (i.e. A toB and C)

(d) Energy can be transferredto a favourite connectionwhich is prioritised (A to B)

Figure 3: Basic functions performed by agents.

in Table 2, the societies are composed by agents initialised withfour different characteristics: high connectivity and high sharingpreference; high connectivity and low sharing preference; low con-nectivity and high sharing preference; and low connectivity and lowsharing preference. Each of these macro-characteristics is encodedthough a different genome, as given in Table 2. We observed theevolution of each population within three environmental scenarios,which varied the availability of resources over time. Specifically,resources can be introduced in each arena according to one of threespawning functions. In the “Uniform” scenario, food items are gen-erated at every simulation update—or “tick”— in a random locationwithin each arena, using a uniform random distribution with afixed probability of 0.05. In the “Periodic” scenario, the spawningprobability is multiplied by |sin 𝑡

100 | where 𝑡 is ticks, meaning thatthe amount of available resources fluctuates periodically over time,with a period lasting around 300 ticks. In the “Extreme Hardship”scenario, the spawning probability is multiplied by 0.5(1 + sin

√𝑡

100 );this makes the availability of food oscillate over time, with an initialbloom followed by an extended period of food scarcity. See Figure4 for a visual summary of the spawning functions. For each foodspawning condition, four arenas were instantiated, each with one

96

Resource Availability and the Evolution of Cooperation in a 3D Agent-Based Simulation GECCO ’21, July 10–14, 2021, Lille, France

Connectivity Sharing Preference Gene SequenceHigh High 0, 7, 2, 2, 2, 2, 2, 2, 11, 11High Low 0, 7, 2, 2, 2, 2, 2, 2, 12, 12Low High 0, 7, 3, 11, 11Low Low 0, 7, 3, 12, 12

Table 2: Characteristics of the four different populationsused to seed each environment, and the genomes used to en-code this in the initial population.

0 1000 2000 3000 4000 5000 6000Time(Ticks)

0.0

0.5

1.0

Fac

tor

Periodic

0 50000 100000 150000 200000 250000 300000Time(Ticks)

0.0

0.5

1.0

Fac

tor

Extreme Hardship

Figure 4: The two functions that adjust the spawning proba-bility of the “Uniform” scenario. Above, the periodic func-tion is shown for a small window of time and below, thevariable-length oscillation is shown over the entire durationof a simulation.

of the outlined population types. We studied the effects of eachenvironmental configuration on the four populations, replicatingeach scenario ten times (see Figure 2 for a snapshot of the fourarenas at the start of a simulation run).

In Table 3, we report the full list of starting parameters in ourexperiments. Every simulation is initialised with 20 agents and12 food items, each food item containing 100 energy points. Eachagent is born with 50 energy points. The cost of cloning is 50 points,and other actions, such as gene translation, cost 1 point per gene.The minimum amount of energy required for cloning is 250 points.During cloning, the mutation rate associated with each gene in theparent’s genome is 0.05. Within each arena, agents can interact andshare resources only within 20 distance units of one another.

We hypothesise that artificial societies evolve differently ac-cording to both environmental conditions and their initial geneticcharacteristics. However, with reference to the background litera-ture, we expect the environment and the availability of resourcesto have a significant impact on their evolution. In the next sections,we discuss whether our findings support these hypotheses.

4 RESULTSIn general, we found that the genetic differences between the fourinitial populations across the arenas did not significantly affect evo-lutionary outcomes. Instead, the environmental conditions relatingto resource availability strongly influenced the evolutionary path-ways taken by the populations, wiping out almost all initial geneticdifferences, and leading to quite different populations across thethree conditions—Uniform, Periodic, and Extreme Hardship. For

Parameter ValueInitial population size 20Initial units of food 12Energy per food unit 100Agent’s starting energy 50Cloning cost 50Minimum energy for cloning 250Cost of all other actions 1Mutation rate 0.05Resource sharing radius 20Maximum agent lifespan (in ticks) 3000Total running time (in ticks) 300000

Table 3: Simulation parameters

this reason, many of the key findings we discuss below aggregateacross the four arenas, and only focus on the differences betweenthe three resource availability scenarios.

4.1 Population stabilityIn the Uniform food stream scenario, across the four types of artifi-cial societies, population size remained stable over the course of thesimulations. In the Periodic scenario, although with greater vari-ance, population size is also stable, with a smaller mean populationsize than in the Uniform case. However, in the Extreme Hardshipscenario, populations had a tendency to die out across all arenas,and all replicate simulation runs. Population size over time in thethree environmental conditions, aggregated over 10 runs, is shownin Figure 5.

4.2 Gene pool of final populationsThe genomes of the agents present near the end of the simulationruns contain valuable information for understanding the differentevolutionary outcomes across the three conditions. This is shownin Figure 6. For Uniform and Periodic conditions, “final populations”consists of any agent who was born during the last 10% of the totalsimulation runtime (i.e. after 30,000 ticks). For Extreme Hardshipconditions, it consists of any agent born after 45% of the totalruntime had passed, as these populations tended to die out aroundthe 55% runtime mark.

One clear finding is that gene 7, which allows an agent to directits motion towards food items, is the most frequent in all three finalpopulations. This is an indication that populations are able to evolvebasic behaviours necessary for survival, i.e. securing nutrition. Therelative distributions of the other genes across the three conditionswill be discussed in further detail in the following sections.

4.3 Targeting behaviourTo test whether some genes were significantly more prevalent inthe final populations of one condition versus another, the finalgene pools were converted to binary distributions representing thepresence of the gene in question. Then, a two-proportion z-testwas run using the scipy.stats.chi2_contingency 1 function to1https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.chi2_contingency.html

97

GECCO ’21, July 10–14, 2021, Lille, France Lara Dal Molin, Jasmeen Kanwal, and Christopher Stone

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

High Conn, High Sharing

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

High Conn, Low Sharing

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

Low Conn, High Sharing

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

Low Conn, Low Sharing

Uniform

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

High Conn, High Sharing

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

High Conn, Low Sharing

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

Low Conn, High Sharing

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

Low Conn, Low Sharing

Periodic

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

High Conn, High Sharing

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

High Conn, Low Sharing

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

Low Conn, High Sharing

0 500 1000 1500 2000 2500 3000Time(100s of ticks)

0

50

100

150

Pop

ulat

ion

Low Conn, Low Sharing

Extreme Hardship

Figure 5: Population size over time, aggregated over 10 runsof each of the four initial populations, in the three environ-mental conditions. Shading represents standard deviation ofthe means.

determine whether the two distributions significantly differed fromone another. Using this method, we found that, although gene 10,which allows an agent to change the target of its directed motionmore rapidly, was popular across the board, gene 9 was only pop-ular in the Extreme Hardship condition, and found significantlymore frequently here than in the other two conditions (𝑝 < 0.001 inboth cases). The function of gene 9 is to prolong the amount of timean agent stays focused on a single target. When food is plentiful,it may be beneficial to change target frequently to maximise the

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0

500

1000

1500

2000

2500

Unifo

rm

Initial population

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0

20000

40000

60000

Final population

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0

500

1000

1500

2000

2500

Perio

dic

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0

10000

20000

30000

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0

500

1000

1500

2000

2500

Extre

me

Hard

ship

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

0

2000

4000

6000

Figure 6: Gene pools across the initial populations comparedagainst gene pools across the final populations, in each ofthe three resource availability scenarios.

0 10 20 30 40 50 60

time bin

0.00

0.05

0.10

Normalised frequency of Gene 9 in Extreme Hardship condition

Figure 7: The normalised frequency of gene 9 in the popu-lation over time, in the Extreme Hardship condition. Thegene frequencies are summed over all four arenas across 10replicate simulation runs, then normalised by the total num-ber of genes in the gene pool at each time bin. The grey lineshows the curve of the food spawning function. The popula-tion crashes prior to the 60th time bin (each time bin repre-sents 3000 ticks).

chances of collecting nearby food. However, in the Extreme Hard-ship condition, where food becomes increasingly scarce, remainingfocused on a single target for longer may be the best chance ofsecuring the rare resources available, hence the increased preva-lence of finding this gene in this particular scenario. Indeed, asFigure 7 shows, the proportion of gene 9 increases over time in thiscondition as resource availability becomes increasingly scarce.

4.4 Network structureThe frequency of genes 2, 3, 4, and 5 in an agent’s genome deter-mines the quantity and type of social networks the agent formswith other agents in its arena. Using two-proportion z-tests, we

98

Resource Availability and the Evolution of Cooperation in a 3D Agent-Based Simulation GECCO ’21, July 10–14, 2021, Lille, France

Uniform Periodic Extreme Hardship

0

1

2

3

4

5

6

7

8

Con

nect

ions

Figure 8: Number of connections per agent in the final pop-ulation, across the three resource availability scenarios.

found that genes 2, 3, and 5 were significantly more prevalent inthe final populations of the Periodic condition than in the other twoconditions (𝑝 < 0.001 in all cases). These genes respectively encodefor: making a mutual connection with a random agent; making amutual connection with a nearby agent; and making a one-wayconnection with a nearby agent. Thus it appears that the Periodiccondition, in which the availability of resources fluctuates over anagent’s lifespan, favours the evolution of a more connected soci-ety, particularly one with more local and mutualistic food-sharingnetworks. Sharing resources with nearby agents may be favoureddue to the fact that clones are spawned near to the parent, andthus nearby individuals are more likely to be relatives. This wouldaccord with Hamilton’s theory that relatedness is a key factor inthe evolution of cooperative behaviour [9]. Mutualistic connectionsmay be favoured due to the simple benefit of reciprocity: whentimes are tough for one agent, the other can help, and vice versa.

Given that three out of the four genes encoding connectednessare more prevalent in the Periodic condition, one would also expectto find a higher average number of connections per agent in thiscondition. An analysis of the number of connections per agent inthe final population across the three conditions confirms this (seeFigure 8). A Welch’s t-test 2, comparing each condition to another,finds that the number of connections per agent is significantlyhigher in the Periodic condition than in both the Uniform and theExtreme Hardship conditions (𝑝 < 0.001 in both cases—there wasno significant difference found between the Uniform and ExtremeHardship conditions).

Interestingly, gene 4, which creates one-way connections witha random agent, is significantly more prevalent in the ExtremeHardship scenario than in the other two scenarios (𝑝 < 0.001 inboth cases).

4.5 Sharing behaviourGenes 11 and 12 respectively encode for raising and lowering anagent’s preference for sharing food. Across all three conditions, allinitial populations within a condition, and all replicates of each ofthese, sharing preference was found to converge at a similar value(see Figure 9).

2https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ttest_ind.html

0 20 40 60 80 100Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

High conn, High sharing

0 20 40 60 80 100Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

High conn, Low sharing

0 20 40 60 80 100Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

Low conn, High sharing

0 20 40 60 80 100Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

Low conn, Low sharing

Uniform

0 20 40 60 80 100Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

High conn, High sharing

0 20 40 60 80 100Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

High conn, Low sharing

0 20 40 60 80 100Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

Low conn, High sharing

0 20 40 60 80 100Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

Low conn, Low sharing

Periodic

0 10 20 30 40 50 60Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

High conn, High sharing

0 10 20 30 40 50Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

High conn, Low sharing

0 10 20 30 40 50Time(x3000 ticks)

0

20

40

60

80

100

Sha

ring

Pre

fere

nce

Low conn, High sharing

0 10 20 30 40 50Time(x3000 ticks)

0

20

40

60

80

100S

hari

ngP

refe

renc

eLow conn, Low sharing

Extreme Hardship

Figure 9: Sharing preference over time, aggregated over 10runs of each of the four initial populations, in the three en-vironmental conditions. Shading represents standard devia-tion of the means.

The dynamics of genes 11 and 12 are nevertheless complex, andmay interact with the presence of other genes, such as those govern-ing the number of connections. Gene 11, which raises the sharingpreferences, is found more commonly in the Periodic scenario thanin the Uniform scenario (𝑝 < 0.001), and even more commonlyin the Extreme Hardship scenario than in the Periodic scenario(𝑝 < 0.001). Thus it would seem that sharing preference increasesas resource availability becomes more uncertain. However, lookingat gene 12, which lowers the sharing preference, this is found mostcommonly in the Periodic scenario, somewhat less commonly inthe Uniform scenario, and least commonly in the Extreme Hardshipscenario (𝑝 < 0.001 in all cases). Genes 11 and 12 therefore seem to

99

GECCO ’21, July 10–14, 2021, Lille, France Lara Dal Molin, Jasmeen Kanwal, and Christopher Stone

balance each other out in each case, such that all populations tendtowards a similar average sharing preference in the end.

The dynamics of genes 13 and 14 are more clear-cut. Gene 13,which makes an agent more likely to share food with any randomagent in its network, as opposed to a specific subset of agents, ismost prevalent in the Extreme Hardship scenario, and least preva-lent in the Uniform scenario (all differences between groups aresignificant at 𝑝 < 0.001). Gene 14, which makes an agent morelikely to share food only with the same two selected agents withinits social network, is more prevalent in the Periodic scenario thanthe Uniform scenario (𝑝 < 0.001) and more prevalent in the Uni-form scenario than in the Extreme Hardship scenario 𝑝 = 0.002).Thus it is the case that “random sharers” are most likely to be foundin the Hardship scenario, and “preferential sharers” in the Periodicscenario.

5 DISCUSSIONOverall, it emerges that the periodically fluctuating availabilityof resources favours the evolution of a tight-knit society, organ-ised into small, local and mutualistic clusters, where resources areshared preferentially with selected social partners. In contrast, thesocieties that evolve under Uniform conditions are less organised.In conditions of Extreme Hardship, where resources become in-creasingly scarce, populations adapt by increasing the presence ofa gene which allows them to direct their motion towards a singletarget for a longer time, although eventually the food becomes tooscarce to support the population. These results contribute to theliterature on resource availability and the evolution of cooperationin two major ways. First, our finding that environmental conditionsoutweighed the genetic characteristics in determining the courseof evolution confirms that resource availability is a non-negligiblefactor in the evolution of cooperative behaviours. Second, similarlyto other studies such as Pereda et al., we find that some level ofresource instability is the scenario that most encourages the evo-lution of cooperative behaviour in the form of resource sharing[17]. Unlike previous studies, our setup allows us to differentiatebetween different types of resource sharing networks, providingfurther insight into the specific characteristics of this relationship.We find that periodic fluctuations in resource availability, that occurmany times over the lifespan of an individual, tend to encouragethe evolution of stable, tight-knit societies consisting mainly ofsmall, local, mutualistic networks.

6 CONCLUSIONS AND FUTUREWORKIn this study, we presented a software system built using Unity3D, which we used here for the analysis of social evolution un-der different scenarios of resource availability. We analysed thebehaviour of four types of evolving artificial societies under threedifferent environmental conditions: Uniform resource availability,Periodic resource availability, and decreasing resource availability,referred to as the Extreme Hardship condition. We reported twomajor findings. First, the environmental conditions with respect toresource availability have a greater impact on the course of evolu-tion compared to the initial genetic conditions of each population.Second, periodically fluctuating resource availability encouragesthe evolution of societies that are organised into small, tightly-knit,

mutualistic communities, resembling the structure of families orclans. These findings support and add to the literature suggestingthat the evolution of cooperative behaviour is linked to resourceavailability, and more specifically that some degree of resourceinstability favours the evolution of resource sharing over socialnetworks [11, 14, 17]. Overall, our results emphasise the signifi-cance of environmental factors for social evolution, and uncovernew characteristics of the relationship between the dynamics ofresource availability and the evolution of cooperative behaviour incomplex networks. Future work will focus on exploring new kindsof scenarios and environmental dynamics which could be automat-ically generated in search of more complex and niche behaviours.Furthermore, effort will be made to increase the re-usability andaccessibility of the software platform so that other practitionerscan easily develop and test their own scenarios.

The system, including source code, data, scripts used to generateplots and statistics is publicly available as a GitHub repositoryhttps://github.com/cls00/L-arenas.

7 ACKNOWLEDGEMENTSSupported by ERC grant 771387 (JK) and EPSRC grant EP/P015638/1(CS).

REFERENCES[1] Chris Adami, C. Titus Brown, and W.K. Kellogg. 1994. Evolutionary Learning in

the 2D Artificial Life System "Avida". In Artificial Life IV. MIT Press, 377–381.[2] Steven S Branda, José Eduardo González-Pastor, Sigal Ben-Yehuda, Richard Losick,

and Roberto Kolter. 2001. Fruiting body formation by Bacillus subtilis. Proceedingsof the National Academy of Sciences 98, 20 (2001), 11621–11626.

[3] Carlos García-Martínez, Francisco J Rodríguez, andManuel Lozano. 2018. GeneticAlgorithms. (2018).

[4] Andy Gardner, Ashleigh S Griffin, and Stuart AWest. 2009. Theory of cooperation.eLS (2009).

[5] Herbert Gintis, Eric Alden Smith, and Samuel Bowles. 2001. Costly signaling andcooperation. Journal of theoretical biology 213, 1 (2001), 103–119.

[6] Rachel Green and Harry F Noller. 1997. Ribosomes and translation. Annualreview of biochemistry 66, 1 (1997), 679–716.

[7] Michael Gurven, Kim Hill, and Hillard Kaplan. 2002. From forest to reservation:Transitions in food-sharing behavior among the Ache of Paraguay. Journal ofanthropological research 58, 1 (2002), 93–120.

[8] Marcus J Hamilton, Oskar Burger, John P DeLong, Robert S Walker, Melanie EMoses, and James H Brown. 2009. Population stability, cooperation, and theinvasibility of the human species. Proceedings of the National Academy of Sciences106, 30 (2009), 12255–12260.

[9] W.D. Hamilton. 1964. The genetical evolution of social behaviour. I. Journal ofTheoretical Biology 7, 1 (1964), 1 – 16. http://www.sciencedirect.com/science/article/pii/0022519364900384

[10] Gregory A Johnson. 1982. Organizational structure and scalar stress. Theory andexplanation in archaeology (1982), 389–421.

[11] Hillard S Kaplan, Eric Schniter, Vernon L Smith, and Bart J Wilson. 2012. Risk andthe evolution of human exchange. Proceedings of the Royal Society B: BiologicalSciences 279, 1740 (2012), 2930–2935.

[12] Lawrence H Keeley. 1988. Hunter-gatherer economic complexity and “populationpressure”: A cross-cultural analysis. Journal of anthropological archaeology 7, 4(1988), 373–411.

[13] William M Kenkel, Allison M Perkeybile, and C Sue Carter. 2017. The neurobi-ological causes and effects of alloparenting. Developmental neurobiology 77, 2(2017), 214–232.

[14] Michael Kirley. 2005. Competition, cooperation and collective behaviour: resourceutilization in non-stationary environments. In IEEE/WIC/ACM International Con-ference on Intelligent Agent Technology. IEEE, 572–578.

[15] Charles M Macal. 2020. Agent-based modeling and artificial life. Complex Socialand Behavioral Systems: Game Theory and Agent-Based Models (2020), 725–745.

[16] Michael O’Neill and Conor Ryan. 2001. Grammatical evolution. IEEE Transactionson Evolutionary Computation 5, 4 (2001), 349–358.

[17] María Pereda, Débora Zurro, José I Santos, Ivan Briz i Godino, Myrian Álvarez,Jorge Caro, and José M Galán. 2017. Emergence and evolution of cooperationunder resource pressure. Scientific reports 7 (2017), 45574.

100

Resource Availability and the Evolution of Cooperation in a 3D Agent-Based Simulation GECCO ’21, July 10–14, 2021, Lille, France

[18] Alison E Rautman. 1993. Resource variability, risk, and the structure of socialnetworks: An example from the prehistoric Southwest. American antiquity (1993),403–424.

[19] Thomas S Ray and Joseph Hart. 1999. Evolution of differentiated multi-threadeddigital organisms. In Proceedings 1999 IEEE/RSJ International Conference on In-telligent Robots and Systems. Human and Environment Friendly Robots with HighIntelligence and Emotional Quotients (Cat. No. 99CH36289), Vol. 1. IEEE, 1–10.

[20] António MM Rodrigues and Tiffany B Taylor. 2018. Ecological and demographiccorrelates of cooperation from individual to budding dispersal. Journal of evolu-tionary biology 31, 7 (2018), 1058–1070.

[21] Ovi Chris Rouly. 2018. A computer simulation to investigate the associationbetween gene-based gifting and pair-bonding in early hominins. Journal ofhuman evolution 116 (2018), 43–56.

[22] Seth Tisue and Uri Wilensky. 2004. Netlogo: A simple environment for modelingcomplexity. In International conference on complex systems, Vol. 21. Boston, MA,

16–21.[23] Colin J Torney, Andrew Berdahl, and Iain D Couzin. 2011. Signalling and the

evolution of cooperative foraging in dynamic environments. PLoS Comput Biol 7,9 (2011), e1002194.

[24] Unity Technologies. 2020. Unity (version 2020.1.17f). (2020). https://www.unity.com

[25] Stuart A West, Ashleigh S Griffin, Andy Gardner, and Stephen P Diggle. 2006.Social evolution theory for microorganisms. Nature reviews microbiology 4, 8(2006), 597–607.

[26] Edward OWilson and Bert Hölldobler. 2005. Eusociality: origin and consequences.Proceedings of the National Academy of Sciences 102, 38 (2005), 13367–13371.

[27] Larry Yaeger. 1994. Computational genetics, physiology, metabolism, neu-ral systems, learning, vision, and behavior or Poly World: Life in a new con-text. In SANTA FE INSTITUTE STUDIES IN THE SCIENCES OF COMPLEXITY-PROCEEDINGS VOLUME-, Vol. 17. Citeseer, 263–263.

101