<figure><img src="image_1.png" /></figure>

HAL
open science

# Analyzing the Parameters of Prey-Predator Models for Simulation Games

Seongdong Kim, Christoph Hoffmann, Varun Ramachandran

<figure><img src="image_2.png" /></figure>

## To cite this version:

Seongdong Kim, Christoph Hoffmann, Varun Ramachandran. Analyzing the Parameters of Prey-Predator Models for Simulation Games. 9th International Conference on Entertainment Computing (ICEC), Sep 2010, Seoul, South Korea. pp.216-223, 10.1007/978-3-642-15399-0_20. hal-01055640

HAL Id: hal-01055640

https://inria.hal.science/hal-01055640

Submitted on 13 Aug 2014

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_3.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Analyzing the Parameters of Prey-Predator Models for Simulation Games

Seongdong Kim¹, Christoph Hoffmann², Varun Ramachandran²

¹ Dept. Gameware, Kaywon School of Art & Design
Euiwhang, Republic of Korea 437-080
TEL.31-420-1881, FAX.31-420-1879
sdkim@kaywon.ac.kr

² Dept. Computer Science, Purdue University
West Lafayette, USA 47907
TEL.765-494-6185, FAX. 765-494-0739
{cmh,vramacha}@purdue.edu

**Abstract**—We describe and analyze emergent behavior and its effect for a class of prey-predators’ simulation models. The simulation uses rule-based agent behavior and follows a prey-predator structure modulated by a number of user-assigned parameters. As part of our analysis, we present key parameter estimations for mapping the prey-predators’ simulation parameters to a functional relationship with the LV(Lotka-Volterra) model, and how the parameters interact and drive the evolution of the simulation.

**Keywords:** prey-predator systems; Lotka-Volterra model; agent-based simulation; emergent behavior; simulation games; parameter estimation.

## 1 Introduction

Simulation games have become a widely accepted and needed tool for training in government agencies and the military. For example, commercial simulation games have had a dramatic effect on the military’s education and training programs [1]. Particularly, in computer games, whether entertainment or educational games, NPCs are agents whose behavior is scripted and automated. In this paper, we develop and test a framework for estimating the impact of specific behavior traits on the overall evolution of game worlds. We restrict to the important subclass of prey-predator simulations that have applications in ecology, biology, economics and sociology, and for which mathematical concepts can be formulated that summarize system properties. For instance, [2] reports a discrete simulation tool to simulate the behavior of predator programs and computer viruses in small scale (1600 node) computer networks. Multi-behavioral games between predators and prey have been studied that integrated pre-encounter and post-encounter behaviors [6]. Mitchell and Lima [8] investigated the shell game using an individual-based model that allows predators to update information about prey location. Huige [9] presented results to predict that very little overlap will occur between the players’ waiting distributions and that the predator
will rarely outwait the prey. We have applied game theory differently, with prey searching for grazing and predators hunting prey in packs. We show that food availability and predators' densities influence patterns of prey distribution. We approach the problem by relating the (extended) Lotka-Volterra (LV) equations [3], [7] to expose essential characteristics of prey-predators simulations. Illustrating our concepts, we relate quantitative parameters, such as birth rate, life span, time to starvation and so on, to the mathematical model, and so try to clarify how changing the driving parameters impacts the simulation.

# 2 Relationship to the Lotka-Volterra Model

## 2.1 Simulation Specifications

Our basic simulation program has been described in [3]. It uses the OpenSteer library [4] to implement basic motion algorithms. The parameter set is as in [3]. For example, using subscript 0 to indicate that the parameter applies to prey, and subscript 1 to indicate that it applies to predators we have:

*   **Birth, aging and death:** The $L_k$ is the maximum life span; no agent lives longer than that. Moreover, $f_k$ is the adulthood fraction, that is, the fraction of $L_k$ spent as an adult. The concept here is that juvenile agents have fewer capabilities, qualitatively or quantitatively, than adults. In particular, juveniles do not have offspring as yet. The $A_k$ is the current age, normalized to be between 0 and 1 as the fraction current age / max lifetime. The $h_k$ is the hunger rate, measuring the speed with which an agent becomes hungry again, and $H$ is the hunger value. The agent dies if $A_k \ge 1$ or if $A_k < 1$ and $r \in [0, A_k^{10}]$. Here $r$ is a random number between 0 and 1, with uniform distribution. Death from hunger depends on $H$. Initially, if $H = 0$ then hunger is incremented by

