Skip to content

Add adjoint-based global error control#56

Draft
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/adjoint-global-error-control
Draft

Add adjoint-based global error control#56
ChrisRackauckas-Claude wants to merge 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:fix/adjoint-global-error-control

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Summary

  • add GlobalAdjoint, an ODE algorithm wrapper that estimates endpoint error with randomized adjoint projections and refines local tolerances until the requested global tolerance is met
  • add adjoint_error_estimate for standalone a posteriori endpoint-error estimation
  • construct reverse problems with the public SciMLSensitivity.ODEAdjointProblem and QuadratureAdjoint APIs, and integrate the dense-interpolation defect with QuadGK
  • treat parameters as fixed SciML structures so scalar and callable parameters work without recreating parameter-derivative bindings
  • document the public API, add focused tests, and bump the minor version to 1.3.0

Design

The estimator follows Cao and Petzold's adjoint defect-projection method. It samples orthogonal terminal directions, solves the corresponding adjoints through SciMLSensitivity, projects the numerical interpolation defect, and applies the small-sample norm factor. This replaces the abandoned symbolic-Jacobian approach from #15 with SciMLSensitivity's public derivative machinery.

The current implementation deliberately supports forward-time ODEs with real vector states, a standard mass matrix, no callbacks, and a solver that provides dense first-derivative interpolation.

Validation

  • GROUP=Everything julia +1.10 --project=. -e 'using Pkg; Pkg.test()'
    • Basic functionality: 1/1
    • Algorithm traits: 3/3
    • Adjoint estimation and control: 13/13
    • BigFloat support: 2/2
    • QA: 20 passed, 1 pre-existing declared broken
  • Runic --check src test docs

Ignore this PR until reviewed by @ChrisRackauckas.

Closes #4.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Implementation log / review scratchpad:

  1. Synced the fork's master to SciML/GlobalDiffEq.jl@f3a308e, created fix/adjoint-global-error-control, and ran the unmodified Core suite successfully before editing.
  2. Reviewed issue Global error estimation and control via adjoints #4, Cao and Petzold (2004), and the earlier incomplete PR adjoint method solver with global error control #15. The key prior-review constraint was to use SciMLSensitivity's VJP/adjoint machinery instead of maintaining symbolic Jacobian and adjoint bindings here.
  3. Implemented endpoint defect projection through the public SciMLSensitivity.ODEAdjointProblem and QuadratureAdjoint APIs. Added Cao-Petzold orthogonal random terminal projections and the small-sample norm factor.
  4. Added a fixed-parameter SciMLStructures adapter so SciMLSensitivity does not attempt parameter sensitivities. This supports scalar and callable parameters; SciMLBase.unwrapped_f plus FullSpecialize keeps the transformed RHS valid for ForwardDiff after the outer solve path has applied AutoSpecialize wrapping.
  5. Put gtol and controller settings on the GlobalAdjoint constructor because DiffEqBase validates solve keywords before dispatching to __solve; a custom solve(...; gtol=...) keyword cannot be implemented safely without suppressing keyword validation.
  6. Added analytic estimator and actual endpoint-control tests, in-place/out-of-place coverage, scalar/callable parameters, traits, invalid configurations, and callback rejection.
  7. Ran Runic, targeted tests, Core, QA, and finally GROUP=Everything; the final combined run passed every active assertion.

Commit: 2ec4a8b957c6d4ceb808bb78b6edc98bcc1994e0.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Final CI follow-up:

  • Core passed on Julia LTS, current, and pre-release
  • QA passed on current Julia
  • downgrade testing passed
  • Runic format, Runic suggestions, test detection, and spelling passed
  • GitHub reports the PR merge state as CLEAN
  • the branch remains up to date with upstream/master

No CI follow-up commit was needed.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

This PR has been carried into SciML/OrdinaryDiffEq.jl#3929, which moves GlobalDiffEq.jl into the OrdinaryDiffEq.jl monorepo as lib/GlobalDiffEq and includes the adjoint method from here restructured as a package extension on SciMLSensitivity + QuadGK (same public API; sensealg defaults to nothing and resolves to QuadratureAdjoint(autojacvec = true) when the extension loads). If that PR merges, this one can be closed and this repo archived.

Ignore until reviewed by @ChrisRackauckas.

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

Update: the monorepo move is now a stacked series of focused PRs. The repo transfer is SciML/OrdinaryDiffEq.jl#3929, and this PR's adjoint method specifically is SciML/OrdinaryDiffEq.jl#3953 (restructured as a package extension on SciMLSensitivity + QuadGK, same public API). The rest of the issue-tracker methods follow in SciML/OrdinaryDiffEq.jl#3954, SciML/OrdinaryDiffEq.jl#3955, SciML/OrdinaryDiffEq.jl#3956, and SciML/OrdinaryDiffEq.jl#3957.

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.

Global error estimation and control via adjoints

2 participants