Idle time while loaded constraint #3846
Unanswered
odashevsky
asked this question in
Routing (and legacy CP) questions
Replies: 1 comment 1 reply
-
I would try: solver = routing.solver()
for index in range(routing.Size()): # all indices except end.
cond = solver.BoolVar(f'{index} is not empty')
solver.Add(cond == (load_dimension.CumulVar(index) != 0))
solver.Add(time_dimension.SlackVar(index) * cond <= 10min * cond) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello. We are solving a VRP problem and have encountered a requirement where a vehicle cannot idle while waiting for next location's window to open if it already carrying cargo. This means, currently solver finds a solution where a vehicle picks up a load from location A (within A's open window) and travels to B and sits there and waits for B to open (B has its own open window). Our restriction is that if vehicle has load onboard, it cannot sit idling for more than 10 minute, but the vehicle can wait indefinitely if vehicle is empty.
I think I need to use a conditional restriction and I know how to do a condition if the load is empty or not. I just not sure how to code the "idling at the location waiting for it to open no more than 10 minutes" part.
Any insight is appreciated. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions