Skip to main content
Log in

An adaptive mesh refinement method for indirectly solving optimal control problems

  • Original Paper
  • Published:
Numerical Algorithms Aims and scope Submit manuscript

Abstract

The indirect solution of optimal control problems (OCPs) with inequality constraints and parameters is obtained by solving the two-point boundary value problem (BVP) involving index-1 differential-algebraic equations (DAEs) associated with its first-order optimality conditions. This paper introduces an adaptive mesh refinement method based on a collocation method for solving the index-1 BVP-DAEs. The paper first derives a method to estimate the relative error between the numerical solution and the exact solution. The relative error estimate is then used to guide the mesh refinement process. The mesh size is increased when the estimated error within a mesh interval is beyond the numerical tolerance by either increasing the order of the approximating polynomial or dividing the interval into multiple subintervals. In the mesh interval where the error tolerance has been met, the mesh size is reduced by either decreasing the degree of the approximating polynomial or merging adjacent mesh intervals. An efficient parallel implementation of the method is implemented using Python and CUDA. The paper presents three examples which show that the approach is more computationally efficient and robust when compared with fixed-order methods.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4

Similar content being viewed by others

References

  1. Agamawi, Y.M., Hager, W.W., Rao, A.V.: Mesh refinement method for solving bang-bang optimal control problems using direct collocation. arXiv:1905.11895 (2019)

  2. Amodio, P., Cash, J., Roussos, G., Wright, R., Fairweather, G., Gladwell, I., Kraut, G., Paprzycki, M.: Almost block diagonal linear systems: sequential and parallel solution techniques, and applications. Numerical Linear Algebra with Applications 7(5), 275–317 (2000)

    Article  MathSciNet  Google Scholar 

  3. Ascher, U.: On numerical differential algebraic problems with application to semiconductor device simulation. SIAM J. Numer. Anal. 26(3), 517–538 (1989)

    Article  MathSciNet  Google Scholar 

  4. Ascher, U.M., Spiteri, R.J.: Collocation software for boundary value differential-algebraic equations. SIAM J. Sci. Comput. 15(4), 938–952 (1994)

    Article  MathSciNet  Google Scholar 

  5. Benson, D.: A Gauss pseudospectral transcription for optimal control. PhD thesis, Massachusetts Institute of Technology (2005)

  6. Betts, J.T.: Survey of numerical methods for trajectory optimization. Journal of Guidance Control, and Dynamics 21(2), 193–207 (1998)

    Article  Google Scholar 

  7. Betts, J.T.: Practical methods for optimal control and estimation using nonlinear programming. SIAM (2010)

  8. Büskens, C., Maurer, H.: Sqp-methods for solving optimal control problems with control and state constraints: adjoint variables, sensitivity analysis and real-time control. J. Comput. Appl. Math. 120(1-2), 85–108 (2000)

    Article  MathSciNet  Google Scholar 

  9. Darby, C.L., Hager, W.W., Rao, A.V.: Direct trajectory optimization using a variable low-order adaptive pseudospectral method. J. Spacecr. Rocket. 48(3), 433–445 (2011)

    Article  Google Scholar 

  10. Darby, C.L., Hager, W.W., Rao, A.V.: An hp-adaptive pseudospectral method for solving optimal control problems. Optimal Control Applications and Methods 32(4), 476–502 (2011)

    Article  MathSciNet  Google Scholar 

  11. Dontchev, A.L.: An a priori estimate for discrete approximations in nonlinear optimal control. SIAM J. Control. Optim. 34(4), 1315–1328 (1996)

    Article  MathSciNet  Google Scholar 

  12. Elnagar, G., Kazemi, M.A., Razzaghi, M.: The pseudospectral legendre method for discretizing optimal control problems. IEEE Trans. Autom. Control 40(10), 1793–1796 (1995)

    Article  MathSciNet  Google Scholar 

  13. Elnagar, G.N., Razzaghi, M.: A collocation-type method for linear quadratic optimal control problems. Optimal Control Applications and Methods 18(3), 227–235 (1997)

    Article  MathSciNet  Google Scholar 

  14. Fabien, B.C.: Indirect numerical solution of constrained optimal control problems with parameters. In: American Control Conference, Proceedings of the 1995, vol. 3, pp. 2075–2076. IEEE (1995)

  15. Fabien, B.C.: Some tools for the direct solution of optimal control problems. Adv. Eng. Softw. 29(1), 45–61 (1998)

    Article  Google Scholar 

  16. Fabien, B.C.: Direct optimization of dynamic systems described by differential-algebraic equations. Optimal Control Applications and Methods 29(6), 445–466 (2008)

    Article  MathSciNet  Google Scholar 

  17. Fabien, B.C.: Indirect solution of inequality constrained and singular optimal control problems via a simple continuation method. J. Dyn. Syst. Meas. Control. 136(2) (2014)

  18. Fabien, B.C.: Parallel indirect solution of optimal control problems. Optimal Control Applications and Methods 35(2), 204–230 (2014)

    Article  MathSciNet  Google Scholar 

  19. Fabien, B.C.: A noninterior continuation method for constrained optimal control problems. In: 2016 European Control Conference (ECC), pp. 1598–1603. IEEE (2016)

  20. Fabien, B.C.: Parallel collocation solution of index-1 bvp-daes arising from constrained optimal control problems. Numer. Algorithms 71(2), 311–335 (2016)

    Article  MathSciNet  Google Scholar 

  21. Fornberg, B.: A Practical Guide to Pseudospectral Methods, vol 1. Cambridge University Press, Cambridge (1998)

    MATH  Google Scholar 

  22. Gerdts, M.: Global convergence of a nonsmooth newton method for control-state constrained optimal control problems. SIAM J. Optim. 19(1), 326–350 (2008)

    Article  MathSciNet  Google Scholar 

  23. Goh, C., Teo, K.: Miser: a fortran program for solving optimal control problems. Advances in Engineering Software (1978) 10(2), 90–99 (1988)

    Article  Google Scholar 

  24. Gong, Q., Fahroo, F., Ross, I.M.: Spectral algorithm for pseudospectral methods in optimal control. Journal of Guidance, Control, and Dynamics 31(3), 460–471 (2008)

    Article  Google Scholar 

  25. Grüne, L.: An adaptive grid scheme for the discrete hamilton-jacobi-bellman equation. Numer. Math. 75(3), 319–337 (1997)

    Article  MathSciNet  Google Scholar 

  26. Hairer, E., Nørsett, S.P., Wanner, G.: Solving ordinary differential equations I (2nd Revised. Ed.): Nonstiff Problems. Springer, Berlin (1993)

    MATH  Google Scholar 

  27. Herman, A.L.: Improved collocation methods with application to direct trajectory Optimization. PhD thesis, University of Illinois at Urbana-Champaign (1995)

  28. Herman, A.L., Conway, B.A.: Direct optimization using collocation based on high-order gauss-lobatto quadrature rules. Journal of Guidance, Control, and Dynamics 19(3), 592–599 (1996)

    Article  Google Scholar 

  29. Kanzow, C.: Some noninterior continuation methods for linear complementarity problems. SIAM Journal on Matrix Analysis and Applications 17(4), 851–868 (1996)

    Article  MathSciNet  Google Scholar 

  30. Kierzenka, J., Shampine, L.F.: A bvp solver based on residual control and the maltab pse. ACM Transactions on Mathematical Software (TOMS) 27 (3), 299–316 (2001)

    Article  Google Scholar 

  31. Liu, F., Hager, W.W., Rao, A.V.: Adaptive mesh refinement method for optimal control using nonsmoothness detection and mesh size reduction. J. Franklin Inst. 352(10), 4081–4106 (2015)

    Article  MathSciNet  Google Scholar 

  32. Liu, F., Hager, W.W., Rao, A.V.: Adaptive mesh refinement method for optimal control using decay rates of legendre polynomial coefficients. IEEE Trans. Control Syst. Technol. 26(4), 1475–1483 (2018). https://doi.org/10.1109/TCST.2017.2702122

    Article  Google Scholar 

  33. Luebke, D.: Cuda: scalable parallel programming for high-performance scientific computing. In: 2008 5th IEEE International Symposium on Biomedical Imaging: from Nano to Macro, pp. 836–838. IEEE (2008)

  34. Miele, A.: Gradient algorithms for the optimization of dynamic systems. In: Control and Dynamic Systems, vol. 16, pp. 1–52. Elsevier (1980)

  35. Miller, A.T., Hager, W.W., Rao, A.V.: Mesh refinement method for solving optimal control problems with nonsmooth solutions using jump function approximations. Optimal Control Applications and Methods 42(4), 1119–1140 (2021)

    Article  MathSciNet  Google Scholar 

  36. Munos, R., Moore, A.: Variable resolution discretization in optimal control. Mach. Learn. 49(2-3), 291–323 (2002)

    Article  Google Scholar 

  37. Nickolls, J., Buck, I., Garland, M., Skadron, K.: Scalable parallel programming with cuda. Queue 6(2), 40–53 (2008)

    Article  Google Scholar 

  38. Patterson, M.A., Hager, W.W., Rao, A.V.: A ph mesh refinement method for optimal control. Optimal Control Applications and Methods 36(4), 398–421 (2015)

    Article  MathSciNet  Google Scholar 

  39. Rao, A.V.: A survey of numerical methods for optimal control. Adv. Astronaut. Sci. 135(1), 497–528 (2009)

    Google Scholar 

  40. Rao, A.V., Mease, K.D.: Eigenvector approximate dichotomic basis method for solving hyper-sensitive optimal control problems. Optimal Control Applications and Methods 21(1), 1–19 (2000)

    Article  Google Scholar 

  41. Rao, A.V., Benson, D.A., Darby, C., Patterson, M.A., Francolin, C., Sanders, I., Huntington, G.T.: Algorithm 902: Gpops, a matlab software for solving multiple-phase optimal control problems using the gauss pseudospectral method. ACM Transactions on Mathematical Software (TOMS) 37(2), 1–39 (2010)

    Article  Google Scholar 

  42. Stoer, J., Bulirsch, R.: Introduction to numerical analysis, vol. 12. Springer Science & Business Media (2013)

  43. Storti, D., Yurtoglu, M.: CUDA for engineers: an introduction to high-performance parallel computing. Addison-Wesley Professional (2015)

  44. Trefethen, L.N.: Spectral Methods in MATLAB. SIAM (2000)

  45. Van Rossum, G., Drake, F.L. Jr: Python tutorial, vol. 620. Centrum voor Wiskunde en Informatica Amsterdam (1995)

  46. Von Stryk, O., Bulirsch, R.: Direct and indirect methods for trajectory optimization. Ann. Oper. Res. 37(1), 357–373 (1992)

    Article  MathSciNet  Google Scholar 

  47. Zhao, J., Li, S.: Adaptive mesh refinement method for solving optimal control problems using interpolation error analysis and improved data compression. J. Franklin Inst. 357(3), 1603–1627 (2020)

    Article  MathSciNet  Google Scholar 

