OR-Tools 解决旅行商 (TSP) 无需返回主节点
我正在使用 Google Or-Tools 通过使用this 示例(基本上我只是用我的替换了距离矩阵).在示例中,我设置了 data['depot'] = 0
.
I'm using Google Or-Tools to solve a Traveling Salesman Problem by using this example (basically I just replaced the distances matrix with mine). As in the example, I set data['depot'] = 0
.
对于我的应用程序,返回到路径末尾的第一个节点并不重要.我可以从解决方案中删除最后一条边,但我想知道如果我可以完全删除此约束,它可能会找到更好的整体路径.
For my application it is not important to return to the first node at the end of the path. I can remove the last edge from the solution but I wonder that if I could remove this constraint altogether it might find a better path overall.
确保所有节点到 0(depot)的距离为空.这相当于您所要求的.
Make sure the distance from all nodes to 0 (the depot) is null. This is equivalent to what you are asking for.