OR-Tools solve traveling salesman (TSP) without returning to the home node

耗尽温柔 提交于 2021-01-27 18:10:19

问题


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.


回答1:


Make sure the distance from all nodes to 0 (the depot) is null. This is equivalent to what you are asking for.



来源:https://stackoverflow.com/questions/61452581/or-tools-solve-traveling-salesman-tsp-without-returning-to-the-home-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!