reformulate_ATSP_as_TSP(TSP)
reformulate_ATSP_as_TSP()所属R语言包:TSP
Reformulate a ATSP as a symmetric TSP
作为对称的TSP重新拟订一个ATSP
译者:生物统计家园网 机器人LoveR
描述----------Description----------
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.
一个ATSP可归结为一个对称的TSP城市的数量增加一倍,(琼克和Volgenant 1983)。的TSP的溶液,也代表了原始ATSP溶液。
用法----------Usage----------
reformulate_ATSP_as_TSP(x, infeasible = Inf, cheap = -Inf)
参数----------Arguments----------
参数:x
an ATSP.
一个ATSP。
参数:infeasible
value for infeasible connections.
值不可行的连接。
参数:cheap
value for distance between a city and its corresponding dummy city.
一个城市及其相应的虚拟城市之间的距离值。
Details
详细信息----------Details----------
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.
重新ATSP为TSP,每个城市的一个虚拟城市(例如,“纽约”一个虚拟的城市“纽约”)。每个城市之间和值cheap负或非常小的距离,其相应的虚拟城市。这可以确保每个城市总是发生在溶液中的虚拟城市。原来的距离之间使用的城市和虚拟城市,每个城市的距离要去的城市和虚拟城市是负责来自城市的距离。所有城市之间的距离和所有的虚拟城市之间的距离设置为infeasible,一个非常大的价值,这使得不可行。
值----------Value----------
a TSP object.
TSP的对象。
参考文献----------References----------
traveling salesman problems, Operations Research Letters, 2, 161–163.
参见----------See Also----------
ATSP, TSP.
ATSP,TSP。
实例----------Examples----------
data("USCA50")
## set the distances towards Austin to zero which makes it a ATSP[#设置向奥斯汀的距离为零,这使得它一个ATSP]
austin <- which(labels(USCA50) == "Austin, TX")
atsp <- as.ATSP(USCA50)
atsp[, austin] <- 0
## reformulate as a TSP[#改写为TSP]
tsp <- reformulate_ATSP_as_TSP(atsp)
labels(tsp)
## create tour (now you could use Concorde or LK)[#创建旅游(现在你可以使用协和LK)]
tour_atsp <- solve_TSP(tsp, method="nn")
head(labels(tour_atsp), n = 10)
## filter out the dummy cities[#过滤掉的虚拟城市]
tour <- TOUR(tour_atsp[tour_atsp <= n_of_cities(atsp)])
tour_length(atsp, tour)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|