$$ \Delta H = h_k * \Delta t * \min \left( 1, \frac{A_k}{1-f_k} \right). \qquad (1) $$

A death due to hunger occurs if $H > 0$ and $r < H^{10}$ where $r$ is a random number in $[0,1]$. Feeding diminishes the hunger.

## 2.2 The Lotka-Volterra Model

The LV differential equations express the global behavior of a prey-predator system under the assumption of unlimited food supply for prey. Excluding the trivial steady state in which one or both population types are extinct, the steady state is a dynamic balance of the two populations and is given to a cyclic boom-bust cycle. The equations are

$$ X' = \alpha X - \beta XY. \qquad (2) $$

$$ Y' = -\gamma Y + \delta XY. \qquad (3) $$
where X and Y are the populations of prey and predators, respectively. The factor α represents the growth rate of the prey population absent predation and so accounts for the birth rate as well as for the rate of death from old age; β is the impact of predation, accounting for death of prey due to being killed by predators. The assumption of unlimited food supply is manifest in that α only assumes death from natural causes. The factor γ quantifies the rate of predators' death from natural causes; δ measures the growth rate of the predator population due to the realized food supply, i.e., due to hunting. Again, change rates are assumed to depend linearly on the population sizes. Assuming nonzero population sizes, steady state is achieved by a zero change rate; that is, when

$$ \alpha = \beta Y. \quad (4) $$

$$ \gamma = \delta X. \quad (5) $$

See also [5]. The factors α and γ measure intrinsic characteristics of prey and predators: prey life span and fertility determine α, and predator life span only determines γ. The presence of X in the term δXY implies that predators' fertility depends on the food supply X, an assumption justified in many situations. The simulation architecture assumes a limited food supply for prey, so the equations have to be modified accordingly. We assume a stable prey population size X_c, absent predation, that is due to the carrying capacity of the environment. Once reached, birth and natural death rates of prey should become equal, without predation. Assuming linearity, we modify the LV equations to incorporate these considerations:

$$ X' = \alpha \left(1 - \frac{X}{X_c}\right) X - \beta XY. \quad (6) $$

$$ Y' = -\gamma Y + \delta X. \quad (7) $$

If we assume no predators, then the first equation becomes the logistics equation:

$$ X' = \alpha \left(1 - \frac{X}{X_c}\right) X. \quad (8) $$

Assuming the continuous case, the solution is:

$$ X(t) = X_c X(0) / \left( X(0) + (X_c - X(0))e^{-\alpha t} \right). \quad (9) $$

Here $X(t)$ is the population at time t.

## 2.3 Carrying Capacity Determination and Base Configuration

Beginning with the logistic equation, we note that the ratio of population size to carrying capacity, for $α > 0$, is 1 in the limit. If $α < 0$, then the ratio goes to zero. The assumption $α > 0$ is the case where the population persists and reaches the carrying capacity of the environment, while for negative $α$ the prey becomes extinct. In the following, we assume that $α > 0$. Note that the magnitude of $α$ only affects
how fast the system reaches the carrying capacity. In the stochastic case, we expect that the population at first grows past the carrying capacity and subsequently collapses due to environmental exhaustion.

## 2.4 Determination of $\alpha, \beta, \gamma, \delta$

To determine $\alpha$, we can run the simulation in the base configuration without any predators. Then the parameter $\alpha$ tracks the average difference of the number of births and deaths at each time step. That is, the intrinsic rate of prey population increase can be estimated as $\alpha(t) = (b(t) - d(t))/X(t)$, where $b(t)$ is the number of births and $d(t)$ is the number of deaths (due to hunger or old age) of the prey, at time $t$. We can use a moving average to compute this estimate. Since the environment has limited food supply, however, the estimate needs to take into account the logistical equation. The formula is then

$$ \alpha(t) = \frac{(b(t) - d(t))}{(X_c - X(t))} \frac{X_c}{X(t)}. \qquad (10) $$

When $X(t)$ approaches $X_c$ the denominator vanishes and the coefficient $\alpha(t)$ cannot be determined. Thus, we have to estimate $\alpha$ by measuring population growth with infinite food supply. To accomplish this, we set the food growth parameters to instantaneous regeneration and set the hunger value to zero. The result is an exponential increase in population size where we determine the value of $\alpha$ by fitting the exponential $X(t) = X(0) \cdot (1 + \alpha)^t$. This should be done for several initial population sizes, arriving at an average value for $\alpha$.

