Optimization and Learning Algorithms for 3D Human Motion