fast_tsp.solve_tsp_exact

fast_tsp.solve_tsp_exact(dists)

Solve the TSP using the exact algorithm.

Solves TSP optimally using the bottom-up Held-Karp’s algorithm in \(O(2^n * n^2)\) time. This is tractable for small n but quickly becomes untractable for n even of medium size.

Parameters:

dists (Union[List[List[int]], ndarray]) – The distance matrix.

Return type:

List[int]

Returns:

An optimal tour for the problem instance.