Model predictive control with memory-based discrete search for switched linear systems