Optimal design of dynamic systems under uncertainty