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

feat: initial implementation of HomotopyContinuation interface #3114

Merged
merged 5 commits into from
Oct 24, 2024

Conversation

AayushSabharwal
Copy link
Member

julia> @variables x y z
julia> eqs = [
           0 ~ x^2 + y^2 + 2x*y
           0 ~ x^2 + 4x + 4
           0 ~ y * z + 4x^2
       ]
julia> @mtkbuild sys = NonlinearSystem(eqs)
julia> prob = MTK.HomotopyContinuationProblem(sys, [x => 1.0, y => 1.0, z => 1.0], [])
julia> sol = HomotopyContinuation.solve(prob.hcsys; threading = false)

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

Add any other context about the problem here.

end

function HomotopyContinuationProblem(args...; kwargs...)
error("Requires HomotopyContinuationExt")
Copy link
Member

Choose a reason for hiding this comment

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

Expand this 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah there's probably a decent bit more work to be done here. I just opened the PR for visibility and as an RFC on implementation.

@AayushSabharwal
Copy link
Member Author

I think most of what's left now is documentation. It would also be nice to not require symbolic jacobians. I want to integrate that with ADTypes and DifferentationInterface, since they're "free" dependencies. ADTypes is pulled in via DI, and DI is pulled in via DiffEqCallbacks and NonlinearSolve, both of which are dependencies of MTK.

@ChrisRackauckas
Copy link
Member

Leave any Jac change for a future PR. Contain the scope a bit here.

@isaacsas
Copy link
Member

One thing that Catalyst does that might be nice is to also support rational functions by converting them into polynomial systems. I think @TorkelE set this up with @shashi at some point via a mix of stuff in Catalyst and Symbolics.

@AayushSabharwal
Copy link
Member Author

Could you point to what transformation you're referring to regarding rational functions?

@isaacsas
Copy link
Member

You can always multiply through by the denominators to make the system polynomial.

If you look at the Catalyst extension you can see what @TorkelE did.

https://github.com/SciML/Catalyst.jl/blob/master/ext/CatalystHomotopyContinuationExtension/homotopy_continuation_extension.jl

@AayushSabharwal
Copy link
Member Author

Ah, I see what you mean now. Yeah that should be simple.

@isaacsas
Copy link
Member

Note, there is no reason not to leave rational systems for a follow up. Just having it on polynomial systems to start is nice!

@TorkelE
Copy link
Member

TorkelE commented Oct 18, 2024

I haven't gone through properly, but one test case that def should be added is parametric exponents (e.g. x^n). If these are not handled properly (I.e. replaced with their value before sent to HC) HC will fail.

@ChrisRackauckas
Copy link
Member

What's left for this to be ready?

@AayushSabharwal
Copy link
Member Author

AayushSabharwal commented Oct 19, 2024

Adding the parametric exponents test @TorkelE suggested, and figuring out why CI is failing

@AayushSabharwal AayushSabharwal marked this pull request as ready for review October 21, 2024 09:45
@ChrisRackauckas ChrisRackauckas merged commit 2770a8f into SciML:master Oct 24, 2024
35 of 39 checks passed
@AayushSabharwal AayushSabharwal deleted the as/homotopy-cont branch October 24, 2024 05:23
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.

4 participants