Driver break discussion #66
Replies: 17 comments 9 replies
-
Hi, I don't have mailing list, but github has discussions. Regarding jsprit - yes, I'm familiar with the project and I even have some MR to fix break location issue (still opened, probably outdated): If I understand correctly, you need breaks which could happen in the middle of the journey from one job (warehouse) to another if it is required legally after specific time. I don't have any immediate solution on top of my mind. I can only think about some preprocessing step which will analyze problem definition to find such long route legs and insert some artificial optional jobs (yes, except start/end, everything is a job). Anyway it is interesting requirement. Some info about current break implementation and why breaks might be skipped in some cases. In general, breaks are hard for implementation using insertion heuristics: you start from empty route and insert activities one by one. But break cannot be inserted in the beginning:
At the moment, I see two strategies to enforce break in such cases:
My current implementation interprets breaks as soft constraints and has |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply :) Your interpretation of my break requirement is correct; "you need breaks which could happen in the middle of the journey from one job (warehouse) to another if it is required legally after specific time". The point I'm making is that this isn't my need, but at least a legal requirement for everyone in Europe (if not further abroad). The only sensible way for breaks to work here would be to be able to split a single leg journey That isn't possible in |
Beta Was this translation helpful? Give feedback.
-
If you track the "slack" time in downstream jobs from the point of insertion, and you detect that you've crossed a threshold where a break is needed, then you might still be able to see that this insertion is invalid without parsing the entire route on every insertion position candidate? |
Beta Was this translation helpful? Give feedback.
-
Sorry, just realised I switched github accounts in the meantime :/ |
Beta Was this translation helpful? Give feedback.
-
The main problem is to find generic solution: we shouldn't make assumption that long time commute happens only at the beginning. If it is in the middle of the route, then any changes done naturally by metaheuristic, will invalidate previous state and the whole recalculation is needed. I think adding some extra time for long commute with a break can be also an alternative solution to |
Beta Was this translation helpful? Give feedback.
-
Absolutely. I misspoke, sorry. This can happen at any time during a route, not just the first leg of the journey.
Fundamentally, it doesn't need one, because there isn't one. It just needs to see that If you have the slack stored in a state manager, will this explode the complexity of your insertion heuristic? |
Beta Was this translation helpful? Give feedback.
-
In that scenario, I'm implementing a break as a "job" during the recreate phase, but it only adds its duration, not travel to/from it. Ideally, it should never be in the unassigned pool in the first place. In |
Beta Was this translation helpful? Give feedback.
-
yes, there is some state which is associated with the route context. It is used to store some pre-cached values to speedup insertion analysis. If we accept that such breaks don't have locations, then the next question would be about representing break in the solution. Need to think about it. Regarding internal api: I would say it is not really ready for extension by code. I put more efforts to support more use cases using pragmatic format and implement them as part of the project. |
Beta Was this translation helpful? Give feedback.
-
maybe this special break, which happens only during traveling, can be implemented as separate feature. But it should be mutual exclusive with current one and the user should have full control on them. |
Beta Was this translation helpful? Give feedback.
-
Totally agree. I'm just really happy that you're thinking about it in general. I waffled a bit, but this is a major barrier to implementing the open-source solutions to any business that deals with these legal compliance issues. I'll help in any way I can. I'm trying to learn more |
Beta Was this translation helpful? Give feedback.
-
At the moment, adding such break as extra time to traveling duration when necessary seems a possible solution. Besides actual implementation, I see the following challenges:
|
Beta Was this translation helpful? Give feedback.
-
Thought about it over night and I think there is some potentially simple way to implement this with some constraints:
|
Beta Was this translation helpful? Give feedback.
-
This sounds good, I really appreciate you taking time to think it over. I have a couple of things that have bitten me in the past when trying to handle this that might be useful to at least mention (possibly not all relevant):
|
Beta Was this translation helpful? Give feedback.
-
Thanks for info! I might try to prototype very basic implementation which supposed to add break time to traveling time when necessary. However, I want first to finish my current task (heuristic refactoring) |
Beta Was this translation helpful? Give feedback.
-
Please don't let me derail your existing plans; I'm glad you've taken an interest in this problem (and feel free to migrate to a discussion if that's possible; we don't have that tab internally so I didn't know it was a thing with git, sorry!). In the meantime, I'm going to try wrap this library on my side too (which will take me some time anyway) so that I can start running on some real data and give real-world feedback on prototypes. Certain details I won't be able to share, but I'm hopeful we can get to some working middle ground. It'd be awesome to close this long-standing issue |
Beta Was this translation helpful? Give feedback.
-
I've slowly started prototyping the solution. At the moment, I decided to split breaks into two types: Required break will be a new type which allows to schedule a break at exact time or after exact working time. So far, I identified the following challenges:
|
Beta Was this translation helpful? Give feedback.
-
To be honest, the plan is to keep such solutions possible:
At the moment, the main implementation problem is how to adjust internal caching logic which speed ups job insertion analysis: Here, LATEST_ARRIVAL_KEY state is used to find the latest arrival time at next activity when analyzing a new job insertion: If it is solved, I would be pretty confident on the whole feature implementation. |
Beta Was this translation helpful? Give feedback.
-
Hi. Firstly, apologies if this belongs on a mailing list (I looked but couldn’t find one) but I wanted to have a discussion about the handling of driver breaks.
I’ve used
jsprit
now for various projects for the last 6 years and I kicked off the discussion originally that got the first iteration of breaks running there. I’m running on the assumption that you have some familiarity withjsprit
given the setup of this library, and it looks like you’re making great progress in some of the shortfalls experienced there.The one thing that causes no end of problems is driver breaks and it appears that you’ve taken the same default as
jsprit
did - the break inherits the location of the previous, tangible job and your own docsThe problem with this is that breaks are non-trivial in the solution itself. Because of things like EU regulations it simply isn’t good enough in a solution to have them modelled as soft constraints because the solution breaks the law if the break jobs get kicked out. Across
jsprit
, OR-Tools (broken for ages), VROOM and this library, I cannot find an implementation that can adequately address this.Fundamentally, this falls down on the location inheritance. If I need to travel 5 hours from the north of the UK down to Cornwall, on a 9-5 shift (for argument’s sake), with a break in the middle, it’s totally impossible for a solution to ever do this job unless there is some stepping-stone job on the way. Tough luck if you're dispatching a full truck for a single order. The stark reality is that vehicles will park up to satisfy the Tachograph at an intermediate location, but this is not possible either with a forward- or a backward-looking location inheritance.
This has led me down all sorts of paths, with instantaneous services at the warehouse immediately before a break just to try fudge this location inheritance, amongst other hacks. They never properly work. I think we need to move away from breaks being considered as a job that can be inserted into a route and, instead, have something time-based.
I’m engaged with a number of large logistics clients with complex constraints, and I have a wrapper library that calls custom and open-source solvers interchangeably, so I can test a number of very different scenarios. Given that you’re so active in your development at the moment and the fact that you’re addressing issues with the solvers that came before, I’d love to assist in testing if you have any ideas on how this long-standing problem can be fixed. Have you had any thoughts in this space and is this something you’d like to explore?
Thanks,
Josh
Beta Was this translation helpful? Give feedback.
All reactions