0

I'm trying to test example of VRPTW with depot usage constraint - from here. If I change VehicleNumber on different value(for example from 4 to 6), solution will never be found. This example only works with the specified property values. Why?

I checked C# and Python examples, result is the same.

  • General remark (for a very general question; no details given): NP-hard problems are very *unstable* in terms of solvers by nature. While SAT-solvers for example usually solve problems with 100 million variables, theory guarantees us (if assuming P != NP), that there will also be an instance with only 100 variables we can't solve. This also means, that a tiny change to the instance often can render a problem unsolvable (without us being able to recognize that fact a-priori; also guaranteed by theory). The routing solver is *heavily* heuristic-based. – sascha Sep 04 '19 at 11:36
  • How can I use this feature of or-tools if it unstable? In my current project this constraint dropped all – Иван Ерофеев Sep 04 '19 at 11:46

1 Answers1

1

Because the problem is over constrained with 6 vehicles.

This code creates one interval per vehicle. These intervals have a fixed duration and a maximum end time. 4 such intervals fit in the allowed time, 6 do not.

Laurent Perron
  • 8,594
  • 1
  • 8
  • 22
  • Why algo can give solution with 4 vehicles, and cann't with 6? It could use 4 out of 6, and keep 2 as unused. How can I fix it? – Иван Ерофеев Sep 05 '19 at 09:18
  • You need to create the fixed interval variables as optional. To do this, you need to pass a Boolean variable that indicates if the vehicle is active. You can use solver->MakeIsDifferentCstCt(start_var_of_vehicle_i, index_of_end_route_for_vehicle_i) – Laurent Perron Sep 05 '19 at 09:34
  • Can I see some example with it for understanding? I found optional flag for interval, and when I setted to true, breaks stopped working for solution. – Иван Ерофеев Sep 05 '19 at 13:06
  • @LaurentPerron, in MakeIsDifferentCstCt, what does "CstCt" stands for? Constant constraint? Cast Constraint? – mac May 18 '20 at 17:42
  • ConstantConstraint: MakeIsDifferentFromConstantConstraint – Laurent Perron May 18 '20 at 20:02