A stochastic approach to the weighted-region problem : 1. the design of the path annealing algorithm