【问题标题】:Ortools - VRP Allow for violation of constraintOrtools - VRP 允许违反约束
【发布时间】:2020-07-03 14:58:13
【问题描述】:

ortool 的vrp model 是否可以允许违反约束(有时称为软约束)?例如。假设每条路线应该在某个单元中获得至少x 的音量,我可以配置 or-tools 以便它也会返回我的游览,但并不总是满足这个约束吗?

看着penalties section,我的印象是,当配置addDisjunction or-tools 时,如果这使得解决方案可行,则会放弃访问。然而,我手头的问题恰恰相反:不应该放弃访问,而是应该违反约束,受到一些惩罚。

【问题讨论】:

    标签: or-tools vehicle-routing


    【解决方案1】:

    您应该创建一个“体积”维度并在端节点上使用:

    void RoutingDimension::SetCumulVarSoftLowerBound(int64 index, int64 lower_bound, int64 coefficient);
    

    参考:https://github.com/google/or-tools/blob/858fa626959f7e386153af82756384b79f983b5a/ortools/constraint_solver/routing.h#L2236-L2249

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-04-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-29
      • 2022-01-06
      • 2020-09-17
      • 2012-07-15
      相关资源
      最近更新 更多