Model-Based Motion Optimization For Quadruped Robots With An Actuated Articulated Torso