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: add infrastructure for initialization of different problem types #885

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4942396
feat: add `constructorof` for `SDEProblem`
AayushSabharwal Dec 3, 2024
5567599
feat: add `constructorof` for `SDDEProblem`
AayushSabharwal Dec 3, 2024
306a29e
feat: add `constructorof` for `DDEProblem`
AayushSabharwal Dec 3, 2024
3a1b052
feat: retain `prob.f.sys` when `remake`ing `SDEProblem`
AayushSabharwal Dec 3, 2024
20ce512
feat: run `remake_initialization_data` when remaking `SDEProblem`
AayushSabharwal Dec 3, 2024
89c49c7
feat: add proper `remake` for `DDEProblem`
AayushSabharwal Dec 3, 2024
1dcbc83
feat: add proper `remake` for `SDDEProblem`
AayushSabharwal Dec 3, 2024
4b09efc
fix: support non-markovian index providers in `updated_u0_p`
AayushSabharwal Dec 3, 2024
0a5aade
feat: implement `get_history_function` for `AbstractSDDEProblem`
AayushSabharwal Dec 3, 2024
bacdf44
feat: implement `get_history_function` for `AbstractSDDEIntegrator`
AayushSabharwal Dec 3, 2024
f5cb199
build: bump SymbolicIndexingInterface compat
AayushSabharwal Dec 4, 2024
4bab2ab
fix: fix type stability of `remake(::SDEProblem)`
AayushSabharwal Dec 4, 2024
ba62ca7
test: test `remake` for `DDEProblem`, `SDDEProblem`
AayushSabharwal Dec 4, 2024
ce92cd8
fix: add `.initializeprob` syntax to all applicable SciMLFunctions
AayushSabharwal Dec 4, 2024
b86cfc5
refactor: update `remake_initializeprob` fallback
AayushSabharwal Dec 4, 2024
24302f6
test: fix DDE indexing test
AayushSabharwal Dec 4, 2024
075ca0b
test: test SDDE indexing
AayushSabharwal Dec 4, 2024
db56a4f
build: bump MTK compat in downstream CI
AayushSabharwal Dec 4, 2024
3582a28
feat: add lazy initialization to new `remake` methods
AayushSabharwal Dec 5, 2024
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ StableRNGs = "1.0"
StaticArrays = "1.7"
StaticArraysCore = "1.4"
Statistics = "1.10"
SymbolicIndexingInterface = "0.3.34"
SymbolicIndexingInterface = "0.3.36"
Tables = "1.11"
Zygote = "0.6.67"
julia = "1.10"
Expand Down
3 changes: 2 additions & 1 deletion src/integrator_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ function isadaptive(integrator::DEIntegrator)
isdefined(integrator.opts, :adaptive) ? integrator.opts.adaptive : false
end

function SymbolicIndexingInterface.get_history_function(integ::AbstractDDEIntegrator)
function SymbolicIndexingInterface.get_history_function(integ::Union{
AbstractDDEIntegrator, AbstractSDDEIntegrator})
DDESolutionHistoryWrapper(get_sol(integ))
end
13 changes: 13 additions & 0 deletions src/problems/dde_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,19 @@ struct DDEProblem{uType, tType, lType, lType2, isinplace, P, F, H, K, PT} <:
end
end

function ConstructionBase.constructorof(::Type{P}) where {P <: DDEProblem}
function ctor(f, u0, h, tspan, p, constant_lags, dependent_lags,
kw, neutral, order_discontinuity_t0, problem_type)
if f isa AbstractDDEFunction
iip = isinplace(f)
else
iip = isinplace(f, 5)
end
return DDEProblem{iip}(f, u0, h, tspan, p; kw..., constant_lags, dependent_lags,
neutral, order_discontinuity_t0, problem_type)
end
end

DDEProblem(f, args...; kwargs...) = DDEProblem(DDEFunction(f), args...; kwargs...)

function DDEProblem(f::AbstractDDEFunction, args...; kwargs...)
Expand Down
16 changes: 16 additions & 0 deletions src/problems/sdde_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,19 @@ end
function SDDEProblem(f::AbstractSDDEFunction, args...; kwargs...)
SDDEProblem{isinplace(f)}(f, args...; kwargs...)
end

function ConstructionBase.constructorof(::Type{P}) where {P <: SDDEProblem}
function ctor(f, g, u0, h, tspan, p, noise, constant_lags, dependent_lags, kw,
noise_rate_prototype, seed, neutral, order_discontinuity_t0)
if f isa AbstractSDDEFunction
iip = isinplace(f)
else
iip = isinplace(f, 5)
end
return SDDEProblem{iip}(
f, g, u0, h, tspan, p; kw..., noise, constant_lags, dependent_lags,
noise_rate_prototype, seed, neutral, order_discontinuity_t0)
end
end

SymbolicIndexingInterface.get_history_function(prob::AbstractSDDEProblem) = prob.h
11 changes: 11 additions & 0 deletions src/problems/sde_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ function SDEProblem(f, g, u0, tspan, p = NullParameters(); kwargs...)
SDEProblem{iip}(SDEFunction{iip}(f, g), u0, tspan, p; kwargs...)
end

function ConstructionBase.constructorof(::Type{P}) where {P <: SDEProblem}
function ctor(f, g, u0, tspan, p, noise, kw, noise_rate_prototype, seed)
if f isa AbstractSDEFunction
iip = isinplace(f)
else
iip = isinplace(f, 4)
end
return SDEProblem{iip}(f, g, u0, tspan, p; kw..., noise, noise_rate_prototype, seed)
end
end

"""
$(TYPEDEF)
"""
Expand Down
Loading
Loading