Department of Movement Sciences, KU Leuven, Leuven, Belgium.
Department of Mechanical Engineering, Universitat Politècnica de Catalunya, Barcelona, Catalunya, Spain.
PLoS One. 2019 Oct 17;14(10):e0217730. doi: 10.1371/journal.pone.0217730. eCollection 2019.
Algorithmic differentiation (AD) is an alternative to finite differences (FD) for evaluating function derivatives. The primary aim of this study was to demonstrate the computational benefits of using AD instead of FD in OpenSim-based trajectory optimization of human movement. The secondary aim was to evaluate computational choices including different AD tools, different linear solvers, and the use of first- or second-order derivatives. First, we enabled the use of AD in OpenSim through a custom source code transformation tool and through the operator overloading tool ADOL-C. Second, we developed an interface between OpenSim and CasADi to solve trajectory optimization problems. Third, we evaluated computational choices through simulations of perturbed balance, two-dimensional predictive simulations of walking, and three-dimensional tracking simulations of walking. We performed all simulations using direct collocation and implicit differential equations. Using AD through our custom tool was between 1.8 ± 0.1 and 17.8 ± 4.9 times faster than using FD, and between 3.6 ± 0.3 and 12.3 ± 1.3 times faster than using AD through ADOL-C. The linear solver efficiency was problem-dependent and no solver was consistently more efficient. Using second-order derivatives was more efficient for balance simulations but less efficient for walking simulations. The walking simulations were physiologically realistic. These results highlight how the use of AD drastically decreases computational time of trajectory optimization problems as compared to more common FD. Overall, combining AD with direct collocation and implicit differential equations decreases the computational burden of trajectory optimization of human movement, which will facilitate their use for biomechanical applications requiring the use of detailed models of the musculoskeletal system.
算法微分(AD)是评估函数导数的有限差分(FD)的替代方法。本研究的主要目的是展示在基于 OpenSim 的人体运动轨迹优化中使用 AD 替代 FD 的计算优势。次要目的是评估包括不同的 AD 工具、不同的线性求解器以及使用一阶或二阶导数在内的计算选择。首先,我们通过自定义源代码转换工具和 ADOL-C 的运算符重载工具使 AD 能够在 OpenSim 中使用。其次,我们开发了 OpenSim 和 CasADi 之间的接口来解决轨迹优化问题。第三,我们通过平衡扰动模拟、二维预测步行模拟和三维跟踪步行模拟来评估计算选择。我们使用直接配置和隐式微分方程执行所有模拟。使用我们的自定义工具的 AD 比使用 FD 快 1.8±0.1 到 17.8±4.9 倍,比使用 ADOL-C 的 AD 快 3.6±0.3 到 12.3±1.3 倍。线性求解器的效率取决于问题,没有一个求解器始终更有效。对于平衡模拟,使用二阶导数更有效,但对于步行模拟则效率较低。步行模拟具有生理现实性。这些结果强调了与更常见的 FD 相比,AD 的使用如何大大减少了轨迹优化问题的计算时间。总的来说,将 AD 与直接配置和隐式微分方程结合使用,可以降低人体运动轨迹优化的计算负担,从而促进其在需要使用肌肉骨骼系统详细模型的生物力学应用中的使用。