TSP with dynamic programming algorithm