We model the population dynamics of aphidophagous ladybirds and their resource, the aphids, with an age-structured system of differential equations. For reasons of tractability, we neglect seasonal dependence of ladybird–aphid dynamics and use a continuous-time model. We first consider the dynamics of ladybird–aphid populations in the absence of cannibalism. Then, we consider the effects of cannibalism and the conditions for this behaviour to evolve. Subsequently, we consider the evolution of ODP synthesized by larvae. Finally, we study the effects of diversity in the composition of the ODP.

##### No-cannibalism model

The structure of this model is illustrated in Fig. 1. We assume three life-cycle stages for the ladybirds: eggs, larvae and adults, and only one stage for the aphids. The density at time *t* for each class is *x*, *y*, *z* and *r* respectively. The parameters used in the models are listed in Table 1. The equation for the change in egg density is given by:

- ( eqn 1)

where *β · η · r · z* denotes the production of eggs by adults, depending on the number of aphids they eat. *λ* and *m* refer to the death and maturation rates respectively. Changes in the density of larvae are given by:

- ( eqn 2)

where *γ · μ · r · y* refers to the development of adults, which depends on the number of aphids the larvae eat, as shown by Dimetry (1976). The death rate of the larvae that hatch from the eggs is *ξ*. The dynamics of adult density is given by:

- ( eqn 3)

with *ϕ* the death rate of adults. Finally, we assume that in the absence of predators, aphid populations grow logistically. We assume that larvae and adults of ladybirds have different predation rates, denoted by *μ* and *η* respectively:

- ( eqn 4)

