Flexible and Generalized Uncertainty Optimization