Expression that requires serving both Nodes or not serving either Node #2959
Replies: 15 comments
-
Any comments? |
Beta Was this translation helpful? Give feedback.
-
Just to throw my two cents on this issue, I, as a user of or tools, also see that it struggles to find solution when some number of such constraints (quite simple really) is introduced in the problem. I was not able to resolve it and looking forward to any comment. |
Beta Was this translation helpful? Give feedback.
-
I hope this is just a syntax issue |
Beta Was this translation helpful? Give feedback.
-
Solver add node one by one so let's say Solver add node A -> your constraint is not satisfied -> failed. |
Beta Was this translation helpful? Give feedback.
-
I didn't understand. Should what I suggested work? |
Beta Was this translation helpful? Give feedback.
-
Understood, since both Nodes are initially inactive, Solver will never visit/activate just one Node and force both the remain inactive ... Maybe just use AddPickAndDrop without the same vehicle constraint? |
Beta Was this translation helpful? Give feedback.
-
Can’t you just use a disjunction with cardinality of 2? Something like The docs say “exactly |
Beta Was this translation helpful? Give feedback.
-
Thx |
Beta Was this translation helpful? Give feedback.
-
Hey @GuyBenhaim, I am currently having the same issue with optional visits for (pickup and delivery) pairs of nodes. I was wondering whether you found a solution for this problem and if so if would you mind sharing it? Any help is highly appreciated! |
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
I found a solution that works for me. Obviously, I made a mistake in adding the constraints. From my understanding, ["same vehicle" constraints + singleton disjunctions] should do the trick. As far I can see atm, I found a working solution for my problem! So no need for you to search through your old code :) Appreciate your response to an outdated post! |
Beta Was this translation helpful? Give feedback.
-
Hey @selting could you be more specific about the working solution you found? |
Beta Was this translation helpful? Give feedback.
-
But NOT necessarily by the same vehicle .... (which P&D forces) |
Beta Was this translation helpful? Give feedback.
-
It's been a minute since I had this problem. So, I'm not sure if I fully understand your problem atm. But here is a snippet I grabbed from my code
I apply this by looping over all Pickup & Delivery pairs. In my particular case, the disjunctions were only applied for the last pair. |
Beta Was this translation helpful? Give feedback.
-
I'd like Node B to be visited later than Node A (not necessarily immediately after) and, if either A or B cannot be served - skip visiting both A and B.
Applying just the time constraint works fine and Solver finds a solution and visits both (a simple case with only two Nodes):
But, when I add the "both or either" condition, no solution is found:
Do I really need the second condition? Any tips?
Beta Was this translation helpful? Give feedback.
All reactions