Martingale conditions for the optimal control of continuous time stochastic systems