Search tips
Search criteria 


Logo of rsosThe Royal Society PublishingRoyal Society Open ScienceAboutBrowse by SubjectAlertsEditorial Board
R Soc Open Sci. 2017 January; 4(1): 160910.
Published online 2017 January 11. doi:  10.1098/rsos.160910
PMCID: PMC5319356

Leaving safety to visit a feeding site: is it optimal to hesitate while exposed?


Animals living in complex environments experience differing risks of predation depending upon their location within the landscape. An animal could reduce the risk it experiences by remaining in a refuge site, but it may need to emerge from its refuge and enter more dangerous sites for feeding and other activities. Here, I consider the actions of an animal choosing to travel a short distance between a safe refuge and a dangerous foraging site, such as a bird leaving cover to visit a feeder. Although much work has been conducted examining the choice between a refuge and a foraging site when faced with a trade-off between starvation and predation risk, the work presented here is the first to consider the travel behaviour between these locations. Using state-dependent stochastic dynamic programming, I illustrate that there are several forms of optimal behaviour that can emerge. In some situations, the animal should choose to travel without stopping between sites, but in other cases, it is optimal for the animal to travel hesitantly towards the food, and to stop its travel at a point before it reaches the refuge. I discuss how this hesitant ‘dawdling’ behaviour may be optimal, and suggest further work to test these predictions.

Keywords: optimal foraging, feeders, starvation/predation trade-off, travelling, distance to cover, refuges

1. Introduction

The threat of being eaten influences many of the behavioural and life-history decisions made by organisms [1,2]. Animals can adjust the predation risk that they experience by choosing where they move. Seeking and remaining within sheltered locations will reduce exposure to predators [3,4], but animals using these refuges will face a trade-off between being safe and being able to conduct other mutually exclusive behaviours such as foraging or seeking a mate. Because it will need to eat before it starves, an animal will be expected to dynamically switch its behaviour between seeking refuge and foraging [5,6].

Many environments are heterogeneous, and an animal will experience differing feeding opportunities and levels of predation risk as it moves through the landscape [710]. In some environments, such as patchy woodlands, an animal may be able to move quickly back and forth between exposed foraging areas and refuge areas where it is safe from being attacked, minimizing its overall exposure to predators [11,12]. Previous studies have explored what animals should do when they have to break cover and visit a foraging site [1117], where the space that lies between these two distinct regions is ignored. This means that little consideration has so far been given to the behaviour that animals show when moving through the exposed region between the refuge and a feeding site.

Continuously travelling back and forth means that an animal is spending periods of time neither in the safety of its refuge nor at a foraging site where it is able to replenish its diminishing energy reserves. The exposed region between the two sites is itself unlikely to be homogeneous in the risks that the animal will be exposed to [8,9]. Even if there is a constant risk of a predator attacking within the region, an animal close to the refuge at an intermediate location is likely to have a reduced overall chance of being predated when a predator appears, as it is more likely to reach cover than an animal that is further away and that has to travel a longer distance to safety. So, it could be the case that being close to a refuge is nearly as safe as being in the refuge, which in turn means that the animal has to spend less time in travelling a shorter distance between the intermediate semi-safe location and the foraging site. So, should animals stop at intermediate points in this exposed zone when they are travelling between safety and a foraging site?

I explore the decisions an animal makes during this travel period using stochastic dynamic programming [1821], a technique where it is possible to consider the effects that multiple consecutive behavioural decisions have upon the fitness of an animal in a given state. I use the technique to identify the optimal choice of movement for an animal that has to move away from safety and travel through a risky environment towards a feeding site, and where the animal's metabolism means that it is spending energy continuously. The animal therefore faces a trade-off between staying under cover and potentially starving to death, or risking travel to the foraging site and exposing itself to predation. The trade-off between starvation and predation is well characterized [5,6] and has been explored within dynamic programmes (e.g. [19,2225]), but although some consideration has been given to animals choosing to explicitly change location between a safe refuge and a dangerous foraging site [5,26] (rather than an implicit assumption that they are doing this by altering their behaviour), no consideration has been given to how the animal should behave in the dangerous exposed region between these two locations, where the danger is as great as being at the foraging site. Here, I describe a simple model of this travel behaviour through the exposed region, and explore whether there are general qualitative predictions about this behaviour that could be used to inform further work. The framework I present is particularly suitable for experiments where feeders are set a short distance from cover (e.g. [15,2729]), and I give suggestions about how the model could be extended to consider these.

2. Material and methods

2.1. Model outline

An animal is assumed to exist in an environment consisting of a foraging site located D units away from a safe refuge, separated by D  1 exposed intermediate points. At any given moment in time t, the animal is found at location d (one of these D + 1 locations). Any changes to the environment or the animal occur at discrete time-steps. If the animal is in its refuge, it is presumed to be safe from predators, but if it is outside the refuge, there is a probability α that a predator appears during a time-step. If a predator has appeared, the animal is killed with probability π per time-step. If a predator appears, it is assumed that it will immediately pursue the animal until it has either escaped or been captured. The animal is therefore assumed to start to flee homeward in the next time period, moving one step closer to the refuge at each decision period until it has entered the refuge. The predator remains present in the environment until the animal has returned home, meaning that an animal that encounters a predator close to the refuge suffers fewer periods with the risk of being predated, when compared with an animal closer to the foraging site. Once the animal has returned home, the predator immediately departs. I note here that I am not considering predation risk as being different for a foraging animal and for a travelling animal (although it would be interesting to extend the model to consider how increased exposure while foraging affects decision-making). I also note here that because I am not explicitly modelling predator spatial location, I am therefore ignoring considerations about flight initiation distance [3032]. I do however consider that the energy reserves of an animal will add to its predation risk through mass-dependent costs [33], where individuals with higher energy reserves will incur a greater risk. These costs are modelled by considering an exponent of the individual's energy reserves (as conducted in Bednekoff & Houston [34]), multiplied by a scalar σ. A larger value of σ implies a higher risk of being predated with large energy reserves. So, if a predator is present, I consider the probability of an exposed individual being killed during a period to be π + σx2.

