-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modelling additional constraint for node during delivery #725
Comments
I think you are looking for adding some You'll need to use |
Thanks @Mizux for the suggestion. Unfortunately, the nodes I'm working with are disjunctive - it's not possible to control this via capacity of the depot. Is there something similar to AddNoOverlap for interval in routing model? |
Don't get it, why disjunctive constraint will interfere with the following constraint ? solver = routing.solver()
intervals = []
for i in range(num_location):
# Add time windows for each location
intervals.append(
solver.FixedDurationIntervalVar(
routing.CumulVar(routing.NodeToIndex(i), time),
42, # to tweak according to your delivery time
"loc_{} interval".format(i))) then you can set that you can only have one interval at a time i.e. no overlap... # Constrain the number of maximum simultaneous intervals accross location.
shared_ressource_capacity = 1
shared_ressource_usage = [1 for i in range(num_locations)]
solver.AddConstraint(
solver.Cumulative(
intervals,
shared_usage,
shared_capacity,
"SharedRessource")) you may be intested in |
Thank @Mizux – I misunderstood the earlier hint with regards to the example. I’m able to add the shared capacity into the model now. However I seem to encounter slightly strange result for some of the input. The model is a modified model from CVRP model. Changes made were
The result from the solve (original data node 18 – with 1time unit service time)
From shared resources perspective:
From this, we can see that node 29 and 18 are served at the same time despite of using the shared resources. Increasing service time to > 1 will eliminate this behavior. The second issue encountered when trying to add more than one shared resources constraints into the model. For this case, the set {1,1 6} was changed to required both shared resource A&B.
For this case, set {1, 16}, node 16 was visited between 79-97 and required resources of A & B. However, I also have node 31 being served between times 90-99 requiring resource B. Appreciate your input on this |
My 2 cents,
I would say for node 18 in range [72,73] and node 29 in range [72,74] means solver find several solutions:
-> solver return 18 in range [72,73] and 29 in range [72,74] since there is feasible solution, up to you to solve the "details" of interpretation. Solver return a aggregate of range for each node not a "collection" of range with constraint/relation/interdependence with other node range. |
Thanks for the clear explanation. One final question, is there example I can refer to change the objective value of the model? I'm more interested in minimizing makespan rather than the total time vehicle spent in the system. |
I would say https://developers.google.com/optimization/routing/vrp#global_span you have an example usage. and my comment on GlobalSpan in #685 (comment) One caveat: for first strategy you must specify a setArcCost() to steer the solver to find a first "good" solution, side effect cost of the route is added to the objective 😞 |
I’m working on a vehicle routing problem in which when a vehicle visits a nose, it required some additional resources to unload during delivery. These resources are drawn from a pool which can be shared across all nodes. The only constraint is these resources cannot be used simultaneously.
Does anyone have tips and/or example for this? Thanks
The text was updated successfully, but these errors were encountered: