Text this: Optimization of Dynamical Systems with Impulse Controls and Shocks