-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
MethodError: anyeltypedual(::Type{Union{}}) when passing ODEProblem as a parameter #440
Comments
Don't provide the ODE as a parameter 😓. Use a functor if you don't want to Box the ODE. |
No we can just fix this. anyeltypedual on this just needs to lower to u0 and p |
I don't know if this is useful to know, but I just realized I have some code I wrote 6 months ago where this behavior is used and the code runs without any errors, with the only difference being it uses the NLsolveJL solver instead of TrustRegion. I tried switching to NLsolveJL solver for the MWE above, but it still throws the same error with the current version. With this environment and NLsolveJL solver, the MWE above runs successfully: Status Status |
It's trivial to fix but I just haven't gotten around to it. But if you help me a little bit this could be done in a few hours. Try the following in your REPL: function DiffEqBase.anyeltypedual(prob::ODEProblem,
::Type{Val{counter}} = Val{0}) where {counter} where {N, T <: NTuple{N, <:Number}}
DiffEqBase.anyeltypedual(prob.u0, prob.p, prob.tspan)
end and then run it. |
I'm not a Julia expert at all, but I'm happy to help. |
SciML/DiffEqBase.jl#1058 handles this and throws a much better error message. |
I am trying to implement a shooting method using a NonlinearProblem. An ODEProblem is passed as a parameter to the NonlinearProblem (to avoid recreating a new ODEProblem at each iteration), and during evaluation of the nonlinear function the properties of the ODEProblem (u0, tspan, p, etc.) are modified. However, when passing the ODEProblem as a parameter, I get the error
MethodError: anyeltypedual(::Type{Union{}}) is ambiguous
. Everything works correctly if the ODEProblem is created inside the nonlinear function, but being able to pass it as a parameter would be more convenient.Minimal Reproducible Example
Error & Stacktrace
Environment:
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
The text was updated successfully, but these errors were encountered: