Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Barycentric Lagrange Interpolation for controls in Simulation #1056

Merged
merged 28 commits into from
Mar 29, 2024

Conversation

robfalck
Copy link
Contributor

Summary

Previously dymos had used Vandermonde interpolation for controls in ExplicitShooting, because matrices could be calculated apriori. However, the exponents on the terms in the Vandermonde matrix go up to N (the number of nodes of interpolation). When the number of nodes is large (greater than 20-30), this exceeds the floating point limitations and accuracy of the interpolation suffers.

Barycentric interpolation fixes this issue, though it is somewhat more expensive.

To improve performance, numba's just-in-time compilation is used to compute some derivatives (the control rates, derivatives of the rates). Numba is optional for this implementation, and it will work seemlessly (albeit more slowly) without it.

For pure simulation, users are unlikely to notice any performance difference at all until segments grow to ~50 nodes or so.

Related Issues

Backwards incompatibilities

None

New Dependencies

Numba jit is used to make a 4-nested for loop more performant. Numba is an optional dependency and

The state segment end values are no longer a variable in the birkhoff transcription.
Birkhoff linear constraints are now improving sparsity on a lot of problems.
Fixed an issue with abs/promoted path names for timeseries plotting.
…ile, simulation and solution cases do not match.
…but needs derivatives and polynomials to work also
… derivative matrices when n is not high enough.
…causing incorrect derivatives in the ODEIntegrationComp.

The partials in the control interpolation and elsewhere seem correct, so I'm not sure whats happening there.

In the meantime, I've reverted to Vandermonde interpolation for ExplicitShooting, except when doing pure simulation, in which
case the more accurate Barycentric interpolant is used.
@coveralls
Copy link

Coverage Status

coverage: 92.549% (-0.5%) from 93.017%
when pulling d64e953 on robfalck:i1044
into 312161b on OpenMDAO:master.

@robfalck robfalck merged commit 8cb3c26 into OpenMDAO:master Mar 29, 2024
10 checks passed
@robfalck robfalck changed the title Use Barycentric Lagrange Interpolation for controls in ExplicitShooting Use Barycentric Lagrange Interpolation for controls in Simulation Mar 29, 2024
@robfalck robfalck deleted the i1044 branch August 14, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vandermonde control interpolation is incompatible with Birkhoff transcription.
3 participants