Quantcast
Channel: ORTools - vehicle routing - minimize package time en route - Stack Overflow
Viewing all articles
Browse latest Browse all 2

ORTools - vehicle routing - minimize package time en route

$
0
0

I am creating solution for vehicle routing with pickup and deliveries. My objective is to minimize time that each packages is being transported (the domain is food delivery and we wont to make the time between the food preparation and it's delivery as short as possible). My idea was to create a variable for each pickup-delivery pair and tell the routing to minimize it:

solver = routing.solver()diff = solver.IntVar(0, MAX_TIMESTAMP_VALUE, f'diff_{pickup_node}_{delivery_node}')solver.Add(diff == time_dimension.CumulVar(delivery_index) - time_dimension.CumulVar(pickup_index))routing.AddWeightedVariableMinimizedByFinalizer(diff, 1) 

Unfortunately this does not work - it seems that the solver completly ignores this objective and produces the same solution as without it. Could someone advise me, what is the problem?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images