The factor $\beta$ measures the impact of predation on the prey population. The equations assume linearity in both predators' and prey densities. We determine the factor using the procedure of Sharov [7]: we run the simulation with one predator for a number of time steps during which no new predators are born.<fnref n="1" /> The k-values [7] of $\beta$ for a single time step are averaged over the simulation interval $[t_0, t_1]$. With $N$ the number of steps we obtain

$$ -\ln(1 - \beta(t)) = \sum_{r} \left( -\ln \left( 1 - \frac{k(t)}{X(t)} \right) \right) / N. \qquad (11) $$

At start-up, the simulation requires a number of steps to reach a semi-stable state. Therefore, we have programmed the possibility of running the simulation for a pre-determined number of steps before introducing the predators at a random location. The parameters $\gamma$ and $\delta$ measure the attrition of the predator population by natural causes, that is, death from old age and hunger, and the effect on the population when prey is available. The parameters are estimated as follows:

1) For fixed population size $X_0$ run the simulation for some time, holding the prey population size constant.

2) For $X_0$, estimate the aggregate predator growth rate $r$ from $X_1(t) = X_1(0)(1 + r)^t$.

<footnote n="1">¹ We assume asexual reproduction for simplicity of the model.</footnote>
Here, $X_1(t)$ is the predator population size at time $t$. This is done for a number of different population sizes $X_0$. Having determined $r$, for different prey population sizes, the parameters for the predator population dynamics is found by fitting a line to the data provided by the $(r, X_0)$ data:

$$r = \delta X(t) - y. \qquad (12)$$

## 2.5 Fitness Metrics

Intuitively, a growth in $\beta$ indicates improving hunting skills of the predators, while a decrease of $\beta$ indicates that prey is better able to evade predators and defend themselves against predation. We can therefore use $\beta$ as a competitive fitness metric by which to quantify the survivability of the two agent populations. Similarly, the other parameters can be considered as indirectly contributing to the competitiveness: Larger $\alpha$ implies greater resilience under predation as well as greater impact on the environment; an increase in $|\gamma|$ implies greater mortality of predators, and larger $\delta$ indicates a greater dependence on prey.

# 3 Experimental Results

## 3.1 Parameter Determination

We determine how the many simulation parameters impact the prey-predator system by estimating the coefficients of the mathematical model of Section 2. This provides guidance when seeking to fine-tune a simulation scenario. In our model, each food square in the environment, upon depletion, lies fallow for a time determined by the *food-growth-delay* and then vegetation grows back at a speed set by the *food-growth-rate* parameter. These parameters govern the amount of consumable food per time unit, and directly impact the carrying capacity. Fig.1a shows the correlation fixing all other parameters. The base configuration values are indicated in red.

<figure><img src="image_4.png" /><figcaption>(a)</figcaption></figure>

<figure><img src="image_5.png" /><figcaption>(b)</figcaption></figure>
<figure><img src="image_6.png" /><figcaption>**Fig.1.** Effect of environmental settings on the carrying capacity (a). Prey characteristics and their effect (b-d). The red circle marks the base configuration values.</figcaption></figure>

The graphs are relatively straightforward. For instance, the carrying capacity first goes up almost linearly with the food growth rate. However, as the food-growth rate increases, the carrying capacity does not continue to increase linearly and instead approaches a limit value induced by the food-growth-delay. The reason for this is as follows: Beyond a certain rate, re-growth is essentially instantaneous. But grazing takes time and then the food patch has to be fallow for the time specified by the food-growth-delay parameter. This means that the total amount of consumable food cannot exceed a maximum imposed by the rate at which prey grazes and the delay before the food values is fully restored. Fig. 1(a) and (b) show the dependence of carrying capacity on the re-growth speed and regeneration delay. For the base configuration the carrying capacity is about 158. Fig. 2 (a) shows the various measured quantities throughout the simulation of the base configuration.

<figure><img src="image_7.png" /><figcaption>**Fig.2.** The prey population (black curve) and average hunger value (green) of prey. The average age (blue) shows large variation initially accounting for significant fluctuations in (a). The models of simulation game; Red triangles represent live prey while yellow triangles indicate dead prey with simulation interfaces on the controls (b).</figcaption></figure>

Fig. 2(b) shows that the simulation of prey-predators’ problem implements the model described above. We initialized each simulation with 40 prey and 10 predators and ran the simulation until both the prey and predators’ populations became extinct.
The square represents the world used in our experiments. The grey patches represent food content for the prey. The brightness of a patch indicates its food value. As prey consume a patch, the food value slowly fades out and only grows back after a certain period of time. The agents are represented by the triangular shapes with the red ones prey and the turquoise and pink ones predators. When a prey dies it remains on the screen for some time, turning yellow and slowly fading out. This does not happen for the predators.

