VRP: How to add constraints to disjunctions? Are there different levels of constraints?

28 views
Skip to first unread message

Tue Boesen

unread,
Jul 17, 2024, 3:44:02 AM (9 days ago) Jul 17
to or-tools-discuss
I am trying to add constraints to a problem while keeping a disjunction.

The approach I came up with to try and solve this problem have some weird behavior which I am trying to understand but so far unsuccessfully. 

Essentially I create a disjunction which forces the solver to pick one of two pickup/delivery routes, [{0,1}] or [{2,3},{4,5}] for one of these two routes I add a constraint.
Adding this constraint seems to force the solver into selecting that route even if the route is not the optimal choice.

I have tried to use routing.ActiveVar(node_index) in the constraint, such that the constraint is only added when that route is selected, but this does not seem to solve the issue.

What makes it even weirder is that I can get the solver to select the first option if the amount of slack time does not allow the second option to be acceptable. So I guess that adding the constraint does not exactly hard force the solver to select the second option, so why is it doing it in the first place?
Is there any way I can debug the solver and figure out what is going on internally when I run my code, because right now I do not understand what is happening or why it is making the choices it does.

I have attached the model

model.txt
Reply all
Reply to author
Forward
0 new messages