MHB What are the best algorithms for solving a TSP with 6 points?

  • Thread starter Thread starter mathmari
  • Start date Start date
mathmari
Gold Member
MHB
Messages
4,984
Reaction score
7
Hey! :o

We are given the input for TSP with $6$ points with the following distances:
View attachment 5849
I want to find the approximation for a TSP-Tour using the NEAREST NEIGHBOR and the NEAREST INSERTION by starting by the vertex $1$.

Do we have the following graph from the above table?
View attachment 5851
Or do we get a directed graph? (Wondering)

Using the NEAREST NEIGHBOR we start by the vertex $1$ and then we visit at each step a non-visited vertex with the minimum distance, right? (Wondering)
So using this algorithm we get the following Tour:
$$1\rightarrow 6\rightarrow 4\rightarrow 3\rightarrow 2\rightarrow 5\rightarrow 1$$ with total distance $48$

or

$$1\rightarrow 6\rightarrow 4\rightarrow 5\rightarrow 2\rightarrow 3\rightarrow 1$$ with total distance $49$

right? (Wondering) The NEAREST INSERTION is the following:
Code:
T <- {1} 
while |T|<n do 
   j <- vertex with minimal d(T,j), j notin T 
   insert j with minimal cost into T 
return T
where $d(T,j)=\min_{i\in T}d(i,j)$ and the costs, to add $j$ between $i$ and $k$ are $\text{cost}(j)=\min_{(i,k)\in T} d(i,j)+d(j,k)-d(i,k)$

So using this algorithm we get the following:
T = {1}
j = 6 , d(1,6)=2
T = {1,6}
j = 2 , d(1,2)=3
T = {1,6,2}
j = 4 , d(1,4)=d(6,4)=4
T={1,6,2,4}
j = 3 , d(2,3)=d(4,3)=10 or j = 5 , d(4,5)=d(6,5)=10
T = {1,6,2,4,3} T = {1,6,2,4,5}
j = 5 , d(4,5)=d(6,5)=10 j = 3 , d(4,3)=d(2,3)=10
T = {1,6,2,4,3,5} T = {1,6,2,4,5,3}
with total distance $2+3+4+10+10=29$.

Is this correct? (Wondering)
 

Attachments

  • distances.PNG
    distances.PNG
    2.3 KB · Views: 103
  • travelling_salesman_problem.png
    travelling_salesman_problem.png
    7.4 KB · Views: 99
Physics news on Phys.org
Hmmm... Looks fine to me.
 
phymat said:
Hmmm... Looks fine to me.

Thank you! (Smile)
 
Hi all, I've been a roulette player for more than 10 years (although I took time off here and there) and it's only now that I'm trying to understand the physics of the game. Basically my strategy in roulette is to divide the wheel roughly into two halves (let's call them A and B). My theory is that in roulette there will invariably be variance. In other words, if A comes up 5 times in a row, B will be due to come up soon. However I have been proven wrong many times, and I have seen some...
Namaste & G'day Postulate: A strongly-knit team wins on average over a less knit one Fundamentals: - Two teams face off with 4 players each - A polo team consists of players that each have assigned to them a measure of their ability (called a "Handicap" - 10 is highest, -2 lowest) I attempted to measure close-knitness of a team in terms of standard deviation (SD) of handicaps of the players. Failure: It turns out that, more often than, a team with a higher SD wins. In my language, that...
Back
Top