简体   繁体   English

如果不同的车辆在第二次旅行中访问目的地,则多程 vrp 中的惩罚 ORTOOLS

[英]penalty in multitrip vrp if different vehicle visits a destination in 2nd trip ORTOOLS

I have implemented multitrip (Allow vehicles to visit a destination more than once) VRP using ortools.我已经使用 ortools 实施了 multitrip(允许车辆多次访问目的地)VRP。 This has been done by duplicating nodes for destinations and introducing virtual depots with negative loads.这是通过为目的地复制节点并引入具有负负载的虚拟仓库来完成的。

I want same vehicle to visit destinations in 2nd trip which visited that destination in 1st trip.我希望同一辆车在第二次旅行中访问目的地,而在第一次旅行中访问该目的地。 This is a soft constraint and a penalty should be added in the objective function if not followed.这是一个软约束,如果不遵守,应该在目标 function 中添加惩罚。 How can we implement this?我们如何实施呢?

  /// Adds a soft constraint to force a set of variable indices to be on the
  /// same vehicle. If all nodes are not on the same vehicle, each extra vehicle
  /// used adds 'cost' to the cost function.
  void AddSoftSameVehicleConstraint(const std::vector<int64_t>& indices,
                                    int64_t cost);

Reference 参考

Using this, I think you can model your requirement.使用这个,我想你可以 model 你的要求。

暂无
暂无

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

相关问题 使用 or-tools 的不同车辆类型的 VRP - VRP with different vehicle types using or-tools Google ortools CVRP - 车辆的不同距离矩阵 - Google ortools CVRP - different distance matrix by vehicle 是否可以在 vrp python ortools 中打破多辆车的需求? - Is it possible to break demands in several vehicles in a vrp python ortools? 在 Python 中合并数据集:第一个数据集具有城市名称,第二个数据集具有两个不同的 city_id 列,用于匹配源城市和目的地城市 - Merging datasets in Python: 1st data set with city name and 2nd with two different columns for city_id for origin and destination cities to match with 将不使用特定机器的惩罚成本引入 ORTools Job Shop 问题 - Introducing penalty cost for not using a certain machine to ORTools Job Shop Problem 更改目标 Function 以解决 Google ortools 中的车辆路径问题 - Change Objective Function for Vehicle Routing Problem in Google's ortools OR-tools VRP 一辆车有容量限制和多条路线 - OR-tools VRP one vehicle with capacity constraint and multiple routes Python:将变量从第一个脚本传递到第二个脚本,并将不同的变量从第二个脚本传递到第一个脚本 - Python: Passing variable from 1st script to 2nd script and passing different variable from 2nd script to 1st script 不同车速的车辆路线(谷歌或工具) - Vehicle Routing with Different Vehicle Speed (Google OR Tools) 在 ORTools 中为每辆卡车设置不同的约束 - Setting different constrains per truck in ORTools
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM