An optimal Bayesian process control for flexible manufacturing processes