Directed annealing search in constraint satisfaction and optimization