Adapted from stats::optim(). Check their documentation / examples for details.
TSP.dist(x, mydist)
x
a valid closed route for the TSP instance
mydist
object of class dist defining the TSP instance