If no predator is present in the environment during a time period (or no predator has yet appeared), the animal can choose between three options (denoted u, the distance moved towards the foraging patch): move one step towards the foraging patch; remain in its current location; or move one step back towards the refuge at d = 0. For most locations, all three of these behaviours are possible. However, if the individual is at the home location, it can only choose between u = 0 or +1, whereas if it is at the foraging patch, it can only choose between u = −1 and 0.

The individual can only increase its energy reserves when it is at the foraging site, where it gains energy at a mean rate γ¯ (with known variance: the individual has a set probability (γ0, γ1, γ2) of finding 0, 1 or 2 energy units of food when it is foraging). Because the model considers an individual that is assumed to be active within the environment, I assume here that it is metabolically active in this model regardless of whether it is moving or not, and it is assumed to have a mean metabolic rate κ¯ that does not differ with activity conducted (where the metabolic rate also has a known variance, with the individual having a set probability (κ0, κ1, κ2) of losing 0, 1 or 2 energy units in a period).

Given these assumptions, optimal policies were calculated using stochastic dynamic programming [1821]. Full details of the model are given in appendix A.

2.2. Forward simulation

For each optimal policy generated, sets of 1000 individuals were run independently through each policy for 20 000 time-steps. Each individual within a set started at t = 0 in the refuge d = 0, with initial energy reserves sampled from a uniform distribution of (1, 2, …, xmax  20) energy units. The period's decision was taken from the optimal policy, and metabolic expenditure (and energy gain if appropriate) were randomly generated according to the parameters that generated the policy. In the forward simulations, predation did not occur, and so the forward simulations solely consider the behaviour of an animal following an optimal policy in a risky environment. Any deaths occurring are therefore due to the animal starving to death. The parameter space chosen was sufficient to ensure that most (99.87 ± 0.008%, mean ± s.d.) of the individuals within each simulation set survived through to the end of their forward runs.

Summary statistics were then calculated as the mean value of the following measures for each set of those individuals who were still alive at the end of a forward run. The two state values of each individual were tracked over time to calculate its mean energy reserves and proportional mean distance from the refuge, and its initial departure time was recorded as the period that it first moved away from the refuge. Once an individual had left the refuge for the first time, the time spent in the refuge after its initial departure was recorded for the remaining periods, as well as the number of visits made to the refuge and the length of each visit. Also recorded were the time spent foraging, the number of visits to the foraging site and the length of foraging episode (noting that an individual forages when it spends a period static at the foraging location), the time spent static when at an exposed location in between the refuge and foraging site, and the number of stays at exposed turning points (taken to be a location where the previous change in location was homeward, and the next change in location was towards the foraging location). If an individual was static during the last (20 000th) period of a simulation, additional periods were calculated solely to assess whether this was a minimum turning point or not—these additional periods did not contribute to any of the other metrics calculated.

Individuals that are not at either the home site or the foraging site during a period are considered to be moving either outwards or homewards. An individual is classified as moving outwards if its last non-zero movement was towards the foraging site, and homewards if its last non-zero movement was towards the home site. These two classifications mean that individuals that have been static for one or more periods are still considered to be in directed transit, based on their last movement. The speed when moving towards and away from the foraging site of an individual are the proportion of those periods where the individual is classified as moving in a given direction where its location changes between consecutive time-steps.

2.3. Model exploration

In total, 50 000 policies were calculated for independently generated parameter sets, as detailed in appendix B, keeping the foraging site at 80 units from the refuge. Models were coded in C++, using a Mersenne twister algorithm for random number generation.

To examine the effects of distance, 5000 parameter sets were also generated, and policies were calculated for these while systematically altering the distance of the foraging site to be 20, 40, 60, 80 and 100 units from the refuge.

Using the three policy classifications described in the results section (identified from initial pilot simulations), summary statistics were explored and visualized using ggplot2 [35] within R v. 3.2.2–4 [36]. To explore whether policy form had an effect on the summary statistics collected, permutation tests were conducted [37,38]. For each summary statistic, Fobs was calculated as the standard F-value from one-way ANOVA (where d.f. = 249 997 for all measures except outward speed, where d.f. = 249 996 through one datapoint being corrupt, and length of home visit where only those simulations where individuals returned home were considered, using d.f. =22 420). Corresponding F-values were calculated for 10 000 complete permutations of the entire dataset, and from these sets the largest value was identified, denoted ‘Fmax, corresponding to significance levels of α = 0.0001. Sensitivity analyses were also conducted exploring the interaction between the policy classifications and parameter values. The results of these are presented in the electronic supplementary material, figures S1–S11, but are not discussed in any detail here as the focus of this work is on the policy forms generated by the model.

