Bacteria inhibit and kill one another with a diverse array of compounds, including bacteriocins and antibiotics. These attacks are highly regulated, but we lack a clear understanding of the evolutionary logic underlying this regulation. Here, we combine a detailed dynamic model of bacterial competition with evolutionary game theory to study the rules of bacterial warfare. We model a large range of possible combat strategies based upon the molecular biology of bacterial regulatory networks. Our model predicts that regulated strategies, which use quorum sensing or stress responses to regulate toxin production, will readily evolve as they outcompete constitutive toxin production. Amongst regulated strategies, we show that a particularly successful strategy is to upregulate toxin production in response to an incoming competitor’s toxin, which can be achieved via stress responses that detect cell damage (competition sensing). Mirroring classical game theory, our work suggests a fundamental advantage to reciprocation. However, in contrast to classical results, we argue that reciprocation in bacteria serves not to promote peaceful outcomes but to enable efficient and effective attacks.

Bacteria commonly live in dense and diverse communities where competition for space and nutrients can be intense (

The production and regulation of bacterial toxins have been studied for decades because of their potential as clinical antibiotics (

Bacteria, therefore, have the potential for a wide range of responses during combat. Evolutionary theory has so far focused on the evolution of unregulated toxin production. This work has highlighted that factors such as strain frequency, nutrient level, the level of strain mixing (relatedness), and the cost of toxin production are all important for whether bacteria employ toxins at all (

Here, we study the evolution of strategy during bacterial warfare by combining a detailed differential equation model of toxin-based competition with game theory to identify the most evolutionarily successful strategies. Informed by the large empirical literature on factors that regulate bacteriocins and antibiotics, we compare four major classes of potential strategies: constitutive (unregulated) toxin production, and regulation via nutrient level, quorum sensing, or by damage from a competitor’s toxin. We study the behaviours and competitive success of each strategy when in competition with other strains across a range of scenarios. We find that all three types of regulated strategies carry benefits relative to non-regulated production and, for short-lived resources, the three types of regulation offer largely equivalent alternatives for controlling attacks. However, for long-lived environments, responding to incoming attacks is often the best performing strategy. A key benefit to such reciprocation in such environments is the ability to downregulate a toxin once a competitor is defeated, thereby saving the energy that would be lost in needless aggression.

We are interested in how competition between strains and species of bacteria shapes the evolution of toxin regulation. The core of our approach is a set of detailed ordinary differential equations (ODEs) that capture ecological competition between bacteria (

(_{A}_{B}

Model parameter | Parameter description | Standard value [unit] (notes) | Effect on optimal toxin investment |
---|---|---|---|

Initial cell biomass of each strain | 0.1 [gC] | ⬆ | |

Initial pool of nutrients | 1 [gN] | Intermediate optimum ( | |

_{N} | Saturation constant for nutrient uptake | 5 [gN] | ⬆ |

_{max} | Maximum growth rate | 10 [1/hr] | ⬇ |

Killing efficiency of the toxin | 20 [1/gT*1/hr] | ⬆ | |

_{T} | Toxin loss rate | 0.1 [1/hr] | ⬇ |

These local-level competitions are embedded into a larger metapopulation framework that determines long-term evolutionary outcomes (

We explore a number of different evolutionary scenarios using different calculations. We start by using invasion analysis (depicted in

Our model needs to be relatively complex in order to capture the evolution of bacterial competition and regulatory networks. As a result, the form of our mathematical model is of a class that is not amenable to analytical work (

We first ask, what favours the evolution of constitutive toxin production. While many toxins are regulated, constitutive production does occur (

In the model, we follow nutrient concentration and cell biomass over time as the strains engage with each other (

Our goal is to understand the evolutionary fate of different strategies of toxin-mediated competition. In order to do this, we need to recognise that the outcome of competition at a local scale may not be predictive of evolutionary trajectories. Consider, for example, a competition between two strains of bacteria on a particle of detritus in a pond. If one focuses solely on local competition on the particle, then any strategy that results in a focal strain making more cells than its competitor will be favoured, even if this leads to relative ruin for the winning strain with only a few cells surviving the process. However, given these competitions can happen on many such particles, it is unlikely that such extreme strategies would be favoured, because few cells will be produced to colonise new particles. Instead, the best strategies will be those that

To capture this effect, we embed the local-level competitions within a broader framework in order to make evolutionary predictions (

What determines the optimal level of toxin investment? Intuitively, we find that cells evolve to invest more in attacking their competitors when toxins are efficient at killing the competitor and/or the toxins persist stably in the environment (

While earlier models have studied the effects of nutrients on toxin production, these studies either did not model nutrients explicitly (

We next investigate what happens when cells are able to regulate their level of toxin production in response to environmental cues. The production of antibiotics and bacteriocins is commonly tightly regulated by a variety of signals and cues. As discussed above, these can be broadly divided into three major classes based upon known bacterial regulatory networks. The first is detection of cell density by canonical quorum sensing or related means (

We first compare the evolution of regulation by quorum, nutrient level, and the level of the competitor’s toxin when each is in competition with constitutive strains. This allows us to ask whether regulated strategies can evolutionarily replace constitutive strategies (see Materials and methods). In brief, we model regulation of toxin production using a simple step function, which is defined by toxin production in activated state (_{induced}_{initial}_{initial}_{induced}

In a vast tournament consisting of millions of individual competitions, we pit all possible strategies of each mode of regulation against all possible versions of the fixed strategy. We then use invasion analysis, as before, to look for the evolution of regulated strategies that can invade all unregulated strategies. As before, we consider both global and local competition (see

Using a deterministic grid search, we find nutrient-sensing, toxin-sensing, and quorum-sensing strategies that can stably invade the entire range of non-regulated producer strategies (_{initial}_{induced}_{initial}_{induced}

How do the different regulatory strategies achieve their success? For the great majority of cases, successful strains evolve to upregulate their attack after a delay, either based on the detection of low nutrients, high quorum, or high levels of the competitor’s toxin (

We also discovered winning strategies that function by

In each case, regulated strategies win by only making high levels of toxin at certain times, thereby saving energy relative to constitutive producers. A corollary is that, if toxin production is cost free, regulation will no longer be benefitical relative to constitutive production. But, assuming that there is some costs to toxin production, regulation is expected to be favoured by natural selection.

In sum, there are regulated strategies of each of the three types under study that can evolutionarily replace all non-regulated strategies. However, this analysis is based on regulated strains invading metapopulations consisting of a single constitutive strategy. In some contexts, a focal strain may face a variety of competitors. Consider, for example, a situation where migration brings in a range of competiting species, each optimised to a different environment. To consider this scenario, we next ask how the different sensing strategies fare in competition with a standing diversity of constitutive strategies. We introduce diversity by letting the different sensory strategies (i.e. nutrient sensing, toxin sensing, and quorum sensing) face an increasingly diverse mix of constitutive toxin-producing opponents. We assume that the standing diversity of constitutive producers is not itself affected by the evolution of the regulated startegies, that is, there is no coevolution (we consider coevolution in the next section, however). For each set of opponents, therefore, we can identify the best performing regulated strategies simply as those that obtain the highest average biomass across the competitions with the set of opponents (Materials and methods). Based on the simulated data, we also fitted a linear regression model with sensing type as a categorical predictor and number of competitors a numerical predictor (see Materials and methods).

When opponents have a single strategy (lowest diversity), the toxin sensing strategy is most efficient in terms of its final biomass produced (

(_{end}

This superiority of toxin sensing is robust across a range of parameters, including different toxin efficiencies, toxin loss rates, and nutrient concentrations (

We have considered how regulated attack strategies perform in the face of constitutive strategies that vary in their level of aggression, and in the face of varying levels of diversity in these opponents. This revealed that regulation is generally beneficial and indicated that the sensing of an opponent’s toxin is often the best performing strategy. However, this analysis is artificial in the sense that bacteria with regulated strategies are also likely to compete against one another. Therefore, we next ask, which sensing strategy is most successful when coevolving with other sensing strategies? We first consider strains that interact with others that have a similar attack strategy, regulated by the same environmental cue. For each of the three types of regulation, we then search for the optimal strategy using a genetic algorithm (see Materials and methods) (

Panels

When competing with the same strategy, all strategies initially evolve to increase toxin production during the competition (_{initial}_{induced}_{initial}_{induced}_{initial}_{induced}_{initial}_{induced}

The evolution of a peaceful outcome is specific to the ability to reciprocate; we do not observe it for nutrient or quorum sensing. Nevertheless, we have identified a route by which bacteria might evolve the peaceful resolutions seen in animal and human conflicts (

We therefore sought to capture this complexity with a final model in which all possible regulated strategies are able to compete against each other, again using a genetic algorithm to identify optimal strategies (see Materials and methods). Despite a great number of potential combinations (over two million different competitions), and with different sets of hyperparameters of the genetic algorithm, we again see a clear winner in toxin-based regulation, both for our normal parameters (

Bacteria use a wide variety of weaponry to harm other strains and species, which is typically under tight regulation (

Our modelling implicitly captures spatial structure at the metapopulation level with discrete patches of bacteria that compete with each other. Within patches, our ODE model best reflects environments with limited spatial structure where cells of different genotypes are mixed together. However, bacteria do also display fine scale spatiogenetic structuring within their communities (

Our work predicts that sensing incoming attacks through direct or indirect means should be a widespread way of regulating toxins and other modes of attack. This hypothesis lends itself to empirical testing via the study of bacterial behaviour during toxin-mediated competition with other strains and species. Some examples of reciprocation already exist. Many bacteria upregulate attack mechanisms via stress responses that detect cell damage (

There is also evidence that bacterial toxins can be regulated via nutrient depletion and quorum sensing (

Another possible explanation for why some bacteria do not use cell damage to regulate their toxins comes from the notion of ‘silent’ toxins. These are toxins that are not easily detected by the cell’s stress responses, which may limit the potential for a toxin-mediated response. For example, some toxins depolarise membranes (

Bacteria use diverse regulatory networks to attack and overcome competitors, and there is much still to understand about their evolution. Here, we have identified general principles for the function of these networks in bacterial warfare. We find there are great benefits using regulation to time an attack; both to minimise its cost and maximise its effect on an opponent. We also find that regulation that enables reciprocation can be particularly beneficial. If cells only attack when attacked, they invest their energy where and when it is most needed: against aggressive opponents. Our findings are mirrored in the classical predictions from the game theory of animal combat, which suggested that adopting a reciprocal and retaliatory strategy can be effective (

In this study we use a modelling framework that captures two scales of competition (

Our model captures pairwise competitions between bacterial strains, which have the potential to produce toxins (_{A}_{B}_{A}_{B}_{N}_{max}_{T}.

For constitutive toxin production, the strategy of a strain is given simply by a fixed

The dynamics of cells, nutrients, and toxins are modelled as continuous for their typical range. But when a cell strain reaches a very low concentration (^{−6}), we assume that stochastic extinction occurs such that cell concentration drops to 0. Further, our model assumes a limited lifetime of the local patches by stopping the dynamics when 24 hr (or less for the analysis of shortened competition times,

We solve the system of ODEs numerically using an implicit Euler method. This numerical scheme is implemented in MATLAB (version 9.5.0.944444) (^{−8} to 0.

To extend the above model to include sensing, toxin production of bacterial strain

These equations of regulated toxin production each comprise the initial investment into toxins (_{initial}_{N}_{TB}_{QS}_{initial}_{induced}

We use our first models to predict the optimal constitutive toxin production strategy across different ecological conditions. Here, the assumed scenario is a monomorphic metapopulation (all strains have identical warfare strategy), where a rare mutant strategy appears that may or may not invade this metapopulation. As time progresses toward infinity, the metapopulation will finally be dominated by a strategy that can invade the metapopulation of any other strategy and that can itself not be invaded. We implement this scenario using classic pairwise invasion analysis. More specifically, we employ game theory and, in particular, invasion analysis to find the best strategies (

We follow previous work (_{inv}_{res}_{res}_{inv}_{res}_{res}_{res}_{inv}_{inv}_{res}

When the invasion index _{inv}_{inv}_{inv}

We next ask whether regulated strategies will evolutionarily replace constitutive production. Here, the ecological scenario is the same as above: monomorphic populations of constitutive toxin production strategies are threatened to be invaded by rare strategies that can sense (_{initial}_{induced}_{fixed}

We also study the evolutionary success of the three different types of sensing when being in constant competition with a diverse set of competitors. Here, the ecological scenario is a polymorphic metapopulation – a mix of different constitutive production strategies – with a given diversity. We assume that this diverse set of strategies is not influenced by evolution in the focal sensing strategy due to, for example, immigration that continually resupplies the diversity of competitors. We then ask what happens when a rare sensing strain enters this metapopulation, where its success depends on its success across pairwise competitions with the different resident strategies.

We implement this by competing focal sensing strategies against a set of different constitutive strategies and computing their fitness from the average biomass produced across those competitions. Specifically, for each of the three different sensing types, we perform a parameter grid search, creating a large number of predefined strategies across the parameter range of _{initial}_{induced}_{N}_{TB}_{QS}

Using the simulated results, we fit linear regression model with the sensing type as a categorical predictor variable and the number of competitors as a numerical predictor variable. The regression takes the form_{i}_{S[i]}, where

Finally, we study which sensing strategies are most successful in competition with other sensing strategies. We study this both within each type of sensing and across all three different types. Here, the scenario is a polymorphic metapopulation of coevolving sensing strategies. Mutation and migration create new strategies inside this population. A strategy’s achieved biomass in pairwise competitions with other strains determines its ability to stay and amplify in the metapopulation. The model initially studies a wide variety of strategies competing with one another. However, as time passes, the metapopulation converges and consists of increasingly optimal strategies. As this happens, the analysis then approximates the invasion analyses described above, where most strains are largely identical and rare mutants are pitted against this majority in the metapopulation (

Specifically, we use a genetic algorithm to search for the evolutionarily stable strategy in the large space of possible strategies of a single type of regulation (and also in the space of all possible regulating strategies). This algorithm adapts the typical structure of a genetic algorithm (

In every round then, each strategy competes against all

The MATLAB code for the regulated toxin model, the invasion analysis, and the evolutionary tournament is available on GitHub (

Thank you to Michael Bentley, Jonas Schluter, Kat Coyte, Nicholas Davies, Wook Kim, and Rolf Kümmerli for feedback. RN is funded by the EPSRC-funded Systems Biology Doctoral Training Centre studentship EP/G50029/1. NMO is funded by the Herchel Smith Fellowship. AGF is funded by the Vice Chancellor’s Fellowship from the University of Sheffield. KRF is funded by European Research Council Grant 787932 and Wellcome Trust Investigator award 209397/Z/17/Z. This project is supported by a Templeton World Charity Foundation grant.

No competing interests declared

Conceptualization, Resources, Data curation, Software, Formal analysis, Validation, Investigation, Visualization, Methodology, Writing - original draft, Writing - review and editing

Conceptualization, Formal analysis, Investigation, Methodology, Writing - review and editing

Validation, Methodology, Writing - review and editing

Formal analysis, Supervision, Investigation, Writing - review and editing

Conceptualization, Investigation, Methodology, Writing - original draft, Project administration, Writing - review and editing

The MATLAB code for the regulated toxin model, the invasion analysis, and the evolutionary tournament is available on github (

Appendix 1—code 1: Pseudo code to find the evolutionarily stable strategy of fixed toxin production.```
Initialization: Find the initial resident fresini (for example, start with the highest average resident biomass)
forward = 1 indicates if the next migrant will have a higher or lower toxin investment than the resident. Can be 1 or -1.
previousforward = 1 record the direction of strategy change from the previous iteration
previousfres = 0 record the resident from the previous iteration
step = 0.1 initial step for the strategy change (initially coarse to localize the ESS)
minstep = 0.0001 the precision we want for the strategy value
singular = 0 boolean saying if a singular strategy is localised
nbflip = 0 record the number of consecutive flips in direction
fres = fresini
newres = 0 boolean saying if there is a new resident
while (!singular) {do this while no singular strategy is localised
if (newres) {
res vs N res competition. Compute the resident against the resident. Record the resident average strategy: wresav.
}
fmut = fres + forward*step pick an invader that differs from resident according to direction
mut vs N res competition. Compute mutant vs resident competition. Record the mutant biomass (wmut) at the end of the competition.
previousforward = forward update the previous direction
previousfres = fres update the previous resident before the competition
if (wmut < wresav) {resident stays the resident.
forward = - forward change the direction, to test a migrant with lower f value at the next step
}
if (wmut > wresav) {the mutant invades and replaces the resident
fres = fmut the new resident will take the migrant value
newres = 1 we have a new resident, we'll have to compute its resident fitness at the next iteration
}
if (forward != previousforward) {compare the direction with previous direction
nbflip = nbflip + 1
}
if (forward == previousforward) {compare the direction with previous direction
nbflip = 0
}
this will allow to localise an ESS. We want fres to stay identical for 2 consecutive time steps, but we want to make sure that the higher and lower strategies have been checked. Indeed if the mutant that we just tested goes extinct, the resident will stay resident but that is not enough to say it is an ESS. We also want the number of flips in direction to be > 1.
if (previousfres == fres & nbflip > 1) {singular strategy localised
if (step <= minstep) {precision is high enough
singular = 1 we have found the optimal strategy
}
if (step > minstep) {will redo the whole procedure with tinier step
step = step/10 increase precision 10 times
nbflip = 0 reset the number of consecutive flips
}
}
}
Record the final fres (ESS).
Finally, we test whether this fres (ESS) is a GLOBAL optimum by competing it against the range of strategies given through f = [0, 0.01, 0.02, ….1].
```

For the system of ODEs presented in

We denote a specific equilibrium state by

Now, setting

From

From

From

From

Thus, we know from

Similarly from

Therefore, from

From

From

Substituting

Similarly, we further have

And the Jacobian matrix of the system state

By computing the maximum real part of all the eigenvalues of

Next, we calculate the derivative of the system for different values of

Finally, we calculate the stability (which is quantified by

We could see that all of possible values of

For different combinations of _{A}_{B}

Plot shows for a range of values for

We plot the evolutionary stable investment into toxin over a range of different initial levels of nutrient (

We plot the optimal toxin investment _{kill}

We investigate the effect of shortening the duration of competitions and ask how this affects the best performing strategies. In nature, the duration of competition will vary depending on the rates of dispersal to new patches. (

We enumerate the occurrence of the four different outcomes from the global and local competitions as shown in

As in

(

As in

In the interests of transparency, eLife publishes the most substantive revision requests and the accompanying author responses.

Bacteria often produce toxins to fight competitors. There has been strong interest in understanding the molecular mechanisms of toxin production, release and mode of actions. Less well understood are the costs and benefits of toxin production and how natural selection acts on regulatory circuits controlling toxin production. The paper tackles this problem. Using computer simulations, the authors show that regulated toxin production is generally a better strategy than constitutive toxin production, and reciprocication is fundamental in competitions. Interestingly, reciprocication doesn't evolve into peaceful coexistence, but a strenuous battle.

[Editors’ note: the authors submitted for reconsideration following the decision after peer review. What follows is the decision letter after the first round of review.]

Thank you for submitting your article "The Evolution of Strategy in Bacterial Warfare" for consideration by

Our decision has been reached after consultation between the reviewers. Based on these discussions, we regret to inform you that we cannot accept your work for publication in

Summary:

Bacteria typically produce toxins to fight competitors. There has been strong interest in understanding the molecular mechanisms of toxin production, release and mode of actions. Less well understood are the costs and benefits of toxin production and how natural selection should act on regulatory circuits controlling toxin production. The paper tackles this problem. Using computer simulations, the authors show that regulated toxin production is generally a better strategy than constitutive toxin production, and reciprocication is fundamental in competitions. Interestingly, reciprocication doesn't evolve into peaceful coexistence, but a strenuous battle.

All Reviewers and the Reviewing Editor found that the paper makes important and interesting conclusions, and agreed that the model is relevant. However, there were significant reservations about methodology, and about whether the approach fully warrants the conclusions of the paper.

Essential revisions:

1) Because of the computational approach of searching parameter space of a quite complex ODE model, a clear quantitative understanding is not provided, but rather an intuition for the observed results. While the model captures the different toxin regulatory systems, which may be complicated to tackle analytically, some analytical insight would really help to demonstrate the generality of the conclusions.

For instance, an analytical model contrasting constitutive vs. regulated traits (first part of the paper), would build a stronger foundation.

2) The authors should clarify why the local versus global analysis is required. This is all the more true that the effect of spatial structure was not explored in the current paper.

If all competitions are pair-wise and the main focus are strategies that invade all other strategies and cannot be reinvaded, why is a metapopulation analysis necessary? Also, the concept is presented is presented in Figure 1, but it is not farther discussed.

The strategies that win/lose locally, but lose/win globally should be discussed to shed light on the importance of this metapopulation analysis. This might matter with regards to possible extensions of the model to spatial settings.

3) The connection to (evolutionary) game theory appears superficial. The authors should clarify this point and be particularly careful about wording when they explain the bases of their model.

In particular, the sentence "we combine evolutionary game theory with differential equation modelling" (line 20) is unfortunate. Evolutionary game theory is primarily differential equation modelling, as for instance, the replicator and replicator mutator equations are ordinary differential equations. (One exception regards finite population analysis, where tools from statistical physics enter.)

In addition, invasion analysis by itself is static game theory. It implies dynamics from stability of fixed points, but not the actual dynamics itself which is taken into account when studying evolutionary games.

4) Are the initial frequencies of the two competing populations important for the final outcome? This is related to the previous question regarding different outcomes between local and global. Also, while the model is currently deterministic, in real case scenarios noise plays a big role, so it would be good to briefly discuss this.

5) In the regulated models, the parameter constraints allow f_induced and f_initial to range between 0 and 1. But because of how the model is set-up, this means that it can happen (and it definitely does looking at Figure 2) that f_initial+f_induced=f is outside the [0,1] range, which is though the constrained range for the f of the constitutive competing strain. This might cause strange model behavior and definitely an unfair competition, so these parameters should be removed/checked.

1) The model developed in the manuscript captures the toxin regulatory system in bacteria, which is very interesting. However, the title of the manuscript and the abstract should be revised to better reflect the specific system under study.

2) The population dynamic equations in eq set 1 could be analysed further to get some analytical handle to promote our understanding. The authors could start from the following paper Vasconcelos, P., Rueffler C., 2020, How Does Joint Evolution of Consumer Traits Affect Resource Specialization? The American Naturalist 195: 331-348.

In addition, the final biomass densities used in the calculation of the invasion fitness (Eq. 2) could be further simplified by focusing on the equilibrium solutions of Eqs. 1 (perhaps under which assumptions the solutions are possible could already be interesting). Providing an expression for the invasion fitness would be a real plus.

3) Please clarify the rationale for choosing parameters in the simulations, and discuss robustness, beyond the statement "parameters of the algorithm […] are chosen to achieve short simulation times and good convergence behaviour as determined by visually inspecting the distribution of population parameters over time." (727-730)

4) Some of the findings are intuitive, as the authors acknowledge. E.g. regulated traits outperform non-regulated traits, but others are more surprising and very interesting. For example, many toxins are quorum-sensing regulated (e.g. phenazines in

5) The conclusion on lines 32-35 is strong. It might apply to mixed conditions as simulated here. However, in spatially structured habitats reciprocal fighting might lead to co-existence as competitors manage to defend their 'territories' and fighting only occurs at the borders. The swift elimination of competitors is maybe less common than assumed in real-world set ups.

6) The argument is that toxin sensing works best as the winner switches off toxin production once the competitor is eliminated. However, toxins might outlast their producers, such that the switching off might take longer than assumed. Can the authors comments on this?

[Editors’ note: further revisions were suggested prior to acceptance, as described below.]

Thank you for submitting your revised article "The evolution of strategy in bacterial warfare: quorum sensing, stress responses, and the regulation of bacteriocins and antibiotics" for consideration by

Both reviewers are very positive about your revised manuscript and recommend publication. However, both reviewers and the reviewing editor agree that one revision would improve your manuscript. Therefore, we would like to ask you to do this revision before we accept your manuscript for publication.

Essential revision:

While the motivation for the local vs. global analysis is well explained, the results from this analysis should be clarified. In figure 1, interesting examples are proposed of strategies that might win/lose locally and then lose/win globally. These are very interesting cases that point at non-trivial competition dynamics. It would be important to add a figure or table (perhaps in the supplement) and an associated discussion paragraph where it is shown that doing this additional meta-population analysis is necessary and adds something to the local competition part. The aim of this addition would be to address the following question: Would the optimal strategy change if one didn't do the global competition step? Some statistics of counter-intuituive scenarios explored, based on their classification in figure 1d, would address this point.

The manuscript puts forward exciting hypotheses about the strategies of toxin production in bacteria, which would be very interesting to test experimentally. Also, future work that tries to shed deeper analytical insight in the results would undoubtedly be very interesting.

I think the work is definitely worth publication. I find the presentation of the results sometimes difficult to follow, partially because the details of the models, which is very helpful to understand the results, is detailed at the end of the paper in the methods. But probably this is unavoidable given the format.

I believe the current version of the manuscript reads better and clarifies some of the misunderstandings in previous versions. There are, however, some criticisms that have not, in my opinion, been well addressed.

1) I appreciate the complexity of the model and the strengths that come with including this complexity. The new analytical work carried out to investigate stability of the fixed points helps towards the analytical interpretation of the results. I think, however, the criticism previously raised by the reviewers was trying to determine whether a simpler model, analytically tractable, would be able to reproduce some of the results showed here, while giving more analytical insight. I don't think the manuscript currently addresses this issue. On the other hand, I also think that it can be left to future work as it is a very interesting and challenging research direction.

2) I am satisfied with the motivation behind the local versus global analysis, which I think is very important, especially in potential future applications to spatial settings of this work. The motivation behind the analysis was never in question. What I don't understand are the results from this analysis. In figure 1, interesting examples are proposed of strategies that might win/lose locally and then lose/win globally. These are very interesting cases that point at non-trivial competition dynamics that would be interesting to investigate further in future work, but I don't see these cases discussed anywhere in the results. I understand that the results of the algorithm come from a sequence of local competition, dispersal, seeding, etc…, that include this metapopulation competition, but I would like to see a figure/paragraph/discussion where it is shown that doing this additional meta-population analysis adds something to the local competition part. Would the optimal strategy change if one didn't do the global competition step? If the answer is yes, which I imagine it is, where do I see this?

The authors have done a very good job in revising their paper. The main issue that arose during the first round of reviewing was the lack of an analytical model to establish a stronger foundation of the principles of competition sensing. Although it was not me who brought up this issue, I have consulted the authors' responses, edits in the main paper and extra analysis in the supplements with great care. My opinion is that the authors have convincingly solved the debate. There is simply no possibility to device an analytical model that captures even the simplest regulatory circuits involved in competition sensing and toxin production. The most important thing is that the authors have not only used verbal arguments to make their point, but have immensely invested in analytical modelling to show why the approach does not work. I believe that the strength of the paper is its biological realism and the fact that it generates predictions that can be empirically tested.

Moreover, the authors have adequately addressed my own comments. The discussion on interactions between regulatory mechanisms and the role of ecology have significantly improved the paper. The addition on local vs. global interactions is also important, especially for non-specialist readers.

[Editors’ note: the authors resubmitted a revised version of the paper for consideration. What follows is the authors’ response to the first round of review.]

Essential revisions:

1) Because of the computational approach of searching parameter space of a quite complex ODE model, a clear quantitative understanding is not provided, but rather an intuition for the observed results. While the model captures the different toxin regulatory systems, which may be complicated to tackle analytically, some analytical insight would really help to demonstrate the generality of the conclusions.

For instance, an analytical model contrasting constitutive vs. regulated traits (first part of the paper), would build a stronger foundation.

We agree that analytical solutions are desirable whenever possible. We did not go this route in this study because our goal is to capture the details of bacterial regulation and competition that microbiologists care about, and to study when and why such complex regulation evolves. The issue then is that analytical solutions would require much simpler starting equations, or simplifying assumptions, with which we would not have achieved our goal. This is already evident in our equation 1, which is based upon a previously published study on bacterial competition via toxins (Bucci, Nadell, and Xavier 2011). This equation, although it does not include the details of toxin regulation, is already of a class that is problematic for analytics.

Nevertheless, over these last months, we have engaged in a serious effort to see what explorations might be possible analytically with our model or a simplified version of it that still captured the relevant biology. To do this, we brought on board a mathematician (Aming Li) who is an expert in the analytics of ecological and evolutionary processes. More specifically, we used Equation 1 from our manuscript and wrote the analytical form that gives the system's derivative for a given state with respect to time as well as the Jacobian matrix to explore the stability of the system (new Supplementary analytics section of the manuscript). It is important to note that we are making the simplifying assumption of setting nutrients to a constant, akin to a chemostat version of our model. We cannot make a similar assumption regarding toxins, as this would remove the key way in which the bacterial strains are interacting.

We then analytically explored the system's stability for a set initial conditions and a range of toxin investments. We compared the analytical results for the derivatives with the results from our numerical simulation, and we found them to be identical (Supplementary analytics section, Supplementary Analytics Figure 1). This is then a confirmation that analytics and our numerics give the same results, although this result is expected because we have implemented our numerical simulations with step sizes chosen to extremely accurately approximate an analytical solution. Our stability analysis of the system shows that all equilibria are unstable (Supplementary analytics section, Supplementary Analytics Figure 1), which is because our model contains feedback loops that render it unstable for non-trivial states.

Supplementary Analytics Figure 1 also demonstrates clearly how analytical explorations fall short of tackling the essence of our system: the results show that the toxin investment of strain A at time t does not impact biomass B, which seems counterintuitive. This is because the analytical solution explores an instant in time, but fails entirely to capture the key interactions between strains. Those occur through toxin production (and in the full model through consumption of limited nutrients), and those create feed-back loops within the system (for example toxin investment of A is responsible for reduction in biomass of B and then in turn for a reduction in toxin B), analogous to more classical predator-prey models, which we note have previously been shown to be intractable by analytics (Boys, Wilkinson, and Kirkwood 2008; Liu and Chen 2003; Gutiérrez and Rosales 1998).

In summary, we found that an analytical exploration of the model did not capture the key processes at hand, nor did it help us with our understanding. We have now added a new paragraph where we discuss this ("Overview" section of "Results and Discussion") and better explain why we rely on numerics. We also now include the analytical stability analysis as a Supplementary Method (Supplementary Analytics section).

In place of analytical results, we have numerically explored the evolution of different regulatory strategies under a wide range of conditions, including i) against one optimised unregulated strategy (Figure 2), ii) against a diversity of unregulated strategies (Figure 3), iii) against the same class of unregulated strategy (Figure 4a,b) and, finally, iv) against an open set of all of the regulated and unregulated strategies (Figure 4c,d). Across all of these scenarios, the strategy class that performs the best is toxin sensing, our key conclusion. Moreover, we have tested the robustness of this prediction across numerous parameter sweeps (Figures 2, S4, S5, S6), which again predict the supremacy of toxin sensing. Finally, we are able to provide an intuitive post hoc explanation for why toxin sensing does so well – it is able to downregulate toxin production after winning a competition – and, importantly, we demonstrate this explanation is indeed causal by shortening competition time which removes this advantage (Figures 3, S7). All of these points combine to give us a lot of confidence in our predictions.

To close this discussion, we would also like to emphasise that – while our work does not have proofs of the sort that are seen in some papers in theoretical biology – our attention to biological details does mean that we generate readily testable prediction e.g. bacteria should often use damage or cues of damage to coordinate their attacks. Our approach then allows us to fulfil our goals better than generating simpler models that lack these details in order to look for more abstract principles. That is, while our work may not be amenable to robustness testing via analytics, it

2) The authors should clarify why the local versus global analysis is required. This is all the more true that the effect of spatial structure was not explored in the current paper.

If all competitions are pair-wise and the main focus are strategies that invade all other strategies and cannot be reinvaded, why is a metapopulation analysis necessary? Also, the concept is presented is presented in Figure 1, but it is not farther discussed.

The strategies that win/lose locally, but lose/win globally should be discussed to shed light on the importance of this metapopulation analysis. This might matter with regards to possible extensions of the model to spatial settings.

Our modelling captures different strategies for bacterial interactions and we are interested in the expected long-term evolutionary fate for these strategies. To achieve this in a way that is relevant to the real world, we consider the potential competition both within and between patches of bacteria, which recognises that the outcome of local competition in any given patch will often not be sufficient to predict evolutionary trajectories. Consider, for example, a competition between two strains of bacteria in one of the pores of your tongue. If we focus solely on local competition within the pore, then any strategy that results in a focal strain making more cells than its competitor will be favoured, even if this leads to relative ruin for the winning strain, with only a few cells surviving the process. However, given these competitions can go on in many pores across many tongues, it is unlikely that such extreme strategies would be favoured as they mean few cells are produced to colonise new patches. Instead, the best strategies are those that make the most cells to disperse, which can also mean they win locally, but it might not. This is what our global analysis captures and it is why it is critical for our modelling. To make this clearer, we now include the above thought experiment in the main text (under section "Evolution of warfare via unregulated toxin production") in reference to Figure 1. We also now discuss spatial structure both with regards to the local (ODE) model, and with regards to our metapopulation level (see "Conclusions", second paragraph).

3) The connection to (evolutionary) game theory appears superficial. The authors should clarify this point and be particularly careful about wording when they explain the bases of their model.

In particular, the sentence "we combine evolutionary game theory with differential equation modelling" (line 20) is unfortunate. Evolutionary game theory is primarily differential equation modelling, as for instance, the replicator and replicator mutator equations are ordinary differential equations. (One exception regards finite population analysis, where tools from statistical physics enter.)

In addition, invasion analysis by itself is static game theory. It implies dynamics from stability of fixed points, but not the actual dynamics itself which is taken into account when studying evolutionary games.

We agree that our wording in the example above and in other places was not very clear. However, our work is more than superficially linked to game theory. To appreciate this, one has to realise that there are, by now, two rather different approaches used in evolutionary game theory. Evolutionary game theory, as originally conceived by Maynard Smith and Price, is based on calculations that ask whether a given strategy will invade from initially being rare (static game theory e.g. Maynard-Smith 1982. Evolution and the Theory of Games, Cambridge University Press). These are the kinds of tests that we are performing. More recently, an alternative set of approaches that use differential equations to follow the evolutionary process have also been called evolutionary game theory (dynamic game theory e.g. Hofbauer and Sigmund 1998. Evolutionary games and population dynamics. Cambridge University Press).

The confusion here then lies in the fact that we are not using this second form of game theory, but we are using ODEs. However, in our case the ODEs follow competitions on ecological timescales, which we use to calculate the success of a strategy against another strategy who meet locally. It is because of these biological details – the competition for nutrients and with toxins and the resulting feedback loops – that we need to capture in our local competitions that our system is not amenable to using dynamic game theory (see our response to point (1)). And of course we cannot just stop at modelling local competition without studying how this will affect the entire meta-populations on an evolutionary time-scale (as discussed in the last point). To achieve this, we combine our numerical solutions of our local competition with static game theory to ask whether this local invasion will lead to a global invasion (Maynard Smith and Price). To avoid further confusion for any reader, we now make it clearer that we are using static game theory in the text as follows:

–line 33: Abstract “Here we combine a detailed dynamic model of bacterial competition with static game theory to study the rules of bacterial warfare.” This avoids too many detailed modelling terms before we define them clearly in the main text

(previously: “Here we combine evolutionary game theory with differential equation modelling to study the rules of bacterial warfare.”)

– line 95: Introduction “Here we study the evolution of strategy during bacterial warfare by combining a detailed differential equation model of toxin-based competition with static game theory to identify the most evolutionarily successful strategies.” (previously: “Here we study the evolution of strategy during bacterial warfare by combining an explicit differential equation model of toxin-based competition with evolutionary game theory.”)

– line 119: Results and Discussion, Overview “We use these differential equations to model ecological interactions of bacterial strains and determine the outcome of competition for a given strategy against another strategy when they meet locally. These local-level competitions are embedded into a larger meta-population framework that determines long-term evolutionary outcomes [56] (Figure 1c and d). This meta-population modelling includes invasion analysis, in the tradition of static game theory developed by Maynard Smith and Price [57], and a more explicit genetic algorithm that employs the same logic (Methods). This algorithm pits diverse strategies against each other across a large number of combinations in order to find the most successful strategies. In these meta-population models, bacterial strains are assumed to compete locally in a large number of patches, but also globally through dispersal to seed new, empty patches based on a standard life history of bacteria used in previous models [58–62] (Figure 1c). Also as previously [62], we refer to the global population as a metapopulation to distinguish it from the local bacterial cell population in each patch. This approach accounts for the possibility that a strategy can do well in local competition, but do poorly globally, and vice versa (Figure 1d). ” (previously: “We use these equations to pit different strategies of attack against one another, and these local competitions are imbedded into a larger framework that uses evolutionary game theory [55] to understand which strategies will evolve (Figure 1 c and d).”)

– line 225: “To capture this effect, we embed the local-level competitions within a broader meta-population framework in order to make evolutionary predictions [56,69,70] (see Figure 1 c and d). This framework allows us to ask whether a particular, initially rare, strategy can successfully invade a metapopulation of another strategy (Methods).” (previously: “We embed these competitions within a broader framework of evolutionary game theory[55,64,65]“)

4) Are the initial frequencies of the two competing populations important for the final outcome? This is related to the previous question regarding different outcomes between local and global. Also, while the model is currently deterministic, in real case scenarios noise plays a big role, so it would be good to briefly discuss this.

This question is covered by one of several parameter sweeps that were in the original submission (Figure S6). There we study the effects of initial frequency in a model of stochastic variation in the initial strain frequencies, using the most general model where all strategies compete with one another. Our results show our predictions are robust for different initial frequencies in the two strains. We have now extended our description of this result in the main text (section "The coevolution of regulated attack strategies') to make this clearer.

5) In the regulated models, the parameter constraints allow f_induced and f_initial to range between 0 and 1. But because of how the model is set-up, this means that it can happen (and it definitely does looking at Figure 2) that f_initial+f_induced=f is outside the [0,1] range, which is though the constrained range for the f of the constitutive competing strain. This might cause strange model behavior and definitely an unfair competition, so these parameters should be removed/checked.

We are sorry about this confusion in the text. To be clear about the definitions: f_initial indicates the toxin investment at the initial condition, f_induced indicates the level of toxin investment when a sensor is triggered. Thus, the change in investment occuring due to the trigger is f_induced-f_initial. We clarify this now in the text and in the legend of Figure 2.

1) The model developed in the manuscript captures the toxin regulatory system in bacteria, which is very interesting. However, the title of the manuscript and the abstract should be revised to better reflect the specific system under study.

This is a good suggestion, and we have now revised the abstract and title accordingly to be more specific about the types of regulation (quorum sensing and stress responses) and the phenotype under regulation (toxin production).

2) The population dynamic equations in eq set 1 could be analysed further to get some analytical handle to promote our understanding. The authors could start from the following paper Vasconcelos, P., Rueffler C., 2020, How Does Joint Evolution of Consumer Traits Affect Resource Specialization? The American Naturalist 195: 331-348.

In addition, the final biomass densities used in the calculation of the invasion fitness (Eq. 2) could be further simplified by focusing on the equilibrium solutions of Eqs. 1 (perhaps under which assumptions the solutions are possible could already be interesting). Providing an expression for the invasion fitness would be a real plus.

Thank you for this suggestion, we looked through this paper and considered it as a starting point but it does not capture our problem well and, as discussed above, analytics more generally are incapable of capturing key features of our system.

3) Please clarify the rationale for choosing parameters in the simulations, and discuss robustness, beyond the statement "parameters of the algorithm […] are chosen to achieve short simulation times and good convergence behaviour as determined by visually inspecting the distribution of population parameters over time." (727-730)

As is typical in non-adaptive genetic algorithms, we base our choice of the control parameters of the algorithm on positive convergence behaviour and short convergence times (Melanie 1996). Further, we reran the simulations with 20 different sets of hyper-parameters to confirm that our findings are not specific to the set of parameters we used initially. We now add this explanation into the "Genetic Algorithm" section: "In our sensitivity analysis, we also examine the results of the genetic algorithm with alternative sets of control parameters, including a smaller and a larger size of the mutation standard deviation (sd=0.01 and sd=0.0005), a smaller and larger proportion of “migrating” strategies in each generation (5 of 60, and 20 of 60), and five different sizes of the population of strategies (50, 70, 80, 90, 100). This yields 20 alternative parameters combinations." (see "Genetic Algorithm" section). The results were consistent with our main simulation. We have also extended the appropriate sentence in the Results section: "Despite a great number of potential combinations (over two million different competitions), and with different sets of hyperparameters of the genetic algorithm, we again see a clear winner in toxin-based regulation, both for our normal parameters (Table 1, Figure 4c) and for sweeps that consider broad ranges of these parameters (Figures S5) and a wide range of initial frequencies of the two strains (Figure S6). "

4) Some of the findings are intuitive, as the authors acknowledge. E.g. regulated traits outperform non-regulated traits, but others are more surprising and very interesting. For example, many toxins are quorum-sensing regulated (e.g. phenazines in

We agree, these are two very interesting points. We have now included a more detailed discussion of why QS might be more common than we are expecting from our results. We now say (in "Conclusion" section) "However, if detecting damage is the best basis for attack, why do some bacteria use these other forms of regulation? For short competition times, our model predicts that the three regulatory strategies are largely equivalent (Figures 3 and S7). A short duration of competition between strains removes the benefit of decreasing toxin production once an attacker has been overcome. Under these conditions, the evolutionary path to one form of regulation may largely be determined by differences in costs for regulatory networks and which pre-existing regulatory systems are available for co-option [98,99]. We predict, therefore, that mechanisms to reciprocate attacks are particularly valuable in environments where warfare commonly leaves a victor unchallenged for a long time afterwards. Consistent with this, one of the clearest examples of reciprocation occurs in

Another possible explanation for why some bacteria do not use cell damage to regulate their toxins comes from the notion of ‘silent’ toxins. These are toxins that are not easily detected by the cell’s stress responses, which may limit the potential for a toxin-mediated response. For example, some toxins depolarise membranes[101] and may be favoured by natural selection specifically because they do not provoke dangerous reciprocation in competitors [87].".

We have also extended our discussion on how multiple sensory mechanisms might work in concert ("Conclusion" section): "[…] bacteria appear to use multiple forms of regulation in order to integrate information from multiple sources [41]. For example,

5) The conclusion on lines 32-35 is strong. It might apply to mixed conditions as simulated here. However, in spatially structured habitats reciprocal fighting might lead to co-existence as competitors manage to defend their 'territories' and fighting only occurs at the borders. The swift elimination of competitors is maybe less common than assumed in real-world set ups.

We agree with this, and have now removed this sentence from our abstract.

6) The argument is that toxin sensing works best as the winner switches off toxin production once the competitor is eliminated. However, toxins might outlast their producers, such that the switching off might take longer than assumed. Can the authors comments on this?

Yes, in our local competitions toxins can outlast their producers. Consistent with this, winning strains commonly downregulate their toxin once the competitor toxin falls to a value that is small, but not exactly zero. That is, these strategies use low rather than zero toxin as a cue for elimination of the opponent. In response, we have altered our discussion of this as follows: "Instead, the winning strategies are initially aggressive and only become passive once an opponent is eliminated (Figure 4 d-f) – or nearly eliminated, because eliminated strains can be outlasted by their toxins, which in turn will take a while to be lost entirely. Indeed the winning strains in these competitions downregulate their toxin once the competitor toxin falls below a value that is small but still non-zero."

[Editors’ note: what follows is the authors’ response to the second round of review.]

Essential revision:

While the motivation for the local vs. global analysis is well explained, the results from this analysis should be clarified. In figure 1, interesting examples are proposed of strategies that might win/lose locally and then lose/win globally. These are very interesting cases that point at non-trivial competition dynamics. It would be important to add a figure or table (perhaps in the supplement) and an associated discussion paragraph where it is shown that doing this additional meta-population analysis is necessary and adds something to the local competition part. The aim of this addition would be to address the following question: Would the optimal strategy change if one didn't do the global competition step? Some statistics of counterintuituive scenarios explored, based on their classification in figure 1d, would address this point.

Reviewer #1 (Recommendations for the authors):

The manuscript puts forward exciting hypotheses about the strategies of toxin production in bacteria, which would be very interesting to test experimentally. Also, future work that tries to shed deeper analytical insight in the results would undoubtedly be very interesting.

I think the work is definitely worth publication. I find the presentation of the results sometimes difficult to follow, partially because the details of the models, which is very helpful to understand the results, is detailed at the end of the paper in the methods. But probably this is unavoidable given the format.

I believe the current version of the manuscript reads better and clarifies some of the misunderstandings in previous versions. There are, however, some criticisms that have not, in my opinion, been well addressed.

1) I appreciate the complexity of the model and the strengths that come with including this complexity. The new analytical work carried out to investigate stability of the fixed points helps towards the analytical interpretation of the results. I think, however, the criticism previously raised by the reviewers was trying to determine whether a simpler model, analytically tractable, would be able to reproduce some of the results showed here, while giving more analytical insight. I don't think the manuscript currently addresses this issue. On the other hand, I also think that it can be left to future work as it is a very interesting and challenging research direction.

2) I am satisfied with the motivation behind the local versus global analysis, which I think is very important, especially in potential future applications to spatial settings of this work. The motivation behind the analysis was never in question. What I don't understand are the results from this analysis. In figure 1, interesting examples are proposed of strategies that might win/lose locally and then lose/win globally. These are very interesting cases that point at non-trivial competition dynamics that would be interesting to investigate further in future work, but I don't see these cases discussed anywhere in the results. I understand that the results of the algorithm come from a sequence of local competition, dispersal, seeding, etc…, that include this metapopulation competition, but I would like to see a figure/paragraph/discussion where it is shown that doing this additional meta-population analysis adds something to the local competition part. Would the optimal strategy change if one didn't do the global competition step? If the answer is yes, which I imagine it is, where do I see this?

We were very pleased that the referees were enthusiastic about publication. As requested, we have now addressed the remaining concerns about the non-trivial competition dynamics shown in Figure 1d. As suggested, we have added a Supplementary Table that reports on the occurrence of all four possible competition dynamics (as per Figure 1 d) occurring in the simulations underlying Figure 2. This shows that all of the four possible outcomes occur. The less intuitive outcomes are rarer than the more intuitive ones, as one would expect, but the fact that all cases occur underlines that the correct metric for fitness is one that accounts for global competition as well as local competition. We now highlight this analysis in the description of the Figure 1, and we also discuss the new Table where we describe our findings of Figure 2.