Download references

Acknowledgements

The authors would also like to thank the reviewers for their careful reading of the article and the many helpful suggestions.

Funding

This work was supported by the National Science Foundation under (grant numbers 1542228) and University of Washington EcoCAR group.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Chaoyi Yang.

Ethics declarations

Conflict of interest

The authors declare no competing interests.

Additional information

Availability of data and material

Not applicable.

Code availability

All the code used for this research can be obtained at https://github.com/UW-OCP/Collocation-Method-with-Adaptive-Mesh.

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendix: A

Appendix: A

1.1 A.1 Derivation of the necessary conditions

To present the necessary conditions for a minimum, define the scalar Hamiltonian function as

$$ \bar{H} = L(x, u, w) + \frac{1}{2\alpha} \sum\limits_{i = 1}^{n_{d}}(d_{i}(x, u, w) + \nu_{i})^{2} + \lambda^{T}f(x, u, w) - \mu^{T} \nu + \frac{\alpha}{2}u(t)^{T}u(t), $$

where α > 0 is a penalty parameter, \(\nu (t) \in \mathbb {R}^{n_d}\) are the non-negative slack variables, \(\lambda (t) \in \mathbb {R}^{n_{x}}\) are the costate variables, \(\mu (t) \in \mathbb {R}^{n_{d}}\) are the Lagrange multipliers associated with the non-negative slack variables ν(t).

