Skip to content

Commit

Permalink
Merge pull request #888 from AayushSabharwal/as/fix-remake
Browse files Browse the repository at this point in the history
fix: check if `prob.f.sys` exists before accessing it in `remake`
  • Loading branch information
ChrisRackauckas authored Dec 6, 2024
2 parents 3cf7743 + 9d0e938 commit a74be37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ function updated_u0_p(
if u0 === missing && p === missing
return state_values(prob), parameter_values(prob)
end
if prob.f.sys === nothing
if has_sys(prob.f) && prob.f.sys === nothing
if interpret_symbolicmap && eltype(p) !== Union{} && eltype(p) <: Pair
throw(ArgumentError("This problem does not support symbolic maps with " *
"`remake`, i.e. it does not have a symbolic origin. Please use `remake`" *
Expand Down
8 changes: 4 additions & 4 deletions test/downstream/problem_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,12 @@ eprob = EnsembleProblem(oprob)
@test eprob.ps[osys.p] == 0.1

@test state_values(remake(eprob; u0 = [X => 0.1])) == [0.1]
@test_broken state_values(remake(eprob; u0 = [:X => 0.2])) == [0.2]
@test state_values(remake(eprob; u0 = [:X => 0.2])) == [0.2]
@test state_values(remake(eprob; u0 = [osys.X => 0.3])) == [0.3]

@test_broken remake(eprob; p = [d => 0.4]).ps[d] == 0.4
@test_broken remake(eprob; p = [:d => 0.5]).ps[d] == 0.5
@test_broken remake(eprob; p = [osys.d => 0.6]).ps[d] == 0.6
@test remake(eprob; p = [d => 0.4]).ps[d] == 0.4
@test remake(eprob; p = [:d => 0.5]).ps[d] == 0.5
@test remake(eprob; p = [osys.d => 0.6]).ps[d] == 0.6

# SteadyStateProblem Indexing
# Issue#660
Expand Down

0 comments on commit a74be37

Please sign in to comment.