ScratchData LogoScratchData
Back to Zro716's profile

Travelling Salesman Problem

ZRZro716•Created September 5, 2015
Travelling Salesman Problem
22
16
698 views
View on Scratch

Instructions

Press space to switch between algorithms used. Blue = current permutation Red = solution permutation (sorry if it looks incorrect, the path is supposed to wrap back to the start but i got lazy)

Description

@turkey3 started this and by inspecting his code I figured out what he was doing: https://en.wikipedia.org/wiki/P_versus_NP_problem So here's a step further to the problem with implementations for Dijkstra pathfinding and lexicographic permutation. Since there is no point to use Scratch for the super intense NP-hard problems, I've decided to slow things down to show you how it works, and why it is an important problem in computer science to cut down the time complexity. Please take note that even though the Dijkstra pathfinding takes barely any time to solve, it generally does not yield the true shortest path. Here is the Wikipedia article on TSP for those who are interested: https://en.wikipedia.org/wiki/Travelling_salesman_problem Wikipedia article for permutation: https://en.wikipedia.org/wiki/Permutation#Generation_in_lexicographic_order

Project Details

Project ID75405472
CreatedSeptember 5, 2015
Last ModifiedSeptember 25, 2015
SharedSeptember 5, 2015
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root