So, I defined a negative distance:
def negative_distance_callback (from_index, to_index):
"""
return the negative distance, use for minimization
"""
return -1 * distance_callback(from_index, to_index)
transit_neg_callback_index = routing.RegisterTransitCallback(negative_distance_callback)
dimension_name = 'Negative_Distance'
routing.AddDimension(
transit_neg_callback_index,
0, # no slack
-1000, # vehicle minimum travel distance
True, # start cumul to zero
dimension_name)
negative_distance_dimension = routing.GetDimensionOrDie(dimension_name)
negative_distance_dimension.SetGlobalSpanCostCoefficient(100)
My idea is that, the cumulative negative distance should not be larger than -1000, so the true total distance should not be less than 1000.
However, the code results an error: "Check failed: min_capacity >= 0 (-1000 vs. 0) "
So, how could I define the minimum constraint?
Thanks