Stochastic optimal control with perfect state information over a finite horizon