简体   繁体   English

如何将服务时间约束添加到具有时间窗口约束的车辆路径问题

[英]How to add a servicing time constraint to a vehicle routing problem with time window constraints

I'm building a tour planner.我正在构建一个旅游规划器。 This tour planner will be given travel time matrix for the itinerary of all places, opening and closing times of all locations and the stay/processing time at each location.该旅游计划者将获得所有地点的行程、所有地点的开放和关闭时间以及每个地点的停留/处理时间的旅行时间矩阵。 I am using Google's OR tools to solve the problem我正在使用 Google 的 OR 工具来解决问题

I've been successful in adding the time window constraints, but am not able to add the stay/processing time constraint to the solver.我已经成功地添加了时间窗口约束,但无法向求解器添加停留/处理时间约束。 The documentation on google OR tools shows how to solve a vehicle routing problem with time window constraints, but there is no mention of how i could add more constraints to the problem. google OR 工具上的文档显示了如何解决具有时间窗口约束的车辆路线问题,但没有提及我如何向该问题添加更多约束。

I've been following this tutorial till now.到目前为止,我一直在关注本教程。 https://developers.google.com/optimization/routing/vrptw https://developers.google.com/optimization/routing/vrptw

The expected output for the planner should consider all the three time constraints mentioned above ie opening time, closing time and stay/processing time规划器的预期输出应考虑上述所有三个时间限制,即开放时间、关闭时间和停留/处理时间

This is actually really simple.这其实很简单。 Since the stay time/processing time will depend only on the destination node, this can be directly added to the time matrix that will be used to solve the problem.由于停留时间/处理时间仅取决于目标节点,因此可以将其直接添加到用于解决问题的时间矩阵中。 For a N*N time matrix where N is the number of nodes in the problem, and a 1*N matrix of stay time, the stay time matrix has to be added to each row of the time matrix to get a matrix that includes both the time matrix and the stay time matrix.对于 N*N 时间矩阵(其中 N 是问题中的节点数)和 1*N 停留时间矩阵,必须将停留时间矩阵添加到时间矩阵的每一行以获得包含两者的矩阵时间矩阵和停留时间矩阵。 Leaving this here for anyone who may face the same problem.把这个留在这里给可能面临同样问题的任何人。

Your transit callback should return the sum of the service time and the travel time.您的公交回调应返回服务时间和行程时间的总和。 ie transit(i, j) == service_time(i) + travel_time(i, j)transit(i, j) == service_time(i) + travel_time(i, j)

If your service time depends on the vehicle you can register a transit callback per vehicle type then use the AddDimension() overload which take a transit callback index array.如果您的服务时间取决于车辆,您可以为每种车辆类型注册一个公交回调,然后使用AddDimension()重载,它采用公交回调索引数组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带时间窗的车辆路线选择Python实现 - Vehicle routing with time window Implementation in Python 时间窗口崩溃的有能力车辆路线问题 - Capacitated Vehicle Routing Problem with Time Windows crashing 不同起点站和终点站时间窗的车辆路径问题 - Vehicle routing problem with time windows at different start and end depot 使用 Google OR 工具解决车辆路径问题 (CVRPTW) 所需的时间取决于车辆容量的排序 - Time taken to solve a Vehicle Routing Problem (CVRPTW) using Google OR Tools depends on the ordering of vehicle capacity 如何将时间窗口约束和容量约束添加到 VRP? - How to add both time window constraint and capacity constraint to VRP? 如何绘制谷歌或工具车辆路线问题解决方案? - How to graph Google OR Tools Vehicle Routing Problem Solution? 车辆路线问题 - 如何完成/确定何时访问某些位置? - Vehicle Routing Problem - How to finish/determine when certain locations are visited? 使用或工具的车辆路径中的最小距离约束 - minimum distance constraint in vehicle routing using or tools 如何节省计算时间以在python中添加约束和求和函数 - How to save the computation time to add constraints and sum function in python 在 Or 工具中设置距离维度以解决车辆路径问题 - Setting distance Dimension in Or tools for vehicle routing problem
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM