OR-Tools 解决旅行商 (TSP) 无需返回主节点 [英] OR-Tools solve traveling salesman (TSP) without returning to the home node

查看:117
本文介绍了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.

这篇关于OR-Tools 解决旅行商 (TSP) 无需返回主节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