A dynamic programming heuristic for the P-median problem