Invia SMS: Deterministic and stochastic optimal control