Your problem seems to be NP-Complete. If you are trying to
find the best set by enumerating every possible one it would
be exactly the Traveller salesman problem. To this set of
problems there isn't a reasonable(polinomial) solution in
this nowadays machines. The best solution is try to find
good heuristic to search for suboptimal solutions. Perhaps
you can think in another way to achieve the results.