Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Implement Adjoints for solution of IntervalNonlinearProblems #623

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

Merged

Conversation

jClugstor
Copy link
Member

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

@ChrisRackauckas this should work in a similar way to the SimpleNonlinearSolve adjoints. It works and gives the correct answer if I define the rrule in the REPL, but the extension with the rrule doesn't seem to actually load. I haven't dealt with extensions much so I think I'm missing something.

Comment on lines 15 to 16
!is_extension_loaded(Val(:DiffEqBase)) &&
error("Adjoint sensitivity analysis requires `DiffEqBase.jl` to be explicitly loaded.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed? This seems very unncessary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So without DiffEqBase being loaded Zygote tries to differentiate through the IntervalNonlinearProblem constructor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just make it an extension in SciMLBase

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in an actual SciMLBaseBracketingNonlinearSolveExt in SciMLBase, yes?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No just chainrules for the constructor rules

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see what you're saying now. I'll add the constructor rrules to the SciMLBase chain rules extension.

prob::IntervalNonlinearProblem,
sensealg, p, alg, args...; kwargs...
)
# DiffEqBase is needed for problem/function constructor adjoint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should just be SciMLBase extensions.


[extensions]
BracketingNonlinearSolveForwardDiffExt = "ForwardDiff"
BracketingNonlinearSolveChainRulesCoreExt = "ChainRulesCore"
BracketingNonlinearSolveChainRulesCoreExt = ["ChainRulesCore", "Zygote"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessary

@jClugstor jClugstor force-pushed the intervalnonlinearsolve_adjoints branch from ad0ba38 to 789e04b Compare May 22, 2025 16:20
@jClugstor jClugstor marked this pull request as ready for review May 22, 2025 20:04
@ChrisRackauckas ChrisRackauckas merged commit 7ad56e8 into SciML:master May 22, 2025
39 of 57 checks passed
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.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.