3. Results

Optimal policies were generated when exploring the parameter space described. In all the policies (figure 1), the animal should move away from home towards the foraging site if its energy reserves are very low (as it would otherwise be at risk of starvation), and it should always move back towards home if its reserves are suitably high (as it is unlikely to starve, and so is exposing itself to unnecessary predation risk). The policy forms differed in how individuals with intermediate levels of energy reserves should behave, mostly showing a clear energy threshold level at a given location, such that the animal should move homeward if its reserves fall above this threshold, and move to the foraging site if its reserves fall below the threshold (although it is optimal to not move at some of these threshold values, as shown by the yellow points on figure 1). This essentially means that the individual should tend to move towards the foraging site when its energy reserves are suitably low, and towards the refuge once it has replenished its reserves, and so following the policy should keep the individual within the state space in the policies that is close to the switching threshold between behaviours.

Figure 1.
Examples of the forms of policy produced by the foraging model. Each panel shows the single optimal behaviour when a predator is absent from the environment, calculated for all possible energy reserves x at all possible distances d from the refuge at ...

Three forms of policy emerged from parameter exploration. In the first (figure 1a), labelled a decreasing policy, the threshold describing the switch between behaviours falls monotonically as distance from the refuge increases. In the second (figure 1b), labelled an increasing policy, the threshold increases monotonically as distance from the refuge increases. Note that the example shown in figure 1b is an extreme example—not all increasing policies rise such that the threshold at foraging site is the maximum energy reserves. The final policy form, labelled an intermediate policy (figure 1c), has a non-monotonic threshold that falls and then rises again as distance from the refuge increases, giving an intermediate location where the threshold is lowest.

In all the policy types shown, the animal should remain in the refuge if its energy reserves are above the threshold (shown by the yellow bar on the left side of each diagram). When the animal is at the foraging site, it should stay if its reserves are below the threshold, but it should be noted that for the decreasing policies, this switching threshold at the foraging site can be higher than the switching threshold at the location immediately before the foraging site (seen as the jump between the turquoise ‘move towards food’ region and the right-hand yellow region in figure 1a). This means that once the animal has reached the foraging site, it should build its energy reserves by staying for a number of periods before it moves off.

Having identified these three policy forms, the data generated were sorted according to the optimal policies the simulated individuals were following. This was done for each policy by identifying the lowest energy value at each location at which the optimal behaviour switched, and then identifying whether these threshold values increased, decreased or showed an intermediate minimum with respect to distance from the refuge. For the policies generated, 11.9% were decreasing, 29.3% were increasing and 58.8% were of the intermediate form (table 1). For the fitness values calculated by the dynamic programme for optimal policies (electronic supplementary material, figure S12), calculated fitness tended to increase sigmoidally with distance from the refuge when predators were absent, and decay with a decelerating form when predators were present. All else being equal, individuals with low energy reserves had lower calculated fitnesses.

Table 1.
The effects of the policy types on the measured statistics (shown with standard deviations, where appropriate). Policies were classified according to the descriptions given in the Results. Also given are indications of how statistics change in response ...

The form of policy seen was influenced strongly by the environmental predation risk, α. In environments with a high chance of a predator appearing (high α), policies tended to be increasing (crosses, figure 2a). As environmental risk decreased, intermediate policies became more common (filled squares, figure 2a), showing a peak in the proportion of policies produced at intermediate environmental risk levels. Although decreasing policies were never the most common policy in the parameter set explored, they did become gradually more common as risk was reduced (open circles, figure 2a).

Figure 2.
Effects of the model parameters on the form of policy produced. Parameters randomly generated for model exploration were continuously distributed, and are presented here by presenting the proportion of each policy type calculated for binned sets of parameter ...

The other parameters explored had less pronounced effects on the proportion of each policy type seen. Increasing the mean gain γ¯ led to more decreasing policies and fewer intermediate policies (figure 2b), while increasing the mean cost κ¯ had the opposite effect (figure 2c). The risk of being killed when a predator was present π had a subtler effect, with an intermediate maximum in the proportion of intermediate policies and an intermediate minimum in the proportion of decreasing policies at an intermediate value of π (figure 2d). Increasing the mass-dependent predation scalar σ led to an increase in the proportion of decreasing policies and a reduction in the proportion of intermediate policies (figure 2e). The proportion of increasing policies seen were little affected by changes in gain, cost or mass-dependent predation scalar (figure 2b,c,e), but showed a gradual increase with an increase in the risk of being killed when a predator was present (figure 2d).

For all the statistics calculated, the Fobs values obtained from resampling were much greater than the ‘Fmax values from the sampled distribution (electronic supplementary material, table S1), suggesting that policy type can have large effects on the behaviours being measured.

