We present numerical methods for hierarchical dynamic optimization problems. The problem setting is the following: A regression objective on the upper level and a nonlinear optimal control problem (OCP) in ordinary differential equations with discontinuities and mixed path-control constraints on the lower level. The OCP can be considered as a model (a so-called optimal control model (OCM)) that describes optimal processes in nature, such as human gait. However, the optimal control model includes unknown parameters that have to be determined by fitting the OCM to measurements (which is the upper level optimization problem). We present an efficient direct all-at once approach for solving this new class of problems. The main idea is the following: We discretize the infinite dimensional bilevel problem where we use multiple shooting for the state discretization, replace the lower level nonlinear program (NLP) by its first order necessary conditions (KKT conditions), and solve the resulting complex NLP, which includes first order derivatives and a complementarity constraint, with a tailored sequential quadratic programming (SQP) method. The complementarity constraint is treated by a new lifting technique that will be discussed in detail. We have implemented this approach and use it to identify an optimal control model for a cerebral palsy patient from real-world motion capture data that has been provided by the Motion Lab of the Orthopaedic Clinics Heidelberg. |