If (x,u,w) represents a local minimum of the OCP (1)–(5), then it is necessary that the following conditions be satisfied.

$$ \begin{array}{@{}rcl@{}} \dot{x} &=& \frac{\partial \bar{H}}{\partial\lambda}, \end{array} $$
(58)
$$ \begin{array}{@{}rcl@{}} \dot{\lambda} &=& -\frac{\partial \bar{H}}{\partial x}, \end{array} $$
(59)
$$ \begin{array}{@{}rcl@{}} \dot{\gamma} &=& \frac{\partial \bar{H}}{\partial w}, \end{array} $$
(60)
$$ \begin{array}{@{}rcl@{}} 0 &=& \frac{\partial \bar{H}}{\partial u}, \end{array} $$
(61)
$$ \begin{array}{@{}rcl@{}} 0 &=& d_i + \nu_{i} - \alpha \mu_{i},\ i = 1,2,\ldots,n_d, \end{array} $$
(62)
$$ \begin{array}{@{}rcl@{}} 0 &=& \psi(\mu_{i}, \nu_{i}; \alpha),\ i=1,2,\ldots,n_d, \end{array} $$
(63)
$$ \begin{array}{@{}rcl@{}} 0 &=& {{{\varGamma}}}(x(t_{\mathrm{i}}),w), \end{array} $$
(64)
$$ \begin{array}{@{}rcl@{}} 0 &=& \lambda(t_{\mathrm{i}}) + D_{x}{{{\varGamma}}}(x(t_{\mathrm{i}}),w) \kappa_{\mathrm{i}}, \end{array} $$
(65)
$$ \begin{array}{@{}rcl@{}} 0 &=& \gamma(t_{\mathrm{i}}) - D_{w}{{{\varGamma}}}(x(t_{\mathrm{i}}),w) \kappa_{\mathrm{i}}, \end{array} $$
(66)
$$ \begin{array}{@{}rcl@{}} 0 &=& {{\varPsi}}(x(t_{\mathrm{f}}),w), \end{array} $$
(67)
$$ \begin{array}{@{}rcl@{}} 0 &=& \lambda(t_{\mathrm{f}}) - \frac{\partial\phi}{\partial x} - D_{x}{{\varPsi}}(x(t_{\mathrm{f}}),w) \kappa_{\mathrm{f}}, \end{array} $$
(68)
$$ \begin{array}{@{}rcl@{}} 0 &=& \gamma(t_{\mathrm{f}}) + \frac{\partial\phi}{\partial w} + D_{w}{{\varPsi}}(x(t_{\mathrm{f}}),w) \kappa_{\mathrm{f}}. \end{array} $$
(69)

