Skip to content

Compute collocation nodes with symmetric eigensolvers - #4118

Open
Kiril1Shevtsov wants to merge 1 commit into
Pyomo:mainfrom
Kiril1Shevtsov:fix/2481-stable-collocation
Open

Kiril1Shevtsov wants to merge 1 commit into
Pyomo:mainfrom
Kiril1Shevtsov:fix/2481-stable-collocation

Conversation

@Kiril1Shevtsov

Copy link
Copy Markdown

Fixes

Numerical instability in high-order Radau and Legendre collocation.

Summary/Motivation:

At higher collocation orders, computing Radau and Legendre nodes by finding polynomial roots in the monomial basis could produce complex-valued nodes due to numerical instability.

Since these collocation nodes should be real, this could prevent the transformation from working correctly at higher orders.

The patch replaces the unstable polynomial-root calculation with a symmetric eigenvalue problem and uses barycentric formulas to construct the collocation tables.

The existing API and dependencies remain unchanged.

Changes proposed in this PR:

  • Replace monomial-basis polynomial root calculations with a symmetric eigenvalue formulation for Radau and Legendre nodes.
  • Use barycentric formulas to construct the collocation tables.
  • Preserve the existing public API and dependencies.
  • Add regression tests for higher collocation orders.

Testing

A fresh validation run reported:

  • 19 passed, 1 skipped.
  • 44 independent node checks.
  • 20 independent collocation-table checks.
  • 6 runs using CBC.

These results cover the tested configurations and do not guarantee numerical accuracy for arbitrary collocation orders.

AI-Use Disclosure

  • AI tools were NOT used during the preparation of this PR

or

  • [] AI tools contributed to the development of this PR

    • [] AI tools generated documentation (including the PR description/comments, code comments, and/or Sphinx documentation)
    • AI tools generated tests (baselines, examples, and/or code)
    • AI tools generated code (apart from tests)

    Review process (select ONE):

    • Rewritten: All AI-generated content was rewritten by me before being committed.
    • Reviewed/verified: I retained AI-generated content and verified it before committing. Verification included (as applicable):
      • Ran the code and fixed issues
      • Added and ran tests
      • Checked correctness/logic of code and tests
      • Checked for alignment with the contribution guide
      • Considered security implications
    • As-is: AI-generated content was committed directly to the repository

Notes for reviewers (optional):

AI tools assisted with developing regression tests, reviewing the code for potential errors, checking test correctness, and identifying and correcting implementation issues.

ChatGPT (GPT-6) was also used to prepare the English PR description.

The numerical checks cover Radau and Legendre collocation nodes and tables, including higher-order cases. Feedback on numerical stability and the barycentric implementation would be appreciated.

Legal Acknowledgement

By contributing to this software project, I have read the [contribution guide](https://pyomo.readthedocs.io/en/stable/contribution_guide.html) and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

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.

1 participant