Abstract
The decentralized cognition of animal groups is both a challenging biological problem and a potential basis for bioinspired design. In this study, we investigated the house-hunting algorithm used by emigrating colonies of Temnothorax ants to reach consensus on a new nest. We developed a tractable model that encodes accurate individual behavior rules, and estimated our parameter values by matching simulated behaviors with observed ones on both the individual and group levels. We then used our model to explore a potential, but yet untested, component of the ants' decision algorithm. Specifically, we examined the hypothesis that incorporating site population (the number of adult ants at each potential nest site) into individual perceptions of nest quality can improve emigration performance. Our results showed that attending to site population accelerates emigration and reduces the incidence of split decisions. This result suggests the value of testing empirically whether nest site scouts use site population in this way, in addition to the well-demonstrated quorum rule. We also used our model to make other predictions with varying degrees of empirical support, including the high cognitive capacity of colonies and their rational time investment during decision-making. In addition, we provide a versatile and easy-to-use Python simulator that can be used to explore other hypotheses or make testable predictions. It is our hope that the insights and the modeling tools can inspire further research from both the biology and computer science community.
1. Introduction
Animal groups are capable of remarkable displays of highly coordinated behavior. Fish schools collectively choose foraging sites (Ward et al., 2012), locusts self-organize into orderly swarms (Yates et al., 2009), oceanic fish assemble in vast migratory shoals (Makris et al., 2009), and social insects perform a host of collective actions, including group foraging, construction of complex nests, and adaptive allocation of tasks across the labor force (Seeley, 1995; Detrain and Deneubourg, 2008; Charbonneau and Dornhaus, 2015; Oldroyd and Pratt, 2015; Perna and Theraulaz, 2017; Detrain et al., 2019). How these group actions result from individual behavior remains a major research challenge.
Although well-informed leaders may play a role, group organization is typically very decentralized (Seeley, 1995; Detrain and Deneubourg, 2008; Feinerman and Korman, 2017). Coordination emerges from interactions among large numbers of animals acting on limited local information with appropriate decision rules. Connecting individual behavior to group outcomes is too much for unaided intuition, and hence, mathematical models and agent-based simulations have become useful tools for understanding. In this article, we present a model for a notable example of decentralized decision-making: nest site selection by ants of the genus Temnothorax.
Models, in combination with experimental studies, have already revealed much about these ants, making them a leading study system for collective decision-making (Pratt, 2019). Colonies live in preformed cavities such as rock crevices or hollow nuts; if their home is damaged, they are adept at finding candidate new homes, evaluating each site's quality, and moving the entire colony to the best one. Their decision emerges from the separate efforts of many scouts, each independently recruiting nestmates to the site she has found. Because recruitment is quality-dependent, better sites accumulate ants more rapidly (Mallon et al., 2001).
These differences are amplified by a quorum rule under which scouts accelerate recruitment to a site once its population crosses a threshold; the winner of the race to attain a quorum becomes the colony's choice (Pratt et al., 2002). An agent-based model has shown that this algorithm helps the colony reach consensus on the best site (Pratt et al., 2005). Other models have shown how a colony can make a good choice even when no individual directly compares sites (Robinson et al., 2011; Masuda et al., 2015), and how individual behavioral strategies optimize speed/accuracy trade-offs at the colony level (Marshall et al., 2006, 2009; Pratt and Sumpter, 2006; Planqué et al., 2007; Sumpter and Pratt, 2009; Franks et al., 2013).
Although successful, models that are based on biological measurements can easily become intractable and hard to use for new predictions. Consequently, most model predictions have been limited to the simple challenge of choosing between two distinct and equidistant nests in a controlled laboratory environment. Real colonies face more complex scenarios, such as selecting among several sites of varying quality, avoiding splits when candidate nest sites are identical, and resolving colony splits when they occur (Sasaki and Pratt, 2012; Doering and Pratt, 2019).
It also remains unclear how the colony maintains high performance with noisy and heterogeneous individuals, and how individuals modify their behavior to account for changes in context or colony state. In addition, a large body of experimental work has uncovered new colony behavior that is yet to be explored in terms of how well our current understanding of the ants' collective algorithm can explain them. These include the more complex scenarios mentioned above, as well as effects on decision-making of colony size and emigration distance, colony reconnaissance of potential new homes, and the emergence of group-level rationality despite individual-level irrationality (Franks et al., 2008; Stroeymeyt et al., 2010; Sasaki and Pratt, 2011).
To better capture the complexities of nest-site selection, we develop a tractable model for the analysis and exploration of the underlying behavioral algorithms. We show that the model can reproduce individual and collective behavior in published studies of simple one- and two-nest experiments. For these data, our model performed similarly to an earlier agent-based model that inspired our work (Pratt et al., 2005).
We then used the model to explore beyond known features of the ants' behavior. In particular, we tested the hypothesis that scout ants attend to a site's population when deciding whether to recruit to it, such that the probability of recruitment increases with population. This hypothesis is different from the well-established quorum rule, under which a recruiter switches from one kind of recruitment (tandem run) to another (social transport) on the basis of site population.
Rather than determining the type of recruitment, the proposed population effect is about the ant's decision whether to recruit at all. The reason to suspect this population effect is its potential role in preventing splits or stalemates when a colony is faced with a choice between very similar nest sites. Without some rule to break the tie, the colony might be unable to reach consensus. A population effect on site evaluation could provide such a tie-breaker, because random differences in discovery and recruitment could easily produce a population difference between competing identical sites. If scouts then show enhanced recruitment to the site that had the larger population, this would amplify the difference, creating positive feedback that could direct the emigration entirely to whichever site happened to take an early lead in population.
To explore this idea, we ran our model with different strengths of population effect to determine how it affected a colony's ability to decide between two identical nests, a context that poses a particular challenge to consensus formation. As described below, our results confirmed the hypothesized population effect on both emigration speed and consensus. Finally, we extended the model to account for more recent empirical observations on robust decision-making among larger numbers of options (Sasaki and Pratt, 2012) and rational colony decisions about decision speed (Sasaki et al., 2019).
The rest of the article is organized as follows. Section 2 introduces our agent-based model for the house-hunting process and the main hypothesis we test: the population effect. Section 3 describes our model parameters and the performance metrics that our predictions about the population effect are based on. Then Section 4 showcases simulation results that confirm the population effect hypothesis. This suggests the value of empirical measurements of population effects, despite the experimental difficulties. Next, in Section 5, we use the model to test or extend other hypotheses that have varying degrees of support from newer empirical studies. Finally, in Section 6, we summarize our results and discuss future work directions.
2. House-Hunting Model
2.1. Informal description
A Temnothorax colony is composed of adult workers and brood items (immature ants), each group making up 40% to 60% of colony members. Adults are roughly equally divided between active workers, who organize and execute emigrations, and passive workers, who, like brood items, are typically transported to the new nest by active workers and do not themselves recruit nestmates (Pratt et al., 2005; Dornhaus et al., 2008; Valentini et al., 2020a).
There are four distinct phases for an active worker in the house-hunting process. In the first, the Exploration phase, the ant randomly starts to explore her surroundings for a suitable new nest. If she finds a candidate site, she enters the Assessment phase, where she individually assesses the site's quality according to various metrics (Franks et al., 2003; Pratt, 2005a; Healey and Pratt, 2008). If she judges the site to be satisfactory, the ant accepts it and enters the Canvassing phase, in which she returns to the old nest to recruit other ants to the site by leading forward tandem runs (FTRs). In a FTR, the recruiter slowly leads a single follower (another active worker) from the old nest to the new (Moglich, 1978; Richardson et al., 2007; Valentini et al., 2020b).
Upon arriving at the nest, the follower ant goes directly into the Assessment phase and evaluates the nest's quality independently of the leader ant. If she finds the nest satisfactory, she will transition to the Canvassing phase and start leading FTRs to the nest. A canvasser continues leading FTRs until she perceives that the new nest's population has exceeded a threshold, or quorum (Pratt, 2005b). At this point, she enters the Transport phase, in which she fully commits to the new nest as the colony's home. She ceases FTRs and instead switches to picking up and carrying nestmates from the old to the new nest. These transports are faster than FTRs, and they are largely directed at the passive workers and brood items, and hence, they serve to quickly move the entire colony to the new nest (Pratt et al., 2002, 2005).
Previous models and experiments indicate that the quorum rule helps the colony to reach consensus rather than splitting among multiple sites (Pratt et al., 2002; Franks et al., 2006, 2013). Splitting becomes a danger if ants at different sites, each ignorant of their nestmate's discoveries, launch FTRs to their respective sites. The quorum rule makes it likely that whichever site first hits the threshold will quickly end up with all or most of the colony, due to the speediness of transport.
Although experimental evidence is equivocal, we assume that the quorum size is correlated with the number of adult workers in the colony (Dornhaus and Franks, 2006; Franks et al., 2006). We also assume that passive workers can contribute to quorum attainment. Once the quorum is met, the switch to Transport phase is irreversible: an ant continues transporting nestmates to her new home nest even if the nest population later drops below the quorum size (Pratt, 2005b). However, transporters do sometimes interrupt transport to search for and assess alternative nest sites. If the search yields a new site that is better than the ant's current nest, then she exits the Transport phase and enters the Assessment phase with the new site as her candidate nest.
An ant in the Canvassing or Transport phase does not recruit indefinitely. Once the site from which she is recruiting is empty, she returns to her home nest and transitions back to the Exploration phase. However, this happens only upon meeting a “termination” condition consisting of 10 occurrences of either of the following events: (1) the worker tries to lead an FTR where the solicited follower is also trying to lead her own FTR, and (2) the worker tries to carry another worker who is also in the Transport phase. This condition is based on frequent observation of these events at recently emptied nests. We hypothesize that an ant's requirement of several such events is a means of ensuring thorough exploration of the old nest so that no nestmates are left behind. We do not have a precise measure of how many such events are required, but chose the number 10 as an upper-bound estimate.
Unlike active worker scouts, passive ants and brood items remain in the old nest until they are carried to the new nest. The only difference between passive ants and brood items is that the former contributes to quorum attainment (Pratt et al., 2002; Dornhaus et al., 2008). Therefore, in our model, the only states for any passive ant or brood item are her location and her role of being passive or brood.
The emigration is completed when all ants in the colony are relocated to the new nest, except possibly for a few active scouts (Pratt et al., 2002).
2.2. Modeling techniques
In this section, we summarize the modeling techniques in this article. However, we are including only a high-level overview in this section, and more details can be found in Sections 7.1 and 7.2.
We develop an agent-based model, where each ant is an agent and is modeled by its own state machine. We use a discrete and synchronous timing model, where time is divided into discrete rounds, and all agents enter a round together. In a round, each agent gets a chance to perform at most one state transition.
Apart from agents, another model component is the environment, containing one home nest and at least one candidate nest. Each nest has its own physical quality.
Agents can transition from one state to another, by initiating an action or receiving an action. Variables representing an agent's state are divided into two parts: external state variables that are visible to other ants, and internal state variables that are only visible to the agent itself. All state variables can change due to a transition. Figure 1 shows the changes of two important external state variables, state_name (in black boxes) and phase (blue filled boxes on the left), due to each action (arrows). The changes of other variables due to these transitions can be found in Section 7.2.

