Real-time Decision Making in Control and Optimization with Performance and Safety Guarantees