comparing deterministic and stochastic optimization methods