in src/genetic_algorithm.py [0:0]
def calc_score_for_candidate(candidate):
# start with the distance from the warehouse to the first stop
warehouse_location = {'X': STARTING_WAREHOUSE_X, 'Y': STARTING_WAREHOUSE_Y}
sum = dist(warehouse_location, delivery_stop_locations[candidate.path[0]])
# then travel to each stop
for i in range(len(candidate.path) - 1):
sum += dist(delivery_stop_locations[candidate.path[i]], delivery_stop_locations[candidate.path[i + 1]])
# then travel back to the warehouse
sum += dist(warehouse_location, delivery_stop_locations[candidate.path[-1]])
return sum