Skip to main content

Treatment Optimization

Prerequisites

To utilize Treatment Optimization, you will need a valid GPOPS-II license and have it downloaded and set up with MATLAB. GPOPS-II is a powerful direct collocation optimal control solver that forms the core of Treatment Optimization.

Purchase GPOPS-II

GPOPS-II Setting Files

GPOPS-II offers two nonlinear problem (NLP) solvers: SNOPT and IPOPT. SNOPT utilizes a quasi-Newton SQP active set method, while IPOPT employs an interior-point method. The choice of solver and settings depends on convergence and computation time considerations. We suggest using IPOPT in first derivative mode as the NLP solver without mesh refinement as we do in the tutorials and examples provided.

tip

For more information regarding GPOPS-II settings, click here

Background

Treatment Optimization is an advanced tool that harnesses the power of neuromusculoskeletal modeling and optimal control techniques to revolutionize the field of biomechanics and human movement analysis. By combining the capabilities of OpenSim and GPOPS-II, Treatment Optimization offers a comprehensive solution for optimizing control strategies and generating predictions of human movement.

At its core, Treatment Optimization consists of three modules: Tracking Optimization, Verification Optimization, and Design Optimization. These modules work together to gradually refine and improve the predicted movement patterns.

The Tracking Optimization module focuses on finding the optimal control strategies, either torque-driven or synergy-driven, that closely match the experimental motion, moments, external loads (if applicable), and muscle activity (if applicable). By minimizing the discrepancy between the predicted and experimental data, Tracking Optimization aims to reproduce the experimental movement.

The Verification Optimization module ensures that the calibrated controllers, derived from Tracking Optimization, can reproduce the experimental data even when tracking those quantities is eliminated. This validation step enhances the reliability and robustness of the predictions generated by Treatment Optimization.

The Design Optimization module offers users the flexibility to test and explore various treatment strategies by customizing cost functions, path constraints, and terminal conditions. Design Optimization empowers researchers, clinicians, and practitioners to tailor the treatment to the specific needs and goals of the individual, paving the way for optimized outcomes and improved patient care.

Treatment Optimization enforces skeletal dynamic constraints and ensures consistency between muscle-produced moments and inverse dynamic moments. This important aspect helps to ensure that the predicted movements are dynamically consistent and align with the physiological principles governing human motion.

Significance

Treatment Optimization plays a crucial role in enhancing our understanding of neuromusculoskeletal dynamics and improving treatment strategies. By providing researchers and practitioners with a powerful tool to optimize control strategies and predict human movement, Treatment Optimization opens doors for personalized treatment plans and enhanced athletic performance. The ability to generate predictions easily using Treatment Optimization significantly contributes to advancements in personalized and tailored treatment plans, ultimately leading to improved outcomes and an enhanced quality of life for individuals.

Problem Formulation

When solving direct collocation optimal control problems involving human movement, implicit skeletal dynamics have been found to work better than explicit skeletal dynamics. However, GPOPS-II does not directly handle implicit dynamics and requires explicit dynamics for dynamic constraints.

To address this limitation of GPOPS-II, an implicit form of skeletal dynamics is introduced in the path constraints of GPOPS-II within Treatment Optimization. This formulation requires treating coordinate acceleration as an additional control variable. The kinematic derivative relationships, where coordinate acceleration is the first-time derivative of coordinate velocity, and coordinate velocity is the first-time derivative of coordinate position, are utilized to establish the required explicit dynamics. A coordinate acceleration minimization term is included in the cost function to ensure that the coordinate acceleration controls are unique. Allowing for the enforcement of implicit skeletal dynamics in GPOPS-II, even though the solver itself does not inherently handle implicit dynamics.

Common File Settings

Input Data

  • tracked_quantities_directory - Directory that contains the quantities that the optimal control problem will track in a cost term. This directory commonly includes coordinate positions, coordinate loads, external forces, muscle moment arms, and EMG data.

  • initial_guess_directory - Directory that contains the quantities that the optimal control problem will use to construct an initial guess. This directory is commonly the same as the tracked_quantities_directory, but can be different if desired. If there are quantities in the tracked_quantities_directory but not in the initial_guess_directory, the initial guess for those quantities is taken from the tracked_quantities_directory.

  • input_model_file - The OpenSim model file that you are using.

  • input_osimx_file - The NMSM Pipeline model file that corresponds to this run. This file is only required if you are using a GCP contact model, or synergy controls.

  • surrogate_model_data_directory - Directory that contains joint angles and moment arms that will be used to fit a surrogate muscle model.

Design Variable Bounds Terms

The search space for the both states and controls are specified using the following xml elements:

  • joint_position_range_scale_factor
  • joint_velocity_range_scale_factor
  • joint_acceleration_range_scale_factor

Instead of assigning the upper and lower bounds for each state (ex. joint position, joint velocity, etc.), we assign a range multiple that applies for all coordinates. The range multiple works as follows for any joint and for both states and controls.

upperLimit(statePositions)=max(q1,2,3,...n)+jointPositionsMultiplerange(q1,2,3,...n)upperLimit(statePositions)= max(q_{1,2,3,...n}) + jointPositionsMultiple * range(q_{1,2,3,...n})
lowerLimit(statePositions)=min(q1,2,3,...n)jointPositionsMultiplerange(q1,2,3,...n)lowerLimit(statePositions)= min(q_{1,2,3,...n}) - jointPositionsMultiple * range(q_{1,2,3,...n})
Synergy driven controller
upperLimit(synergyActivations)=maxSynergyActivationsupperLimit(synergyActivations)= maxSynergyActivations
lowerLimit(synergyActivations)=0;lowerLimit(synergyActivations)= 0;
upperLimit(synergyWeights)=maxSynergyWeightsupperLimit(synergyWeights)= maxSynergyWeights
lowerLimit(synergyWeights)=0;lowerLimit(synergyWeights)= 0;
Torque driven controller
upperLimit(torqueController)=max(load1,2,3,...n)+torqueControlMultiplerange(load1,2,3,...n)upperLimit(torqueController)= max(load_{1,2,3,...n}) + torqueControlMultiple * range(load_{1,2,3,...n})
lowerLimit(torqueController)=min(load1,2,3,...n)torqueControlMultiplerange(load1,2,3,...n)lowerLimit(torqueController)= min(load_{1,2,3,...n}) - torqueControlMultiple * range(load_{1,2,3,...n})

For more detail on how to work through the Treatment Optimization toolset, visit the hands-on Torque-Driven Treatment Optimization and Synergy-Driven Treatment Optimization tutorials.