I have a vehicle routing problem that I’m trying to solve with ortools
for python.
My depot is at location 0. For each assignment i->j
(which means pickup at location i
, delivery at location j
) I create distinct nodes i
and j
. Depot creates another distinct node. Since assignments can have common endpoints, this means that each location is duplicated into several nodes. In a dataframe, I store each nodes original location.
For assignments, each load and unload time lasts for 10min. I have a dimension VehicleTotalTime
(with slack and needs not start at 0) that measures how many seconds each vehicle spent. How do I create constraints that at depot, there are at most 5 vehicles at any given time, and at stores, there is at most 1 vehicle at any given time?
Is there a way to create a dimension for each location, that counts how many vehicles are there at each time?
TLDR: Please take a look at the resource constraints guide:
https://developers.google.com/optimization/routing/cvrptw_resources
3