TSP Visualizer
The traveling salesman problem asks for the shortest closed tour through every city. It is NP-hard, so past a handful of cities nobody checks every tour. Instead you pick a strategy for searching well. Below are four strategies from two of my papers, running live in your browser. Pick a method, press Run, and watch how it searches.
Method
Objective
Speed
Total length
588.0
Longest edge
88.4
Generations
0
Best so far
588.0
GA + Wisdom of Crowds: Population evolution with crowd consensus
The CSE 545 hybrid. Alongside ordinary crossover, each generation counts how often every edge appears among the top-performing tours and builds extra offspring that greedily follow the highest-agreement edges, using nearest neighbor to complete the tour when the crowd offers nothing. Offspring inherit from the whole population, not just two parents.
What to look for
- Nearest Neighbor finishes instantly but leaves one long edge stranded at the end, because it never reconsiders an early choice.
- Simulated Annealing looks chaotic at first. That is deliberate: a high temperature accepts worse tours so it can cross valleys, and the tour only settles as it cools.
- The plain Genetic Algorithm improves in visible jumps as a better tour takes over the population, then stalls once diversity is gone.
- GA + Wisdom of Crowds usually locks in the obvious edges sooner, because offspring inherit whatever the whole leading group agrees on rather than just two parents.
- Switch the objective to the longest edge and the winning tour changes shape, happily adding total distance to shorten its single worst hop.
This is a teaching model, not the code from the papers. It runs entirely client-side at a smaller scale, so the tuning is lighter than the experiments the papers report.