abouz28/tsp-ga ? reverse-engineered prompt
Reverse engineered prompt
Build me a small Python project that solves the Traveling Salesman Problem with a genetic algorithm, using only NumPy for the core math. I want it to read TSPLIB style .tsp files, handle the usual rounded distance rule, and be able to run on a few example instances like berlin52. Please include a correctness check that makes sure tours stay valid, crossover and mutation do what they should, and the distances match the published optimum where available.
I also want a simple command line script to solve one instance, compare it against nearest neighbor and random search, and print the results clearly. Add a benchmark script that can run multiple trials, plus a plotting script that saves a couple of useful charts for convergence and tour comparisons. If you need to look up any current TSPLIB or matplotlib details online, go ahead. Keep the code clean and easy to run from the README with a few simple commands.