Optimization-Based Motion Planning For Dynamic Robotic Manipulation Of Physical Systems