VRP: Constraining the difference of 2 cumul variables #4550
Unanswered
rishab9750
asked this question in
Routing (and legacy CP) questions
Replies: 1 comment 1 reply
-
May be you could try something like this. IntVar* difference = solver.MakeDifference(dimension.CumulVar(dropoff), dimension.CumulVar(pickup)).Var();
solver.AddConstraint(solver.MakeLessOrEqual(difference, allowed_transit_time)); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am working on a VRP, where I need to constrain the difference between two cumulative variables.
In particular, the model contains a series of Pickup and Dropoff node pairs. The model also has a time_dimension. Each pickup and dropoff node have a cumulative variable associated with the time_dimension.
I need to constrain the following:
time_dimesion_cumvar_at_dropoff - time_dimesion_cumvar_at_pickup <= allowed_transit_time
allowed_transit_time is a constant
I'm aware of how to set a constraint on a single cumulative variable, e.g. constraining time_dimesion_cumvar_at_dropoff to occur within some time window. However, my goal is to constraint the difference between two different cumulative variables. How can this be achieved?
Beta Was this translation helpful? Give feedback.
All reactions