Optimality, stochasticity, and variability in motor behavior