Evolution changes populations across generations by passing traits through reproduction, filtering individuals by fitness, and introducing variation through mutation. In computational models, the goal is not merely to keep the strongest individuals but to encourage adaptive change and population diversity. section 2.4.1 section 2.4.4
A deliberately simple evolutionary simulation follows this loop:
- Represent each individual with traits and a fitness value. section 2.4.1
- Evaluate fitness with an explicit equation tied to the traits. section 2.4.1
- Select higher-fitness individuals as parents, mate pairs, and create offspring from shared trait values. section 2.4.1
- Mutate offspring occasionally by changing trait values within configured bounds. section 2.4.1
- Repeat evaluation and reproduction while tracking population, average fitness, or other attributes. section 2.3 section 2.4.1
A cell population optimizing strength
A life simulation assigns each cell random health and strength values. Health is adjusted using strength, and health thresholds determine reproduction and death. Plotting population size, average strength, and average health makes the optimization process observable across generations. section 2.3
Listing 2.6 EDL_2_3_Simulating_Life.ipynb: Life functions updated
def create_cell():
return dict(
health = random.randint(1, 100),
strength = random.randint(1, 100) #1
)
def birth(offspring):
return [create_cell() for i in range(offspring)]
def evaluate(cells): #2
for cell in cells:
cell["health"] *= cell["strength"]/100 #3
return cells
Inspect the minimal Python functions that create cells with random traits and evaluate health from strength before adding selection and mutation. section 2.3
The model is intentionally simplified: averaging is only one inheritance mechanism, selection has many variants, and long mutation-driven runs may produce only minor changes. Experiments can change target functions, operators, crossover, selection, and mutation parameters. section 2.4.1 section 4.1.2


