Survey propagation methods for efficient optimization and probing of glassy states