Animals following decreasing policies tended to spend a longer time at home before their initial departure, when compared to animals following increasing or intermediate policies (table 1), because the threshold for leaving tended to be lower. Once they had left the refuge for the first time, animals following decreasing policies tended not to return to the refuge often (less than 20% of the simulations following these policies returned home, table 1), but if they did return, they remained in the refuge over multiple consecutive periods. Most of their time was spent nearer to the foraging site than the refuge (table 1). Their movement towards and away from the foraging site followed the form of pattern illustrated in figure 3. Movement towards the foraging site tended to be punctuated by a series of stops and starts, giving a slow mean outward speed (table 1) resulting from a large amount of their time spent static in the exposed region between refuge and foraging site (table 1). Once they arrived at the foraging site, they foraged for a short period of time, and then headed back to the refuge at ‘top speed’, without pausing until they reached an intermediate exposed turning point, whereon they turned and started heading back towards the foraging site (possibly pausing first). This slow movement towards the foraging site and fast movement away was continuously repeated, with the location of the exposed turning point changing over time (as seen in figure 3) as optimal turning behaviour is dependent upon the energetic state of the animal. Individuals following decreasing policies also tended to have low mean energy reserves over time (table 1).

Figure 3.
Demonstration of a ‘dawdling’ time series, coming from an individual following the decreasing policy given in figure 1a. The distance from the refuge (a) and energy reserves (b) of an individual are shown for the first 10 000 time-steps ...

In comparison, animals following increasing policies showed much more time at the refuge, with all individuals returning at some point during the simulations, and spending a much longer time in the refuge per visit than returning individuals following decreasing policies (table 1). They spend very little time static in the exposed region, and tend to shuttle back and forth between the foraging site and refuge, travelling at top speed in both directions and tending not to turn back in the exposed region. As they spend more time at the refuge than foraging, over time they tend to be close to the refuge (as seen in the proportional mean distance to the refuge, table 1). The shape of an increasing policy means that an animal leaving the refuge will tend to spend a long time at the foraging site to build its reserves to a point where it then returns home, and this is seen in the larger amount of time spent foraging (table 1). Animals following increasing policies tend to have much higher energy reserves than with other policies (table 1).

Animals following an intermediate policy tended to show behavioural statistics intermediate between the decreasing and increasing policy behaviours, with their overall behaviour more closely matching the form of individuals following decreasing policies (table 1), with intermediate turning points and stuttering movement out towards the foraging site.

Changing the distance to the foraging site affected behaviour. Table 1 shows the patterns of change seen in the summary statistics when this distance was increased (summarizing the electronic supplementary material, figures S13–S15). Policy form had no effect on several of the patterns seen, which were similar for all three policies: the number of visits back to the refuge or to the foraging site and the time spent in the refuge decreased with increasing distance, while the mean energy reserves increased. A further foraging site (modelled by increasing D) meant animals tended to spend more time in the refuge during a visit (unless following a decreasing policy with a close foraging site), and tended to spend longer at the foraging site during a visit (again, unless following a decreasing policy with a close foraging site). Animals tended to stop less when travelling towards the foraging site (except where the policy was increasing, when they would have been travelling without pausing regardless of distance).

4. Discussion

The model described here demonstrates that when we are observing the behaviour of an animal choosing to move between a refuge and a close foraging site, it may be optimal for an animal to be making decisions about its behaviour while travelling between these two locations. Dependent upon the form of policy followed, the animal may also show slow ‘dawdling’ behaviour on its way towards the foraging site (but should always return fast), as is seen when policies show decreasing or intermediate forms. For the sake of describing the different forms of behaviour seen, I arbitrarily divided policies into three forms, but it may be more correct that they are seen as a continuum, where intermediate policies are similar to decreasing ones, as is evident from the similarity of the report statistics in table 1. The form of increasing policies suggested that distinguishing these from the other forms is sensible, however. These increasing forms are particularly likely when the probability of a predator appearing is high, which means that animals foraging in dangerous environments should tend to travel quickly between the refuge and foraging site, rather than spend extra time exposed.

The model suggests that in some cases (particularly for decreasing policies) it might be advantageous to remain part-way between the foraging site and the refuge, rather than returning completely to cover. Showing exposed turning points means that an individual does not have to travel the full distance between the foraging site and the refuge each time (saving time and energy), while keeping its minimum distance to the refuge suitably small to reduce its overall probability of being captured by a predator if one appears. Within the model, when the animal initially heads homewards after leaving the foraging site, it does not stop until it reaches a turning point. Because the optimal policy is fixed for an individual, the location of the turning point will depend upon both immediate metabolic expenditure and the energy gained in the previous foraging episode, both of which are stochastic. Empirically, this translates to uncertainty in both food supply and metabolic processes, and should be interpreted as an individual being expected to stop at some intermediate exposed location, rather than as an exact prediction about location (and the stuttering stop–start behaviour when moving back to the foraging location should be interpreted similarly). Furthermore, it is likely that stopping points will be heavily influenced by local environmental features (e.g. convenient points to perch, stand or otherwise rest). An animal in the wild may therefore be likely to follow a simpler heuristic than its optimal policy [39], such as ‘after eating, travel homeward and stop at a convenient exposed location, and wait until your reserves fall to a predefined level’.

Despite the potential ease of observing travel to a close foraging site, and the number of studies exploring this form of foraging behaviour (e.g. [1117,2729,4043]), there is little empirical information about this behaviour, and that which exists (e.g. [41], which shows that several species of bird travelled directly between refuge and foraging site without stopping) is anecdotal. Model predictions are accessible to study with wild individuals foraging at feeders, and could even be explored using common garden feeders (e.g. [27,28]) provided a suitable technique for avoiding pseudoreplication is used. The predictions made here about behaviour in response to differing distances between the refuge and foraging site are particularly open to experimental manipulation, and broadly match existing empirical evidence (e.g. [16,29,42]).

