ScratchData LogoScratchData
Back to Java_Programmer's profile

Traveling Salesman Problem

JAJava_Programmer•Created April 15, 2018
Traveling Salesman Problem
42
27
729 views
View on Scratch

Instructions

Press space to show/hide the minimum distance between cities (using Bridson's Algorithm). Restart the project to generate a new set of cities. Enjoy! For faster results (run in turbo mode): https://sulfurous.aau.at/#216344883

Description

The Traveling Salesman Problem is that given a set of cities, the goal is to find the shortest path to go in a complete cycle (through every city and back to the first). My brother was learning about this in one of his college classes, so I felt like trying it out myself. ;) I just used a genetic algorithm with each species having its own path. Every step, the worst half (more or less with randomness) of the population is taken out, and new mutated copies are made from the remaining half. I could probably make it a bit more efficient, but it works for now. I also used Bridson's Algorithm to generate a nice, spaced-out set of cities.

Project Details

Project ID216344883
CreatedApril 15, 2018
Last ModifiedApril 16, 2018
SharedApril 16, 2018
Visibilityvisible
CommentsAllowed