GeneticAlgorithm_TSP_Demo
Python implementation of a genetic algorithm for Traveling Salesman Problem optimization.
Why I Built This
I built this to move beyond textbook descriptions of genetic algorithms and see how convergence actually behaves in code. TSP offered a clean way to test selection, crossover, and mutation choices under clear optimization pressure. It became a practical sandbox for understanding how small hyperparameter changes affect solution quality over time.
Problem Setup
Solve TSP on a large fully connected graph, typically around 50 nodes.
Implementation Highlights
- Euclidean coordinate generation to satisfy triangle-inequality constraints.
- Route-based population initialization and fitness as inverse path distance.
- Roulette-style parent selection with ordered crossover.
- Configurable mutation and generation controls for experimentation.
Outcome
A practical notebook demo that shows how simple genetic operators can steadily improve route quality over generations.
Links
- Code/notebook: GeneticAlgorithm_TSP_Demo
- Colab entry point: Open in Colab