-
Notifications
You must be signed in to change notification settings - Fork 339
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
Maximum travel time and/or distance per tour #918
Comments
Here is a small example with a vehicle being located at the depot and two pickup/delivery tasks. In the default case the solution will have a total travel time of
If you set
So the vehicle goes back to the depot in between to avoid a tour with travel time Instance: |
This is an interesting use-case and need, thanks for sharing your work on it! I took a quick look at your branch diff and you got the overall picture right: store additional data required for validity checks, implement validity checks for this new constraint, add the relevant new checks wherever needed (heuristic, local search etc.). One first limitation I can see for including this is that it will currently introduce some computing overhead (checks and data updates) for all situations, even when this constraint is not used at all. This could be evaluated using the usual benchmarks and there are probably ways around that. I'm also a bit puzzled about how this could be exposed in a more generic way in term of API.
We have no notion of
Probably less of concern as it could be changed, but we can't really ship a new feature that is only usable if you provide your own matrices and
Nope, we use several benchmark classes and typical instances as functional and non-regression tests, see https://github.com/VROOM-Project/vroom#functional-tests. I would advise in that regard to add assertions on validity for the new constraint in the route formatting process. |
This is a great implementation. Thanks for sharing. I have a unique use case which I am trying to solve. We have quarry trucks that pickup quarry material from different quarries and then deliver it to construction sites. In our instance it's always a pickup followed by a delivery because the capacity of the truck is always filled at every pickup. Km travelled fully loaded is quite important to us. One thing I have been trying to achieve is limit the max travel time from delivery to next pickup location, and/or preferring shipments (pickup->delivery) where the duration to the pickup from the current location is smaller than the duration from that pickup to it's delivery. In understanding that the latter is a more complicated task. Would either of you have any suggestions on how to limit the max travel time from delivery to next pickup location? Similarly any advice on how to possibly achieve preferring shipments (pickup->delivery) where the duration to the pickup from the current location is smaller than the duration from that pickup to it's delivery :) |
Well, if trucks are always filled at every pickup, then if all shipments are assigned there is nothing to optimize in term of fully loaded distance as it is fixed by the pickup->delivery legs.
Since the pickup->delivery legs are fixed and all separated, the travel time from deliveries to next pickup is all that is left to optimize, so this should happen out of the box.
Not sure I get this correctly, maybe there is a business rule behind this? All in all, I'm not sure this has much to do with the initial "travel time per tour" topic, maybe we should move that discussion to a dedicated ticket? |
@jcoupey Coming back to the initial topic, I was thinking that it would be nice to include this somehow in the main stream of VROOM as we are using this feature quite a lot, but we are a bit stuck with the version back then. What about these two options:
Both would produce the behaviour that we want without defining explicitly a |
@sebhoerl thanks for coming up with alternative suggestions, it is indeed a good approach to try and get something as generic as possible. My main concern about this is that accounting for a specific situation, albeit in a more generic way, could fall short for slightly different use-cases. We don't want to hard-code some specific assumptions in the solving approach because we'd implement something too targeted and would then be stuck for anything beyond that.
Relies on the assumption that "the pickup is always at the same place": this constraint would not make much sense in a situation with pickups spread all around. Also would not cover the situation where pickup place and battery-swapping facility are different (e.g. with the symmetric problem where you collect all things to bring them to the depot).
Again assumes that the start place has another role beyond just being the first step in the route, which feels wrong in the semantics of the API. Would fall short as soon as someone would come up with a variant:
I guess my point is that in order to do things properly we should probably get back to the initial business requirement you expressed in your original post: "they can swap batteries". In your case it happens at a specific point known in the model but the general case is that this could be pretty much anywhere and we don't want to make (too much) assumptions on this. I realize this is not helping much in the short-term because while the work-around you already have kinda works for your use-case, solving for the bigger picture is actually a much more complex problem. |
For those who are interested, I made a new implementation based on 176f57. It can be found here:
The footprint of this implelmentation has been reduced considerably and the |
@jcoupey Not sure what you think of the new version, it is relatively low-key with not a lot of code added. It could become a "hidden" feature for experts, but for you to decide ;) sebhoerl@16e2cbd Probably would make sense to add another |
@sebhoerl I just checked sebhoerl@16e2cbd which is indeed kind of self-contained and is a straightforward expression of your requirement: you check cumulative duration/distance against the My main concerns would be:
That last point is a deep change to the approach we have so far as the current complexity for all validity checks is linear in the size of the inserted range. If you take for example a very simple local search operator as |
We currently have a use case where we look at cargo bikes that are placed at a central depot to perform deliveries. The idea is that they can do as many tours as necessary during one day, but that their range / travel time is limited per tour. The assumption is that the riders will be active all day, but they can swap batteries in the depot.
I have an implementation for that with two contributions:
depot_index
is defined per vehicle, defining at which spot tours start and end (and this probably only makes sense in combination withstart_index
andend_index
). This is necessary, because otherwise there is no notion of what is a "tour".max_travel_time_per_tour
is introduced that limits the time that can be spent traveling between two subsequent visits of thedepot_index
.I'm not sure if this is a relevant point on your roadmap, please let me know if I should send a PR with this. The code is here, and the main change is inRawRoute
: master...sebhoerl:vroom:max_tour_travel_timeUpdate 22 January 2024: See fruther below, there is a more straight-forward and more correct implementation now.
I haven't been writing C++ in quite a while, so this was an interesting exercise to catch up a bit, but clearly there may be room for improvement ;-) I tested it on some of our small test instances (large runs yet to come). I'm not really familar with C++ project setups, I assume there are unit tests somewhere, but not sure how to run them :)
The text was updated successfully, but these errors were encountered: