From bfbb09ef7fa11c7a10109eced2ae35225440ee18 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Fri, 28 Jun 2024 11:03:36 +0530 Subject: [PATCH] fix: fix remake for `IntervalNonlinearProblem` --- src/remake.jl | 5 +++++ test/remake_tests.jl | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/remake.jl b/src/remake.jl index 36fe6e28c..cc826636d 100644 --- a/src/remake.jl +++ b/src/remake.jl @@ -63,6 +63,11 @@ function remake(prob::AbstractSciMLProblem; u0 = missing, _remake_internal(prob; kwargs..., u0, p) end +function remake(prob::AbstractIntervalNonlinearProblem; p = missing, interpret_symbolicmap = true, use_defaults = false, kwargs...) + _, p = updated_u0_p(prob, [], p; interpret_symbolicmap, use_defaults) + _remake_internal(prob; kwargs..., p) +end + function remake(prob::AbstractNoiseProblem; kwargs...) _remake_internal(prob; kwargs...) end diff --git a/test/remake_tests.jl b/test/remake_tests.jl index b2817b42b..8f1aa2ec9 100644 --- a/test/remake_tests.jl +++ b/test/remake_tests.jl @@ -265,3 +265,11 @@ u0 = [1.0; 2.0; 3.0] tspan = (0.0, 100.0) prob = ODEProblem(lorenz!, u0, tspan, nothing) @test_nowarn remake(prob, p = (), interpret_symbolicmap = true) + +# IntervalNonlinearProblem doesn't have a u0 +# Issue#726 +interval_f(u, p) = u * u - 2.0 + p[1] +uspan = (1.0, 2.0) +interval_prob = IntervalNonlinearProblem(interval_f, uspan) +new_prob = @inferred IntervalNonlinearProblem remake(interval_prob; p = [0]) +@test new_prob.p == [0]