Genetic Algorithms · AI Algorithms
SELECT, CROSS, MUTATE — evolution as an optimization algorithm
Mutation maintains diversity — without it the population converges to a local optimum
S
Selection — fitter solutions more likely to reproduce
A fitness function evaluates the quality of each candidate solution in the population, and fitter solutions are given a higher probability of being selected to reproduce.
Example: in a scheduling optimization problem, schedules with fewer conflicts (higher fitness) are more likely to be selected as parents for the next generation.
C
Crossover — combining two parents to produce offspring
Two selected parent solutions are combined (typically by mixing parts of each) to produce new offspring solutions, hopefully inheriting good traits from both parents.
Example: combining the first half of one parent schedule with the second half of another parent schedule to create a new candidate schedule.
M
Mutation — randomly altering part of a solution
A small random change is occasionally introduced into offspring solutions, which maintains genetic diversity in the population and helps avoid getting stuck in a local optimum.
Example: randomly swapping two elements in an otherwise unchanged offspring schedule, introducing a small amount of novel variation.
1
A genetic algorithm is run without any mutation step at all, relying purely on selection and crossover across many generations.
2
Ask: what happens to the population's diversity over time without mutation? It tends to converge toward a narrow set of similar solutions, since crossover alone can only recombine existing genetic material, not introduce anything new.
3
This can trap the population at a local optimum — a solution that's good relative to its immediate neighbors but not the best possible solution overall.
4
Adding mutation back in reintroduces novel variation into the population, giving it a better chance to escape local optima and continue improving over generations.

Exams test whether you understand each step's specific role (selection favors fitter solutions, crossover combines existing solutions, mutation introduces novel variation) and specifically why mutation is essential for avoiding premature convergence to a local optimum — a frequently tested conceptual point.

The most common trap is assuming crossover alone is sufficient to explore the full solution space. Crossover can only recombine genetic material that already exists in the population; without mutation's random novel variation, the population risks converging prematurely to a local optimum rather than continuing to explore toward a potentially better global optimum.

1. What does the fitness function do in a genetic algorithm?
Evaluates the quality of each candidate solution in the population.
Tap to reveal / hide
2. What does selection favor?
Fitter solutions being more likely to be chosen to reproduce.
Tap to reveal / hide
3. What does crossover do?
Combines two parent solutions to produce new offspring solutions.
Tap to reveal / hide
4. What problem does mutation specifically help prevent?
Premature convergence to a local optimum, by maintaining genetic diversity in the population.
Tap to reveal / hide
5. When are genetic algorithms typically used instead of gradient-based optimization?
When the search space is huge or a gradient is unavailable.
Tap to reveal / hide