Laboratory · Interactive exhibit LAB-10
Walkers that evolve generation by generation
A population of two-legged walkers starts with random gaits. In every generation the fastest leave offspring with small changes. See how many generations it takes and what exactly the algorithm finds.
Simulation: the genetic algorithm is real, the movement model is a simplified toy and not physicsTry it
The best walker
Leg A: solid line and circle. Leg B: dashed line and square. The leg supporting the body is drawn thicker.
Score per generation
Best (solid line)Mean (dashed line)
Observe
- Press “+10 generations” and look at the chart. How much does the best score rise and how much the mean?
- Change “What is rewarded” to “Distance minus effort cost” and run again with the same seed. How do the gait and the genes change?
- Try a very low and a very high mutation probability. What happens to progress?
- Look at the gene table. Are there values “at the edge of their range”? What does that tell you about the rule I set?
What happened
Each walker has seven genes, that is, seven numbers that define how fast and how widely it moves its two legs and with what phase. The algorithm measures how far each one gets in 10 seconds, keeps the two best unchanged and builds the rest by choosing parents in small tournaments of three, swapping genes and randomly changing a few. Nobody programmed the gait. It emerges from selection and mutation.
The algorithm finds what is rewarded, not what you meant. If the reward is distance only, it pushes the genes towards the fastest and widest movement that the range I set allows. If effort costs something, the amplitudes tend to shrink. When a reward rule has gaps, the algorithm exploits them, and in the literature this is called specification gaming.
The movement model is deliberately simple. It does not compute forces, friction or balance. The body advances as far as the supporting leg moves backwards and “falls” when it drops too low. The gaits you see say nothing about how a real robot would walk. A well-known example of evolution in a far more realistic simulator is the work of Karl Sims.
What to keep
- A genetic algorithm is a search with a population: selection, crossover, mutation.
- It finds what is measured. If the reward rule has gaps, the algorithm will find them.
- The result of a simulation is worth only as much as its model. Here the model is a toy.
Documentation
Sims’s work shows the same pattern of selection, copying, combining and mutation on far more complex virtual creatures. The model and code here belong to the Museum and are much simpler.
Curatorial note: The movement model is a toy. The score is measured in game “metres” and does not correspond to real distance or speed.