HomeAI & Machine LearningGenetic Algorithm: Evolving a Route

Genetic Algorithm: Evolving a Route

Interactive genetic algorithm simulator: a population of candidate routes evolves generation by generation through tournament selection, order crossover and swap mutation, converging on a short tour between scattered cities while a live fitness curve tracks the improvement.

AI & Machine Learning3DModerate60 FPS
genetic-algorithms-advanced ↗ Open standalone

A genetic algorithm searches for good solutions by evolving a whole population of candidates at once rather than following a single gradient. This simulator applies that idea to a small traveling-salesman problem: each individual is a full tour through a set of scattered cities, and its fitness is simply how short that tour is. Generation after generation, the fittest tours survive, pairs of parents recombine through order crossover to produce valid child tours, and occasional swap mutations keep the population exploring new orderings instead of settling on the first decent route it finds. Watch the best, second-best and third-best routes redraw themselves live, and track the population's improvement on the fitness-convergence curve in the corner. Tune population size, mutation rate, crossover rate and evolution speed to see how each reshapes the search — and to feel directly why a genetic algorithm trades the certainty of gradient descent for the ability to search spaces no derivative could touch.

⚙ Under the hood

Interactive 3D genetic algorithm: a population of candidate tours through scattered cities evolves generation by generation through tournament selection, order crossover and swap mutation, with the best, second-best and third-best routes redrawn live alongside a fitness-convergence curve.

Three.jsgenetic-algorithmevolutionary-optimizationselectioncrossovermutationtraveling-salesmanai-ml

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)