Planning for optimal control and performance certification in nonlinear systems with controlled or uncontrolled switches. (April 2017)