Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
881 B
2
Indexable
Never
# number = Add number of vendors here and uncomment
distance_matrix = np.load('distance_matrix_short.npy')[:number,:number]
initial_total_distance = np.trace(distance_matrix) 
distance_initial = [distance_matrix[i, i].item() for i in range(number)]

print("Total Initial Distance: ", np.sum(distance_initial), "Initial Assignment distance: ", distance_initial)
max_values = (np.argsort(distance_initial)[-10:])
print("Vendor IDs with max distances: ", [i for i in max_values])
print("Distances: ", [distance_initial[i] for i in max_values])
print("Number of vendors with distance above 10kms in initial assignment: ", len([i for i in distance_initial if i >= 10]))
print("Initial total actions: ", number * number)
print("Number of possible actions after removing actions with distance > 10kms:", (number*number) - len([i for i in distance_matrix.flatten() if i >= 10]))
Leave a Comment