Home / Computer science / Traveling salesman problem (TSP) / Computation: Python, Nearest neighbor heuristic (NN)
Postcondition: Total distance
Make sure the total distance is correct.
assert y == np.sum(d[x, np.roll(x, 1)])
Home / Computer science / Traveling salesman problem (TSP) / Computation: Python, Nearest neighbor heuristic (NN)
Make sure the total distance is correct.
assert y == np.sum(d[x, np.roll(x, 1)])