def dist()

in src/genetic_algorithm.py [0:0]


def dist(location_a, location_b):
    # for this problem, we are assuming a grid of streets where each delivery stop is located at an intersection.
    # this means that travelling from one to another is the delta X + delta Y distance.
    # (this problem assumes all streets are two-way)
    xdiff = abs(location_a['X'] - location_b['X'])
    ydiff = abs(location_a['Y'] - location_b['Y'])
    return xdiff + ydiff