Genetic Algorithm
Optimize with no gradient at all — keep a population of candidate solutions, let the fittest reproduce with mutation and crossover, and watch quality climb.
Genetic Algorithm
Some landscapes are too rugged, discrete, or mysterious to differentiate — there is no gradient to follow. A genetic algorithm sidesteps that entirely by imitating natural selection. Instead of one point creeping downhill, you maintain a whole population of candidate solutions and breed them:
- Evaluate each individual's fitness (how good a solution it is).
- Select parents, favoring the fitter ones.
- Crossover — combine two parents into a child, mixing their "genes."
- Mutate — randomly tweak a few genes to inject new variety.
- Repeat. The next generation is, on average, a little fitter than the last.
There is no derivative anywhere — only variation (mutation and crossover) and selection (survival of the fittest). Over generations, that loop reliably climbs toward good solutions, and it cheerfully handles problems gradient descent cannot touch.
Evolving toward a target phrase
The classic demonstration: evolve random gibberish into a target sentence. Each individual is a string; its fitness is simply how many letters it gets right. No string is ever designed — selection and mutation alone drive the population from noise to the exact phrase. Watch the best fitness climb generation by generation; matched letters turn green.
Click to start a fresh population of random strings.