Traveling Salesman Problem (TSP) Implementation in Python

preview_player
Показать описание
Hey Guys,

In this video will learn how to solve the traveling salesman problem with the help of Python programming language.

The traveling salesman problem asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city exactly once and returns to the origin city?

**************************************************************
Related Questions:

what is the traveling salesman problem, how to solve traveling salesman problem, what is traveling salesman problem, how to solve the traveling salesman problem, traveling salesman problem where the cost depends on the order visited, how will you write a monte carlo type of solver for traveling salesman problem?, what did people discover while working on the traveling salesman problem, traveling salesman problem how to solve, now, consider a traveling salesman problem in which the salesman starts at city 0 a, for the traveling salesman problem applied to seven cities, how many distinct tours are possible?

Tags:
#TravelingSalesmanProblem #TSP #TSPPython
***************************************************************

Like👍 Share✔Comment👇🏻Subscribe❤❤❤❤
Visit OUR website

Do Let us know if you have any problems in the comment section below.
==========Thanks for Watching =========
See you with the next Video.
Рекомендации по теме
Комментарии
Автор

This appears to be a brute force algorithm since all permutations are evaluated for cost and the minimum of the lowest-so-far cost and current cost is saved after each permutation. Thank you for sharing.

phillipbarbour
Автор

You guys are doing great in explaning the travelsalesmanproblem plzz do try other topics like DFS and BFS problems and program they will have more idea with both .. so plzz try to implement it

hithadechakka
Автор

what if its start from node 2 or 3 or 4??

artmisknight
Автор

Can u tell how can we print the path also

friendzone
Автор

You should first explain your method before explaining it in code.. That's how followup become easy. BTW, thanks for the code

vaibhavshukla
Автор

I know this might sound.. wrong.. but believe me, I know that learning a totally different language than your own is DIFFICULT, I am learning Indonesian.. But, why do Indians speaking english constantly repeat themself, saying the same 2 or 3 times in a slightly different way? 😅

maxfrischdev
Автор

Thanks for the code:) u need to really work on ur explanation. First, explain the logic and then the code.

vatanmai
Автор

You lost me when started defining the second function, could someone explain this part a bit? what is this function actually doing?

maryk
Автор

Can somebody tell me how to print the path you take through the nods ?

theresa
Автор

Is there any way to print the path which gives the min cost?

secondarypemail
Автор

Would this work, if any node has same distance to the any other two nodes?

keshavgokhaledivine
Автор

Very well explained and indeed this can be achieved in two ways either on Dynamic prog or through Brute force algorithm (first evaluate all possible tours and afterwards choose the one for which we get the shortest distance). I ran this prog in Spyder (5.3.3) but the output for me 95 instead of 80. I am still figuring it out why the output is 95. Thnaks for sharing this code. Cheers

vasudevanrao
Автор

Second function is wrongly implemented instead of comparing vertices index u should have used cost from graph matrix. How can you say by comparing the vertex numbers at it would be next min path without considering the cost comparison in next min path

behardikjoshi
Автор

Hindi mai hie pdha deta jada aacha se smjh aata

TearTales