[英]The shortest combination of paths that starts and ends with a single node and covers all points in an undirected graph
I need an algorithm(k, s)
where 我需要一个
algorithm(k, s)
其中
k
is the number of paths k
是路径数 s
is the starting and ending node s
是起点和终点 and given n
number of nodes in an undirected graph in which all nodes are linked to each other, returns k
paths to traverse all nodes of which the sum of distances covered by the k
paths is the shortest. 在给定
n
个节点的无向图中,其中所有节点都相互链接,则返回k
条路径以遍历所有节点,这些节点的k
路径所覆盖的距离之和最短。
Eg Given n
= 10
, algorithm(2,5)
might give me an array of two arrays such that the sum of the distances covered by the two paths are the shortest and that all nodes are traversed. 例如,给定
n
= 10
, algorithm(2,5)
可能会给我一个包含两个数组的数组,以使两条路径所覆盖的距离之和最短,并且遍历所有节点。
[[5,1,2,3,10,5],[5,4,6,7,8,9,5]]
Djikstra's algorithm finds the shortest path from one node to another, but not the shortest combination of k
paths. Djikstra的算法找到从一个节点到另一节点的最短路径,但找不到
k
路径的最短组合。
Yen's algorithm finds k
number of shortest paths from one node to another, but not the shortest combination of k
paths. 日元的算法找到
k
数目的从一个节点到另一个的最短路径,但不是最短的组合k
路径。
What algorithm can help me find the shortest combination of k
paths that starts and end with node s
such that all n
nodes are covered? 哪种算法可以帮助我找到以节点
s
开始和结束以覆盖所有n
节点的k
条路径的最短组合?
What you are describing above, is the classical Traveling Sales Man problem, many optimization techniques. 上面描述的是经典的旅行商问题,还有许多优化技术。 One such is Ant Colony Optimization .
一种就是蚁群优化 。
There are many libraries that implement ACO, you could find one for Ruby, as it stands, there are no easy solutions to Traveling Salesman Problem with classical (mathematical) approach. 有许多实现ACO的库,就目前而言,您可以找到一个针对Ruby的库,没有经典(数学)方法解决Traveling Salesman问题的简单解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.