-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Vehicle routing with minimum locations per route. #261
Comments
I'm not quite sure what you want by point 4. Setting a cost of a vehicle maybe the way to do it? """
# Create a set of vehicles, the number set by the length of capacity.
vehicles = Vehicles(capacity=capacity, cost=cost)
""" See cvrptw_plot.py for an example. If I understand things correctly, doing it this way, a vehicle cost will be added if the vehicle is used. Setting this cost high will prevent vehicle 'under use' |
Thanks for the quick reply Martin. Basically we have a requirement like vehicle should be operated only if the By setting up penalty as weight of order, we are able to make sure heavy Hope this clarifies. On 19 Oct 2016 11:12 pm, "Martin West" notifications@github.com wrote:
|
Today after some testing, I ran into yet another issue with penalty where it is not working as expected. For instance, for the the following configuration,
When I add the following disjunction it gives me C1, C2, C3 in route Where as when I add the following disjunction it gives me C4 in route I expected it should have given C1,C2 & C3 for both the cases as their penalty is higher than the penalty of C4. Can you check and let me know what might be going wrong? |
Hi, |
If you want a hard constraint, you can simply add a constant dimension of value 1 and add a constraint on the cumulative var of this dimension at the end of each vehicle end. |
For the critical customer, you should add a disjonction around each not critical node and the solver will be able to skip them (at some high cost). |
like proposed in #515 you can use: minimum_allowed_capacity = 42 # put your 4. requirement value here
capacity = "Capacity"
routing.AddDimension(
demand_evaluator, # function which return the load at each location (cf. cvrp.py example)
0, # null capacity slack
data.vehicle.capacity, # vehicle maximum capacity
True, # start cumul to zero
capacity)
capacity_dimension = routing.GetDimensionOrDie(capacity)
for vehicle in xrange(vehicle_number):
capacity_dimension.CumulVar(routing.End(vehicle)).RemoveInterval(0, minimum_allowed_capacity) |
I am trying to solve very similar problem mentioned in #4 above. minimum_allowed_capacity = 42 # put your 4. requirement value here |
Hi Mizux, Thanks in advance. |
try to use this instead: or-tools/ortools/constraint_solver/routing.h Lines 2516 to 2526 in b77bd3a
|
Thank you in advance |
strange, seems a bug.
|
Hi,
data['num_vehicles'] = 16 |
you must use counter_dimension = routing.GetDimensionOrDie('Capacity')
for vehicle_id in range(data['num_vehicles']):
counter_dimension.SetCumulVarSoftLowerBound(routing.End(vehicle_id), 30, 100000) |
Hi Mizux, Google Colab Link: https://colab.research.google.com/drive/1zrBibaeAZErSuihjwSvlXeDNSHOZ1PwT?usp=sharing Result : Thank you in Advance |
Hi,
I have been trying to use the or-tools routing model for generating routes with the following constraints,
I am able to implement (1), (2) and (3) following the wiki docs and code samples. But not sure how to achieve (4). I tried to use SetEndCumulVarSoftLowerBound on capacity dimension but results to be not optimal. As I change the value of the cumulVar parameter in the method, results varies a lot and skips entries for certain cumulVar.
Any pointers and help on implementing (4) along with 1..3 would be really helpful.
I am pasting the code I use for creating model below for reference.
The text was updated successfully, but these errors were encountered: