Text this: An integrated optimal control algorithm for discrete-time nonlinear stochastic system