opty: Software for trajectory optimization and parameter identification using direct collocation

Jason K. Moore, Antonie van den Bogert
2018 Journal of Open Source Software  
opty is a tool for describing and solving trajectory optimization and parameter identification problems based on symbolic descriptions of ordinary differential equations and differential algebriac equations that describe a dynamical system. The motivation for its development resides in the need to solve optimal control problems of biomechanical systems. The target audience is engineers and scientists interested in solving nonlinear optimal control and parameter identification problems with
more » ... al computational overhead. A user of opty is responsible for specifying the system's dynamics (the ODE/DAEs), the cost or fitness function, bounds on the solution, and the initial guess for the solution. opty uses this problem specification to derive the constraints needed to solve the optimization problem using the direct collocation method (Betts 2010). This method maps the problem to a non-linear programming problem and the result is then solved numerically with an interior point optimizer IPOPT (Wächter and Biegler 2006) which is wrapped by cyipopt (cyipopt Developers 2017) for use in Python. The software allows the user to describe the dynamical system of interest at a high level in symbolic form without needing to concern themselves with the numerical computation details. This is made possible by utilizing SymPy (Meurer et al. 2017) and Cython (Behnel et al. 2011) for code generation and justin-time compilation to obtain wrap optimized C functions that are accessible in Python. Direct collocation methods have been especially successful in the field of human movement (Ackermann and Bogert 2010, A. J. van den Bogert et al. ( 2012) ) because those systems are highly nonlinear, dynamically stiff, and unstable with open loop control. Typically, closed-source tools were used for multibody dynamics (e.g. SD/Fast, Autolev), for optimization (SNOPT), and for the programming environment (Matlab). Recently, promising work has been done with the Opensim/Simbody dynamics engine (Lee and Umberger 2016, Lin and Pandy (2017) ), but this requires that Jacobian matrices are approximated by finite differences. In contrast, opty provides symbolic differentiation which makes the code faster and prevents poor convergence when the severe nonlinearity causes finite differences to be inaccurate. Furthermore, opty allows the system to be formulated using an implicit differential equation, which often results in far simpler equations and better numerical conditioning. The first application of opty was in the identification of feedback control parameters for human standing (Moore and Bogert 2015). It should be noted that opty can use any dynamic system model and is not limited to human movement. Presently, opty only implements first order (backward Euler) and second order (midpoint Euler) approximations of the dynamics. Higher accuracy and/or larger time steps can be achieved with higher order polynomials (Patterson and Rao 2014), and opty could be extended towards such capabilities. In our experience, however, the low order discretizations provide more robust convergence to the globally optimal trajectory in a nonlinear system when a good initial guess is not available (Zarei 2016).
doi:10.21105/joss.00300 fatcat:7mcmfmswm5gildog5qeuahwqfi