Need Help : Constraint on Max Travel Time in CVRP-TW #4291
-
Hi, I've searched through available resources, but couldn't find what I needed. I'm working on a CVRPTW model for picking up patients and dropping them at a hospital. The hospital is considered as the depot, and vehicles travel through nodes within their time windows. Each vehicle can handle the same number of demands per day. I need help with adding a constraint for Max Travel Time between nodes. This maximum allowable travel time varies for each vehicle from a regular node (patient) to the depot. Where, Consider, there are three Nodes(X,Y,Z) and Depot D. In Case 1. #685 - I found this issue dated 6 years back andit was given for pickup and Delivery where pickup and drop nodes are specified to model beforehand but in case of CVRP there are no nodes specified as pickup and drop. If possible provide code snippet as I'm new to the or-tools. Platform Info: Ortools Version : 9.9.3963 in python 3.8 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
|
Beta Was this translation helpful? Give feedback.
-
My two cents, having done exactly this in the past, is this approach works fine up to a point. I started to have trouble when the patients hit the thousands per day scale. Then I had to start partitioning the problem. (Then eventually the startup who hired me pivoted so the project ended.)JamesOn Jul 3, 2024, at 01:46, Mizux ***@***.***> wrote:
depot does not exist from the solver point of view, solver need a unique node index for each vehicle start and end. So if you don't have a duplicating Depot/Hospital how can you find the correct vehicle end index to use since you don't know which vehicle will pickup the patient ?
the constraint force the delta time aka duration between patient pickup and patient delivery (at hospital) wherever if there is 0 or 10 000 nodes in between, so if you have this constraint for any pair then you guaranty that all patient will have less than 1.3 * direct route travel time from pickup to hospital.
For the capacity constraint simply add a capacity dimension in addition to the time_dimension.
merging a cvrptw samples with a p&d should be straightforward don't hesitate to join our discord if you are facing some implem issue and/or share a gist with your attempt
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
My Gist based on your but using
main
branch (sopywrapcp
has been replaced bypywraprouting
etc..)https://gist.github.com/Mizux/36a87040af87eb9c5324d49224f709ac
I also updated the print function to have more data display...
However, one error spotted: distance callback
Also you can use the
AddDisjunction([picku…