Optimization Under Stability Constraints