moved get pre distance to front process of solveTSP