Interactive computer science lesson

Genetic Algorithms × Travelling Salesperson

Can evolution find a short route through 50 cities? Watch a population of candidate routes evolve through selection, crossover and mutation. The goal is not to try every possible route.

1. The evolving route

GENERATION
0
BEST DISTANCE
—
MEAN DISTANCE
—
MUTATION RATE
5%

2. Fitness over generations

● Best route ● Population mean

3. What is happening?

STEP 1
PopulationMake random routes
STEP 2
FitnessMeasure distance
STEP 3
SelectionPrefer shorter routes
STEP 4
CrossoverCombine parents
STEP 5
MutationSwap two cities
STEP 6
Next generationRepeat