States and actions modeling the behavior of active ants responsible for organizing colony emigrations. As described in Section 2.1, the four distinct phases are in different boxes: Exploration, Assessment, Canvassing, and Transport.
2.3. The population effect hypothesis
Under this hypothesis, for individual decisions that depend on assessing a nest's quality, the assessment includes both its physical qualities (Sasaki et al., 2015; Burns et al., 2016) and the nest population (Pratt, 2005b; Dornhaus and Franks, 2006). Therefore, with inspirations from Ghaffari et al. (2015), in Figure 1b we model the final nest quality x as a simple linear combination of these two factors, with a new parameter called
where 4 is the maximum value of nest qualities, and num_ants is the total colony size. We further define the following sigmoidal function (Fig. 2)

Sigmoidal function with
where
Similarly, for decisions that depend on the comparison of two nests' qualities, an ant is required to compare the quality of a candidate nest (with physical quality q1 and population
where 4 is the maximum value of nest qualities, and num_ants is the total colony size.
Positive feedback through peer opinion is known to be important in collective intelligence generally, but has not been thoroughly explored in this system, beyond the quorum rule. The population effect we model here is thus a new way to consider the influence of peer opinion in individual decision-making during house-hunting. It is different from quorum sensing since there is no threshold involved but instead a linear combination of population and physical attributes of the nest. The population effect hypothesis then states that the incorporation of population into nest quality assessments can offset the individual noise level represented by
3. Model Parameters and Performance Metrics
In this section, we describe all the parameters of our model. We also quantitatively define the speed and consensus measures for our predictions. A detailed description of the Python simulator implementation is in Section 7.3, and the simulator code can be found online at https://github.com/snowbabyjia/Collective-Decision-Making-HH.
3.1. Model parameters
There are three kinds of parameters: environment, algorithm, and settings. In our Python simulator, these parameters are listed together in a configuration file. An example file is in Section 7.3.
Environment parameters are controlled by the environment and not considered changeable or tunable. These include the number of ants in the colony, and the number and physical qualities of the nests as potential new nest options.
Algorithm parameters are parameters controlling probabilistic individual state transitions. These include
Settings' parameters control plotting features and also convergence criteria. These include the option to generate a plot, the total number of runs for every environment/algorithm setting, the maximum number of rounds per simulation run, the percentage of ants needed in a nest to declare convergence, and the number of rounds the convergence needs to persist to declare persistent convergence, which marks the end of the simulation run.
We note that our number of algorithm parameters, eight, is a significant decrease from those in the previous model [table 1 in Pratt et al. (2005)], thus making our model much more tractable and generalizable, as well as easier for collecting various statistics and adding extra features.
Default Parameter Values and the Sources That Helped Determine These Values
3.2. Default parameter values
The parameters values below are used as a default from Sections 4 and 5, unless otherwise specified.
3.2.1. Algorithm parameters
Compared with the agent-based model in Pratt et al. (2005), our model places less emphasis on assigning specific observed values to a large number of parameters, striving instead to be more agile in representing a wide range of possible behaviors. Some parameters have experimental “meanings” and can be estimated from empirical data, as shown in the next paragraph. Some parameters cannot be directly drawn from existing empirical data. We estimate these parameter values in a trial-and-error manner. In general, the default values of these parameters are picked so that our simulation results match well with the empirical results in Pratt et al. (2005) for one- and two-nest emigrations, as detailed in Section 7.4.
The sources for determining the algorithm parameter values are listed in Table 1. In particular, the values of
This parameter can be influenced by many other factors such as the spatial geometry of the nests and the experience level of the individual. Although these nuances are not captured in our model in the interest of simplicity, follow-up research (Cai et al., 2021) has already started extending our model to include these geospatial aspects. The parameter
However, even lost followers enjoy a significantly increased chance of finding the target nest on their own (Pratt, 2008). We thus chose a high FTR success rate of 0.9 to capture both these direct and indirect effects of tandem following on nest discovery. The parameter
3.2.2. Environment and settings' parameters
An average colony size of 200 with 50 active workers, 50 passive workers, and 100 brood items is within the range of real colony compositions (Franks et al., 2015). One round approximately translates to 0.5–1 minute, although this is a very rough estimate. A simulation with 2000 rounds thus translates to 16–32 hours, and one with 4000 rounds translates to 32–64 hours. We set the default to 4000 to include some very slow emigrations observed in published reports (Pratt and Sumpter, 2006). The values for variables
3.3. Speed and consensus measures
Using the set of parameters that replicated the empirical data shown in Pratt et al. (2005), we demonstrate the power of our model by testing new hypotheses and making new predictions as shown in Section 4. To do so, we define the speed and consensus performance metrics below for the whole emigration process until either convergence or the end of simulation, including cases resulting in splitting.
3.3.1. Convergence score as speed
The final goal of the house-hunting algorithm is to achieve fast convergence in any given environment and stabilize at that convergence. To assess how well this was achieved, we calculate a convergence score as the inverse of the round number when a persistent convergence started. If no persistent convergence was reached before the end of the simulation, the convergence score is 0. Each simulation run has a convergence score.
3.3.2. Consensus
Another important metric is consensus, defined as the largest proportion of ants in any nest at the end of emigration. The end of an emigration is either when it reaches a persisted convergence, or when the simulation reaches maximum number of rounds.
4. The Power of Population Effect
In this section, we explore the influence of the population effect on emigration speed and cohesion. We test the population effect hypothesis in an environment with two equal quality candidate nests, making it particularly challenging for colonies to reach consensus, or at least making it take much longer to do so. Section 4.1 explores correlations between
4.1. Population effect helps with emigration speed
To investigate the influence of the population effect, we ran simulations for different combinations of
4.1.1. Results
The results show evidence for an inverse relationship between

