-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Support remake
to update individual variables/species in new MTK version
#2396
Comments
what about |
I think this notation is good. If the users provide a symbol not existing in The only potential problem is if the user writes an entirely new |
I believe that already works? We setup symbolic remake awhile ago. |
I think it is supposed to, but I think generally the |
I think it does work and is tested? It's worth double checking. |
Don't know, e.g. this gives errors for me: using Catalyst
using DifferentialEquations
begin
@parameters σ ρ β
@variables t x(t) y(t) z(t)
D = Differential(t)
eqs = [D(x) ~ σ * (y - x),
D(y) ~ x * (ρ - z) - y,
D(z) ~ x * y - β * z]
@named sys = ODESystem(eqs)
sys = structural_simplify(sys)
u0 = [x => 1.0,
y => 0.0,
z => 0.0]
p = [σ => 28.0,
ρ => 10.0,
β => 8 / 3]
tspan = (0.0, 100.0)
prob = ODEProblem(sys, u0, tspan, p)
end
prob[x] # 1.0
prob_new = remake(prob; u0 = [x => 1.0])
prob_new[u0] # Error
prob_new = remake(prob; u0 = [x => 1.0, y => 0.0, z => 0.0])
prob_new[u0] # Error |
It worked fine. using Catalyst
@parameters σ ρ β
@variables t x(t) y(t) z(t)
D = Differential(t)
eqs = [D(x) ~ σ * (y - x),
D(y) ~ x * (ρ - z) - y,
D(z) ~ x * y - β * z]
@named sys = ODESystem(eqs)
sys = structural_simplify(sys)
u0 = [x => 1.0,
y => 0.0,
z => 0.0]
p = [σ => 28.0,
ρ => 10.0,
β => 8 / 3]
tspan = (0.0, 100.0)
prob = ODEProblem(sys, u0, tspan, p)
prob[x] # 1.0
prob_new = remake(prob; u0 = [x => 2.0])
prob_new[x]
prob_new[z]
prob_new = remake(prob; u0 = [x => 2.0, y => 0.0, z => 0.0])
prob_new[x]
prob_new[z]
|
Currently, to mutate e.g. an
ODEProblem
to change a variable, you can doUsing
remake
is a bit different, in that it leaves the original problem unchanged, but creates a new one. Bar various bugs, you can do e.g.to create a new problem wit ha new variable vector. However, if I want to update only a subset of the variables, e.g. only
x
, is there a plan for supporting this using the new symbolic indexing update?The text was updated successfully, but these errors were encountered: