Reformulate a ATSP as a symmetric TSP
A ATSP can be formulated as a symmetric TSP by doubling the number of cities (Jonker and Volgenant 1983). The solution of the TSP also represents the solution of the original ATSP.
reformulate_ATSP_as_TSP(x, infeasible = Inf, cheap = -Inf)
x |
an ATSP. |
infeasible |
value for infeasible connections. |
cheap |
value for distance between a city and its corresponding dummy city. |
To reformulate the ATSP as a TSP, for each city a dummy city (e.g, for 'New
York' a dummy city 'New York*') is added. Between each city and its
corresponding dummy city a negative or very small distance with value
cheap
is used. This makes sure that each cities always occurs in the
solution together with its dummy city. The original distances are used between
the cities and the dummy cities, where each city is responsible for the
distance going to the city and the dummy city is responsible for the distance
coming from the city. The distances between all cities and the distances
between all dummy cities are set to infeasible
, a very large value which
makes the infeasible.
a TSP object.
Michael Hahsler
Jonker, R. and Volgenant, T. (1983): Transforming asymmetric into symmetric traveling salesman problems, Operations Research Letters, 2, 161–163.
data("USCA50") ## set the distances towards Austin to zero which makes it a ATSP austin <- which(labels(USCA50) == "Austin, TX") atsp <- as.ATSP(USCA50) atsp[, austin] <- 0 ## reformulate as a TSP tsp <- reformulate_ATSP_as_TSP(atsp) labels(tsp) ## create tour (now you could use Concorde or LK) tour_atsp <- solve_TSP(tsp, method="nn") head(labels(tour_atsp), n = 10) tour_atsp ## Note that the tour has a lenght of -Inf since the reformulation created ## some -Inf distances ## filter out the dummy cities (we specify tsp so the tour lenght is ## recalculated) tour <- TOUR(tour_atsp[tour_atsp <= n_of_cities(atsp)], tsp = atsp) tour
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.