Average convergence score (across 500 simulations) as a function of
To gain further understanding of the optimal
4.1.1.1. Advantages
Higher momentum in the system. This can promote the colony to accumulate population at a certain nest more quickly, and thus achieve faster convergence.
Better prevention of splits. Multiple candidate nests may reach the quorum, especially when the nests have similar physical qualities. This can lead to the colony splitting between more than one site. Population effect via
4.1.1.2. Disadvantages
Slower error correction. Since we are dealing with a randomized algorithm, there is always a chance that the colony will collectively make a “bad” temporary decision, even if individuals have low noise levels. The higher momentum will then make the wrong decision more “sticky” by accumulating more ants at a mediocre nest even if a better one is available. The colony would then have to move later to the better nest, adding costs in time and risk. In this way, high
These trade-offs suggest that there is an optimal value of
4.2. Population effect helps with consensus
In this section, we further explore how a population effect can help colonies to reach consensus when faced with two identical nests. We explore this question by simulating emigrations in which a colony is presented with two identical nest sites. We assess how well they reach consensus on a single one. We also vary the degree of scout sensitivity to site population by considering different values of
We ran 200 simulations each for
4.2.1. Results
The simulation results show strong symmetry breaking (Fig. 4). That is, a large majority of simulations ended with 80% to 100% of the colony in one of the two nests. When consensus was reached, it was roughly equally likely to be in nest 1 or nest 2, producing the distinctive U-shaped distribution seen in Figure 4. This pattern was true regardless of the value of

