1

I'm testing VRPTW with Resource Constraints example from official website. Everything is fine except for 1 thing: If I set too many vehicles in data model and that will cause some unused vehicles and unused routes. Unused vehicles will still occupy depot capacity and cause inefficient routes planning. In my case, I'd rather like vehicles not to occupy depot capacity when they're unused.

In the following mock example, vehicle 0 & 1 occupied depot and caused postponing departure for vehicle 2 & 3.

Route for vehicle 0:
0 Time(0,0) -> 0 Time(20,20)
Time of the route: 20min

Route for vehicle 1:
0 Time(5,5) -> 0 Time(25,25)
Time of the route: 20min

Route for vehicle 2:
0 Time(10,10) -> 1 Time(17,17) -> 2 Time(25,25) -> 0 Time(30,30)
Time of the route: 20min

Route for vehicle 3:
0 Time(15,15) -> 3 Time(17,20) -> 4 Time(30,30) -> 0 Time(35,35)
Time of the route: 20min

In my case, I'd rather like vehicles not to occupy depot when they're unused. Does anyone know how to do that?

I have try to add solver.IsVehicleUsed and solver.IsDifferentCstCt into the following constraints but failed. Please help (examples would be much appreciated), Thanks!

depot_usage = [1 for i in range(len(intervals))]
   solver.Add(
       solver.Cumulative(intervals, depot_usage, data['depot_capacity'], 'depot'))
  • i also face this issue. my solution is when i have number of vehicle in request, i do for loop for vehicle from 1 to `total vehicle`, loop will stop when i found the unused vehicle. then i know how much vehicle i need in reality – uncle bob Oct 08 '21 at 16:15

0 Answers0