GraphHopper.com | Forum | GitHub | Maps | Blog

Restrict Time Window for Vehicle Type


#1

Is it possible to restrict some Time Windows for only a specified set of Vehicle Types? The problem I’m trying to solve is that in some cities the Time Windows during the day can only be attended by small vehicles, while Time Windows during the night can also be attended by bigger vehicle types.


#2

Hi @LCenteleghe,

A workaround I can think of is that you make siblings for such jobs, then use skills or constraints to formulate the job-vehicle restrictions, and add a constraint to make sure only one of the siblings is assigned.

For example, assume you have a Delivery d1 which can be served by bikes in time window TW1 and can be served by cars in time windows TW1 and TW2. When building the vrp, instead of adding one job d1, you add two jobs d1_bikes and d1_cars, and d1_bikes bears time window TW1 while d1_cars bears TW1 and TW2. Then you can use skills or constraints to make sure d1_bikes can only be served by bikes and d1_cars can only be served by cars. And you also need a constraint to make sure only one of d1_bikes and d1_cars is assigned.

Best regards,
He