-
-
Notifications
You must be signed in to change notification settings - Fork 234
Open
Labels
bugSomething isn't workingSomething isn't working
Description
remake does not update parameters that are vector-valued. The following example is taken from the Catalyst documentation:
using OrdinaryDiffEq
using Catalyst
two_state_model = @reaction_network begin
@parameters k[1:2]
@species X(t)[1:2]
(k[1],k[2]), X[1] <--> X[2]
end
u0 = [:X => [0.0, 2.0]];
tspan = (0.0, 1.0);
ps = [:k => [1.0, 2.0]];
oprob = ODEProblem(two_state_model, u0, tspan, ps);
oprob_rmk = remake(oprob; p=[:k => [0.0, 0.0]]);
oprob_rmk does not have the updated parameters; both solve(oprob)(1.0) and solve(oprob_rmk)(1.0) produce the same output.
Interestingly, this behaviour is absent if the parameters are defined outside of the reaction_network macro:
@parameters k[1:2]
two_state_model = @reaction_network begin
@species X(t)[1:2]
($k[1],$k[2]), X[1] <--> X[2]
end
u0 = [:X => [0.0, 2.0]];
tspan = (0.0, 1.0);
ps = [k => [1.0, 2.0]];
oprob = ODEProblem(two_state_model, u0, tspan, ps);
oprob_rmk = remake(oprob; p=[k => [0.0, 0.0]]);
Here, solve(oprob_rmk)(1.0) produces the expected output, i.e. [0.0, 2.0].
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working