VRP model with maximum time constraint #2965
Unanswered
annis-souames
asked this question in
Routing (and legacy CP) questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been able to solve a vrp problem with ortools, but I have to add a new constraint, where the overall time of a route for a given vehicle should always be less then a maximum, obviously in this case I would add a new Dimension for Time and set a maximum equal to the constant
T_MAX
, however when I print the time of the route I'm usingassignment.min(time_var)
wheretime_var = time_dimension.CumulVar(index)
, but it shows inaccurate results even though they always stay lower than T_MAX.I have t(i)(j) which is the time to go from i to j, since the speed is constant, I'm just dividing d(i)(j) which I already have from solving the standard vrp, over the speed constant, I also have s(i) which is the service time (waiting time, it must wait that exact time) for a given node I.
I want to print the time of a route while respecting the constraint
t(i)(j) + s(i) < T_MAX
When I print the distance of the route, the time of the route, and the sum of s(i) in the route for each vehicle, and I check by dividing route distance over speed and adding the sum of service time for that route and compare it to route time returned by assignment.Min it's very far.
Here are the related parts of my code:
Notes:
find_real_index
is just a helper function I made because of my VRP model (I have duplicates of nodes which should be printed as the same node, so this function does the mapping)So how can I achieve such constraint, are there some functions to use that can achieve t[i][j] + s[i] < T_MAX ?
I can't use slackmax, because I have to wait exacly s[i] hours on node i .
Beta Was this translation helpful? Give feedback.
All reactions