Constrained annealing for systems with quenched disorder