Constraint for putting a set of nodes on the same vehicle (VRP) #2155
Labels
Lang: Java
Java wrapper issue
OS: Mac
MacOS
Solver: Routing
Uses the Routing library and the original CP solver
Milestone
What version of OR-tools and what language are you using?
Version: 7.7.7810
Language: Java/Kotlin
Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi)
Routing Solver
What operating system (Linux, Windows, ...) and version?
Mac OS
What did you do?
I want to set a hard constraint that enforces a set of nodes to be visited by the same vehicle. I found various links that describe this problem and the suggested approach, see here, here and 9.5.5.3 for examples.
Given this, I have crafted the following extension function in Kotlin:
If you are unfamiliar with Kotlin, here is a short description of an extension function.
Anyway, my problem is that this suggested approach seems to work for a problem set with 2 nodes that have to be on the same vehicle, but not three.
Setting the constraint for two nodes is straightforward:
Setting the constraint on three nodes I would expect to do this:
However, OR-Tools seems to hang when I do this. This is the output in the search log:
Removing the
addPickupAndDelivery()
fromaddVehicleEqualityConstraint()
seems to work, but I am suspecting that is something that works by chance rather than that is how it should work (as it contradicts all the comments and documentation).I believe this is a bug?
Also, it'd be good to refactor the function name
addPickupAndDelivery
to something likeaddNodeAssociation
as it is more generic than the pick up and delivery constraint.The text was updated successfully, but these errors were encountered: