Optimal control of constrained switched systems and application to electrical vehicle energy management. (November 2018)