A Machine Learning-Based Approach To Cybersecurity And Safety Of Model Predictive Control Systems