Flexible break time for vehicle

219 views
Skip to first unread message

Forest C.

unread,
Aug 19, 2019, 1:59:43 AM8/19/19
to or-tools-discuss
Hi all,
  would like to ask if anyone had tried to assigned each vehicle a flexible break time (for example, lunch time) using or tools?

Before the version 7.x, using python, i tried using the following two:
  • routing.solver().IntervalVar
  • SetBreakIntervalsOfVehicle
and it works! However, after the update (7.x), the same function doesn't seem working, i believe that i might not understand the documentation correctly and hope to get some guidance here. Thank you very much!

Forest C.

unread,
Sep 3, 2019, 5:37:04 AM9/3/19
to or-tools-discuss
Hi all,
  i tried the same function on C++ and it works, however, it failed using the Python wrappers. Even the python example: https://github.com/google/or-tools/blob/39f44709bba203f5ff3bc18fab8098739f189a6d/ortools/constraint_solver/samples/cvrptw_break.py; it does not work properly if you apply the constraint to all vehicles.

Any feedback are welcomed. Thanks!

J. E. Marca

unread,
Sep 11, 2019, 1:44:46 PM9/11/19
to or-tools-discuss
I implemented breaks as nodes with a long service time.  Super complicated implementation here: https://github.com/jmarca/initial-solution/blob/master/src/breaks.py

In my case, I needed one break every 10 hours of driving, and a short break every 8 hours.  So just creating the break nodes was a pain.

If you have just one daily break per vehicle, then you can set up one dummy node per vehicle, restrict access to just that vehicle, and set the travel time to and from those break nodes and every other node to something nominal like 10 minutes (to reflect driving to a suitable lunch break destination).  Set time windows as appropriate, and set "service time" of break node as appropriate. 

I'm pretty sure breaks is still broken in OR tools.  It is an issue on github, and is flagged as being on the development path for version 7.4, but for now dummy nodes works and is pretty flexible.
Reply all
Reply to author
Forward
0 new messages