To improve the efficiency of the analysis, the model is rescaled in dimensionless parameters and densities. We rescale time from *t* to *αt*, i.e. relative to the growth rate of the aphids, and all densities to density/*k*, i.e. relative to the carrying capacity of the aphids. For ease of notation, we do not introduce new symbols for the scaled parameters, but refer to them by the original symbols, as introduced in eqns 1 to 4 (an overview is given in Table 1). This implies that the differential equations are the same as before, except for the population dynamics of aphids (eqn 4), which becomes:

- ( eqn 5)

This dynamical system can have three equilibria. The trivial equilibrium, where all densities are zero, is unstable for all positive parameter values. In the second equilibrium, the ladybirds are extinct and the aphid density is at its carrying capacity. In the third, the aphids and ladybirds coexist. It can be shown that in this case (see Appendix S1 for derivation):

- ( eqn 6)

This equilibrium only exists if is <1, as otherwise the aphid density equals its carrying capacity, and there can be no coexistence. This leads to the condition:

- ( eqn 7)

which can be written as:

- ( eqn 8)

It can be concluded that *β* and *η* need to be high enough, and *ϕ* low enough, to make coexistence possible. In words, ladybird larvae have to eat many aphids and adults have to survive well and efficiently convert the aphids they eat into eggs. Figure 2a shows the maximum of the real part of the eigenvalues of the Jacobian matrices for the second (ladybirds extinct, aphids at carrying-capacity) and third equilibrium (coexistence) as a function of *β*, the rate of conversion of aphids into eggs by adult ladybirds. From this figure, it can be seen that as long as inequality (8) is invalid, the second equilibrium is stable. As soon as the third equilibrium exists, this non-coexistence equilibrium becomes unstable. Initially the third coexistence equilibrium is then stable, but at very high values of *β* it also becomes unstable. In that case none of the equilibria are stable. Numerical analyses show that in this region of the parameter space, there are stable limit cycles (Fig. 2b,c).

In biological terms, it simply means that ladybirds have to produce sufficient eggs to ensure coexistence. If egg production is larger, the model predicts limit cycles (Fig. 2b,d). Indeed increase in egg production leads to an increase in the number of larvae and of their predation rate, so the number of aphids per larva goes down. As we assume that the growth rate of larvae depends on the number of prey consumed, larvae will take longer to develop. This results in a decrease in adult recruitment.

##### Cannibalism model

That is, the more conspecific eggs larvae eat, the more energy they accumulate and the greater their growth rate. As a consequence, the equation for changes in adult density becomes:

- ( eqn 12)

That is, the more conspecific eggs larvae eat, the higher the proportion that become adult. Egg cannibalism results in an increase in food supply and consequently decreases the time needed for larval development. Consequently, cannibalism first reduces the density of larvae (Fig. 3b), but this loss is not due to death but to an increase in adult recruitment (Fig. 3c). The resultant increase in egg production (Fig. 3a) is counterbalanced by cannibalism, which allows the system to reach equilibrium.

The conditions for the extinction of the predator do not change when cannibalism is added to the model. However cannibalism destabilizes the system, as it increases the parameter range over which cycling occurs (Fig. 4). Still the area of stable cycles remains limited, as a severe increase in the cannibalism rate does not lead to the disappearance of a stable coexistence area. In the following, only parameter combinations where stable coexistence occurs are considered.

**Evolution of cannibalism. ** In this part we examine by means of adaptive dynamics how cannibalism might have evolved. We consider a resident ladybird population at equilibrium with a fixed level of cannibalism, and study whether a mutant with a slightly different tendency to cannibalize can invade the population. By determining which types of mutant can invade different types of resident populations, we can infer the direction of evolution (see e.g. Otto & Day 2007).

In this analysis we use the tendency to cannibalize as the decision variable that varies between mutant and resident. This implies that the parameter *c*_{1} of the cannibalism function (cannibalism tendency, see eqn 10) will change for the mutant, and this will affect the invasive capacity of the mutant. We consider a resident population at equilibrium, with a cannibalism function, denoted by *f*_{r}. The dynamics of the egg density of a rare mutant appearing in this population is given by:

- ( eqn 13)

where denote the equilibrium densities of aphids, larvae and adult ladybirds in the resident population respectively. Dynamics of mutant larva and adult densities are given by:

- ( eqn 14)

- ( eqn 15)

where is the resident equilibrium egg density. Numerical analyses show that any resident population can be invaded by more cannibalistic mutants, that is, when We have seen that despite the increase in cannibalism, the parameter range for coexistence of predators remains the same, as the loss of eggs due to cannibalism is counterbalanced by a better recruitment of adults (Fig. 3c). However, it can be seen from Figs 3b and 4 that without limitation, the evolutionary increase in cannibalism would lead to a dramatic reduction in the density of ladybird larvae and the occurrence of cycles, with the stochasticity occurring under natural conditions, will increase the risk of extinction.

##### The ODP model

With *ρ* the rate of acceptance of occupied patches, (*ρ* < 1), and should decrease when females become more sensitive to ODP. It can be seen that the incorporation of ODP in the relationship corresponds to a reduction in the cannibalism function. Therefore, the effect of ODP is opposite to cannibalism.

**Evolutionary invasion analysis: adding ODP. ** We have seen that ODP can be considered as a decrease of the cannibalism function. To study its evolution, we proceed as before, and consider the initial growth rate of a rare mutant in a resident population fixed for a certain level of ODP. We suppose for physiological reasons that all larvae produce the molecules that compose the ODP, and that these molecules signal the presence of larvae. That is, a mature female will avoid laying eggs near larvae when they are able to detect them. The equations for the dynamics of rare mutants are as follows:

- ( eqn 19)

where *ρ*_{m} is the rate at which mutant females lay eggs in occupied patches,

- ( eqn 20)

where *ρ*_{r} is the rate at which resident females lay eggs in occupied patches, and

- ( eqn 21)

Numerical analyses show that mutants with a better recognition of ODP can invade a resident population. If the level of recognition can improve indefinitely during evolution, this will eventually lead to a perfect avoidance of occupied patches by females, reducing the level of cannibalism to zero.

##### Diversity model

From the previous analyses, we can conclude that there can be an arms race between the larvae and adult females. The best strategy for larvae is to mask their presence from gravid females and benefit by eating any eggs they lay. Thus, when adult females can detect the pheromone produced by larvae, there is a selective pressure towards changing the chemical composition of the pheromone. This situation gives the opportunity for polymorphism in ODP, since it is advantageous to produce a rare pheromone that cannot be detected by the majority of the females. On the other hand, the best response for adult females would be to recognize a mixture of molecules rather than only one, potentially at the cost of being less efficient at recognizing each molecule.

In order to explore this possibility, we consider a model with two versions of ODP and four phenotypes: *AA*, *AB*, *BA* and *BB*. The first letter refers to the version of ODP produced by larvae, the second to that recognized best by adult females. As before, ladybirds have three-age classes. When we add the dynamics of the aphid population, this results in a system of 13 differential equations. For example, the dynamics of the density of eggs of type *AA* are given by:

- ( eqn 22)

where, e.g. Γ_{ba} denotes the rate of acceptance of patches with tracks of type *B* by females that are best at recognizing type *A*, and Γ_{aa}, Γ_{ab} and Γ_{bb} are defined analogously, with:

- ( eqn 23)

Now, we can write the equation for the dynamics of larval density of type *AA* as:

- ( eqn 24)

and for the adults as:

- (eqn 25)

Analysis of the model shows four kinds of stationary behaviour:

- 1
An equilibrium where the densities of all the phenotypes are the same.

- 2
An equilibrium where the densities of types *AA* and *BB* are equal and smaller than those of types *AB* and *BA*, which are also equal.

- 3
An equilibrium where the densities of *AA* and *BB* are equal and larger than those of *AB* and *BA*, which are also equal to each other.

- 4
Stable limit cycles, where the densities of all types fluctuate.

Equilibria (1) and (2) are unstable. Depending on initial conditions [and provided the starting conditions are not exactly equal to equilibrium (1) or (2)], the system converges to either case (3) or (4). Cycles are due to the alternation of advantage due to cannibalism, and recognition of the ODP. That is, the sequences of the peaks are

Alternation of peaks is the result of phases of high cannibalism alternating with phases of high recognition of ODP. When *AB* is dominant, it means that tracks are mainly of the kind *A*, but the recognition of ODP is not optimal. In this case, densities of type *AA* that is best at recognizing tracks of kind *A* increase, due to the avoidance of conspecifics. Phenotype *BA* is also better at recognizing *A* tracks, but it produces offspring that synthesize *B* tracks. Therefore, they are not recognized by their own group and are at a disadvantage compared to *AA*. When type *AA* is dominant, phenotype *BA*, whose larvae produce *B* tracks, are less likely to be recognized by the majority of the adult females and will benefit from eating eggs they lay. In the same way, *BB* and *AB* finally become successively dominant and close the cycle.

To obtain cycles, ‘mixed strategies’, i.e. *AB* (respectively *BA*) need to be frequent enough to increase at the time *BB* (respectively *AA*) dominates. Otherwise the system produces damped oscillations that go to the equilibrium (3) where both *AA* and *BB* are the main phenotypes. The higher the initial densities of *AA* or *BB*, the fewer are the oscillations. It means that in a scenario where ODP is well established, the model predicts the maintenance of a higher recognition rate for ODP when a mutant with new larval track is added in the system (Fig. 5).