Predicting and Optimizing Ergonomics in Physical Human-Robot Cooperation Tasks