Resource allocation with stochastic optimal control approach