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: remove implicit MTK dependency, other bug fixes, MTKv9 compatibility #603

Merged
merged 10 commits into from
Feb 1, 2024
81 changes: 60 additions & 21 deletions src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
tspan = missing,
p = missing,
kwargs = missing,
interpret_symbolicmap = true,
_kwargs...)
if tspan === missing
tspan = prob.tspan
Expand All @@ -68,14 +69,26 @@
if u0 === missing
u0 = prob.u0
end
if (eltype(p) <: Pair && !isempty(p)) || (eltype(u0) <: Pair && !isempty(u0)) # one is a non-empty symbolic map
hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :ps) ||
throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." *
" Please use `remake` with the `p` keyword argument as a vector of values, paying attention to parameter order."))
hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :states) ||
throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." *
" Please use `remake` with the `u0` keyword argument as a vector of values, paying attention to state order."))
isu0symbolic = eltype(u0) <: Pair && !isempty(u0)
ispsymbolic = eltype(p) <: Pair && !isempty(p) && interpret_symbolicmap
if isu0symbolic && !has_sys(prob.f)
throw(ArgumentError("This problem does not support symbolic maps with" *

Check warning on line 75 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L75

Added line #L75 was not covered by tests
" remake, i.e. it does not have a symbolic origin. Please use `remke`" *
ChrisRackauckas marked this conversation as resolved.
Show resolved Hide resolved
"with the `u0` keyword argument as a vector of values, paying attention to" *
"parameter order."))
end
if ispsymbolic && !has_sys(prob.f)
throw(ArgumentError("This problem does not support symbolic maps with " *

Check warning on line 81 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L81

Added line #L81 was not covered by tests
"`remake`, i.e. it does not have a symbolic origin. Please use `remake`" *
"with the `p` keyword argument as a vector of values (paying attention to" *
"parameter order) or pass `interpret_symbolicmap = false` as a keyword argument"))
end
if isu0symbolic && ispsymbolic
p, u0 = process_p_u0_symbolic(prob, p, u0)
elseif isu0symbolic
_, u0 = process_p_u0_symbolic(prob, prob.p, u0)

Check warning on line 89 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L89

Added line #L89 was not covered by tests
elseif ispsymbolic
p, _ = process_p_u0_symbolic(prob, p, prob.u0)

Check warning on line 91 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L91

Added line #L91 was not covered by tests
end
end

Expand Down Expand Up @@ -262,6 +275,7 @@
ucons = missing,
sense = missing,
kwargs = missing,
interpret_symbolicmap = true,
_kwargs...)
if p === missing && u0 === missing
p, u0 = prob.p, prob.u0
Expand All @@ -272,14 +286,26 @@
if u0 === missing
u0 = prob.u0
end
if (eltype(p) <: Pair && !isempty(p)) || (eltype(u0) <: Pair && !isempty(u0)) # one is a non-empty symbolic map
hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :ps) ||
throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." *
" Please use `remake` with the `p` keyword argument as a vector of values, paying attention to parameter order."))
hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :states) ||
throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." *
" Please use `remake` with the `u0` keyword argument as a vector of values, paying attention to state order."))
isu0symbolic = eltype(u0) <: Pair && !isempty(u0)
ispsymbolic = eltype(p) <: Pair && !isempty(p) && interpret_symbolicmap
if isu0symbolic && !has_sys(prob.f)
throw(ArgumentError("This problem does not support symbolic maps with" *

Check warning on line 292 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L292

Added line #L292 was not covered by tests
" remake, i.e. it does not have a symbolic origin. Please use `remke`" *
ChrisRackauckas marked this conversation as resolved.
Show resolved Hide resolved
"with the `u0` keyword argument as a vector of values, paying attention to" *
"parameter order."))
end
if ispsymbolic && !has_sys(prob.f)
throw(ArgumentError("This problem does not support symbolic maps with " *

Check warning on line 298 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L298

Added line #L298 was not covered by tests
"`remake`, i.e. it does not have a symbolic origin. Please use `remake`" *
"with the `p` keyword argument as a vector of values (paying attention to" *
"parameter order) or pass `interpret_symbolicmap = false` as a keyword argument"))
end
if isu0symbolic && ispsymbolic
p, u0 = process_p_u0_symbolic(prob, p, u0)
elseif isu0symbolic
_, u0 = process_p_u0_symbolic(prob, prob.p, u0)

Check warning on line 306 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L306

Added line #L306 was not covered by tests
elseif ispsymbolic
p, _ = process_p_u0_symbolic(prob, p, prob.u0)

Check warning on line 308 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L308

Added line #L308 was not covered by tests
end
end

Expand Down Expand Up @@ -331,6 +357,7 @@
p = missing,
problem_type = missing,
kwargs = missing,
interpret_symbolicmap = true,
_kwargs...)
if p === missing && u0 === missing
p, u0 = prob.p, prob.u0
Expand All @@ -341,14 +368,26 @@
if u0 === missing
u0 = prob.u0
end
if (eltype(p) <: Pair && !isempty(p)) || (eltype(u0) <: Pair && !isempty(u0)) # one is a non-empty symbolic map
hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :ps) ||
throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." *
" Please use `remake` with the `p` keyword argument as a vector of values, paying attention to parameter order."))
hasproperty(prob.f, :sys) && hasfield(typeof(prob.f.sys), :states) ||
throw(ArgumentError("This problem does not support symbolic maps with `remake`, i.e. it does not have a symbolic origin." *
" Please use `remake` with the `u0` keyword argument as a vector of values, paying attention to state order."))
isu0symbolic = eltype(u0) <: Pair && !isempty(u0)
ispsymbolic = eltype(p) <: Pair && !isempty(p) && interpret_symbolicmap
if isu0symbolic && !has_sys(prob.f)
throw(ArgumentError("This problem does not support symbolic maps with" *

Check warning on line 374 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L374

Added line #L374 was not covered by tests
" remake, i.e. it does not have a symbolic origin. Please use `remke`" *
"with the `u0` keyword argument as a vector of values, paying attention to" *
"parameter order."))
end
if ispsymbolic && !has_sys(prob.f)
throw(ArgumentError("This problem does not support symbolic maps with " *

Check warning on line 380 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L380

Added line #L380 was not covered by tests
"`remake`, i.e. it does not have a symbolic origin. Please use `remake`" *
"with the `p` keyword argument as a vector of values (paying attention to" *
"parameter order) or pass `interpret_symbolicmap = false` as a keyword argument"))
end
if isu0symbolic && ispsymbolic
p, u0 = process_p_u0_symbolic(prob, p, u0)
elseif isu0symbolic
_, u0 = process_p_u0_symbolic(prob, prob.p, u0)

Check warning on line 388 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L388

Added line #L388 was not covered by tests
elseif ispsymbolic
p, _ = process_p_u0_symbolic(prob, p, prob.u0)

Check warning on line 390 in src/remake.jl

View check run for this annotation

Codecov / codecov/patch

src/remake.jl#L390

Added line #L390 was not covered by tests
end
end

Expand Down
Loading
Loading