Home / Computer science / Traveling salesman problem (TSP) / Computation: Python, Nearest neighbor heuristic (NN)
Postcondition: Permutation
Make sure the output is a permutation of the input.
np.array_equal(np.sort(x), np.arange(n))
Home / Computer science / Traveling salesman problem (TSP) / Computation: Python, Nearest neighbor heuristic (NN)
Make sure the output is a permutation of the input.
np.array_equal(np.sort(x), np.arange(n))