fast_tsp.find_tour

fast_tsp.find_tour(dists, duration_seconds=2.0)

Find a tour using the fast heuristic.

Run a local solver to find a near-optimal TSP tour. For small problems, the exact solution is returned.

Parameters:
  • dists (Union[List[List[int]], ndarray]) – A distance matrix.

  • duration_seconds (float) – The maximum duration of the tour.

Return type:

List[int]

Returns:

A tour that is ideally near-optimal.

dists = [[0, 1], [1, 0]]
tour = fast_tsp.find_tour(dists)
print(tour)
# [0, 1]