3

Is it possible in ortool's vrp model to allow for violation of a constraint (sometimes called a soft-constraint)? E.g. Say each route should pick up a minimum volume of x in some unit, can I configure or-tools such that it will also return me tours subjected that this constraint is not always met?

Looking at the penalties section I get the impression that when configured with addDisjunction or-tools will drop a visit if this makes a solution feasible. However, the problem I have at hand is quite the opposite: the visit shouldn't be dropped and instead, the constraint should be violated, subjected to some penalty.

Fred
  • 3,365
  • 4
  • 36
  • 57
k88
  • 1,858
  • 2
  • 12
  • 33

1 Answers1

2

You should create a "Volume" dimension and use on the end node:

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

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

Mizux
  • 8,222
  • 7
  • 32
  • 48