A polynomial solution to regulation and tracking. II. Stochastic problem