Routing problem with no solution! #4283
-
Hey there, hope you are having a great day I'm building a routing system for sellers that need to spend time in multiple locations. This time varies for each location, and the sum of both service and transit times needs to be within the time capacity of my sellers. I tried to solve it as this example, but this solution was not including the service_time into the capacity of the sellers, for some reason: https://stackoverflow.com/questions/67948290/solving-time-constrained-cvrp-with-two-vehicle-types-in-google-or-tools What I tried to do to solve it, was to incorporate the service time in the transit callback, in this way: def combined_time_callback(from_index, to_index):
from_node = manager.IndexToNode(from_index)
to_node = manager.IndexToNode(to_index)
return int(data['service_time'][to_node] + data['time_matrix'][from_node][to_node])
transit_callback_index = routing.RegisterTransitCallback(combined_time_callback)
max_time_per_vehicle = data['capacity']
routing.AddDimension(
transit_callback_index,
0,
max_time_per_vehicle,
True,
"Time"
)
time_dimension = routing.GetDimensionOrDie("Time") but is still not working and not finding any solution. I've tried tooooons of different approaches to solve this, but have not found the right solution. I just need to create one big route that takes into consideration commuting and service times for each seller, and that the sum of both is within seller's capacity. Any idea what can I do to solve this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
look good to me, except usually we use service time of the |
Beta Was this translation helpful? Give feedback.
look good to me, except usually we use service time of the
from_node
aka thetime_dimension.CumulVar(X)
represents the arrival time at location X, then the transit is compose of the service time X + the travel time X->Y.