Note: This is a follow up to my SAA2018 paper

Some very interesting recent work has focused on the role of environmental instability in human evolution (Potts 2013, Grove 2014) and the development of cultural complexity (Fogarty et al 2017). This work has tended to look at adapative responses of populations of learning agents in evolutionary time. But how does environmental instability affect the behaviour of more simple individual automata? What can we learn from the baseline responses of simple foraging agents in a changing environment?

In a previous paper, I reported that when environmental instability is introduced in sugarscape, agents tend to prefer neighbourhoods that are diverse in rate of environmental change relative to the overall environment. I hypothesized that agents rely on the environmentally stable patches in their immediate neighbourhood while waiting for a possible payoff from the environmentally unstable patches. Here, I report the results of further experiments that show that agents have a strong preference for neighbourhoods that combine relatively high diversity in rate of environmental change, and relatively high overall stability (i.e. low overall rate of change). This is heavily constrained by map crowding and the overall level of instability in the environment.

In other words, whenever possible, agents select neighbourhoods where overall patch stability is relatively high, but where there is still a good diversity of rates of environmental change. Far from shunning instability, agents readily integrate it into their foraging strategy.


For details of the simulation itself, please see the previous paper (Costopoulos 2018). In brief, I used a slightly modified version of Li and Wilensky’s (2009) constant growback sugarscape NetLogo model. I used 200 runs in which I set a random number of agents (1-500) and a random maximum value for environmental change rate of patches (0-50%).

The agents evaluated their metabolic state at every iteration. When their metabolic state fell below a certain threshold, they examined their immediate neighbourhood (within a distance of 5 patches) and moved to the patch with the most sugar. The agents tracked the average rate of environmental change of the patches in the neighbourhoods they visited during the run (neighbouhood stability), as well as the average standard deviation of rate of environmental change of patches in those neighbourhoods (neighbourhood diversity). This information was not used in their decisions, and only recorded for later analysis.

The agents sample the environment at a certain rate. We therefore expect both neighbourhood stability and diversity of the agents to differ from the overall value from the environment in any given run. More specifically, we expect the value for neighbourhood diversity to be higher than that for the overall environment, since samples are expected to have greater variability than entire populations. I therefore compared neighbourhood diversity and stability of the agents with that of random points rather than with that of the overall environment.

A number of random points equal to the starting number of agents for each run moved randomly around the landscape, without reference to sugar. Like the agents, they tracked both neighbourhood stability and diversity.

One of the methodological challenges of this experiment was to ensure that the only difference between the behaviour of agents and of random points was the pursuit of sugar. Since the agents are sometimes happy in their current locations, they don’t necessarily move at every iteration (time step). In order to have the random points sample the environment at the same rate as agents, the random points moved randomly with a probability equal to the average rate of movement of the agents at that point in any given run.

For every run, I calculated a map stability index ((1 – max run change rate) / max experiment change rate), a map crowding index (run initial population / max experiment initial population), and an environment index ((1 – mapcrowding) * stability). Runs with uncrowded, stable maps have a high environment index, and maps that are crowded and unstable have a low environment index.


Relative to random points, agents preferred more diverse neighbourhoods in 65.5% of runs, and more stable neighbourhoods in 51% of runs.


Figure 1: Agent neighbourhood stability relative to random point neighbourhood stability (bubble size), plotted against map crowding and map stability, for 200 runs. Empty or black bubbles show negative values.

Figure 1 shows that agents tended to occupy stable neighbourhoods in all stable environments, but that crowding reduced the magnitude of trend.


Figure 2: Agent neighbourhood variability relative to random point neighbourhood variability (bubble size), plotted against map crowding and map stability, for 200 runs. Empty or black bubbles show negative values.

Figure 2 shows that agents tended to occupy diverse neighbourhoods in stable environments, again with a reduction in magnitude as crowding increased.


Figure 3: Environment quality for 200 runs (bubble size), plotted against agent neighbourhood diversity and stability relative to random point neighbourhood diversity and stability

Figure 3 shows that in most runs, agents tended to occupy diverse and stable neighbourhoods in runs with a high environment index (low crowding, high stability) and tended to occupy more unstable low diversity neighbourhoods in runs with low environment index (high crowding, low stability). Agents almost never occupied neighbourhoods with low diversity and high stability, regardless of overall environmental conditions.


It is clear that whenever conditions of crowding and overall environmental stability allow it, simple agents end up exploiting resources in neighbourhoods that are relatively stable but also relatively variable. The agents tend to occupy neighbourhoods that have relatively low average change rate, but also have a mix of high and low rates of change rate. This suggests that they are surrounded by mostly low change rate patches, which keeps the average low, with a few high change rate patches to drive up the variability.

It is important to remember that, as far as their movement decisions go, the agents are not aware of change rate. They are only aware of sugar and of their own metabolic state. This means, effectively, that they climb local gradients on the map to find success in areas where they can rely on stable patches while benefiting from the occasional pay-off created by a few unpredictable patches.

In figure 3, the runs closest to (1,0), where there is no difference between the behaviour of the agents and the behaviour of the random points, are all among the worst environments produced by the experiment. They are the most crowded and have the most unstable environment. In such an environment, there is little scope for agent choices to coalesce into a strategy, and their behaviour ends up being very close to random.

With a slight improvement in the environment (or as the bubbles grow on figure 3), the agents start occupying neighbourhoods that combine low stability and low diversity. They seem to be maximizing the chance of a large payoff by surrounding themselves with high change rate patches, rather than minimizing risk by surrounding themselves with low change rate patches (which would be in the upper left quadrant of figure 3).

As the environment steadily improves, agents increasingly focus on the neighbourhoods that are both stable and diverse. These allow the agents to reduce risk by having stable patches near them, and also to benefit from the occasional large payoff from an unstable patch.

While agents in some runs with reasonably good environments end up focusing on neighbourhoods that have low stability and high diversity (lower right quadrant of figure 3), agents almost completely stay away from neighbourhoods that are uniformly stable. They get better returns in any of the other three environmental configurations.


Environmental stability seems to be an advantage only if it is accompanied by diversity in rate of environmental change. Uniformly stable environments are avoided by the agents, and uniformly unstable environments are exploited only in low quality or heavily crowded environments. As environments improve, agents have room to express their preference for diverse and stable environments.

The fact that very simple agents that don’t learn, express a preference for neighbourhoods with relatively high diversity in rate of environmental change, suggests that environmental instability may indeed be an important factor in evolution.

Code and Output


Costopoulos A 2018. Preview of my SAA2018 paper: Environmental instability, habitat choice, and mobility: An agent-based simulation

Fogarty L, J Yuichiro Wakano, MW Feldman, K Aoki 2017. The driving forces of cultural complexity, Human Nature 28:39-52.

Grove M 2014. Evolution and dispersal under climatic instability: a simple evolutionary algorithm, Adaptive Behavior 22:235-254.

Li J and U Wilensky 2009. NetLogo Sugarscape 2 Constant Growback model,, Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

Potts R 2013. Hominin evolution in settings of strong environmental variability, Quaternary Science Reviews 73:1-13.

2 thoughts on “Environmental instability and habitat choice in a simple agent-based foraging model: Agents prefer diversity in rates of environmental change

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s