Q function (learning to optimize when the model is not available)