-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaks add unnecessary slack at the beginning of routes // and improved support for breaks. #4564
Comments
I had a similar problem of unnecessary slack in depot after adding SetCumulVarSoftUpperBound and SetCumulVarSoftLowerBound for PD problem. I solve it adding _timeDimension.SetSpanCostCoefficientForAllVehicles(1) to time dimension. This method SetSlackCostCoefficientForAllVehicles also solve it but sometimes gives a solution with more vehicles to avoid slack. |
Thanks for your reply.
And this does solve the issue when the problem is less than ~1000 nodes. (However with greatly increased solve time) |
The line causing the speed problem is because it adds a separate constraint that the break must start between 6 and 7 hours after the start. How about setting a time window for your break |
Hi StevenGay!
The problem to be solved includes time windows and capacity constraints. As fix_start_cumul_to_zero is set to False, a route might start at any time (eg 14:00 which is 840 in the time dimension). I'm not sure how "break distance duration" would make it possible to "keep it in the middle of the schedule" in this case, as the docs for setbreakdistancedurationofvehicle is very lacking (and as mentioned the feature seems not to work as expected). Another further question: EDIT UPDATE:
This seems to ALMOST work. Memory consumption is still 10x the non-break case (around 18 GB for 3000 nodes) However for the bigger problem (~3000 nodes) the initial solution is doesnt have a slack problem anymore (no unnecessary slack at the beginning of the routes), however the local search *now doesnt even start (even slower? more hit by performance)
No futher solutions given. Based on my (limited) experiment the only remaining issues are: However without the new break logic: And as mentioned, preferably the breaks should not effect the span cost (maybe this can be solved with more dimensions? Suggestions appreciated) The breaks can (and often is) scheduled at the beginning of the route. If anyone has any suggestion to how to make the solver not place the break near the beginning of the route, it would be appreciated. By the way here the trace_search in the local search part with <1000 nodes:
etc. Here is how it looks like with ~3000 nodes:
And then its just stuck here |
What version of OR-Tools and what language are you using?
Version: 9.12.4544
Language: Python
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
Routing Solver
What operating system (Linux, Windows, ...) and version?
Windows
What did you do?
Im not sure this is a bug or feature request...
Im trying to solve a VRP problem with ~3000 nodes.
I've implemented breaks in the following way:
This seems to create a lot of not needed slack in the beginning of the routes (between depot, and first stop).
The start time of the routes needs to be very free and any start time between 1 and 1440 is allowed.
Further, because I also have a limit on the number of loading docks being able to be used at the same time, slack at the beginning of the route must be allowed. Thus I cant simply limit the the amount of allowed slack (I tried that, and unnecessary slack is still created, just less of it).
Code for the loading docks logic:
The span cost, does make the solver reduce the slack in the beginning, however this is only feasible with upto around ~1000 nodes. After which the local search is so slow, the slack is not reduced within reasonable time (2 hours). Adding the break logic slows the local search from around 1300 solutions in 90 seconds, to merely 20 solutions in 90 seconds. (The loading dock logic is not causing this issue, commenting it out only barely makes the local search faster 20 -> 25 solutions)
Further the break logic 10x the memory consumption (2 GB -> 20 GB)
((Further I tried using "setbreakdistancedurationofvehicle", however this seems to not work, and works more like SetSpanUpperBoundForVehicle.))
((I tried many things to make this work))
((Adding AddVariableMaximizedByFinalizer and AddVariableMinimizedByFinalizer to the start/end times didnt make a difference))
What did you expect to see
A better break implementation. Breaks are important for real world use cases.
I hope breaks gets an upgrade in an upcoming version, with improved performance, options and usability.
The text was updated successfully, but these errors were encountered: