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

Fix SDEProblem constructor issue #2281

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/systems/diffeqs/sdesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@
noise_rate_prototype = zeros(eltype(u0), size(noiseeqs))
end

SDEProblem{iip}(f, u0, tspan, p; callback = cbs,
SDEProblem{iip}(f, f.g, u0, tspan, p; callback = cbs,

Check warning on line 586 in src/systems/diffeqs/sdesystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/diffeqs/sdesystem.jl#L586

Added line #L586 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

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

wasn't this removed?

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, but from testing locally

f, u0, p = process_DEProblem(SDEFunction{iip}, sys, u0map, parammap; check_length, kwargs...)
SDEProbelm(f, u0, tspan, p; ...)

would cause the same error in CI
but if we changed to

f, u0, p = process_DEProblem(SDEFunction{iip}, sys, u0map, parammap; check_length, kwargs...)
SDEProbelm(f, f.g u0, tspan, p; ...) # or SDEProbelm(f.f, f.g u0, tspan, p; ...)

working fine

Copy link
Member

Choose a reason for hiding this comment

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

But that's the constructor you deleted? Why not just use the SDEProblem(::SDEFunction, u0, tspan, p) dispatch?

Copy link
Member Author

Choose a reason for hiding this comment

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

What is the f generated from process_DEProblem here? I think it should be working fine with the v2.0 SciMLBase, which directly build SDEProblem on SDEFunction by using SDEProblem(f, u0, tspan, p).

Copy link
Member

Choose a reason for hiding this comment

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

It's generating an SDEFunction.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's strange here, I tested f here and indeed I got an SDEFunction, but the constructor SDEProblem(f::SDEFunction, u0, tspan, p; ...) still error here

Copy link
Member

Choose a reason for hiding this comment

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

yes, that's what I was asking before merge that you were testing. Did you @which see that everything is going to the right dispatches? I thought you needed tspan::Tuple or something so that it could dispatch correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Don't sure if this guess is right, I am wondering since this is a DiffEqBase.SDEProblem dispatch for SDESystem type, what is the "version" of SDEProblem used here(MTK is still use 1.103.0 version DiffEqBase)?

SDEProblem{iip}(f, u0, tspan, p; callback = cbs,
noise_rate_prototype = noise_rate_prototype, kwargs...)

Copy link
Member

Choose a reason for hiding this comment

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

It's forcing SciMLBase v2. The StochasticDiffEq issues are the same problem without MTK involved. I don't think they are hitting the correct dispatches.

noise_rate_prototype = noise_rate_prototype, kwargs...)
end

Expand Down Expand Up @@ -648,7 +648,7 @@
tspan = $tspan
p = $p
noise_rate_prototype = $noise_rate_prototype
SDEProblem(f, u0, tspan, p; noise_rate_prototype = noise_rate_prototype,
SDEProblem(f, f.g, u0, tspan, p; noise_rate_prototype = noise_rate_prototype,

Check warning on line 651 in src/systems/diffeqs/sdesystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/diffeqs/sdesystem.jl#L651

Added line #L651 was not covered by tests
$(kwargs...))
end
!linenumbers ? striplines(ex) : ex
Expand Down
Loading