where \(\psi (\mu _{i}, \nu _{i}; \alpha ) = \mu _{i} + \nu _{i} - \sqrt {\mu _{i}^{2} + \nu _{i}^{2} + 2\alpha }\) is the Kanzow’s smoothed Fisher-Burmeister formula used.

The variables \(\gamma (t) \in \mathbb {R}^{n_{w}}\) are used to write the stationary conditions associated with the parameters w as a differential equation instead of an integral equation. The Lagrange multipliers \(\kappa _{\mathrm {i}} \in \mathbb {R}^{n_{{{\varGamma }}}}\) are associated with the initial time constraints and the Lagrange multipliers \(\kappa _{\mathrm {f}} \in \mathbb {R}^{n_{{{\varPsi }}}}\) are associated with the final time constraints.

1.1.1 A.1.1 Boundary value problem

The necessary conditions (58)–(69) can then be represented in a compact form as a boundary value problem involving differential algebraic equations (BVP-DAEs) by separating the unknowns into: (i) differential variables; (ii) algebraic variables; and (iii) parameters. In particular, define

$$ y(t) = \left[\begin{array}{c} x(t) \\ \lambda(t) \\ \gamma(t) \end{array}\right],\ z(t) = \left[\begin{array}{c} u(t) \\ \mu(t) \\ \nu(t) \end{array}\right],\ p = \left[\begin{array}{c} w \\ K_{\mathrm{i}} \\ K_{\mathrm{f}} \end{array}\right], $$
(70)

where \(y(t) \in \mathbb {R}^{n_{y}}\) are the differential variables, \(z(t) \in \mathbb {R}^{n_{z}}\) are the algebraic variables, and \(p \in \mathbb {R}^{n_{p}}\) are the parameter variables with ny = 2nx + nw, nz = nu + 2nd, and np = nw + nΓ + nΨ.

Using these definitions, the necessary conditions for a minimum can be written as the BVP-DAEs

