What’s in a resource gradient? Comparing alternative cues for foraging in dynamic environments via movement, perception, and memory

Consumers must track and acquire resources in complex landscapes. Much discussion has focused on the concept of a ‘resource gradient’ and the mechanisms by which consumers can take advantage of such gradients as they navigate their landscapes in search of resources. However, the concept of tracking resource gradients means different things in different contexts. Here, we take a synthetic approach and consider six different definitions of what it means to search for resources based on density or gradients in density. These include scenarios where consumers change their movement behavior based on the density of conspecifics, on the density of resources, and on spatial or temporal gradients in resources. We also consider scenarios involving non-local perception and a form of memory. Using a continuous space, continuous time model that allows consumers to switch between resource-tracking and random motion, we investigate the relative performance of these six different strategies. Consumers’ success in matching the spatiotemporal distributions of their resources differs starkly across the six scenarios. Movement strategies based on perception and response to temporal (rather than spatial) resource gradients afforded consumers with the best opportunities to match resource distributions. All scenarios would allow for optimization of resource-matching in terms of the underlying parameters, providing opportunities for evolutionary adaptation, and links back to classical studies of foraging ecology.


Introduction
Successful acquisition of resources is essential to an individual's survival and reproduction. The acquisition problem is especially challenging in seasonal or otherwise dynamic landscapes where the spatial location of resources changes over time. This absence of consistently available resources leaves consumers with several options. Consumers may track the shifting positions of resources that themselves move across the landscape, they may move to other regions to take advantage of different resources, or they may stay local but switch to alternative resources. Each of these foraging strategies requires that consumers monitor resource availability and respond through movement or changes in feeding style. However, many routes to resource monitoring and movement decision-making exist, and different strategies are unlikely to exhibit the same level of profitability with regard to resource acquisition (Grünbaum 1998). Historically, researchers working on foraging-related movement have sought to understand the contributions of three elements: search strategies, behavioral changes, and cues for movement. Here, we bring together these three elements in a synthetic approach that investigates how consumers' responses to alternative 'resource gradients' translate into foraging success.
As consumers seek out resources, they can employ a wide variety of search strategies. Some of these strategies operate on large scales and are long-term in nature. For example, some birds and ungulates 'surf the green wave' as they time their migratory journeys to match seasonal changes in the availability of palatable, nutrient-rich resources as functions of latitude or elevation (Aikens et al. 2020). In other taxa, such as some Brazilian marsupials, perceptual range plays a key role in determining whether the animals move randomly (when no forest was nearby) or in a directed fashion (when they could perceive a nearby forest patch) (Prevedello et al. 2011). Similarly, Holdo et al. (2009) found that longdistance perception that allowed tracking of conditions over large spatial scales was crucial to the success of wildebeests' migratory journeys in the Serengeti and attention solely to small-scale gradients was insufficient for migratory success. In contrast, blue whales appear to rely not on perception per se, but rather on spatial memory as they migrate. The whales time their patterns of space use to exploit those regions in which resources have been both on average abundant and reliably available over many years (Abrahms et al. 2019;Fagan 2019).
Evidence suggests that such search strategies do not exist in isolation, but rather are used by consumers in different combinations, often as a function of context. With regard to switching between search strategies, a key tension is between searching for new resources and not wandering too far. This is particularly important when resources are spatiotemporally heterogeneous. Mathematically, this tension can appear as a balance between random search (diffusion) and range residency (movement with a central tendency) as animals switch between movement modes as a function of their spatial context. A growing list of empirical examples demonstrates that such context-dependent behavioral switching between movement modes is quite widespread.
A few examples include mosquitoes (Raji and DeGennaro 2017), tuna (Newlands et al. 2004), opossums (Prevedello et al. 2011), elk (Morales et al. 2004), and woodpeckers (Vergara et al. 2019). Moreover, robust statistical tools are increasingly available for deconstructing empirical movement paths into alternative movement modes and identifying behavioral change points (Morales et al. 2004;Gurarie et al. 2009Gurarie et al. , 2016. Key open questions center on the factors that precipitate such changes in behavior and how different forms of context-dependent switching influence resource acquisition. To some degree, modeling studies have also explored the consequences of combining movement modes in various mixtures. Frequently, diffusion (random search) and advection (gradient following) are explored together, often with the goal of identifying optimally blended movement strategies that yield evolutionarily stable strategies (Cantrell et al. 2008(Cantrell et al. , 2018Lam and Lou 2014). Other modeling studies have directly considered switching between alternative movement modes; that is, they explored situations where, rather than simultaneously blending two movement modes, individuals could be considered to be in either one movement mode or another. Skalski and Gilliam (2003) explored how switching between slow and fast movement states (which occurred independent of spatial context) influenced a population's spatial distribution. More recently, Tyson et al. (2011) considered spatially independent behavioral switching terms for a model where foragers had both fast-moving diffusive and slowmoving advective-diffusive states. They found that singlemovement-mode models (in which the forager population was homogeneously diffusive or advective-diffusive) provided a worse fit to data for both caribou and honeybees than did the model with behavioral switching. Different types of intermittent movement (Gleiss et al. 2011), especially so-called burst-and-coast movement by fish (Kramer and McLaughlin 2001;McLaughlin and Grant 2001), provide yet more examples in which animals sequentially switch between movement types. Burst movement is thought to provide rapid propulsion that alternates with coast movement during which fish can better perceive their surroundings. Fagan et al. (2020) analyzed a model in which switching between movement modes depended on spatial context. They found that behavioral switching was most beneficial when an organism's gradientfollowing abilities were weak compared to its overall capacity for movement. Moreover, they found that an organism's perceptual range was a key determinant of whether behavioral switching was advantageous or disadvantageous in the search for resources.
Just as different movement strategies and opportunities for switching between strategies present consumers with a range of options for mobility, so too do the proximal cues on which resource-related movement decisions are based. For example, Dusenberry (1998) demonstrated that freeswimming bacteria can be differentially advantaged by using temporal gradients versus spatial gradients in their quest for resources. In that system, movements based on following temporal gradients were especially valuable in providing superior access to resources when those resources were at low densities. In another example, numerous species of tropical frugivorous birds appear to track temporal changes in fruit abundance, shifting their spatial activity in response to increases and decreases in fruit abundance (Loiselle and Blake 1991). In other cases, following spatial rather than temporal gradients appears essential to success, and smallscale spatial gradients are particularly useful for consumers that rely on chemosensation. For example, catfish follow centimeter-scale spatial (rather than temporal) gradients in nutrient concentration as they seek out resources (Johnson and Teeter 1980). Similarly, rats effectively 'smell in stereo' as they respond to highly localized bilateral differences in the concentration of odorants (Rajan et al. 2006), whereas moles combine serial scent detection (i.e., repeated 'sniffing') with bilateral olfaction to identify the gradients that guide their search for resources (Catania 2013).
Here, we seek to synthesize these three factors (i.e., alternative search strategies, switching between movement modes, and diverse cues for movement) into a single modeling framework to explore in detail how these features influence the abilities of consumers to track and match the spatiotemporal distribution of resources in dynamic landscapes. Intriguingly, we find that different search-movement strategies perform best under different resource situations, suggesting conditions under which alternative resource dynamics might select for the evolution of alternative foraging strategies.

A dynamic resource
We will assume a one-dimensional binary resource landscape of habitat patches and non-habitat that is temporally dynamic. Fagan et al. (2017) explored how alternative resource functions influence the ability of consumers to match the distribution of their resources. Here, we consider one of the resource functions studied in that paper, the Pulsed Gaussian resource: where μ and σ are, respectively, the mean and standard deviation of the resource pulse and is the temporal frequency of the pulse. Equation (1) corresponds to a resource patch with smoothly varying edges that does not change position spatially but does increase and decrease in abundance over time.
We consider situations in which there either is a single resource patch that pulses in time or two identical pulsing resource patches that are shifted by half a period relative to one another. The latter scenario corresponds to a strongly seasonal landscape where there exists opportunity for migration to emerge between the two resource patches that are oscillating out-of-phase.

Consumers switch between random search and range-residency
Living on this dynamic resource landscape is a population of consumers. We consider a population in which the consumers can switch between two distinct modes of dispersal. Tyson et al. (2011) andFagan et al. (2019) explored scenarios in which consumers switch between a random search mode and a mode in which there exists movement in response to a resource gradient. Here, motivated by recent developments in the statistical analysis of animal tracking data (Fleming et al. 2014;Noonan et al. 2019), we do something a bit different. Specifically, we consider the spatial dynamics of consumers that may have home ranges, but which can switch between a random search mode and a range-resident mode. Note that this pair of movement modes is different than the pair of modes involved in chemotaxis (Keller and Segel 1971) and area-restricted search models (Kareiva and Odell 1987). In those cases, organisms can switch between random turning (employed within a resource patch) and ballistic motion (a tendency to move in a straight line, employed between resource patches). Here, motivated by recent studies on some vertebrate species (Prevedello et al. 2011;Tyson et al. 2011), our foragers use random motion between resource patches and their more sophisticated (and more spatially intensive) movement mode (here, home ranging) in the vicinity of resource patches. To build our model of movement, we assume that the density of the population engaged in diffusive (random search) behavior at position x and time t is denoted u(x,t), and the density engaged in range-resident behavior is denoted v(x,t). We write where the parameter D is the rate of diffusion undertaken by the portion of the population that is in the random search mode. The functions (x, t) and (x, t) , defined below, are generic functional forms for the rates of switching between the random-search and range-resident movement modes. The term represents the overall movement of the portion of the population engaged in range resident behavior. In Eq. (3), ≪ 1 represents a small amount of background random movement (this is necessary for certain theorems about partial differential equations to hold true), and quantifies the rate of mean reverting (home ranging) movement. The term (from Eq. (1)) represents the consumers' 'attractive target.' This corresponds to the center of the resource patch in scenarios where there is only a single, fluctuating area with resources. (2) This location could also be thought of as the location of a den or nest site. In more complicated scenarios, could be generalized to a function μ [•] that allows for more than one attractive target, and these could correspond to the physical centers of multiple or temporally oscillating resource patches. In other scenarios, where consumers are able to distinguish resource habitat from non-habitat, but where perception is limited and the physical center of a resource patch may not be detectable, the attractive target could correspond to a location with favorable conditions inside the patch at the limit of detection.

Six scenarios for switching between movement modes
To explore the interplay between movement modes, search strategies, and cues for movement, we focus on the switching functions (x, t) and (x, t) and the impacts that these terms have on the ability of the consumers to track their resources. To explore the importance of the context of behavioral switching, we simplify other aspects of the model, and depart from previous treatments in Fagan et al. (2017Fagan et al. ( , 2020 and Gurarie et al. (2021). We consider six different scenarios, of increasing complexity, in which different considerations govern the consumers' switching between random movement and home-ranging behavior. All six of these scenarios, which range from simple density dependence through more complicated situations involving perception or spatial memory, have either been utilized previously in theoretical studies of animal movement or discussed verbally in papers on animal movement and decision-making behavior (e.g., Noonan et al. 2019;Abrahms et al. 2019;Aikens et al. 2020).

Scenario 1: switching depends on consumer density
In this scenario, we assume that consumers change between the random search and range resident behavior only as a function of their own density. That is, these consumers are not able to detect or react to changes in resource availability (in space, or in time) but they can tell when they are crowded, and switch behaviors as functions of the density of their conspecifics.We write.
which means that consumers will switch from random search mode to range resident mode at rate s if the local total consumer density ( u + v ) exceeds a threshold value, w 0 , and will otherwise remain in random search mode. Similarly, such that consumers will switch from range residency to random search mode at rate s if the local total consumer density ( u + v ) remains below a threshold value, w 0 , and will otherwise remain in range resident mode. For simplicity, we will consider the switching rates in Eqs. (4)-(5) to be the same, but these could certainly differ as a function of the consumers' current behavioral mode, as could the threshold density for switching between movement modes. These assumptions correspond roughly to assumptions of the 'local enhancement' framework for seabirds foraging from colonies (Buckley 1997). Likewise, there are conceptual connections to results described in Cvikel et al. (2015) and Egert-Berg et al. (2018), wherein bats cue in on the location of their own kind in determining where to forage. However, the model does not lead to aggregation on conspecifics per se (unless = 0 ). Instead, the model would be better interpreted as representing aspects of social learning with discovery. To see this, consider the subpopulation with density u as 'uninformed about resources' and the subpopulation with density v as 'informed.' Then, note that v(x, 0) = 0 and u(x, 0) = u 0 is an equilibrium if u 0 < w 0 . If the model starts with v = 0 and u small everywhere, then the system will tend to stay with v = 0. However, if initially, u is sufficiently large somewhere, then some u will switch to v. As the subpopulation with density v gets concentrated near , the switching rate might then favor further increase in v and further concentrate the population near . Modifying the movement mechanism to include actual aggregation on the density of conspecifics might produce a more concentrated population density on a smaller home range, but it is not clear that it can produce home ranging behavior in the absence of other movement components.

Scenario 2: switching depends on resource density
Here, consumers change their movement behavior as a function of the density of resources instantaneously available at their immediate location. This kind of temporal tracking of resource density is at the heart of the marginal value theorem from optimal foraging theory (e.g., Charnov 1976;McNair 1982), but in that case (unlike here) such temporal tracking is tied to globally omniscient knowledge of resource conditions elsewhere. Assuming a threshold resource density, m 0 , to which the consumers respond by switching their movement mode, we write. which means that consumers will switch from random search mode to range resident mode at rate s if the resource density and position x and time t exceeds a threshold value, m 0 , and will otherwise remain in random search mode. Similarly, such that consumers will switch from range residency to random search mode at rate s as resource availability deteriorates below the threshold density. Note that the structure of Eqs. (6)-(7) effectively creates an aggregative response to areas of abundant resources.

Scenario 3: switching depends on spatial changes in resource density
Whereas Scenario 2 focused on resource density per se, in this scenario, consumers change their movement behavior as a function of the magnitude of the spatial gradient in the resources available, where the rate of switching is s if the spatial gradient in resource availability is greater than the threshold magnitude 0 , and 0 otherwise. Similarly, such that consumers will switch from range residency to random search mode at rate s as the spatial gradient in resource availability weakens.

Scenario 4: switching depends on perceived spatial changes in resource density
Here, consumers again change their movement behavior as a function of the spatial gradient in the resources available, but we augment their perceptual abilities to detect those spatial gradients. Specifically, we assume that the consumers possess a perceptual range, R (Zollner and Lima 1997;Mech and Zollner 2002;Fagan et al. 2017). Thus, for a distance |x-y| from position x, the consumers can perceive the existence of resources according to a detection function.
The perceived resource function, h(x), is then written which in the case of g(x, y, R) from Eq. (10) simplifies to We make these choices of g(x, y, R) and h(x) to simplify comparisons with the other scenarios developed in this paper. The consequences of choosing different functional forms for g(x, y, R) are explored extensively in Fagan et al. (2017).
To model the effects of switching movement modes as a function of perceived spatial resource gradients, we write.
where the rate of switching is s if the spatial gradient in resource availability is greater than the threshold magnitude 0 , and 0 otherwise. Similarly, such that consumers will switch from range residency to random search mode at rate s when the spatial gradient in resource availability is sufficiently weak. Note that because of our choices of g(x, y, R) and h(x, t) in Eqs. (4)-(4) we can use the same threshold magnitude, 0 , in Eqs. (12)-(13) as in Scenario 3 Eqs. (8)-(9).

Scenario 5: switching depends on temporal changes in resource density
In this penultimate scenario, we depart from the previous two scenarios that focused on reaction to spatial gradients, and instead assume that the consumers have some modest ability to detect and respond to temporal changes in resource density at their specific spatial location (e.g., Loiselle and Blake 1991;Dusenberry 1998). The assumptions in this scenario of our model mean that consumers are able to identify whether their access to immediately local resources is instantaneously getting better or worse, but they have no knowledge of long-term trends in resource availability nor any information about trends beyond their current location. Mathematically, we can write this detection of immediate trends in terms of the temporal gradient of the resource, m t , such that where the rate of switching is s if the temporal gradient in resource availability is greater than the threshold magnitude 0 , and 0 otherwise. This means that the consumers only switch from random search mode into range resident mode if resource density is improving sufficiently quickly. Note that we must use a different threshold, 0 , and not 0 , because we are dealing with a temporal rather than a spatial gradient in resource density. However, because of our choices of m(x, t) and g(x, t) , we can, under some circumstances, use the same magnitude for these thresholds and just allow the dimensional units to differ. More specifically, because the resource equation for m(x, t) (and by extension for h(x, t)) has a natural time scale of 4 π/ω and a natural spatial scale of σ built into it (Eq. (1)), we can equate the thresholds 0 and 0 if we equate the magnitudes of the two intrinsic scales. With different choices for these intrinsic scales, we can make the same transition from spatial to temporal gradients with a rescaling coefficient. Similarly, which means that the consumers only switch into random foraging mode if resource density is deteriorating sufficiently quickly. Collectively, Eqs. (14-15) imply that the consumers switch their behavioral modes only if local resource density is instantaneously changing by a substantial amount, and that they ignore any near-term fluctuations in resource density less than 0 in magnitude.

Scenario 6: switching depends on consumers' memory of resource density
Here, we assume that the consumers possess a simple, but spatially detailed form of memory that allows them to keep track of the long-term resource dynamics of an area. If we were building models of movement trajectories for individual animals, we would want to structure each consumer's memory around the resources encountered along those trajectories (Schlaegel and Lewis 2014; Bracis et al. 2015;Abrahms et al. 2019;Lin et al. 2021). However, because we are working within a PDE modeling framework, and need to characterize the collective memory of a group of organisms, we need a different approach.
To do this, we consider a situation in which the consumers base their decisions to switch between movement modes on how much they can remember of the resource cycle and where they are within that cycle. From Eq. (1), the temporally dynamic resource has period 1 ∕ and repeats endlessly for any given spatial location. We use the parameter Q , where Q ≤ 1 ∕ , to represent the memory length, i.e., Q is the proportion of the full resource cycle that the consumers can remember. The consumers' memory, M , of the resource conditions leading up to time t can thus be written Note that a given value of Q will yield a different memory depending on what point in the resource cycle the system is in. We then base the movement switching rates on this memory by writing where the rate of switching is s if the consumers' memory of resource availability at location x exceeds the threshold magnitude M 0 , and 0 otherwise. This means that the consumers only switch from random search mode into range resident mode if their memory of a location, at a particular time, is sufficiently positive. Similarly, such that consumers switch from range-resident mode into random search mode if their memory of a location, at a particular time, is sufficiently unfavorable, but remain in range resident mode otherwise.

Quantifying foraging success
To quantify the consumers' ability to track the distribution of their resources over space and time, we use the continuous form of the Bhattacharyya Coefficient (BC; Bhattacharyya 1943) for quantifying the overlap between two distributions. Because the BC was initially formulated for use with probability distributions, we use a normalized form. Specifically, we have The timeframe t' to t max represents some period after transient behaviors have settled down. For static resource distributions, which (with appropriate boundary conditions of mass conservation) always exhibit an equilibrium solution, the integral is only over space (Fagan et al. 2020). For dynamic landscapes, such as periodically fluctuating 1 3 landscapes on which we focus, the time integral needs to be taken over a long enough period to discount the transient behaviors and instead capture long-term variation (Fagan et al. 2017). This metric of foraging success differs a bit from that used in Fagan et al. (2017Fagan et al. ( , 2020, but the change is necessary to accommodate comparison across all six of the scenarios we consider here. Equation (19) quantifies 'resource matching' in the sense that foragers must spatially and temporally overlap with resources to be successful. We do not consider mutual interference or resource depletion because we want to focus only on animal movement behavior and not population growth or decay. This is a reasonable assumption when population density is low (i.e., sparsely populated regions) and resources are ephemeral (i.e., resources degrade before their density can be reduced much by the foragers). In these systems, the question is more about capitalizing on transient resources, as opposed to avoiding competition. Such transient resource dynamics characterize, for example, the Eastern steppes of Mongolia that have motivated much earlier work on animal movement (Mueller and Fagan 2008;Mueller et al. 2011;Martínez-García et al. 2013;Fleming et al. 2014).
Throughout, we solved the initial-boundary value problem numerically using the method of lines by discretizing in space over the domain x = [0, 100] and solving the system of ordinary differential equations in time. We implemented a different scheme for the components of Eq. (2) as required by their respective structure. For example, for the random search equation, we used a simple forward-time, centered-space scheme, whereas for the gradient following equation, we used the Lax-Wendroff method, accounting for the method's natural dispersion error in the term 2 x 2 v . To solve the resulting coupled system of ODEs, we used the variable-step, variable-order differential algebraic equation solver ODE15S (Shampine and Reichelt 1997).
For initial conditions, all the numerical experiments had u and v distributed uniformly with population density 1/L.   Figure 1 shows the dynamic (pulsed Gaussian) resource landscapes on which the forager populations are moving. In both the single-patch and two-patch landscapes,  Fig. 1 Heatmaps of the resource landscapes with one (left) and two (right) seasonally pulsed Gaussian resource peaks. Note that the variations in the resources are sufficiently intense that the resource den-sity drops to near zero during the troughs between the resource peaks. Parameters: L=100, μ=50, μ 1 =33.3, μ 2 =66.6, σ=5.5, ω=0.2

Fig. 2
Location and timing of the resource conditions that promote the consumer population actively switching into home ranging mode for the landscape with a single resource patch (see Fig. 1a). Note how the intensity of the resource conditions that promote switching behavior as well as the timing and location of those favorable locations vary strongly depending on how the gradient of the resource is defined (labeled as scenarios 1-6). The six advection scenarios involve starkly different locations and times at which the consumers are switching from the diffusive foraging mode to the home ranging mode (Fig. 2). For example, in Scenario 1, switching into the home ranging mode is constant after the population equilibrates, with no influence from the underlying periodicity in resource availability. In contrast, the resource conditions that favor switching to home ranging are strongest at the time and location of the resource peak in Scenario 2 (tracking the resource density, Fig. 2b) whereas the resource conditions that favor switching are strongest on the 'shoulders' of the resource peak in Scenarios 3 and 4 (tracking changes and perceived spatial changes in resource density, respectively) (Fig. 2c, d). Provided R in Eq. (10) (perception scenario) is sufficiently small, the resource conditions favoring switching regions for scenario 4 are nearly identical to those of scenario 3 for low R (Supplementary Fig. F). Different still are the resource conditions that promote the switching behavior in Scenario 5 (tracking temporal changes in resource density) where the switching behavior is greatest as the resource begins to increase in density (Fig. 2e). Provided Q in Eq. (16) (memory scenario) is sufficiently large, resource conditions will lead to some portion of the consumer population constantly switching into the diffusive foraging mode regardless of what part of the seasonal cycle the system is in (Fig. 2f).
In contrast, for sufficiently small Q, the resource conditions promoting this constancy of switching disappears and the results from Scenario 6 converge on those from Scenario 2 ( Supplementary Fig. G). Resource conditions that promote switching from home ranging to diffusive foraging mode are largely complementary to these results for all six scenarios for switching from diffusive to home ranging.
The differences in switching behavior among scenarios alter the consumers' movement behaviors and thus translate into differences in the location and timing of the consumer population densities. Scenario 1 (tracking conspecific density) shows a concentration of consumers to the location of the resource peak regardless of whether the resource is at high or low density. In contrast, Scenario 2 (tracking resource density) shows periodicity in the consumer population density, indicating a degree of matching of the consumers to both the location and timing of the resource peak. Scenario 3 (tracking spatial changes in resource density) shows the consumers concentrating on the shoulders of the resource peak, but not on the resource peak itself. In contrast, scenario 4 (tracking perceived spatial changes in resource density) shows advection occurring over a much broader area. In scenarios 5 (tracking temporal changes in resource density) and 6 (memory), the density of the advecting consumers is greatest on the resource peak. Both of these scenarios also feature a limited degree of oscillation in population density that mirrors the temporally dynamic nature of the resources. In the case of a single resource patch, considerable differences exist in Ω across scenarios, indicating that the different movement strategies allow for very different degrees of resource matching. Resource matching success (Ω) is clearly greatest in Scenario 5 where switching between diffusive and home ranging movement types depends on the temporal resource gradient, but only when the threshold for switching between movement behaviors is very small (Fig. 3). Peak Ω values (broad to concentrated in parametric extent) exist within each scenario, and the location of these Ω peaks differs across scenarios. Collectively, these results indicate that, within a given movement strategy, resource matching could potentially be optimized, but that the degree of switching and the switching thresholds that are necessary to provide optimal matching differ among scenarios. For example, in Fig. 3, low levels of switching provide marginally better resource matching in Scenarios 1 and 2, but switching needs to occur at a faster rate when it occurs in conjunction with temporal resource gradients (Scenario 5).
In the case of two resource patches, the location and timing of the consumer population switching into home ranging mode become more complicated, reflecting the greater complexity of the resource conditions favoring such changes in behavior (Fig. 4). The timing and location of such switching vary strongly across scenarios depending how the gradient of the resource is defined. For example, switching to advection is consistently concentrated in the vicinity of the resource peaks in Scenario 1 even though the resource is periodic in time. Switching to advection occurs on the 'shoulders' of the double-peaked resource distributions in Scenarios 3 and 4, but occurs in the vicinity of, but in advance of, the resource peaks in Scenario 5 (excluding only the spatiotemporal region where the resource is most strongly waning in abundance). In Scenario 6, switching to advection again reflects the periodic nature of the resource, but, due to the effects of memory, there exists a lingering degree of switching near the centers of the resource peaks even though the resources are least abundant at these times (Fig. 4). Density plots for the component of the consumer population in the home ranging mode appear in Supplementary Fig. B. A counterpart to Fig. 4 that shows the location and timing of the population switching from foraging mode into diffusive mode appears in Supplementary Fig. C. Compared to Fig. 3, resource matching success is generally higher in the two patch case because the resources are better distributed within the landscape and easier to find with a given level of mobility (Fig. 5). This is especially true for Scenario 3 (spatial gradient) and Scenario 4 (spatial gradient with non-local perception) where resource matching success is now on par with the best performing parameters from Scenario 5 (following a temporal resource gradient). High levels of switching between diffusion and advection are generally deleterious unless the thresholds for undertaking such switches are sufficiently high. The thresholds at which optimal resource matching is reached tend to be higher in this two resource patch case than in the single resource patch.
The home ranging parameter, θ, also influences the degree of resource matching success. Supplementary Fig. D gives resource matching success in the case of one resource path (comparable to Fig. 3), except that θ is increased and, separately, decreased from the baseline level. For a fixed rate of diffusion, increasing θ affords greater resource matching success for almost all scenarios and decreasing θ has the opposite effect. Scenario 1 (advection on conspecifics) clearly differs in that increasing θ leads to a decrease in resource matching. For the case of two resource peaks (Supplementary Fig. E, compare with Fig. 5), θ has a different effect in that increasing the degree of home ranging tends to decrease Ω, at least somewhat, except in Scenarios 3 and 4. In these scenarios, where the behavioral switching depends upon a form of spatial resource gradient, resource matching clearly increases with increasing θ.
Perceptual range (R) plays an important role in the degree of resource matching success afforded by Scenario 4 by shifting the timing and location of the behavioral switching into the home ranging mode (Supplementary Fig. F). For sufficiently small R, results from Scenario 4 converge on those of Scenario 3. For sufficiently large R, the switching regions become more refined as the organisms' increased perceptual radius affords more information on the full distribution of resources across the domain and the ideal times and locations to switch behaviors. Note that for R = 15, which is exactly half the distance between the centers of the two resource pulses, the switching regions turn on and off centered at x = 50 ( Supplementary Fig. F).
Likewise, the duration of memory in Scenario 6 can also influence the timing and location of behavioral switching ( Supplementary Fig. G). As memory duration, Q, increases, the lingering effects of memory tend to link the switching responses to consecutive resource peaks so that switching to advection occurs in a consistent location, even though the underlying resource is periodic in time. For sufficiently small Q, switching behavior of Scenario 6 converges on that of Scenario 2.

Discussion
This synthetic overview makes clear that the ecological concept of 'consumers tracking resource gradients' can mean very different things in practice when implemented in Overall, we found that Scenarios 3 (tracking spatial gradients), 4 (tracking spatial gradients with the benefit of non-local perception), and 5 (tracking temporal gradients) provided the highest level of resource matching for consumers. To some extent, these advantages may change with the distribution of resources. For example, if one considers a resource distribution function which is very flat around its global maximum point but peaked around a local maximum point, Scenario 3 would likely provide very poor resource matching levels. In this scenario, tracking perceived spatial gradients (Scenario 4) should perform better than tracking the immediately local gradients (Scenario 3). Results in Fagan et al. (2020), where we considered step functions for the resources, support this contention. Perception (Scenario 4) afforded good resource-matching success, comparable to the highest levels of resource matching that were obtained through Scenario 5 (tracking temporal gradients). The utility of perception, which was especially true in more complex two-patch resource landscapes, is in line with earlier studies suggesting the benefits of non-local information gathering in temporally variable resource landscapes (Fagan et al. 2017).
The general superiority of Scenario 5 (tracking temporal gradients) may be, in part, due to the mathematical model of movement that we explored. For example, because μ, the spatial location of resources, is built into the range-resident dispersal mode, there is spatial information built into that mode, but no temporal information. Then, adding temporal information via tracking of temporal gradients (Scenario 5) would add relatively more to an organism's overall information about the environment than using additional spatial information, because there is already some spatial information implicitly available in the OU mode. The observation that Scenarios 3 and 4, especially 4, perform relatively better when there are two resource patches than where there is only one supports this argument, because with two resource locations getting extra spatial information might be more valuable.
In contrast to the more successful strategies (Scenarios 3, 4, and 5), other scenarios involving tracking the density of conspecifics (Scenario 1), tracking the abundance (rather than the gradient) of resources (Scenario 2), or employing a particular form of memory (Scenario 6) provided poorer spatiotemporal matches to resources. Consumers that switched their foraging behavior as a function of conspecific densities generally achieved very poor resource-matching success. The effect was especially pronounced when home-ranging behavior was strong, which limited the consumers' spatial exploration. These results suggest that pure 'local enhancement' type mechanisms (Buckley 1997) wherein consumers aggregate in areas where others of their kind are already foraging cannot succeed in isolation. Instead, a modest level of directly tracking the resources themselves, together with cueing in on conspecific activity, would likely improve this strategy. This modification would also connect to the producer-scrounger dichotomy in studies of social group foraging behavior (Beauchamp 2000), wherein 'producers' behave directly according to resources but 'scroungers' base their decisions on producers.
Increasing evidence suggests that memory is important for consumers that must acquire resources in highly dynamic landscapes (Bracis and Mueller 2017;Abrahms et al. 2019). Consequently, we were surprised to see that memory-based movement also provided some of the worst tracking of available resources. This deviation from expectations may stem from the particular (rather crude) form of memory that we implemented in Scenario 6. Indeed, other modeling work that considered memory at the individual (rather than collective) level found that a rather sophisticated form of memory, including separate long-and short-term memory records, was necessary to track resources in dynamic landscapes (Lin et al. 2021).
Collectively, these results suggest that tracking gradients (Scenarios 3, 4, and 5) may, in general, be more effective than tracking resource density directly (Scenario 2) or indirectly (Scenario 1). One plausible reason for this is that gradients should be detectable over a broader range of conditions than density per se. This would accord with the underlying biology. Consider that, in practice, it would often be easier to assess the gradient of something than its magnitude. For example, discerning whether movement was up or down a hill would likely be easier than identifying the elevation. Such differential identifiability of gradients versus magnitudes would likely hinge on the rate of movement relative to the scale of the gradient.
Intriguingly, the different scenarios for switching between home ranging and diffusive movement did not rank consistently with regard to the level of resource matching that they afforded. Even something as simple as switching from a model with a single periodic resource peak to one with two periodic resource peaks changed the relative performance of the different scenarios for switching between home ranging and random movement (compare Figs. 3 and 5). These differences appear to arise, primarily, because changing the number of resource peaks changes the average location of resources relative to consumers with specific levels of mobility.
The degree to which consumers incorporate range-resident behavior in their movement also played an important role in determining how well they overlap the distribution of their resources in space and time. In particular, the strength of home ranging (relative to random dispersal) interacted with the behavioral cues for switching to shape resource overlap in a strong way. Switching based on spatial resource gradients (whether immediately local or perceived over a longer distance) provided particularly good matches to resource distributions when coupled with strong range-resident behavior. This result is intriguing given that a recent statistical analysis of home range behavior found that many animals' movement patterns were well described by models that included elements of both diffusive and range-resident behavior (Noonan et al. 2019).
The conditional similarities between Scenarios 3 and 4 ( Supplementary Fig. F), and separately, between Scenarios 2 and 6 ( Supplementary Fig. G), are due to their underlying mathematics. Specifically, the switching functions in Scenarios 2 and 3 were based on a derivative, whereas in Scenarios 4 and 6 the switching functions were based on a slope which approximated the respective derivative for low enough R or Q. In contrast, for large values of R or Q, Scenarios 4 and 6 departed strongly from Scenarios 3 and 2, respectively, demonstrating how the introduction of additional information caused different behavior by the home-ranging component of the population (Supplementary Fig. F and G). This additional information may be either spatial (in the form of an increased perceptual range, Scenario 5) or temporal (in the form of a lingering memory, Scenario 6), but in either case, the additional information altered the basis for the behavioral decision-making.

Opportunities for optimal resource matching
The existence of parameter regions featuring higher levels of resource-matching success amidst a sea of lower-performing parameters (Figs. 3 and 5, Supplementary Fig. D and E) suggests that, within a given movement strategy, resource matching could potentially be optimized. However, the rate of switching (between home ranging and diffusive movement modes) and the switching thresholds that are necessary to provide optimal resource matching differ quite strongly among scenarios. For example, in Fig. 3, low rates of switching provide marginally better resource matching in Scenarios 1 and 6, but switching needs to occur at a faster rate when it occurs in conjunction with temporal resource gradients if consumers are to achieve the highest levels of resource matching (Scenario 5).
Although our study considered models with continuous space, the high levels of resource matching success observed in some scenarios brings to mind concepts like the marginal value theorem for optimal resource tracking (Charnov 1976;McNair 1982) and the ideal free distribution for optimal distribution of resources among consumers (Farnsworth and Beecham 1999;Křivan et al. 2008) that had their origins in patch-based models of consumers tracking resources. To our knowledge, there is nothing like the marginal value theorem in partial differential equation (PDE) models or other ecological models involving continuous space. However, there is a strong foundation for the ideal-free distribution in continuous space models (Arditi and Dacorogna 1988;Grunbaum 1998), and more recent PDE work demonstrates how certain kinds of resource-tracking strategies can lead to an ideal free distribution of consumers (Cantrell et al. 2008(Cantrell et al. , 2010. Real-world complications, such as perceptual constraints, can cause departures from an ideal free distribution (Abrahams 1986), but 'approximately optimal' solutions are possible even when underlying assumptions are violated (Griffen 2009;Street et al. 2018).
In general, optimal movement in heterogeneous landscapes requires that consumers consider both space and time (Arditi and Dacorogna 1988;Cantrell et al. 2021). In this paper, Scenarios 2, 3, and 4 consider space, 5 considers time, and 6 considers both space and time (but considers time, via memory, in a rather crude way). However, all of these scenarios involve behaviors that are relatively simple, in that movement decisions are being made with respect to metrics observable by many animals. Of the switching cues we examined, that of Scenario 2 is closest to classical considerations of optimal foraging in patchy landscapes. From the marginal value theorem, we know that, for omniscient consumers, the best time to leave a patch is when the rate of resource uptake on that patch drops below the system-wide average (Charnov 1976). This criterion reflects elements present in both Scenarios 2 and 5. Scenario 2 is relevant because resource uptake should be proportional to the density of resources available. However, Scenario 5, where the focus is the temporal rate of change of resource density, is also relevant in that the rate of change of available resources shapes the rate of resource uptake. For example, knowing the rate of change in resource availability would offer consumers information on how much longer they have to gather resources. This information could be far more valuable than just knowing what resources are available at an exact spatiotemporal location. These conceptual links to the marginal value theorem are particularly strong for cases where behavioral changes are framed in terms of optimal 'giving up times' (McNair 1982) or residence times (Turchin 1991). Overall, Scenario 5 afforded much better opportunities for resource overlap than did Scenario 2 (Figs. 3 and 5, Supplementary Figs. D, E). This result raises intriguing questions about optimal foraging in dynamic landscapes, including the possibility that consumers tracking both the rate of change in local conditions and their own rate of change of resource uptake may be especially adept at maximizing resource gain. This will be explored in future work. Additional future directions could include models that combine memory and perception together, or that combine local enhancement type strategies (Scenario 1) with gradient-following behavior.
In summary, we compared the performance of alternative methods by which consumers can be reasonably said to be tracking gradients related to their resources. Optimal resource matching is achievable via all six scenarios, at least to some degree. Within most scenarios, a broad range of parameter values yields similarly high levels of resource matching success. Thus, even if consumers were channelized to possess particular resource-tracking abilities and were unable to switch among scenarios, wide parametric regions of 'nearly optimal' resource matching success would provide a broad evolutionary target wherein good foraging success is obtainable even when the parameters cannot be fine-tuned. Such broad targets would be advantageous given the high degree of temporal resource variability that exists in natural systems (e.g., Abrahms et al. 2019).