Simulation results for colonies choosing between two identical nests. The histograms show the distribution of the percentage of the colony occupying the left nest, for three different values of
5. Other Predictions with Experimental Support
In this section, we test other hypotheses concerning more complex scenarios where the link between colony patterns and individual behavior has not previously been modeled. For scenarios that have been explored empirically, we determine how well our model can account for observed results, and whether the empirical observations are comprehensive. Section 5.1 examines a colony's ability to choose well when faced with larger option arrays; and Section 5.2 focuses on how colonies make rational decision time investments depending on nest quality differences.
5.1. Colonies have high cognitive capacity
How well do colonies perform when selecting from many nests? A previous study (Sasaki and Pratt, 2012) showed that colonies are quite good at selecting a single good nest from a set of eight nests, four of which are good and four of which are mediocre. This is in contrast to individual ants, who are as likely to choose a mediocre as a good nest when faced with the same scenario. The colony advantage has been hypothesized to result from sharing the burden of nest assessment: very few of the scouts ever visit more than one or two nests, whereas a lone ant visits several, potentially overwhelming her ability to process information about them successfully (cognitive overload). We simulate this experiment to determine whether we can reproduce both the colony's ability and the observed distribution of nest visits across scouts.
We designed a simulated experiment with multiple nests in the environment, half of which are mediocre (physical_quality 1.0) and the rest of which are good (physical_quality 2.0). We considered three environments with 2, 8, and 14 nests, respectively. For each environment, we ran 600 simulations with a fixed colony size of 200, containing 50 active and passive ants each, and 100 brood items.
5.1.1. Results
First, we found that simulated colonies reached consensus on a good nest with high probability, matching that seen in empirical data (Fig. 5). This was true even when the number of nests was increased to 14.

The proportions of colonies that eventually moved into poor or good nests.
Next, we verified that the high cognitive capacity of colonies is associated with a low number of nests visited by each scout. The proportion of ants visiting only one or two nests was similar in the simulations and experiments (Sasaki and Pratt, 2012): over 80% of individual ants visited only one or two nests in the course of the emigration. Figure 6 shows that a similar pattern is seen for the number of transports: that is, if we focus only on the ants who contributed to the emigration by transporting nestmates, over 80% visited only one or two nests. Ants that access many nests are few and have a minor role in the transportation process. Thus, colonies are less vulnerable to cognitive overloading compared with single ants when choosing among multiple sites, providing a possible explanation to the higher cognitive capacity of colonies.