$$ \begin{array}{@{}rcl@{}} \dot{y} &=& h(y(t),z(t),p), \end{array} $$
(71)
$$ \begin{array}{@{}rcl@{}} 0 &=& g(y(t),z(t),p,\alpha), \end{array} $$
(72)
$$ \begin{array}{@{}rcl@{}} 0 &=& r(y(t_{\mathrm{i}}),y(t_{\mathrm{f}}),p) \end{array} $$
(73)

Here, (71) defines a set of differential equations, (72) defines a set of algebraic equations, and (73) defines a set of boundary conditions. Moreover,

$$ h(y(t),z(t),p) = \left[\begin{array}{c} \partial \bar{H} / \partial \lambda \\ - \partial \bar{H} / \partial x \\ \partial \bar{H} / \partial w \end{array}\right] \in \mathbb{R}^{n_y}, $$
(74)
$$ g(y(t),z(t),p,\alpha) = \left[\begin{array}{c} \partial \bar{H} / \partial u \\ d(x,u,w) + Ne - \alpha Me \\ \psi_{d}(\mu,\nu;\alpha) \end{array}\right] \in \mathbb{R}^{n_z}, $$
(75)
$$ r(y(t_{\mathrm{i}}),y(t_{\mathrm{f}}),p) = \left[\begin{array}{c} {{{\varGamma}}}(x(t_{\mathrm{i}}),w) \\ \lambda(t_{\mathrm{i}}) + D_x{{{\varGamma}}}(x(t_{\mathrm{i}}),w) \kappa_{\mathrm{i}} \\ \gamma(t_{\mathrm{i}}) - D_{w}{{{\varGamma}}}(x(t_{\mathrm{i}}),w) \kappa_{\mathrm{i}} \\ {{\varPsi}}(x(t_{\mathrm{f}}),w) \\ \lambda(t_{\mathrm{f}}) - \frac{\partial\phi}{\partial x} - D_x{{\varPsi}}(x(t_{\mathrm{f}}),w) \kappa_{\mathrm{f}} \\ \gamma(t_{\mathrm{f}}) + \frac{\partial\phi}{\partial w} + D_{w}{{\varPsi}}(x(t_{\mathrm{f}}),w) \kappa_{\mathrm{f}} \end{array}\right] \in \mathbb{R}^{n_{y}+n_{p}}, $$
(76)

with \(d(x,u,w) = [d_{1}(x,u,w), d_{2}(x,u,w), \ldots , d_{n_{d}}(x,u,w)]^{T}\), \(\mathcal {N} = \text {diag} (\nu _{1},\) \(\nu _{2}, \ldots ,\nu _{n_{d}})\), \({\mathscr{M}} = \text {diag} (\mu _{1}, \mu _{2}, \ldots ,\mu _{n_{d}})\), ψd(μ,ν; α) = [ψ(μ1,ν1; α),ψ(μ2, \(\nu _{2};\alpha ), \ldots , \psi (\mu _{n_{d}},\nu _{n_{d}};\alpha )]^{T}\), \(D_x{{{\varGamma }}} = [\partial {{{\varGamma }}}_{1}/\partial x, \partial {{{\varGamma }}}_{2}/\partial x, \ldots ,\) \(\partial {{{\varGamma }}}_{n_{{{{\varGamma }}}}}/\partial x]^{T}\), \(D_{w}{{{\varGamma }}} = [\partial {{{\varGamma }}}_{1}/\partial w, \partial {{{\varGamma }}}_{2}/\partial w, \ldots , \partial {{{\varGamma }}}_{n_{{{{\varGamma }}}}}/\partial w]^{T}\), \(D_x{{\varPsi }} = [ \partial {{\varPsi }}_{1}/\partial x, \partial {{\varPsi }}_{2}/\partial x, \ldots , \partial {{\varPsi }}_{n_{{{\varPsi }}}}/\partial x]^{T}\), \(D_{w}{{\varPsi }} = [\partial {{\varPsi }}_{1}/\partial w, \partial {{\varPsi }}_{2}/\partial w, \ldots , \partial {{\varPsi }}_{n_{{{\varPsi }}}}/\partial w]^{T}\), and e = [1, 1,…, 1]T.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Yang, C., Fabien, B.C. An adaptive mesh refinement method for indirectly solving optimal control problems. Numer Algor 91, 193–225 (2022). https://doi.org/10.1007/s11075-022-01259-1

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11075-022-01259-1

Keywords

Navigation