SciML / SciMLBase.jl

The Base interface of the SciML ecosystem
https://docs.sciml.ai/SciMLBase/stable
MIT License
118 stars 91 forks source link

Cannot access values of parameters of problems generated via `remake` (likely a new bug) #664

Closed TorkelE closed 2 months ago

TorkelE commented 2 months ago

Simple example:

using ModelingToolkit, OrdinaryDiffEq
using ModelingToolkit: t_nounits as t, D_nounits as D

@parameters kp kd k1 k2
@variables X(t) Y(t)
eqs = [
    D(X) ~ kp - kd*X - k1*X + k2 * Y,
    D(Y) ~ k1*X - k2 * Y
]
@mtkbuild model = ODESystem(eqs, t)

u0_vals = [X => 4, Y => 5]
tspan = (0.0, 10.0)
p_vals = [kp => 1.0, kd => 0.1, k1 => 0.25, k2 => 0.5]

prob = ODEProblem(model, u0_vals, tspan, p_vals)
prob.ps[k2]
prob2 = remake(prob; p = [k2 => 15.0])
prob2.ps[k2] # ERROR: MethodError: no method matching parameter_values(::Nothing)

This was caught by some Catalyst tests that worked quite recently, so I think this is probably something that was recently introduced.

ChrisRackauckas commented 2 months ago

That's an odd and unexpected bug... should take high priority since that's a regression.

AayushSabharwal commented 2 months ago

Fixed in https://github.com/SciML/ModelingToolkit.jl/pull/2630 and released in MTKv9.11