GPU-Accelerated Pseudospectral Methods for Optimal Control Problems
Abstract
1. Introduction
2. Pseudospectral Method with GPU Acceleration
2.1. Optimal Control Problem Formulation
2.2. Pseudospectral Discretization
2.3. GPU Acceleration
- Function Evaluation: Evaluation of the objective function, constraints, and their derivatives, including the Jacobian and the Hessian of the Lagrangian;
- NLP Algorithm: An iterative algorithm that updates the decision variables based on the function evaluations to find an optimal solution;
- Linear Algebra Solver: A solver for the KKT linear systems that arise in each iteration of the NLP solver, often involving factorization of large sparse symmetric indefinite matrices.
- Objective Function Evaluation: The integral cost function is approximated as a sum over all subintervals and collocation points. The contribution to the cost from each collocation point is computed in parallel. These values are then summed efficiently using parallel reduction techniques on the GPU to obtain the total cost.
- Dynamics and Path Constraint Evaluation: To evaluate the system dynamics and path constraints in parallel, we assign the calculations for each collocation point to a separate GPU thread. This allows for simultaneous computation of all dynamics and path constraints, reducing evaluation time. The matrix multiplications on the left-hand side of Equation (10) are less computationally demanding and are performed on the CPU using sparse matrix operations.
- Jacobian and Hessian Computation: Second-order optimization methods require the construction of the constraint Jacobian and the Hessian of the Lagrangian. The sparsity patterns of these matrices are fixed and can be determined beforehand. The first and second derivatives of the objective and constraint functions are independent for each collocation point, except for the terms involving matrix multiplication in the dynamics. We compute these derivatives in parallel on the GPU, with each thread calculating the derivatives for a single collocation point. This computation is performed sparsely, using pre-generated expressions for each nonzero entry in the Jacobian and Hessian. Since the differentiation matrix is sparse and fixed for a given discretization, the first derivatives of the matrix multiplication terms are handled by memory copy operations, and their second derivatives are zero.
3. Numerical Experiment
3.1. Low-Thrust Trajectory Optimization Problem
3.2. Problem Setup
3.2.1. Initial and Final Conditions
3.2.2. Problem Discretization Parameters
3.2.3. Initial Guess Generation
3.2.4. Software Implementation
3.2.5. Hardware Environment
3.3. Performance Analysis
3.3.1. Solution Accuracy
- For a given number of subintervals M, the CPU and GPU solutions agreed with at least 10 significant digits in the objective value J, as computed by both implementations.
- Solutions computed with different numbers of subintervals agreed with the value reported by Jiang et al. [37] with a relative error of less than 0.01% in the objective value J.
3.3.2. Time Breakdown
3.3.3. Overall Performance
- Full Offload: All components (objective function, gradient, constraints, Jacobian, and Hessian) are computed on the GPU.
- Heterogeneous Offload: Only the Hessian evaluation is offloaded to the GPU, while the other components are computed on the CPU.
4. Discussion and Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Abbreviations
CPU | Central processing unit |
GPU | Graphics processing unit |
CUDA | Compute Unified Device Architecture |
NLP | Nonlinear programming |
TPBVP | Two-point boundary value problem |
FFT | Fast Fourier transform |
MPC | Model predictive control |
KKT | Karush–Kuhn–Tucker |
LG | Legendre–Gauss |
LGR | Legendre–Gauss–Radau |
LGL | Legendre–Gauss–Lobatto |
MEE | Modified equinoctial element |
AU | Astronomical unit |
SIMD | Single instruction, multiple data |
References
- Betts, J.T. Survey of Numerical Methods for Trajectory Optimization. J. Guid. Control Dyn. 1998, 21, 193–207. [Google Scholar] [CrossRef]
- Andres-Martinez, O.; Palma-Flores, O.; Ricardez-Sandoval, L. Optimal control and the Pontryagin’s principle in chemical engineering: History, theory, and challenges. AIChE J. 2022, 68, e17777. [Google Scholar] [CrossRef]
- Baleanu, D.; Jajarmi, A.; Sajjadi, S.; Mozyrska, D. A new fractional model and optimal control of a tumor-immune surveillance with non-singular derivative operator. Chaos Interdiscip. J. Nonlinear Sci. 2019, 29, 083127. [Google Scholar] [CrossRef] [PubMed]
- Kelly, M. An Introduction to Trajectory Optimization: How to Do Your Own Direct Collocation. SIAM Rev. 2017, 59, 849–904. [Google Scholar] [CrossRef]
- Wang, J.; Cui, N.; Wei, C. Optimal Rocket Landing Guidance Using Convex Optimization and Model Predictive Control. J. Guid. Control Dyn. 2019, 42, 1078–1092. [Google Scholar] [CrossRef]
- Benedikter, B.; Zavoli, A.; Colasurdo, G.; Pizzurro, S.; Cavallini, E. Convex Approach to Three-Dimensional Launch Vehicle Ascent Trajectory Optimization. J. Guid. Control Dyn. 2021, 44, 1116–1131. [Google Scholar] [CrossRef]
- Gao, Y. Near-Optimal Very Low-Thrust Earth-Orbit Transfers and Guidance Schemes. J. Guid. Control Dyn. 2007, 30, 529–539. [Google Scholar] [CrossRef]
- Quarta, A.A.; Mengali, G.; Bassetto, M.; Niccolai, L. Optimal Interplanetary Trajectories for Sun-facing Ideal Diffractive Sails. Astrodynamics 2023, 7, 285–299. [Google Scholar] [CrossRef]
- Lu, P.; Sandoval, S.; Davami, C. Fast and Robust Optimization of Full Trajectory from Entry Through Powered Descent. J. Guid. Control Dyn. 2024, 47, 203–216. [Google Scholar] [CrossRef]
- Li, W.; Song, Y.; Cheng, L.; Gong, S. Closed-Loop Deep Neural Network Optimal Control Algorithm and Error Analysis for Powered Landing under Uncertainties. Astrodynamics 2023, 7, 211–228. [Google Scholar] [CrossRef]
- Ottesen, D.; Russell, R.P. Direct-to-Indirect Mapping for Optimal Low-Thrust Trajectories. Astrodynamics 2024, 8, 27–46. [Google Scholar] [CrossRef]
- Haberkorn, T.; Martinon, P.; Gergaud, J. Low Thrust Minimum-Fuel Orbital Transfer: A Homotopic Approach. J. Guid. Control Dyn. 2004, 27, 1046–1060. [Google Scholar] [CrossRef]
- Gill, P.E.; Murray, W.; Saunders, M.A. SNOPT: An SQP Algorithm for Large-Scale Constrained Optimization. SIAM J. Optim. 2002, 12, 979–1006. [Google Scholar] [CrossRef]
- Wächter, A.; Biegler, L.T. On the Implementation of an Interior-Point Filter Line-Search Algorithm for Large-Scale Nonlinear Programming. Math. Program. 2006, 106, 25–57. [Google Scholar] [CrossRef]
- Benson, D.A.; Huntington, G.T.; Thorvaldsen, T.P.; Rao, A.V. Direct Trajectory Optimization and Costate Estimation via an Orthogonal Collocation Method. J. Guid. Control Dyn. 2006, 29, 1435–1440. [Google Scholar] [CrossRef]
- Benson, D. A Gauss Pseudospectral Transcription for Optimal Control. Ph.D. Thesis, Massachusetts Institute of Technology, Cambridge, MA, USA, 2005. [Google Scholar]
- Garg, D.; Patterson, M.A.; Francolin, C.; Darby, C.L.; Huntington, G.T.; Hager, W.W.; Rao, A.V. Direct trajectory optimization and costate estimation of finite-horizon and infinite-horizon optimal control problems using a Radau pseudospectral method. Comput. Optim. Appl. 2011, 49, 335–358. [Google Scholar] [CrossRef]
- Kameswaran, S.; Biegler, L.T. Convergence rates for direct transcription of optimal control problems using collocation at Radau points. Comput. Optim. Appl. 2008, 41, 81–126. [Google Scholar] [CrossRef]
- Elnagar, G.; Kazemi, M.; Razzaghi, M. The pseudospectral Legendre method for discretizing optimal control problems. IEEE Trans. Autom. Control 1995, 40, 1793–1796. [Google Scholar] [CrossRef]
- Fahroo, F.; Ross, I.M. Costate Estimation by a Legendre Pseudospectral Method. J. Guid. Control Dyn. 2001, 24, 270–277. [Google Scholar] [CrossRef]
- Garg, D.; Patterson, M.; Hager, W.W.; Rao, A.V.; Benson, D.A.; Huntington, G.T. A Unified Framework for the Numerical Solution of Optimal Control Problems Using Pseudospectral Methods. Automatica 2010, 46, 1843–1851. [Google Scholar] [CrossRef]
- Wu, D.; Cheng, L.; Gong, S.; Baoyin, H. Low-Thrust Trajectory Optimization with Averaged Dynamics Using Analytical Switching Detection. J. Guid. Control Dyn. 2024, 47, 1135–1149. [Google Scholar] [CrossRef]
- Patterson, M.A.; Rao, A.V. Exploiting Sparsity in Direct Collocation Pseudospectral Methods for Solving Optimal Control Problems. J. Spacecr. Rocket. 2012, 49, 354–377. [Google Scholar] [CrossRef]
- Betts, J.T. Practical Methods for Optimal Control and Estimation Using Nonlinear Programming, Second Edition, 2nd ed.; Society for Industrial and Applied Mathematics: Philadelphia, PA, USA, 2010. [Google Scholar] [CrossRef]
- Jain, S.; Tsiotras, P. Trajectory optimization using multiresolution techniques. J. Guid. Control Dyn. 2008, 31, 1424–1436. [Google Scholar] [CrossRef]
- Fornberg, B. A Practical Guide to Pseudospectral Methods; Cambridge Monographs on Applied and Computational Mathematics, Cambridge University Press: Cambridge, UK, 1996. [Google Scholar]
- Lin, W.; Zhou, Q.; Chen, X.; Shi, W.; Ai, J. An Efficient GPU-Accelerated Algorithm for Solving Dynamic Response of Fluid-Saturated Porous Media. Mathematics 2025, 13, 181. [Google Scholar] [CrossRef]
- Murúa, N.; Coronel, A.; Tello, A.; Berres, S.; Huancas, F. GPU Accelerating Algorithms for Three-Layered Heat Conduction Simulations. Mathematics 2024, 12, 3503. [Google Scholar] [CrossRef]
- Chen, J.; Zhu, P. An Alternate GPU-Accelerated Algorithm for Very Large Sparse LU Factorization. Mathematics 2023, 11, 3149. [Google Scholar] [CrossRef]
- Treml, L.M.; Bartocci, E.; Gizzi, A. Modeling and Analysis of Cardiac Hybrid Cellular Automata via GPU-Accelerated Monte Carlo Simulation. Mathematics 2021, 9, 164. [Google Scholar] [CrossRef]
- Rastgar, F.; Masnavi, H.; Shrestha, J.; Kruusamäe, K.; Aabloo, A.; Singh, A.K. GPU Accelerated Convex Approximations for Fast Multi-Agent Trajectory Optimization. IEEE Robot. Autom. Lett. 2021, 6, 3303–3310. [Google Scholar] [CrossRef]
- Mena, H.; Pfurtscheller, L.M.; Stillfjord, T. GPU Acceleration of Splitting Schemes Applied to Differential Matrix Equations. Numer. Algorithms 2020, 83, 395–419. [Google Scholar] [CrossRef]
- Roccon, A. A GPU-ready Pseudo-Spectral Method for Direct Numerical Simulations of Multiphase Turbulence. Procedia Comput. Sci. 2024, 240, 17–30. [Google Scholar] [CrossRef]
- Adabag, E.; Atal, M.; Gerard, W.; Plancher, B. MPCGPU: Real-Time Nonlinear Model Predictive Control through Preconditioned Conjugate Gradient on the GPU. In Proceedings of the 2024 IEEE International Conference on Robotics and Automation (ICRA), Yokohama, Japan, 13–17 May 2024; pp. 9787–9794. [Google Scholar] [CrossRef]
- Jeon, S.H.; Hong, S.; Lee, H.J.; Khazoom, C.; Kim, S. CusADi: A GPU Parallelization Framework for Symbolic Expressions and Optimal Control. IEEE Robot. Autom. Lett. 2025, 10, 899–906. [Google Scholar] [CrossRef]
- Diehl, M.; Ferreau, H.J.; Haverbeke, N. Efficient Numerical Methods for Nonlinear MPC and Moving Horizon Estimation. In Nonlinear Model Predictive Control: Towards New Challenging Applications; Magni, L., Raimondo, D.M., Allgöwer, F., Eds.; Springer: Berlin/Heidelberg, Germany, 2009; pp. 391–417. [Google Scholar] [CrossRef]
- Jiang, F.; Baoyin, H.; Li, J. Practical Techniques for Low-Thrust Trajectory Optimization with Homotopic Approach. J. Guid. Control Dyn. 2012, 35, 245–258. [Google Scholar] [CrossRef]
- Walker, M.J.H.; Ireland, B.; Owens, J. A Set of Modified Equinoctial Orbit Elements. Celest. Mech. 1985, 36, 409–419. [Google Scholar] [CrossRef]
- Gould, N.I.M.; Scott, J.A. A Numerical Evaluation of HSL Packages for the Direct Solution of Large Sparse, Symmetric Linear Systems of Equations. ACM Trans. Math. Softw. 2004, 30, 300–325. [Google Scholar] [CrossRef]
- Guennebaud, G.; Jacob, B. Eigen v3. 2010. Available online: http://eigen.tuxfamily.org (accessed on 1 October 2025).
Parameter | Initial Value | Final Value |
---|---|---|
p (AU) | 1.00038180 | 0.72330055 |
f | ||
g | ||
h | ||
k | ||
L (rad) | 0.240005389 | 20.8951551 |
m (kg) | 1500 | Free |
M | Platform | Objective | Gradient | Constraint | Jacobian | Hessian |
---|---|---|---|---|---|---|
64 | CPU (s) | 2.49 × 10−7 | 3.02 × 10−6 | 6.73 × 10−6 | 1.53 × 10−5 | 0.000335 |
GPU (s) | 5.24 × 10−5 | 5.48 × 10−5 | 7.93 × 10−5 | 7.36 × 10−5 | 0.000125 | |
Ratio | 0.00474 | 0.0552 | 0.0848 | 0.207 | 2.67 | |
128 | CPU (s) | 4.27 × 10−7 | 4.51 × 10−6 | 1.22 × 10−5 | 2.29 × 10−5 | 0.000516 |
GPU (s) | 4.69 × 10−5 | 5.31 × 10−5 | 8.36 × 10−5 | 8.00 × 10−5 | 0.000158 | |
Ratio | 0.00909 | 0.0849 | 0.146 | 0.287 | 3.25 | |
256 | CPU (s) | 6.08 × 10−7 | 1.64 × 10−5 | 2.07 × 10−5 | 4.31 × 10−5 | 0.000965 |
GPU (s) | 5.17 × 10−5 | 4.68 × 10−5 | 9.65 × 10−5 | 9.44 × 10−5 | 0.000206 | |
Ratio | 0.0118 | 0.351 | 0.216 | 0.456 | 4.69 | |
512 | CPU (s) | 1.23 × 10−6 | 2.92 × 10−5 | 4.25 × 10−5 | 9.69 × 10−5 | 0.00186 |
GPU (s) | 7.57 × 10−5 | 9.06 × 10−5 | 1.62 × 10−4 | 1.65 × 10−4 | 0.000352 | |
Ratio | 0.0162 | 0.323 | 0.262 | 0.587 | 5.29 | |
1024 | CPU (s) | 2.90 × 10−6 | 3.58 × 10−5 | 9.27 × 10−5 | 0.000220 | 0.00361 |
GPU (s) | 0.000181 | 0.000261 | 0.000411 | 0.000723 | 0.00111 | |
Ratio | 0.0160 | 0.137 | 0.226 | 0.304 | 3.26 | |
2048 | CPU (s) | 5.34 × 10−6 | 7.12 × 10−5 | 0.000176 | 0.000467 | 0.00731 |
GPU (s) | 0.000349 | 0.000496 | 0.000810 | 0.00188 | 0.00277 | |
Ratio | 0.0153 | 0.143 | 0.217 | 0.249 | 2.64 | |
4096 | CPU (s) | 1.11 × 10−5 | 0.000154 | 0.000365 | 0.000993 | 0.0151 |
GPU (s) | 0.000582 | 0.000829 | 0.00135 | 0.00339 | 0.00457 | |
Ratio | 0.0190 | 0.186 | 0.271 | 0.292 | 3.30 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zou, Y.; Jiang, F. GPU-Accelerated Pseudospectral Methods for Optimal Control Problems. Mathematics 2025, 13, 3252. https://doi.org/10.3390/math13203252
Zou Y, Jiang F. GPU-Accelerated Pseudospectral Methods for Optimal Control Problems. Mathematics. 2025; 13(20):3252. https://doi.org/10.3390/math13203252
Chicago/Turabian StyleZou, Yilin, and Fanghua Jiang. 2025. "GPU-Accelerated Pseudospectral Methods for Optimal Control Problems" Mathematics 13, no. 20: 3252. https://doi.org/10.3390/math13203252
APA StyleZou, Y., & Jiang, F. (2025). GPU-Accelerated Pseudospectral Methods for Optimal Control Problems. Mathematics, 13(20), 3252. https://doi.org/10.3390/math13203252