Shop Optimal Design Of Control Systems: Stochastic And Deterministic Problems