modified heuristic to take into account route costs.