How to add lb and ub constraints to travel time in VRPTW (ortools)?

34 Views Asked by At

In a VRPTW problem, for each node i, and the next node j in a route, I want to make sure that the travel time(time of next node j minus time of node i) has a lower and upper bound. I don't mind which vehicle has the edge from i -> j, but I want to make sure their time difference satisfies the lb and ub.

It means: lb <= Time(j) - Time(i) <= ub, where i is the precedence of j in a route.

How can I implement this in ortools? Thanks a lot.

I have tried NextVar but I think the functionality of it is limited.

1

There are 1 best solutions below

0
Laurent Perron On

You can constraint the slack var of the dimension.

A good read is this old thread:

https://groups.google.com/g/or-tools-discuss/c/Ti-zDA0ipqM