Experiments on fish in tanks containing refuges and foraging sites separated by an open space are particularly suitable for testing model predictions (although tank design may directly influence the behaviour observed [44]). Directness of motion between a refuge and a foraging site or latencies in leaving and travelling across an open space were recorded as a report statistic for fish [45,46], while other reports [47,48] describe time spent in a ‘hesitancy zone’ as an area immediately outside a refuge that individuals may pause in (which may be relevant to the current model, although it is possible that optimal pausing could happen in regions beyond any arbitrarily allocated ‘hesitancy’ threshold).

The model presented here considers a single forager in a simple environment where the forager is unable to influence how it detects and responds to the predator. The forager could show vigilance [49,50], which may enhance its ability to detect the predator early (potentially to the detriment of foraging or travel speed). The forager could also decide the distance at which it is best to start fleeing from the predator, and the speed at which it should escape [3032], or it could reduce its time at the foraging site by carrying food back to the refuge for processing [11,12,41]. The model also assumes the predator leaves immediately once the forager has returned to its refuge, but if the predator remains, the forager may have to wait a length of time until it is (potentially) safe to emerge [51], which may also be dependent upon its current size and metabolic rate [52,53]. Adding temporal changes to the environment, such as through fluctuating food availability or predator presence [5,6], may also affect the foraging behaviour (potentially pushing foraging behaviour to bimodal peaks similar to those predicted for small birds in winter [18,19], although there is experimental evidence [54] suggesting foraging may occur throughout the day). Finally, the forager's social environment may influence its behaviour and risks incurred [24,55,56]. If there are multiple individuals foraging together with dominance hierarchies affecting how they interact, an individual's position within the hierarchy may determine how far it has to go to forage [14,57], or the amount of access it has to a refuge [58]. The modelling framework I outline here could be extended to consider these additional complications, in addition to being parametrized to more accurately represent the biology of a species of interest.

Here, I have described an optimal behaviour akin to latent approach behaviour as an optimal foraging strategy under the risk of predation. Similar patterns are seen in the cognitive sciences in response to a fitness-reducing factor. A slow approach behaviour could be construed as ‘wariness’ or ‘fearfulness’ by an observer [59,60], and in tests exploring cognitive bias, negative underlying emotional states may lead animals to show latency in approaching stimuli [61]. Tests exploring speed–accuracy trade-offs also explore delays in approaching targets [62]. In this study, I demonstrated that this ‘dawdling’ may be an optimal response, and there could be adaptive value to what observers may see as undirected behaviour.

Supplementary Material

This material contains two files. The first collects the following figures:• Table S1: results of randomisation test• Figures S1-S11: sensitivity analyses• Figure S12: examples of fitness values generated• Figures S13-S15: effects of changing foraging site distance on summary statisticsNote that the sensitivity analyses are presented here as graphs without further in depth discussion of the trends seen, given that the focus of this paper is on the policy forms.

Supplementary Material

The code used is included as a separate file ‘’, which contains two files suitable for building with a C++ compiler:• main.cpp, which is the main model code• mersenne_twister.h, which contains the Mersenne twister functionThe latter is an amended version of a library distributed under a GNU Library General Public License - please see the file header for details.


Christos Ioannou, Nicola Rooney, Joah Madden and two anonymous reviewers are thanked for discussion.

Appendix A. Model details

An individual's state is characterized by: its energy reserves x(0,1,,xmax); its distance from the refuge d(0,1,,D); and whether there is a predator immediately present in the environment p(A,P), where A denotes an environment where a predator is absent and P denotes an environment where there is a predator present. If the individual is at the foraging site, it gains γi = i units of energy for i = 0, 1 or 2 with probability Γ(γi), where iΓ(γi)=1. During a time period, the individual also spends κj = j units of energy for j = 0, 1 or 2 with probability K(κj), where jK( κj=1. In the exploration of parameter space, mean gain and mean cost are set such that there is an expected net gain when at the foraging site, and a slow decline in reserves when the animal is elsewhere in the environment.

The environment the individual occupies is assumed to be one-dimensional, such that the individual's location in the environment d represents the number of steps it would take the individual to return to its refuge at d = 0 if it were to travel directly homewards. The refuge at d = 0 is assumed to be safe and predator free, while the patch at d = D is the foraging site, and is the furthest point the individual can travel from the refuge. If an individual returns to its refuge, any predators previously present in the environment are assumed to have departed as soon as the individual has returned home (when d = 0).

The individual is assumed to make a series of consecutive decisions about its behaviour at periods [0, T], where T is sufficiently large to allow for convergence (see below) to occur in less than T periods. At a time t, the fitness of an individual at a given state combination is denoted V(x, d, p, t).

The reward function R(x, d, p) at t = T is set as

A 1

Having set these final fitness values, the following criteria can be used to calculate all values of V(x, d, p, T  1), and these can then be used to calculate all values of V(x, d, p, T  2), and so forth, using backward iteration.

If a predator is present

A 2

where Λ(x)=min(xmax,max(0,x)).

If a predator is absent and x > 0, V(x,d,A,t)=maxuH(x,0,A,t|u), where u denotes the behavioural options available

H(x,0,A,t|u)={not consideredifu=1κ=02K(κ)V(Λ(xκ),0,A,t+1)ifu=0(1α)κ=02K(κ)V(Λ(xκ),1,A,t+1)+α(1(π+σx2))×κ=02K(κ)V(Λ(xκ),1,P,t+1)ifu=+1,
A 3a

A 3b

A 3c

H(x,D,A,t|u)={(1α)κ=02K(κ)V(Λ(xκ),D1,A,t+1)+α(1(π+σx2))×κ=02K(κ)V(Λ(xκ),D1,P,t+1)ifu=1(1α)κ=02γ=02K(κ)Γ(γ)V(Λ(x+γκ),D,A,t+1)+α(1(π+σx2))×κ=02γ=02K(κ)Γ(γ)V(Λ(x+γκ),D,P,t+1)ifu=0not consideredifu=+1.
A 3d

Backward iteration was conducted until tconv, where maxx,d,p|V(x,d,p,tconv)V(x,d,p,tconv+1)|0.00001, where V′(x, d, p, t) is V(x, d, p, t) standardized so that the highest value is set equal to 1 (such that V(x,d,p,t)=V(x,d,p,t)/{maxx,d,pV(x,d,p,t)}). Since environmental conditions are not explicitly dependent upon time, I assume that strong backward convergence holds [19,63], and so the results described are independent of assumptions made about the reward function. Therefore, I assume that the policy generated in response to V(x, d, p, tconv) is the optimal policy. I note here that none of the optimal policies generated had ambiguous results—all possible state combinations had a single optimal behaviour associated with it.

Appendix B. Sensitivity analysis parameters

For parameter space exploration, each parameter set was generated using the following criteria, where randn is a random variable independently sampled from a uniform distribution (0,1): α = 10E(−2–8rand1); π = 10E(−1–4rand2);σ=(10E(36rand3))/(xmax2); Γ(2) = 0.5 + 0.49rand4; Γ(0) = (1  Γ(2))rand5; K(0) = 0.95 + 0.45rand6; and K(1) = (1  K(0)rand7.

Data accessibility

C++ code for the model simulations described is included in the electronic supplementary material.

Competing interests

I declare I have no competing interests.


This work was supported by the University of Bristol Returning Carers' Scheme.


1. Lima SL, Dill LM 1990. Behavioral decisions made under the risk of predation: a review and prospectus. Can. J. Zool. 68, 619–640. (doi:10.1139/z90-092)
2. Nonacs P, Blumstein DT 2010. Predation risk and behavioral life history. In Evolutionary behavioral ecology (eds Westneat DF, Fox CW), pp. 207–221. New York, NY: Oxford University Press.
3. Sih A. 1997. To hide or not to hide? Refuge use in a fluctuating environment. Trends Ecol. Evol. 12, 375–376. (doi:10.1016/S0169-5347(97)87376-4) [PubMed]
4. Sih A, Petranka JW, Kats LB 1988. The dynamics of prey refuge use: a model and tests with sunfish and salamander larvae. Am. Nat. 132, 463–483. (doi:10.1086/284865)
5. Houston AI, McNamara JM, Hutchinson JMC 1993. General results concerning the trade-off between gaining energy and avoiding predation. Phil. Trans. R. Soc. Lond. B 341, 375–397. (doi:10.1098/rstb.1993.0123)
6. Higginson AD, Fawcett TW, Trimmer PC, McNamara JM, Houston AI 2012. Generalized optimal risk allocation: foraging and antipredator behavior in a fluctuating environment. Am. Nat. 180, 589–603. (doi:10.1086/667885) [PubMed]
7. Blanchard P, Lauzeral C, Chamaillé-Jammes S, Yoccoz NG, Pontier D 2016. Analyzing the proximity to cover in a landscape of fear: a new approach to fine-scale habitat use by rabbits facing feral cat predation on Kerguelen archipelago. PeerJ 4, e1769 (doi:10.7717/peerj.1769) [PMC free article] [PubMed]
8. Brown JS. 1999. Vigilance, patch use and habitat selection: foraging under predation risk. Evol. Ecol. Res. 1, 49–71.
9. Brown JS, Laundré JW, Gurung M 1999. The ecology of fear: optimal foraging, game theory, and trophic interactions. J. Mammal. 80, 385–399. (doi:10.2307/1383287)
10. Laundré JW, Hernández L, Altendorf KB 2001. Wolves, elk, and bison: reestablishing the ‘landscape of fear’ in Yellowstone National Park U.S.A. Can. J. Zool. 79, 1401–1409. (doi:10.1139/cjz-79-8-1401)
11. Lima SL. 1985. Maximizing feeding efficiency and minimizing time exposed to predators: a trade-off in the black-capped chickadee. Oecologia 66, 60–67. (doi:10.1007/BF00378552)
12. Lima SL, Valone TJ, Caraco T 1985. Foraging-efficiency–predation-risk trade-off in the grey squirrel. Anim. Behav. 33, 155–165. (doi:10.1016/S0003-3472(85)80129-9)
13. Grubb TC Jr, Greenwald L 1982. Sparrows and a brushpile: foraging responses to different combinations of predation risk and energy cost. Anim. Behav. 30, 637–640. (doi:10.1016/S0003-3472(82)80133-4)
14. Schneider KJ. 1984. Dominance, predation, and optimal foraging in white-throated sparrow flocks. Ecology 65, 1820–1827. (doi:10.2307/1937778)
15. Cowie RH, Simons JR 1991. Factors affecting the use of feeders by garden birds: I. The positioning of feeders with respect to cover and housing. Bird Study 38, 145–150. (doi:10.1080/00063659109477083)
16. Pascual J, Senar JC 2013. Differential effects of predation risk and competition over vigilance variables and feeding success in European siskins (Carduelis spinus). Behaviour 150, 1665–1687. (doi:10.1163/1568539X-00003114)
17. Cowlishaw G. 1997. Refuge use and predation risk in a desert baboon population. Anim. Behav. 54, 241–253. (doi:10.1006/anbe.1996.0466) [PubMed]
18. Clark CW, Mangel M 2000. Dynamic state variable models in ecology: methods and applications. New York, NY: Oxford University Press.
19. Houston AI, McNamara JM 1999. Models of adaptive behaviour: an approach based on state. Cambridge, UK: Cambridge University Press.
20. Mangel M. 2015. Stochastic dynamic programming illuminates the link between environment, physiology, and evolution. Bull. Math. Biol. 77, 857–877. (doi:10.1007/s11538-014-9973-3) [PubMed]
21. Houston AI, Clark CW, McNamara JM, Mangel M 1988. Dynamic models in behavioural and evolutionary ecology. Nature 332, 29–34. (doi:10.1038/332029a0)
22. McNamara JM, Houston AI, Lima SL 1994. Foraging routines of small birds in winter: a theoretical investigation. J. Avian Biol. 25, 287–302. (doi:10.2307/3677276)
23. Houston AI, McNamara JM 1993. A theoretical investigation of the fat reserves and mortality levels of small birds in winter. Ornis Scand. 24, 205–219. (doi:10.2307/3676736)
24. Rands SA, Cowlishaw G, Pettifor RA, Rowcliffe JM, Johnstone RA 2003. The spontaneous emergence of leaders and followers in a foraging pair. Nature 423, 432–434. (doi:10.1038/nature01630) [PubMed]
25. Brodin A. 2007. Theoretical models of adaptive energy management in small wintering birds. Phil. Trans. R. Soc. B 362, 1857–1871. (doi:10.1098/rstb.2006.1812) [PMC free article] [PubMed]
26. Newman JA. 1991. Patch use under predation hazard: foraging behavior in a simple stochastic environment. Oikos 61, 29–44. (doi:10.2307/3545404)
27. Allen AJ, Harper DGC 2000. Foraging blue tits Parus caeruleus may trade-off calorific value of food items and distance from cover. Bird Study 47, 232–234. (doi:10.1080/00063650009461178)
28. Horn DJ, Abdallah M, Bastian MK, DeMartini JR, Wilhelmi RM 2003. Bird abundances at feeders increases with decreasing distance to cover. Trans. Ill. State Acad. Sci. 96, 247–254.
29. Mónus F, Barta Z 2016. Is foraging time limited during winter? – a feeding experiment with tree sparrows under different predation risks. Ethology 122, 20–29. (doi:10.1111/eth.12439)
30. Ydenberg RC, Dill LM 1986. The economics of fleeing from predators. Adv. Stud. Behav. 16, 229–249. (doi:10.1016/S0065-3454(08)60192-8)
31. Cooper WE., Jr 2015. Theory: models of escape behavior and refuge use. In Escaping from predators: an integrative view of escape decisions (eds Cooper WE Jr, Blumstein DT), pp. 17–60. Cambridge, UK: Cambridge University Press.
32. Cooper WE Jr, Frederick WG 2007. Optimal flight initiation distance. J. Theor. Biol. 244, 59–67. (doi:10.1016/j.jtbi.2006.07.011) [PubMed]
33. Witter MS, Cuthill IC 1993. The ecological costs of avian fat storage. Phil. Trans. R. Soc. Lond. B 340, 73–92. (doi:10.1098/rstb.1993.0050) [PubMed]
34. Bednekoff PA, Houston AI 1994. Dynamic models of mass-dependent predation, risk-sensitive foraging, and premigratory fattening in birds. Ecology 75, 1131–1140. (doi:10.2307/1939436)
35. Wickham H. 2009. ggplot2, elegant graphics for data analysis. New York, NY: Springer-Verlag.
36. R Development Core Team. 2016. R: a language and environment for statistical computing. Vienna, Austria: R Foundation for Statistical Computing.
37. Anderson MJ. 2001. Permutation tests for univariate or multivariate analysis of variance and regression. Can. J. Fish. Aquat. Sci. 58, 626–639. (doi:10.1139/cjfas-58-3-626)
38. Rands SA, Pettifor RA, Rowcliffe JM, Cowlishaw G 2006. Social foraging and dominance relationships: the effects of socially mediated interference. Behav. Ecol. Sociobiol. 60, 572–581. (doi:10.1007/s00265-006-0202-4)
39. Rands SA. 2011. Approximating optimal behavioural strategies down to rules-of-thumb: energy reserve changes in pairs of social foragers. PLoS ONE 6, e22104 (doi:10.1371/journal.pone.0022104) [PMC free article] [PubMed]
40. Walther BA, Gosler AG 2001. The effects of food availability and distance to protective cover on the winter foraging behaviour of tits (Aves: Parus). Oecologia 129, 312–320. (doi:10.1007/s004420100713)
41. Valone TJ, Lima SL 1987. Carrying food items to cover for consumption: the behavior of ten bird species feeding under the risk of predation. Oecologia 71, 286–294. (doi:10.1007/BF00377297)
42. Monclús R, Anderson AM, Blumstein DT 2015. Do yellow-bellied marmots perceive enhanced predation risk when they are farther from safety? An experimental study. Ethology 121, 831–839. (doi:10.1111/eth.12397)
43. Slotow R, Coumi N 2000. Vigilance in bronze mannikin groups: the contributions of predation risk and intra-group competition. Behaviour 137, 565–578. (doi:10.1163/156853900502213)
44. Näslund J, Bererhi B, Johnsson JI 2015. Design of emergence test arenas can affect the results of boldness assays. Ethology 121, 556–565. (doi:10.1111/eth.12368)
45. Ioannou CC, Singh M, Couzin ID 2015. Potential leaders trade off goal-oriented and socially oriented behavior in mobile animal groups. Am. Nat. 186, 284–293. (doi:10.1086/681988) [PubMed]
46. McDonald ND, Rands SA, Hill F, Elder C, Ioannou CC 2016. Consensus and experience trump leadership, suppressing individual personality during social foraging. Sci. Adv. 2, e1600892 (doi:10.1126/sciadv.1600892) [PMC free article] [PubMed]
47. Harris S, Ramnarine IW, Smith HG, Pettersson LB 2010. Picking personalities apart: estimating the influence of predation, sex and body size on boldness in the guppy Poecilia reticulata. Oikos 119, 1711–1718. (doi:10.1111/j.1600-0706.2010.18028.x)
48. Ioannou CC, Payne M, Krause J 2008. Ecological consequences of the bold-shy continuum: the effect of predator boldness on prey risk. Oecologia 157, 177–182. (doi:10.1007/s00442-008-1058-2) [PubMed]
49. Lima SL, Bednekoff PA 1999. Temporal variation in danger drives antipredator behavior: the predation risk allocation hypothesis. Am. Nat. 153, 649–659. (doi:10.1086/303202)
50. Elgar MA. 1989. Predator vigilance and group size in mammals and birds: a critical review of the empirical evidence. Biol. Rev. 64, 13–33. (doi:10.1111/j.1469-185X.1989.tb00636.x) [PubMed]
51. Cooper WE Jr, Frederick WG 2007. Optimal time to emerge from refuge. Biol. J. Linn. Soc. 91, 375–382. (doi:10.1111/j.1095-8312.2007.00802.x)
52. Krause J, Cheng DJ-S, Kirkman E, Ruxton GD 2000. Species-specific patterns of refuge use in fish: the role of metabolic expenditure and body length. Behaviour 137, 1113–1127. (doi:10.1163/156853900502466)
53. Dowling LM, Godin J-GJ 2002. Refuge use in a killifish: influence of body size and nutritional state. Can. J. Zool. 80, 782–788. (doi:10.1139/z02-036)
54. Bonter DN, Zuckerberg B, Sedgwick CW, Hochachka WM 2013. Daily foraging patterns in free-living birds: exploring the predation–starvation trade-off. Proc. R. Soc. B 280, 20123087 (doi:10.1098/rspb.2012.3087) [PMC free article] [PubMed]
55. Rands SA. 2011. The effects of dominance on leadership and energetic gain: a dynamic game between pairs of social foragers. PLoS Comput. Biol. 7, e1002252 (doi:10.1371/journal.pcbi.1002252) [PMC free article] [PubMed]
56. Rands SA, Cowlishaw G, Pettifor RA, Rowcliffe JM, Johnstone RA 2008. The emergence of leaders and followers in foraging pairs when the qualities of individuals differ. BMC Evol. Biol. 8, 51 (doi:10.1186/1471-2148-8-51) [PMC free article] [PubMed]
57. Slotow R, Rothstein SI 1995. Importance of dominance status and distance from cover for foraging white-crowned sparrows: an experimental study. Auk 112, 107–117. (doi:10.2307/4088771)
58. Lima SL, Wiebe KL, Dill LM 1987. Protective cover and the use of space by finches: is closer better? Oikos 50, 225–230. (doi:10.2307/3566005)
59. Brilot BO, Bateson M, Nettle D, Whittingham MJ, Read JCA 2012. When is general wariness favored in avoiding multiple predator types? Am. Nat. 179, E180–E195. (doi:10.1086/665648) [PubMed]
60. Boissy A. 1995. Fear and fearfulness in animals. Q. Rev. Biol. 70, 165–191. (doi:10.1086/418981) [PubMed]
61. Mendl M, Brooks J, Basse C, Burman O, Paul E, Blackwell E, Casey R 2010. Dogs showing seperation-related behaviour exhibit a ‘pessimistic’ cognitive bias. Curr. Biol. 20, R839–R840. (doi:10.1016/j.cub.2010.08.030) [PubMed]
62. Wang M-Y, Brennan CH, Lachlan RF, Chittka L 2015. Speed–accuracy trade-offs and individually consistent decision making by individuals and dyads of zebrafish in a colour discrimination task. Anim. Behav. 103, 277–283. (doi:10.1016/j.anbehav.2015.01.022)
63. McNamara JM. 1990. The policy which maximises long-term survival of an animal faced with the risks of starvation and predation. Adv. Appl. Prob. 22, 295–308. (doi:10.1017/S0001867800019583)

Articles from Royal Society Open Science are provided here courtesy of The Royal Society