## 3.2 Estimation of the LV Parameters

In Section 2.1 we determined the carrying capacity in the base configuration from a number of simulation runs, without predators, obtaining $X_c \approx 158$. Following the method described in Sharov[7] the four key parameters, in the base configuration, are about $\alpha = 0.075$, $\beta = 0.00543$, $\gamma = 0.0689$, and $\delta = 0.0031$. We integrated the modified LV equations, for a more intense world, with $\alpha = 0.21$, $\beta = 0.024$, $\gamma = 0.23$, and $\delta = 0.002$. These values are the result of more concentrated food growth and hungrier predators. The predicted system evolution is shown in Fig.3 (a):

<figure><img src="image_8.png" /><figcaption>**Fig.3.** Predicted evolution: The first peak of predator population (red curve) is 42 after about 40 time steps; the crossover of the predator and prey populations (black curve) is 40 after an x-value of about 65 time steps. Carrying capacity is 703 (a). Observed evolution: Predator population peaks at 46, holding steady between time steps 25 and 120; crossover is at time step 57 with 45 individuals (b).</figcaption></figure>

The predictions are in reasonable agreement with the observation, accounting for stochasticity of the simulation. The observed times of extinction are reasonably close considering that, unlike in the equation model, we deal with integer values in the simulation. We have run additional observations and predictions.

# 4 Discussion and Conclusions

We have investigated and estimated experimentally four key parameters from experiments with the prey-predator simulations that allow predicting the fluctuations of the populations using the augmented LV equation. The configuration space expressing the system evolution as function of the parameter assignments is a high-dimensional manifold, so local exploration around a particular configuration is an expedient way to assess the survival value resulting from the various parameter settings when making adjustments.
Our simulation differs from many other studies by basing prey behavior on Reynolds's flocking algorithms [3]. It is known that the parameter settings of the three basic rules of flocking impact the emergent behavior of a flock [10]. This can influence herd size and cohesion and, with them, the effectiveness of grazing: a large herd could exhaust a sector of the environment so quickly, that not all herd members would have adequate grazing. So, as the herd moves to a new square, the followers in the herd could conceivably starve. Thus, it might be better for prey to roam the environment in herds that are smaller and split and explore in different directions searching for food. Such geometric considerations can be analyzed using our approach.

### Acknowledgements

This work has been partially supported by NSF Grants CPATH 0722210 and 0938999, by DOE award DE-FG52-06NA26290, and by a gift from Intel Corporation and by the National Research Foundation of Korea Grant funded by the Korean Government (MEST) (NRF-2010-0016003, Development of Simulation Framework of Group Behaviors for Heterogeneous-Autonomous Character in Computer Game.

### References

1. Michael Macedonia, "Games, Simulation, and the Military Education Dilemma," Forum for the future of Higher Education, Forterra System Inc. (2002)

2. Ajay Gupta, Daniel C. DuVarney, "Using Predators to Combat Worms and Viruses: A Simulation-Based Study," ACSAC, pp.116-125, 20th Annual Computer Security Applications Conference (ACSAC'04), (2004)

3. Seongdong Kim, Chris Hoffmann, J.M Lee, "An Experiment in Rule-based Crowd Behavior for Intelligent Games," Fourth (ICCIT, (2009)
http://www.cs.purdue.edu/homes/cmh/distribution/PapersChron/3896a410.pdf

4. C. Reynolds, "The OpenSteer Library", http://opensteer.sourceforge.net/ (2004)

5. Lotka-Volterra equation, Wikipedia, (2004)-9

6. William A. Mitchell, "Multi-behavioral strategies in a predator-prey game: an evolutionary algorithm analysis", Journal comp. Oikos 118:1073-1083 (2009)

7. Alexei Sharov. Quantitative population ecology.
http://home.comcast.net/~sharov/PopEcol/

8. William A. Mitchell and Steven L. Lima, "Predator-prey shell games: large-scale movement and its implications for decision-making by prey", Journal compilation, Oikos 99:249-259 (2002)

9. Don M. Hugie, "The waiting game: a battle of waits between predator and prey", International Society for Behavior Ecology, Vol. 14 No. 6:807-817 (2003)

10. S.-C. Chiang, C. Hoffmann, S. Mittal, "Emergent Crowd Behavior." CAD'09, Reno, NV, June (2009)