Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ function remake(prob::ODEProblem; f = missing,

iip = isinplace(prob)

if build_initializeprob == Val{true} || build_initializeprob == true
if build_initializeprob isa Val{true} || build_initializeprob == true
Copy link
Member

Choose a reason for hiding this comment

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

build_initializeprob defaults to Val{true} and Val{true} isa Val{true} == false so this won't run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right ... 🤦

Copy link
Member

Choose a reason for hiding this comment

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

The other way to do it is build_initializeprob === Val{true}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't help. Looks like the problem is inside the if, within remake_initialization_data::Any. I effectively just made it if false so it never ran.

if f !== missing && has_initialization_data(f)
initialization_data = remake_initialization_data(
prob.f.sys, f, u0, tspan[1], p, newu0, newp)
Expand Down
1 change: 0 additions & 1 deletion test/downstream/initialization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ end
@test occursin("Initialization status: OVERDETERMINED", sprint(summary, prob))
end


@testset "CheckInit" begin
@testset "ODEProblem" begin
function rhs(u, p, t)
Expand Down
14 changes: 14 additions & 0 deletions test/downstream/solution_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,17 @@ end
sol = solve(prob)
@test sol(0.6, idxs = y) ≈ 2.0
end

@testset "Type stability of MTK workflow" begin
@variables x(t)
@mtkbuild sys = ODESystem([D(x) ~ 0.0], t; defaults = [x => 0.0])
prob = ODEProblem(sys, [], (0.0, 1.0))
@test_nowarn @inferred solve(prob, Tsit5())

@parameters α=1 β=1 γ=1 δ=1
@variables x(t)=1 y(t)=1
eqs = [D(x) ~ α * x - β * x * y, D(y) ~ -δ * y + γ * x * y]
@named sys = ODESystem(eqs, t)
prob = ODEProblem(complete(sys), [], (0.0, 1))
@test_nowarn @inferred remake(prob, u0 = prob.u0, p = prob.p) # was Any
end
Loading