Dynamic Simplex: Balancing Safety and Performance in Autonomous Cyber Physical Systems