What is a Genetic Algorithm?
Genetic algorithms, told as a story about mixing and twisting engine-tuning dial settings across generations to find the best one.
We want the dial settings where the engine runs best.Too many combinations to try them all.
Trying each combo by hand never ends.We need a way to mix the good settings together.
A genetic algorithm mixes the best settings, twisting occasionally, to search for better ones.Over many generations, it edges closer to the best setting.
After creating the first settings, steps ② to ⑤ repeat each generation.Scoring through twisting repeats generation after generation.
A genetic algorithm doesn't always find the single perfect setting.With too many options, a genetic algorithm finds a pretty good answer faster than trying them all.
A genetic algorithm mixes well-performing settings from a population, occasionally applies a random twist, and across generations searches for a progressively better answer.
A genetic algorithm is an optimization technique modeled on biological evolution — selection, crossover, and mutation. It builds a population of candidate solutions, scores each with a fitness function, selects the fitter ones to produce offspring via crossover, and applies mutation at low probability to preserve diversity. Repeating this over many generations converges toward a near-optimal answer, though it never guarantees the global optimum.
When grown-ups say it
- Population
- The many dial settings in one generation. A collection of candidate solutions.
- Fitness Function
- The scorecard for how well a setting performs. Decides which individuals survive.
- Selection
- Picking out the well-performing settings. Higher fitness means a higher chance of being picked.
- Crossover
- Mixing two settings into a new one. The new setting inherits good traits from both parents.
- Mutation
- Occasionally twisting a setting at random. Keeps the settings diverse, so they don't all crowd around one spot.
- Generation
- One cycle of updating the population. The population's scores generally improve generation after generation.
- Local Optimum
- A pretty good setting, but not the very best. A genetic algorithm can get stuck here.
- Metaheuristic
- A family of strategies for a good-enough answer, fast. Genetic algorithms belong to this family.