[英]Vehicle Routing Problem - How to finish/determine when certain locations are visited?
I have VRP problem.我有 VRP 问题。 I have vehicles starting positions and I have distance matrix.
我有车辆起始位置,我有距离矩阵。 I want solution to be terminated/finished when certain locations are visited.
我希望在访问某些位置时终止/完成解决方案。
So I don't want it to actually visit each index of location_matrix but if visiting different index beside "MUST VISITS" make for better solution then I have no problem.所以我不希望它实际访问 location_matrix 的每个索引,但如果访问“必须访问”旁边的不同索引可以获得更好的解决方案,那么我没有问题。 Because you know sometimes going from directly 1 to 3 is slower than 1-2-3.
因为你知道有时直接从 1 到 3 比 1-2-3 慢。 (visiting 2 which is not necessary but make it for shortcut)
(访问 2 不是必需的,但将其作为快捷方式)
I defined a dummy depot which cost 0, I used this for end because if you use starts you have to define ends.我定义了一个成本为 0 的虚拟仓库,我用它作为结束,因为如果你使用开始,你必须定义结束。 And I put ends 000 which are basically ending position.
我把结尾 000 基本上结束了 position。 You might ask why you didnt put your "JOB" locations.
您可能会问为什么没有放置“工作”位置。 But this means they have to end there.
但这意味着他们必须到此为止。 So it doesn't seem optimal because example one vehicle could be really near to both of "JOB" locations but if it terminates / ends because it has END defined vehicle would stop.
所以它似乎不是最优的,因为例如一辆车可能真的靠近两个“工作”位置,但如果它终止/结束,因为它有 END 定义的车辆将停止。
I have no idea how to make this work.我不知道如何使这项工作。 Basically what I want that if certain locations are visited once just terminate - that's the solution.
基本上我想要的是,如果某些位置被访问一次只是终止 - 这就是解决方案。 So if jobs are (1,3,5) and Vehicle 1 visited 1,3 and Vehicle 2 just visited 2 it should be finished.
因此,如果工作是 (1,3,5) 并且车辆 1 访问了 1,3 而车辆 2 刚刚访问了 2,则应该完成。
If I use solver in ortools It will be like TSP problem which will try to visit each location in distance_matrix.如果我在 ortools 中使用求解器,它将像 TSP 问题一样尝试访问 distance_matrix 中的每个位置。 I don't exactly want this.
我不完全想要这个。 It could visit if results better solution(does it make sense?) but it should be focusing on "JOB" locations and how to go them faster
如果结果更好的解决方案它可以访问(它是否有意义?)但它应该关注“工作”位置以及如何更快地 go
Potential approach: Compute a new distance matrix with only the "MUST VISIT" locations, and run a VRP with this matrix.潜在方法:计算仅包含“必须访问”位置的新距离矩阵,并使用此矩阵运行 VRP。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.