-
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
Support for Time Windows #113
Comments
@K-Leon thanks for your feedback. Performance is achieved by using dedicated approaches for sub-problems like TSP and capacitated VRP (CVRP). The drawback is that there is no cheap hack to add TW support. The next release will include solving CVRP with skills constraints (still work in progress). Adding TW would be next in line, so I'm flagging this issue as a feature request for further reference. |
Yes great project, but kind of useless to us without time widows... almost all our jobs have time constraints. If you guys can figure this out this will be quite amazing. Jsprit takes about 1300 ms to solve what this does in 50 ms (using the web nodejs wrapper). But again without time windows its unfortunately of little use... Will definitely looking for TW! |
Now that the CVRP feature is released, the good news is we'll probably be able to reuse most of the approach (and part of the code) to handle time-windows. I'd like to have:
Points 1. to 3. are enough to have a decent VRPTW implementation running. Point 4. could come later, but would be great for computing speed-up, and scaling concerns. I want to keep this issue as a place for ideas and discussions on the approach outline, and will open dedicated tickets for required steps. |
This is great news guys!!! Any ROUGH idea on the timelines?? Thank you!! |
Great news! |
I'd say a few months from now depending on available slots and priorities on my side. Any help to make it faster is of course appreciated. ;-) |
I can help in testing if that is in any way useful. |
Hi @jcoupey! +1
I could help with development in my free time. ) |
@peterdn1 yes testing is definitely useful, but we need to get on with the development phase before. Do you have some specific use-cases/instances in mind? |
@sashakh thanks! I've ticketed everything I have in mind so far for the time-windows part, let me know if you'd like to join for something in particular. There are also a couple other technical issues added to the |
@jcoupey , Ok. BTW. Probably you know this page already, but recently I've found this research http://homepages.dcc.ufmg.br/~rfsilva/tsptw. There are a lot of TSP+TW benchmarks and some C++ code implemeting TSP+TW running those benchmarks. It seems to be "public domain", so I've published the code at https://github.com/sashakh/TSPTW. Probably could be useful as a reference. If you wish to contact me directly for boring details please feel free to use my email sashakh at gmail dot com. |
@sashakh I'm planning to start working on #136 and #137 in the coming week, we can probably find a way to get along. Thanks for the TSPTW benchmark link, I did not know that source. This will probably be very handy while implementing #137. Having the benchmarks all set up while starting on the TW work would definitely be great! |
For anyone following this ticket and interested in early tests: #138 (comment). |
I just let a stream of data running through vroom and i‘m thrilled about the quality and the speed of the timewindow implementation. We‘re talking about a reduction of 40 seconds + for some queries. One little hint would still be great: Is there an easy way to support soft timewindows? To put I that way: If it‘s not fitting it will plan a stop anyhow but in a way that the overall delay isn‘t that large. |
Thanks @K-Leon it's really useful to have some feedback on the overall behaviour in term of quality/speed. Note that there is still work in progress to adjust/improve things at #166 and #139.
I'd be really interested if you could provide a bit more context, like total computing time magnitude/typical problem size, and what other solving approach you're comparing to?
Validity constraints enforced by time windows are "hard" constraints: serving a job is either valid if it fits with the timing or not considered at all. There is no support for "soft" constraints with some kind of penalty at the moment. The lazy answer right now is that if you're OK with delaying a stop after it's time window, then the corresponding "hard" constraint was too tight in the first place. ;-) |
I just followed your tips and we implemented the poor mans soft timewindow algorithm clientside ;) (if it‘s not fitting drop all constraint except the most important) But one thing we noticed with current master that we have from time to time suboptimal solutions. It‘s not reproducable in current demo server so I guess it‘s related to the latest speed optimizations. I just added a screenshot from our testing App. Regarding the context: we usually handle quiet simple Problem. Only one vehicle, fixed, but timewindows with soft constraints. Our previous Solution with embedded soft timewindows took a lot of Time - mostly due to the fact that it scaled very badly. The solution with vroom is even way faster if there are multiple rounds necessary and not many stops around. The usual query takes around 500/1000ms with vroom. |
@K-Leon thanks for the details. Yes scaling is a key factor in my opinion, and it plays a big part in the way the solving approach has been designed so far.
There is no guarantee of optimality in the returned solution, but it should usually be impossible to improve it in a very obvious way. In the case of your example (back-and-forth 16 -> 17 -> 18 -> ...), I'd consider this a bug if there is no reason related to timing constraints for doing so. Could you check that or share your request?
This is only another hint that timing constraints might be responsible here. Since august, the demo server has been running on 3979d76, a version prior to any work on time windows. So time windows constraints handed over were simply ignored until today. I just updated it to 96996ef to enable tests with time windows (you might still experience differences with a local instance, mostly related to using different OSM datasets/OSRM version or profile). |
@jcoupey Thanks for your hard work! I just prepared the Request. It's very hard to strip it down, because the "bug" seems only to be triggered at very specific conditions. I added a marking for the tricky stops: https://gist.github.com/K-Leon/19a0721329248aa65399e53df717f908 Edit: Like you said - the new version of the Demo Frontend returns a different Result. Now It's getting interesting finding a repro. I'm open for everything to help you |
To overcome the effect of different OSM/OSRM context and behaviour, you can run this script on your input file (make sure https://github.com/VROOM-Project/vroom-scripts/blob/master/src/utils/osrm.py#L5-L6 points to your own OSRM server).
It will handle the |
@K-Leon happy to look further into this if you can share an instance with an embedded matrix, but could you then open a dedicated ticket as we're drifting from the original scope here. |
I just created a new Ticket containing the Matrix Request. Thank you very much! |
I just tagged a Happy to have any feedback, feel free to comment here or open other tickets. Edit: |
Hi Julien! Quick question.. I suppose work has to be done on vroom-express to add the new time_window_t data into the requests? Or is that automatic?? I would love to test it via HTTP REST api... If you have any quick tips it would be appreciated! We could run some routing data (with job time windows) against JSprit and compare it with vroom... We could then compare the results and see if its working! Cheers, One small point I build rc2 and running it yields the message: |
Nothing to change to vroom-express, POST data is just passed through to the
I'd really appreciate any feedback you may have on real-life instances. For comparisons, do you have a way to make sure the underlying routing costs are identical (maybe you're running jsprit on top of OSRM)? Also, note that the default
I cherry-picked a commit from master for |
Yes we use OSRM with JSprit... I will try to get vroom-express up and running ... Could you give me an example of the json with time windows?? |
The API description now contains a full example with input and response. |
Awesome thank you! |
For anyone following this ticket and interested in testing, you should update to |
Sounds great! I'll let my Testdata run over it and let you know about the results. |
Perfect we are starting are tests v jsprit now. I will post solution from both when complete... |
Also, note that the default -x value is now 5 (longer computing time for better results), you might want to tune it down depending on your instances size and the trade-off you want to pick. How do we increase this?? Sorry not a C++ guy anymore.. the -x values are 0 to 5 is there a way to increase this?? Just for comparison, jsprit is using 2000 iterations I would like to use the same for a fair comparison! |
The
The notion of a "fair" comparison is somewhat hard to define. Is it comparing solution costs with equal computing time? Is it comparing computing times for similar solution costs? In practice probably neither will be doable. The simplest step would be to use your jsprit setting (the one you're currently satisfied with) and compare it to VROOM with If you want to go ahead and compare multiple settings, you could pick several tunings for jsprit (number of iterations or other parameters) and several values of Of course some parameters should be identical for fairness though:
I don't know about multi-threading in jsprit. For VROOM, provided you have enough cores at hand, going from |
Ok so same machine/ORSM and threads (8) for both jsprit and vroom. Note we are using latest north america OSRM file ... The request is a realistic mix of orders with no windows and a few with windows. NOTE If all have no time windows current "regular" vroom produces optimal result. In this case the jsprit results are better (although slower). Note that vroom does not satisfy all the time windows requirements and jsprit does. Did I get the request parameters wrong?? Let me know if you need any more info! Cheers |
I guess you mean jobs 19 and 3, whose Could you run this script on your input request in order to provide a standalone version of your problem? This would embed the cost matrix in the request file so that I could reproduce the exact same problem locally without any access to your OSRM stack. |
@mikeppp looks like the travel times used by both solvers does not really allow a fair comparison. I've taken a look at the common edges from your two result files in order to compare travel times used by jsprit and VROOM.
Looks like your jsprit instance uses travel times rounded to minutes that are consistently lower that the one used by VROOM (OSRM table values rounded to the nearest second). Do you have a way to adjust that? |
@jcoupey I don't have a way sorry... JSprit has everything in minutes where as VROOM is al lin seconds. I don't actually know the inner workings of JSprit either. I was trying to create a realistic scenario and then apply the problem to both systems. This isn't my specialty or area of expertise. To be honest I just want something that works fast and accurately. Do you get a similar solution from my input file?? |
It seems you are correct in that VROOM travel times are more realistic. We are looking into the solution in more detail... Did you have a chance to run our problem yourself? |
Maybe the rounding down to minutes comes from the way you interface jsprit with OSRM? You could either have jsprit use second-rounded times, or have VROOM use the same minute-rounding convention here.
I can't solve your problem using another OSRM instance and expect to reproduce the results (different data, OSRM versions and profiles etc.). But I can take a look if you share a standalone problem. |
Hi Julian, Now we are running osrm inside docker is that the problem?? |
You're just missing a python module, |
Ok attached is the generated problem matrix file... |
Thanks for sharing the full instance. I'm getting the exact same solution as your initial Using the travel times from the matrix confirms this cost for VROOM route ( |
Hi Julian, Thank you for the analysis. We have dissected the route by hand and it does seem valid. This is good news actually! I think you are definitely ready or close to ready to release then. We will conduct some tests over the next little while. I now know how to create and share the instance! Cheers |
@mikeppp thanks for your feedback, happy to have more if you can. Do you have bigger instances to test on (like multiple vehicles or higher number of jobs)? FWIW, I've been feeding a few instances to a linear programming solver recently, and it turns out that for the instance you shared, the solution with cost 9780 is optimal (with regard to total travel time). |
@jcoupey Thank you! Depending on time, yes it is our goal to do a much LARGER request with LOTS of orders and users. We will be working on that problem shortly... |
I justed looked into vroom - it's a really amazing project! Especially the performance is excellent.
I'm just wondering if there are any plans or existing "workarounds" to support Time Window constraints for Jobs?
Best Regards,
Leon
The text was updated successfully, but these errors were encountered: