1 Simulating Rodent Populations Using Neural Networks Paul Garratt 1 and J. Dickman1 Abstract Agricultural businesses must manage pests effectively. Populations of pests and other economically important species e.g. microtine rodents can exhibit violent fluctuations whose causes are poorly understood. The Periodic Lethal Toxin Production, PLTP, hypothesis of Doncaster and Plesner-Jensen attempts to explain the precipitous decline phase of rodent cycles. Indirect and anecdotal observations support the hypothesis that the rodents are poisoned by plants. This explanation remains untested experimentally. This paper reports our design, development and use of a simulator to test the PLTP hypothesis in a virtual environment. The simulator incorporates six features important in the natural environment of the rodent rodents: breeding and death of the individual animals and their predators, growth of their food plants, selection of food plants by the rodents, predation on the rodents, migration of the rodents and predators and evolution of toxin resistance in individuals. A mathematical treatment of so many factors would be impossible. The simulator models the behaviour of individual animals active in a grid of zones where changing densities of rodents, plants and predators comprise the virtual environment. The individuals use a neural network to make important decisions such as choice of food and migration routes through the grid. The neural network responds to factors such as food availability and predator threat. The behavioural response to the environment evolves by means of a genetic algorithm applied to the virtual chromosomes of the individual rodents. The individuals grow and breed at rates proportional to their food intake. Predation reduces the population to provide a turnover of individuals within the system. The inclusion in the model of toxic plants and toxin resistance allows testing of the PLTP hypothesis. An individual rodent can spontaneously gain or lose resistance to plant toxins by mutation. An individual can inherit resistance if either parent has it. Modelled plants produce toxins when over-grazed, as observed in nature. The discrete event simulator executed successfully exploring the dynamics of rodent populations to test hypotheses which are pre-conditions to PLTP such as: do the rodents feed on toxic plants when the density of preferred plants is below a critical thresh hold? The model supported and refuted several similar hypotheses in the virtual environment. The simulation exercise replicated the cyclical population changes observed in natural rodent populations. For some cases involving migration across the zones in the system the neural network appeared to give authentic results: the cyclical fluctuations in population density becoming synchronised. However in more complex situations the model tended to a non-cyclic equilibrium. The novel simulation design combining neural networks and genetic algorithms proved to be very powerful. The model programmed in an extensible object-oriented manner allowed simulation of a variety of situations. While results fell short of validating the PLTP 1 Department of Electronics and Computer Science, University of Southampton, UK. GarrattP 12/03/2003 2 hypothesis in full, the use of a neural network to model decision-making by animals under study holds great promise for future investigations. 1. Introduction In their paper “Lethal Toxins in Non-preferred Foods: How Plant Chemical Defences Can Drive Microtine Cycles” (Journal of Theoretical Biology, July 1999), Susanne Plesner-Jensen and C. Patrick Doncaster present a theory called “Periodic Lethal Toxin Production” (PLTP). This theory outlines an explanation of how the cyclical patterns in the size of some rodent populations could occur. 1.1 Rodent population dynamics The reason behind fluctuations in rodent populations (e.g. voles and lemmings) is an unanswered question in ecology (Kent 2001). The rodent population cycle lasts between two and five years and progresses as follows (Krebs et al 1973): 1. Increase 2. Peak 3. Catastrophic decline 4. Extended low phase Many theories as to the cause of the changes in population size have been proposed but none has gained widespread acceptance. The four main mechanisms that have been considered for the driving force behind the cycles are (Kent 2001): Social organisation and dispersal Hestbeck’s social fence hypothesis asserts that a dense population will inhibit movement and dispersal, causing resources in the area to become depleted and the population to crash. Maternal effects Rood & Boonstra have shown that if the density of female rodents is reduced then young in the population have a higher survival rate and reproductive ability. Therefore young born into a high density population are able to produce less offspring in the next generation, causing a crash. Predation As the rodent population increases, so does that of the predator Cycling in this case depends on the ability of the rodent population to recover faster than the predators. Nutrition and food Rodent populations are influenced by both the quality and quantity of the food they consume. The PLTP hypothesis was proposed by Plesner-Jensen and Doncaster. The hypothesis is based on toxin production by plants but differs from earlier explanations: the production is not constant but in direct response to grazing by the rodents. In the hypothesis, the population cycles are proposed to be a result of complex interactions between four species within two distinct environments: tundra and the surrounding area. The species are: GarrattP 12/03/2003 3 Rodent Predator, which feeds on the rodent. The preferred food of the rodent The non-preferred food of the rodent, having the ability to produce toxins. The plant species both have a logistic growth pattern, modelling the concept of a ‘carrying capacity’, the maximum density that can be supported. A differential equation representing the growth is: ds s r s 1 dt K where s is the density of the plant, r is the growth rate and K is the carrying capacity. An example with K=1 and r=0.2 is shown in figure 1. Kent ran the model using parameters gathered from experimental and observational data in existing literature on the subject. He was able to produce results that corresponded to the observed data on the population cycles on five criteria. These were: Cycle period Peak population density Trough population density Density ratio Occurrence of population collapse In simulations without a toxic pulse only the first four of these could be satisfied. When the toxic pulse was introduced, the model fulfilled all five criteria. An example of a single cycle with the toxic pulse is shown in figure 2. Density (ha-1) 250 200 150 100 50 0 0 0.5 1 1.5 2 2.5 Time (years) Figure 2: Population density of rodents in tundra environment GarrattP 12/03/2003 3 4 The effect of migration to and from surrounding areas is absent, as is the species which preys on the rodents. The model does not cater for evolutionary factors, such as the development of a resistance to the toxin by the rodent 2. System Design The simulator described in this paper incorporates aspects of the situation that Kent did not include. The simulator models a number of factors that are present in the natural system: Breeding and death of rodents and predators Growth of plant species Selection of food by rodents Predation on rodent population Migration of rodents and predators between the regions Evolution of resistance to plant toxins Rodent density w1 Predator density Preferred plant density w2 Σ w3 Response w4 Non-preferred plant density Figure 3 Neural network determining rodent behaviour The system is based on a grid structure, with each of the squares representing an area of land in which the plants and animals would exist. Each zone keeps track of the density of the plants and the number of rodents and predators within it. The entities in the system, the rodents and the predators, have the freedom to move to an adjacent square on each iteration of the simulation using a connectionist model (neusciences 2003). For each choice, a set of stimuli indicates the density of the four species in that direction. A weighted sum over nearby grid squares is used to determine the level of a stimulus in a given direction see figure 3. GarrattP 12/03/2003 5 2.1 Resistance to Toxin Another aspect included in the model is the evolution of a resistance to the toxin by the rodents. This is necessary to test Plesner-Jensen and Doncaster’s proposition that resistance would not occur, as the population regrowth in areas where the toxic plant is found is largely due to immigration from the surrounding regions. If both parents of the new individual have resistance to the toxin then the offspring will also have resistance. If neither parent has resistance then neither will the offspring. After the initial resistance has been calculated then the effect of mutation is applied. 2.2 Implementation The simulator had to be able to run a simulation of hundreds of years in a reasonable time. To keep the implementation modular and discrete it is constructed in an object-oriented language: C++. Simulat or Plant Animal 1 * 1 1 1 Preferre d Plant Predato r Zone 1 * 1 1 ToxicPl ant * Rodent Figure 4 The simulator class structure 2.1.1 Simulator structure The root class in the system is the Simulator class. The Simulator controls the sequence of events that occurs in the system and outputs the current state of the simulation on each iteration. It holds references to each of the Zones in a two GarrattP 12/03/2003 6 dimensional array. The Zone class controls the interactions between the different species within the system. It has three main functions that are called from Simulator: stepSimulation moveAnimals finishMovement 2.1.1.1 step Simulation This function calculates the interaction between the species within the zone. The grow function of the plant species is called, increasing the density of plants within the area. Next, the level of consumption of each of the varieties of plant by the rodents is calculated. The same calculation is performed for the interaction between the rodents and the predators. The decrease in density for the rodents is added to the decrease due to predation. The numbers of rodents and predators that are born are calculated from the increase in their densities. The animals that die are also chosen randomly from the populations. 2.1.1.2 move Animals The result of this function call corresponds to the direction in which the animal wants to move. 2.1.1.3 Finish Movement The purpose of this function is to move the animals from the list of incoming predators and rodents to the main list of animals in the zone. 2.1.1.3 Animal Animal contains the code that evaluates the desirability of moving in a given direction. Its constructor takes pointers to two parent animals and contains the genetic algorithm that evolves the weights of the neural network used for the evaluation (Obitko 2002). 3. Program Testing The behaviour of the system as a whole is difficult to test due to the complex nature of the interactions between the species. However, many aspects of the system could be tested in isolation using small test harnesses developed for the purpose. Test 1.1: Do the plants grow as expected when parameters from Kent’s simulation are used? Outcome: PASS – the system simulated the expected logistic growth of the plants GarrattP 12/03/2003 7 Test 1.2: Does the rate of plant growth increase when the growth rate parameter is increased? Outcome: PASS – the system simulated an increased rate of growth of the plants. Test 1.3: Is the density of the plants zero when the carrying capacity is zero? Outcome: FAIL – a division by zero caused the program to crash. The bug was fixed by adding a test for zero carrying capacity. The test was then passed. 3.1 Testing of animal behaviour within a zone Test 2.1: Do the rodents only feed on the preferred food when the density of preferred plants is above the critical threshold? Outcome: PASS – the rodents did not eat any of the toxic plants Test 2.2: Do the rodents feed on the toxic food when the density of preferred plants is below the critical threshold? Outcome: PASS – the rodents did eat some of the toxic plants. Test 2.3: Does the mortality rate of the rodents increase when the density of the toxic plants is low enough to cause toxin production? Outcome: PASS – the mortality rate of the rodents did increase. Testing of animal migration between zones Test 3.1: Does the algorithm for calculating the stimuli perform as expected? Outcome: FAIL– the stimuli to the south and west was also 2.17. The bug was due to not raising the rate of weight decrease to the power of the distance travelled. A subsequent retest showed the expected result. Test 3.2: Does a rodent move from one zone to an adjacent zone as expected? Outcome: PASS – the rodent moved as expected. 3.2 Reproduction of Kent’s results The first simulation was to check that results matched those presented by Kent. GarrattP 12/03/2003 8 100 90 80 Density (kg/ha) 70 60 Toxic plants 50 Preferred Plants Voles 40 30 20 10 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Time (years) Figure 5: Output of simulator with no toxic pulse As expected, this output looks identical to Kent’s results for the population dynamics without the toxic pulse see figure 5. Next, the toxic pulse was added and again the results were compared with Kent’s. The toxic pulse was added by setting the toxic threshold to 20, the value used by Kent. The procedure used was the same as before. The results are shown in figure 6. 100 90 80 Density (kg/ha) 70 60 Toxic Plants 50 Preferred Plants Voles 40 30 20 10 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Time (years) Figure 6: Output of simulator with toxic pulse This is again the same result that was obtained by Kent. To check on the progression of the evolution the data was plotted from the beginning of the GarrattP 12/03/2003 9 simulation. The density of rodents within a single zone in the simulation is shown in figure 7. 16 14 12 Density (kg/ha) 10 8 6 4 2 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 Time (years) Figure 7: Evolution of weights in the neural network leading to regular cycles in the simulation It is clear that the evolutionary strategy is working – at the beginning the migration is random, causing large fluctuations in the number of rodents within the square. Later, as the simulation progresses, the migration becomes more ordered, with the cycles in all of the squares becoming synchronised, as can be seen from the densities of the toxic plants in three of the zones in figure 8. Figure 8: Synchronisation of cycles occuring in the simulator GarrattP 12/03/2003 10 It is clear that the evolutionary strategy is working – at the beginning the migration is random, causing large fluctuations in the number of rodents within the square. Later, as the simulation progresses, the migration becomes more ordered, with the cycles in all of the squares becoming synchronised, as can be seen from the densities of the toxic plants in three of the zones in figure 8. Figure 8: Synchronisation of cycles occuring in the simulator The next step was to set up the simulation to include both the tundra region, where the non-preferred plants grow, and the surrounding regions, where the toxic plants are absent. This was done by increasing the grid size to 5 and setting the tundra radius to 2, giving a circular region in the middle of the grid where the non-preferred plants can grow. The results from this simulation were not as expected. The simulation very rapidly became non-cyclic across the entire grid. This was very disappointing, as we expected to see the cycling behaviour that had occurred in the previous simulations, with migration in and out of the tundra reducing but not halting the fluctuations. After this result, it was clear that any hope of producing the population dynamics described by the PLTP hypothesis required considerable extension of the simulator. 4. Conclusions The population of rodents crashes as a predators into the surrounding regions. rodents found there to suffer a similar scenarios were produced. In the simpler GarrattP result of the toxin, causing an exodus of This subsequently causes the number of decline. Results from simulating various cases, the outcome was the same as Kent 12/03/2003 11 has achieved using his model. For some cases involving migration across the areas in the system, the neural network approach seemed to work well: the cyclic fluctuations in population density became synchronized. However, for the most complex situations, the model tended to a non-cyclic equilibrium. The evolution of a neural network to model the decision making by the animals was by far the most novel part of the research, it was successful and holds the most promise for future investigation. Bibliography Krebs, C.J., M.S. Gaines, B.L. Keller, J.H. Myers, and R.H. Tamarin (1973). Population cycles in small rodents, Science 179, 35-41. Plesner-Jensen and C. Patrick Doncaster (1999). Lethal Toxins in Non-preferred Foods: How Plant Chemical Defences Can Drive Rodent Cycles, J. Theor. Biol. 199, 63-85. Kent A. (2001). Rodent Cycles and the PLTP Hypothesis, University of Southampton Faculty of Biomedical Sciences PhD thesis Křivan V. (1996) Optimal foraging and predator-prey dynamics. Theor. Pop. Biol. 49, 265-290 Křivan V. & Asim Sikder (1999) Optimal foraging and predator-prey dynamics, II. Theor. Pop. Biol. 55, 111-126. Neusciences, http://www.neusciences.com (12 March 03) Obitko M., Introduction to Genetic Algorithms. http://cs.felk.cvut.cz/~xobitko/ga/ (13 May 2002). GarrattP 12/03/2003