When trying to understand how tabu search can be applied to travelling salesman, I have struggle understanding how the neighbourhood is generated. If we look at this pseudocode from wikipedia:
sNeighborhood ← getNeighbors(bestCandidate)
for (sCandidate in sNeighborhood)
if ( (not tabuList.contains(sCandidate)) and (fitness(sCandidate) > fitness(bestCandidate)) )
bestCandidate ← sCandidate
end
end
My best candidate starts as the path generated from a nearest neighbours algorithm, what are the neighbours to this path?
Say my path is A,B,D,C,A is the neighbourhood every possibility for each index? e.g. [B,D,C], [A,C,D] etc?
And then we eliminate neighbours that are in the tabu list for each index?
If not, what is my neighbourhood?
Also in the pseudocode the tabu list only adds new best candidates, so then how do we pick a different neighbourhood next time?
if (fitness(bestCandidate) > fitness(sBest))
sBest ← bestCandidate
end
tabuList.push(bestCandidate)
Wikipedia source code: