We simulate evolution by subjecting organisms to reproduction, mutation, and selection. Each organism *i* has a phenotype consisting of as many traits as there are resources, *R*. Each trait is a *resource affinity*
*c*
_{
i
k
}, which describes the efficiency with which an organism utilizes resource *k*. All resources are perfectly substitutable. The population size *N* is kept constant by randomly removing 1*%* of the population every computational update (equivalent to about 100 updates per generation), and replacing those organisms by randomly choosing which survivors reproduce with a probability based on their relative fitness. This replacement scheme is equivalent to a death-birth Moran process with multiple deaths/births per update (see e.g.,
[41, 43]). Offspring inherit the phenotype of the parent, but every trait value *c*
_{
i
k
} has a chance *μ* of mutating, resulting either in a decrease or an increase in resource affinity. Resource affinities vary between 0 (minimum utilization) and 1 (maximum utilization). 30*%* of mutations change a trait value by either increasing or decreasing resource affinity by 0.1 with equal probability. 70*%* of mutations are *trait-lethals*, which have the effect of setting the resource affinity to zero. This is meant to stimulate diversification by disrupting the function of utilizing one distinct resource. Once a trait is affected by a trait-lethal mutation, a subsequent mutation may again increase its value by 0.1.

Resource competition among organisms is modeled in a way similar to Michaelis-Menten kinetics and models based on the Monod equation
[

7,

20,

44], which describes fitness of each possible phenotype. Individual fitness is a function of affinity,

*c*
_{
i
k
}, to each resource,

*k*, the resource abundance,

*r*
_{
k
}, and of how costly it is to have a nonzero affinity (eq.

1). The half-saturation,

*γ*
_{
k
}, is the resource abundance at which fitness from resource

*k* is half of its maximal value:

The term 1/(1+

*D*
_{
i
}) is a sum over resource affinities that simulates trade-offs by assigning a cost to positive (

*σ*
_{1}) and in particular multiple (

*σ*
_{2}) resource affinities:

Here *σ*
_{1} specifies the cost of having a high affinity for any particular resource *k*, in terms of diminishing returns for affinity on additional resources. The reasoning behind this model of diminishing returns is simple: enzymes do not act on their own. Rather, their effects are linked through their substrates and products
[45, 46], and increasing the affinity for one resource is likely (but not guaranteed
[47]) to limit affinity for another. Even when metabolic pathways are completely modular (so that there are limited or absent diminishing returns) there can be a constant one-time cost of switching the metabolic pathway to a different resource. The parameter *σ*
_{2} specifies this cost without differentiating between high and low affinity: in (2), *ξ*(*c*
_{
i
k
}) is 0 for *c*
_{
i
k
}=0 and 1 otherwise, distinguishing only between zero and non-zero affinity. As a typical example of such a cost, when the methylotroph *Methylobacterium extorquens* switches to growth on methanol (from its more usual succinate substrate), it needs to reset the metabolic pathway even though the two pathways are very modular
[48]). As this resetting takes a few hours, it results in a fixed cost of switching. Similarly, when the evolved citrate-utilizing type of *E. coli* switches from glucose to citrate utilization it experiences a costly lag
[49], and evolutionary optimization of the pathway to a large extent reduces this lag, thus, reducing the cost of switching.

Each resource is replenished every update at a constant influx per individual

*λ*
_{
k
}, decays at a rate

*c*
_{0} proportional to the amount of available resource, and is consumed by the organisms at a rate equal to the total fitness in the population derived from that resource,

, where

*F*
_{
i
k
} is the fitness derived from the

*k*th resource by the

*i*th individual (eq.

3).

Resource abundance is at a maximum when there is no consumption, in which case we solve eq. (3) for
with
and obtain *r*=*N*
*λ*/*c*
_{0}. When a resource is fully consumed every update before it can decay (*c*
_{0}=0), the resource abundance is just equal to the amount of resources that flows into the system, *r*=*N*
*λ*.

### Degree of specialization

With a mutation rate of *μ*=0.05, phenotype space is fairly well explored, consistently resulting in hundreds of unique phenotypes (i.e., unique combinations of resource affinities) within a few hundred updates. To find the number of *ecotypes* in the population after 40,000 updates of reproduction, we identify stable phenotypes by performing a *zero-mutation rate experiment*. With the mutation rate set to to zero no new phenotypes are generated, and existing phenotypes begin to outcompete each other. We continue simulations until the remaining phenotypes cannot outcompete each other (no more than 80,000 updates). If this steady-state of the population was in doubt, we performed *invasion experiments* to establish the stability of the population. Invasion experiments were performed by setting one of the phenotypes to a low frequency and checking if this phenotype had the ability to invade when rare. No inconsistencies were found between the two methods.

We quantify the

*degree of specialization* by the number of ecotypes

*n*
_{
t
} and the population

*niche breadth* (e.g.,
[

50]), calculated as the fraction of nonzero resource affinities in the population:

*B* equals 1/*R* when every individual utilizes exactly one resource, and 1 when every individual uses all resources. A population of generalists is thus characterized by a high niche breadth, while resource specialization results in low niche breadth. This definition is close to that used in investigations of niche breadth reduction in Avida
[29], where it is calculated as the proportion of organisms performing each function summed over all functions, rather than taking the mean over all resources, as we do here.

### Initial conditions

We start simulations with a homogeneous population comprised of specialists that have one nonzero affinity *c*
_{
i1}=0.1 and the rest equal to zero, or with generalists that have affinity 0.1 for all resources. Throughout we use *R*=9 resources, *c*
_{0}=0.1, and *γ*
_{
k
}=100 for all resources. We start with all resource abundances either at a minimum equal to the influx, *N*
*λ*, or at the maximum given by eq. (3) without consumption, *N*
*λ*/*c*
_{0}, but we emphasize that distinction makes no difference to the evolution of the population, because resource abundances adjust based on consumption before the population has enough time to change how they use resources.