Proportions of transport efforts as a function of the number of candidate sites visited by each ant. The blue bars show the percentage of transports done by ants that visited a given number of nests (Sasaki and Pratt, 2012), and the dark orange bars show the same for simulated ants. Colonies choose among eight nests (four good and four mediocre) in both simulations and experiments (Sasaki and Pratt, 2012).
5.2. Colonies make rational choices about decision speed
For choices between two nests, how does the difference between the nests affect the speed of decision-making? Counterintuitively, a previous study (Sasaki et al., 2019) found that colonies move more quickly when site qualities are more similar. However, this behavior accords with decision theory predictions that decision makers should take less time if the consequences of their choice are small; that is, since the nests are similar in quality, the opportunity cost of making a wrong decision is small, so it is rational to save time costs by taking on a higher risk of choosing the wrong nest.
We simulate this scenario to determine if we can reproduce the same pattern, but we also explore a broader range of quality differences to better describe the relationship between quality difference and decision time. We designed an environment with two candidate nests, one good and the other mediocre. The good nest has physical_quality 2 in all simulations, but the physical_quality of the mediocre nest varies across simulations from 0.2 to 1.7. We asked whether the quality of the mediocre nest is correlated with the convergence score (a measure of decision speed). We ran 300 simulations for each environment with a colony size of 200, consisting of 50 active workers, 50 passive workers, and 100 brood items. We repeated this set of simulations for five different values of
5.2.1. Results
If our model reproduces the rational time investment choices of colonies (Sasaki et al., 2019), then we expect the convergence score to increase as the mediocre nest quality increases, thus becoming more similar to the good nest. Our results partially match this prediction, with the convergence score increasing as the mediocre nest quality goes from 0.2 to about 1 (Fig. 7). However, at higher mediocre nest qualities, the pattern reverses and the convergence score declines. This basic pattern is seen for all tested values of

