tubeshowcase●1,036,204 videos♡ My collection 0
← Learn to Code

Learn to Code23:09

Coding Challenge #35.5: TSP with Genetic Algorithm and Crossover

The Coding Train ↗

From the creator

In Part 1 of this multi-part coding challenge, I introduce the classic computer science problem of the Traveling Salesperson (TSP) and discuss the pitfalls with a brute force solution. In Part 2, I discuss Lexicographic Ordering and demonstrate one algorithm to iterate over all the permutations of an array. In Part 3, I apply this algorithm to a brute-force solution of the TSP problem. Every single route permutation is checked one by one. In Part 4, I attempt to create a solution to the TSP problem with a genetic algorithm, and then I add a “crossover” algorithm in Part 5. Code: https://thecodingtrain.com/challenges/35-traveling-salesperson p5.js Web Editor Sketches: 🕹️ Part 1: Traveling Salesperson (TSP): https://editor.p5js.org/codingtrain/sketches/FCNAHaCqf 🕹️ Part 2: Lexicographic Order: https://editor.p5js.org/codingtrain/sketches/iYxi30gbl 🕹️ Part 3: TSP with Lexicographic Order: https://editor.p5js.org/codingtrain/sketches/bWPIkEv9s 🕹️ Part 4: TSP with Genetic Algorithm: https://editor.p5js.org/codingtrain/sketches/EGjTrkkf9 🕹️ Part 5: TSP with Genetic Algorithm and Crossover: https://editor.p5js.org/codingtrain/sketches/EGjTrkkf9 Other Parts of this Challenge: 📺 Part 1: Traveling Salesperson (TSP): https://youtu.be/BAejnwN4Ccw 📺 Part 2: Lexicographic Order: https://youtu.be/goUlyp4rwiU 📺 Part 3: TSP with Lexicographic Order: https://youtu.be/9Xy-LMAfglE 📺 Part 4: TSP with Genetic Algorithm: https://youtu.be/M3KTWnTrU_c 🎥 Previous video: https://youtu.be/Cl_Gjj80gPE

Published 2017-05-02 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code