0

I can't really understand how to find the neighbours of a given tour using 2-opt algorithm :

Suppose we have T = 0-1-2-4-3-0

the definition says : neighbourhood of T is defined as the set of all tours that can be reached by changing two nonadjacent edges in T (2-interchange).

So we have these nonadjacent edges :

(0,1) and (2,4)

(0,1) and (4,3)

(1,2) and (4,3)

(1,2) and (3,0)

(2,4) and (3,0)

we have to find 5 neighbours , how we can generate them by making those 2-interchange moves ?

Thanks in advance.

Hamza
  • 121
  • 1
  • 1
  • 8

1 Answers1

0

You have the right idea for finding pairs of non-adjacent edges. Then, for each pair, there is exactly one feasible way to form a new tour by attaching new edges. For example, if we remove (0,1) and (2,4), then there are three pairs of edges we could replace them with:

(0,1) and (2,4): but this is the same as the original tour

(0,4) and (1,2): but this creates two subtours instead of one tour

(0,2) and (1,4): this is the winner

In general, if we remove edges (i,j) and (k,l) then we replace them with (i,k) and (j,l) -- assuming this reduces the cost. Note that this changes the orientation of half the tour.

So according to your definition, the neighborhood of T is the set of all new tours that can be attained in this way.

LarrySnyder610
  • 2,277
  • 12
  • 24