Average convergence score as a function of the physical_quality of the mediocre nest. The physical_quality of the good nest is 2, and that of the home nest is 0.
We propose that the nest qualities studied in Sasaki et al. (2019) came from the region below the peak score that saw an increase of speed with decreasing quality difference. However, from our more granular simulations, we predict that as the quality difference gets still smaller, the convergence score will start decreasing, meaning colonies will start investing more time.
Why might this happen? Recent studies have explained the behavioral difference between individuals and colonies via two different decision models: the tug-of-war model describes individual behavior, while colony behavior is better accounted for by the horse race model (Kacelnik et al., 2011). The tug-of-war correctly predicts the irrational behavior of individual ants, in that their decision-making slows down for options that are more similar. The horse race, in contrast, correctly predicts colonies' rational acceleration of decision-making for similar options. We hypothesize that the applicability of these models to the colony's behavior changes as the quality difference changes.
More specifically in Figure 7, before the peak score is reached, the colony may effectively distribute its decision-making across many ants with limited information, the situation envisioned in the horse race model. After the peak score is reached, the colony may come to depend more on individual comparisons between nest sites made by a few well-informed ants, and thus to show the irrational slowdown predicted by the tug-of-war model. It could also be the case that more transports are performed between the two candidate nests as the likelihood of the mediocre nest achieving quorum attainment increases.
6. Discussion
In this article, we developed a tractable agent-based model to examine the collective nest site selection process in colonies of Temnothorax ants. To test against existing experimental data and to make predictions, we built a convenient Python simulator that can easily be extended to add extra features. The model successfully replicated published individual- and colony-level outcomes, and performed as well as an earlier model (Pratt et al., 2005) in accounting for underlying individual and colony behavior in one- and two-nest emigrations, but did so with a more concise set of individual decision rules. Using the set of parameter values that achieved the above, our model confirms a novel population effect hypothesis, which states that the integration of peer opinion, represented by a nest's population, is helpful for both the speed (Fig. 3) and consensus (Fig. 4) of emigrations.
On top of matching previous studies of simple one- and two- choice environments, our model also generated simulated results that confirmed emigration behavior in more realistic and challenging multinest environments that had not been modeled previously. Specifically, in Figures 5 and 6 we show evidence that colonies, compared with single ants, make more accurate decisions among multiple nests because the former is minimally exposed to cognitive overloading, as shown experimentally in Sasaki and Pratt (2012). In addition, with partial empirical support, our model makes predictions on the quantitative relationships between emigration speed and the mediocre nest quality in a two-nest environment with one good and one inferior nest (Fig. 7).
From these examples, we showed that the model and the accompanying software are versatile and easy to extend to additional investigations on unexplored scenarios such as emigrations in a changing environment. Moreover, the generalizable modeling framework that we introduced can be used to formally represent a variety of distributed algorithms used by animal groups to understand the emergence of collective intelligence in biological systems.
Although the presence of the population effect has not yet been shown in Temnothorax colonies, there is reason to expect that they would benefit from a behavioral rule to enhance consensus. They differ from other social insect species that achieve consensus through highly nonlinear recruitment mechanisms. For example, ant species that recruit via trail pheromones will choose one of two identical food sources rather than forming trails to both. This is because the attractiveness of a trail is a sigmoidal function of the amount of pheromone it contains, which leads to rapid amplification of small random differences in the strengths of competing trails (Beckers et al., 1990; Perna et al., 2012).
However, similar experiments on Temnothorax ants found that they do not always break symmetry, instead exploiting both feeders equally, a result that has been attributed to the linear relationship between tandem running effort and recruitment success (Shaffer et al., 2013). An open question is whether this lack of symmetry breaking also holds for nest site selection. When presented with identical nests, do colonies choose only one or split between them? If they can reach consensus, then how do they do so? One possibility is that the quorum rule provides sufficient nonlinearity to amplify small random differences in site population, thus ensuring that the colony does not split. Another possibility is that colonies have some other mechanisms of avoiding splits.
A good candidate for such a mechanism is the population effect explored in this article. This would allow amplification of early random differences in population, by increasing the likelihood of recruitment to the nest with more ants. Further study is warranted to test whether this effect is found in real colonies.
In the rest of this section, we discuss several specific directions for future research. While our model captures many aspects of individual behavior, it leaves out some important features, including many that affect timing. These include (1) effects of the spatial distribution of nests, which is the focus of a recent modeling and data analysis study that extended our house-hunting model. Cai et al. (2021) have also demonstrated the value of this framework and the ease of use of our simulator, (2) effects of individual experience on recruitment probability and speed, and (3) actions that may last a variable duration such as the evaluation of a new nest.
Adding these to the model would allow it to explore a broader range of colony abilities and to reveal as-yet unknown components of individual behavior and how they interact with known aspects. For example, more realistic models of timing would undoubtedly affect the discovery behavior currently captured by the single variable search_find.
On the simulation data analysis side, there are many directions for further research. First, we note the link between the effects of different quorum sizes and the horse race and tug-of-war models that have been successfully used to describe group and individual decision-making, respectively, in these ants (Kacelnik et al., 2011). Our model finds that group decision-making may be better captured by the tug-of-war model when a colony is choosing between two very similar options. If so, this suggests that colonies can change their relative reliance on individual decision-making according to the decision context. This indicates the value of developing a more quantitative model that combines the tug-of-war and the horse race models, based on the same factors that affect how a colony chooses the most beneficial quorum size.
In addition, our model shows the potential utility of individual ants taking account of site population when assessing a site's quality. Whether real ants use peer opinions in this way has not yet been experimentally tested. Our results suggest that it may be important for preventing and repairing split decisions. However, the number of peer opinions that individuals should rely on is an intricate balance, as we described in Section 4.1. It would be highly valuable to quantify the relationship between the frequency and degree of splitting to the quorum size and to
A related research direction is to find out other factors that allow colonies to robustly reunify in split cases. However, the runtime of our program over hundreds of simulations can be significant, making it difficult to investigate the system dynamics and performance in all possible parameter settings. Overcoming this challenge requires software optimization techniques such as code parallelization and possibly further model simplifications.
On the theoretical analysis side, our model serves as a stepping stone for more rigorous mathematical formulations and proofs of guaranteed bounds on any metrics of interest. Starting with simpler environments, our model can be reduced to analytically derive the goals different mechanisms can and cannot achieve. These results can then potentially provide insights on why certain collective behaviors have emerged through evolution, as well as on engineering artificial distributed systems subject to similar limitations to reach consensus. In fact, a recent theoretical work on the effect of quorums in single-nest emigrations (Zhang et al., 2021) demonstrates the value of our house-hunting model.
Finally, we emphasize that our modeling framework can be flexibly adapted to other distributed algorithms inspired by animal groups. One compelling example is that honeybee colonies use a very similar algorithm in their nest-selection process (Laomettachit et al., 2016), and can be easily modeled by our framework. Comparing it with our ant colony model can reveal commonalities and differences in how different animal groups achieve various goals and organize potentially conflicting priorities.
7. Appendix
7.1. Modeling framework
In this section, we introduce a general modeling “language” that has the potential to be useful for a wide range of applications. In Section 7.2, we instantiate this language in the context of the house-hunting process in ant colonies.
7.1.1. Agent-based model
Formally, the components below define the entities in the system and their static capabilities. More explanatory text follows after the list.
Each agent has a unique agent-id
We define
The set
Agents can also access values in the environment, and each value is called an env-choice. The set
An agent can transition from one state to another by taking an action
The function
The function
7.1.2. Timing and execution model
In this section, we introduce the dynamic aspects of our model, including the discrete and synchronous timing model, and how different components in the system interact with each other at different points during the execution of the algorithm.
Our system configuration contains (1) an environment state, called env-state, and (2) each agent's state, which is a pair (external-state, internal-state), independent of env-state. Agents receive inputs from and react to the environment during the execution of the system. In this article, we assume that the environment is fixed. That is, the env-state does not change during the execution of the system.
Incorporating some theoretical ideas from Ghaffari et al. (2015) and Radeva (2017), we divide the total time into rounds. Each round is a discrete time-step, and times are the points between rounds. At any time t, there is a corresponding system configuration t. The initial time is time 0, and the first round is round 1, taking the system from configuration 0 at time 0 to configuration 1 at time 1. In general, round t starts with system configuration (
We now describe the execution of an arbitrary round t. At any point in the execution of round t, each agent x is mapped to a state, state_x, which is visible to agent x itself. However, to other agents, only agent x's external-state, external_x is visible. We denote all-external
Accounting for the randomness of the order of execution for all the agents, a randomly chosen permutation of
The rest of this section describes all possible operations during one agent x's turn in round t. When an agent with agent-id x (a.k.a. agent x) gets its turn to execute, it first checks whether
Otherwise, agent x has not yet transitioned in round t. Let state_x denote the state of agent x. Agent x calls the function
Agent x then calls
7.1.3. Discussion
Although our model keeps track of the external-state of all the agents in all-external, when performing a transition, an agent can only access local information in it. Locality here is flexible to the context, that is, local to the location of the agent initiating an action.
Agent-based models are especially powerful for simulating and analyzing collective behaviors given their natural compatibility with object-oriented programming methodologies and their flexibility for allowing individual differences in realized state transition probabilities among the agents (De Vries and Biesmeijer, 1998; Sumpter et al., 2001; Pratt et al., 2005; Masuda et al., 2015).
7.2. House-hunting model details
7.2.1. Formal model
7.2.1.1. Model components
In this section, we show how each component in our modeling framework (Section 7.1.1) is defined in the house-hunting algorithm context.
Figure 8 shows our native data structures as used by various components in the system: Nest objects, an array that constitutes an env-state; Ant objects, each corresponding to an agent; State = (ExternalState, InternalState) objects, each corresponding to a state = (external-state, internal-state), and Action objects, each corresponding to an action. Each of the data structures contains a set of variables, as seen in Figure 8. Note that we consider all variables belonging to either the class ExternalState or the class InternalState to belong to the class State as well. Throughout the rest of the article, we use the notation object.variable to denote the value of a variable belonging to a class object.

Native data structures that define different entities in the distributed system.
Using these data structures as building blocks, we now show all possible values for the components in the framework presented in Section 7.1.1. Note that for consistency with our implementation in Section 7.3, we use
In any ExternalState class object, phase has one of four possibilities—Exploration (searching for new nests), Assessment (assessing new nests), Canvassing (leading other active workers on FTRs to her accepted candidate nest), and Transport (committing to the new nest and rapidly carrying other ants to it). Note we abbreviate the four phases to names “E,” “A,” “C,” and “T,” respectively. The initialization of an Ant's phase and state_name can be found in Section 7.2.1.3. For each phase, the variable state_name take values from a different set, as shown in Figure 9.
The variable role can be one of (0,1,2) representing (active ant, passive ant, brood), and each Ant is initialized with the appropriate value. The variable location can be any integer in the range [0, num_nests) where num_nests is the total number of nests in the environment, with 0 representing the original home nest. In addition, recall that

State_name's available for each phase.
7.2.1.2. The select-action function
The function
For search, the probabilities of choosing a to be “find” and “no_action” are
For follow, the probabilities of choosing a to be “follow_find” and “get_lost” are
For reverse_lead, the probabilities of choosing a to be“delay” and “no_action” are
For quorum_sensing, let the set
For lead_forward, let
For “lead,” if
For “get_lost,”
For “terminate,”
For transport, let
For “carry,” if
For “stop_trans,”
For “terminate,”
For at_nest, the probability of choosing a to be “search” is
For arrive, the probabilities of choosing a to be “reject” and “no_reject” are
7.2.1.3. The transition function
7.2.1.3.1. Passive workers and brood items
Active worker scouts are defined as those who engage in the emigration process by independently discovering the new nests (entering without carrying or being carried) or by carrying brood items or other adult ants to the new nest or both. Passive workers remain in the old nest until they are carried to the new nest. Brood items are similar to passive workers but do not contribute to quorum attainment (Pratt et al., 2002; Dornhaus et al., 2008).
We use
7.2.1.3.2. Initiation and termination of emigration
All ants start in
We do not designate a separate “termination state” that disables an ant from exploring further, but at the termination of the emigration process, we expect most active workers to be in
As a result, the more agents stabilize in the same nest, the more likely that they will stay stable and that new agents will stabilize as well. In the house-hunting algorithm, the conditions that trigger this “termination” behavior contain two cases, as mentioned in Section 2.1. The details of this special “termination” case handling are discussed in the next paragraph.
7.2.1.3.3. Special and general cases
In the house-hunting algorithm, there are some special cases that the
Otherwise, role = 0. Let
We now list out how the function
The first special case is if the input argument agent-id
The second special case is if act satisfies the termination condition mentioned earlier in this Section. Specifically, the cases are when agent-id = x, and act is either (1) (
The third special case is if agent-id = x and act does not satisfy the termination conditions, but
Last, in the general case where none of the above special cases applies, the function first adds x to Trans. Then it finds the black text box corresponding to state.phase and state.state_name in Figure 1b, and the black text box that a leads to contain the phase and state_name of the resulting state. The rest of the variables in state are modified as well. The rest of this sections lists details for each possible value of the (phase,
In Fig. 1a and b, action-types are color coded, as shown in Table 2. We walk through all possible transitions of an ant and the associated changes in the internal and external states, in a phase-by-phase manner.
Color Coding of Arrows Representing Action types in Figure 1a and b
7.2.1.3.4. Exploration
An ant in
An ant is in the state
An ant in the state
An ant in the state
7.2.1.3.5. Assessment
An ant in the state
An ant in the states
An ant in
7.2.1.3.6. Canvassing
An ant in
An ant in
An ant in
An ant in
An ant in
7.2.1.3.7. Transport
An ant in
An ant in
An ant in
An ant in the states
An ant in
7.3. Simulation details
The Python code for the simulator can be found at:
https://github.com/snowbabyjia/Collective-Decision-Making-HH.
7.3.1. Sample configuration file
[ENVIRONMENT]
num_ants = 200
nest_qualities = 0,1,2
[ALGO]
lambda_sigmoid = 8
pop_coeff = 0.35
quorum_thre = 0.15
quorum_offset = 0
search_find = 0.005
follow_find = 0.9
lead_forward = 0.6
transport = 0.7
[SETTINGS]
plot = 0
total_runs_per_setup = 500
num_rounds = 4000
percent_conv = 0.9
persist_rounds = 200
7.3.2. Data structures and global variables
We define four native data structures, as shown in Figure 8. The global variables include (1) the transition tables defined in Fig. 1, (2) Nests, the array of all nests including the home nest that by default has quality 0 and id 0, and (3) Ants, the array of all ants in the colony.
7.3.3. Simulation overview
We describe our algorithm implementation in detail below. Our executable software and instructions are available upon request.
Consider a colony of size num_ants where all the ants start the house-hunting task synchronously. We divide the total time to completion into rounds, with a maximum round number of total_runs_per_setup.
At the beginning of round t, no ant has transitioned yet (instantiate Trans =
The action picked by an ant x has an action_type, a receiving ant id, and a nest id. Please note here that in real ant colonies, an action can involve either just a single ant or a pair of ants (tandem run and carry). In the single ant action case, the receiving ant's id is assigned value
By looking up the Ants array, x can also get the current external state of all ants including the receiving ant y, if any, of the picked action. These values are enough for x to call the transition function, and add its own id to Trans. The special case handling is detailed in Section 2.2.3 in the main article, including the case where y might also call a transition function and adds itself to Trans.
When one round finishes, each ant has had one chance to initiate or receive an action, and potentially has a new state. Repeat rounds such as the above until the criteria are met for convergence with persistence, or until the program reaches the maximum number of rounds specified in the configuration file.
7.4. Parameter estimation
We estimate the various parameters in our model using the same empirical data set, successfully accounted for by an earlier model (Pratt et al., 2005) for emigrations in simple one- and two-new-nest environments.
Just like the parameter estimation technique used in Pratt et al. (2005), we first examine a simple scenario where colonies have only one candidate nest in the environment. Then we consider a decision between two nests that clearly differ in quality. For all scenarios, we compare our simulation results with the same empirical data collected by Pratt et al. (2005), at both the individual and colony levels. All simulations for the rest of the article default to the default values described in Section 3.1, unless specified otherwise.
7.4.1. Single-nest emigrations
The first question we ask is: does our model accurately reproduce statistics on individual discovery and recruitment acts in single-nest emigrations? Previous empirical work showed the distributions across ants of key behaviors contributing to the collective outcome (Pratt et al., 2005). These include the number of recruitment acts per ant, the number of ants performing each recruitment type, and the number of ants arriving at the new site by different routes. We asked whether our model could replicate the empirical distributions.
To answer the question, we simulated the single-nest experiments conducted in Pratt et al. (2005), on the 12 colonies with compositions detailed in Figure 10. We used default parameter values, except we increased search_find to 0.05. This increase accounts for the presence of only one new nest, hence all “find” actions after the first one are rediscoveries of this nest, which we assume has a higher probability than finding a previously unknown site (Pratt et al., 2005). In future work, this variable should be expanded to depend on other factors, such as the number of nests in the environment or the spatial geometry. We ran 500 simulations for each colony.

7.4.1.1. Results
We compared the statistics of the model output to the same statistics reported in Pratt et al. (2005) (Fig. 11). Figure 11a shows the histograms of individual workers grouped by the number of recruitment acts. More than half of the simulated workers never recruited, consistent with the empirical finding of about 60% nonrecruiting active workers. The other bins show similar mean and variance to the empirical data. Figure 11b classifies ants by their recruitment behavior, and the breakdowns are again consistent with the experimental observations. Figure 11c categorizes workers by their routes to discovery of the candidate nest, and is again consistent with the findings in Pratt et al. (2005), at least when the experimental data are pooled over six emigrations by three colonies.

Histograms of
However, the distributions across the three different routes vary strongly across emigrations. Indeed, the results in Pratt et al. (2005) notably differ from those in Pratt (2005a). While our model does not account for this variation, we conclude that it does adequately reproduce key distributions in recruitment behavior in single-nest emigrations.
7.4.2. Two unequal nests: splits
The second question we ask is: does our model account for the degree of splitting in two-nest emigrations with unequal qualities? In these circumstances, colonies do not always make a unanimous choice, but may temporarily split between the sites before eventually coalescing on a single one. We focus on splitting because it is a primary hindrance to consensus. The measurement of splitting as defined in Pratt et al. (2005) is the percentage of brood items in the better candidate nest at the time when the last ant has been moved from the home nest.
We replicated the two-nest emigrations in Pratt et al. (2005), with six colonies whose member compositions are listed in Table 3. We set
We ran 500 simulations for each colony, and for each colony we recorded the average percentage of brood items in the better nest at the time the home nest became empty. To compare the simulations with empirical data, we measured for each colony the proportion of simulations departing as far or farther from the colony average as did the experimental value. Twice this proportion gave the p-value for a test of the null hypothesis that the observed value was drawn from the same probability distribution as the simulated values.
7.4.2.1. Results
The results show no significant difference between experiment and simulation for five of six colonies (Table 4). This outcome confirms our model's ability to reproduce observed patterns of splitting in two-nest emigrations for a variety of colony compositions, using the default parameter values.
Percentage of Brood in the Better Nest for Each of the Six Colonies, Predicted Versus Observed
The last column is the p-value, with p < 0.05 indicating a significant difference between predicted and observed percentages.
Footnotes
Acknowledgment
The authors thank Dr. Anna Dornhaus for the early discussions of this work.
Author Disclosure Statement
The authors declare they have no competing financial interests.
Funding Information
For this work, J.Z. and N.L. were supported by NSF Awards CCF-2003830, CCF-1461559, and CCF-0939370.
