| TOUR {TSP} | R Documentation |
Class to store the solution of a TSP.
Essentially, an object of class TOUR is an integer vector
containing the order of cities to visit.
## S3 method for class 'TOUR': print(x, ...)
x |
an object of class TOUR |
... |
further arguments are passed on. |
Since an object of class TOUR is an integer vector, it can be
subsetted as an ordinary vector or coerced to vector using as.vector.
Additionally, TOUR has the following attributes:
"method", "tour_length".
For most functions, e.g., tour_length or image, the TSP
object used to find the tour is still needed, since the tour does not contain
the distance information.
TSP,
tour_length,
image.
data("iris")
tsp <- TSP(dist(iris[1:4]))
## calculate a tour
tour <- solve_TSP(tsp)
tour
str(tour)