Stochastic Minimization with Adaptive Memory