Skip to content
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

Better documentation of remake mutating original problems #416

Open
TorkelE opened this issue Apr 10, 2024 · 0 comments
Open

Better documentation of remake mutating original problems #416

TorkelE opened this issue Apr 10, 2024 · 0 comments

Comments

@TorkelE
Copy link
Member

TorkelE commented Apr 10, 2024

Normally remake does not affect the input problems. However, for JumpProblem this is the case:

using Catalyst, JumpProcesses
# Creates the model.
rn = @reaction_network begin
    p1*p2, A + B --> C
end
@unpack p1, p2 = rn

u0 = [:A => 1, :B => 2, :C => 3]
ps = [:p1 => 3.0, :p2 => 2.0]
dprob = DiscreteProblem(rn, u0, (0.0, 1.0), ps)
jprob = JumpProblem(rn, dprob, Direct())

jprob.massaction_jump.scaled_rates[1] # Returns 6.0.
jprob2 = remake(jprob; p = [p1 => 0.0]) 
jprob.massaction_jump.scaled_rates[1]  # returns 0.0 
jprob2.massaction_jump.scaled_rates[1] # returns 0.0

This should be documented properly, and a kwarg added to instead make a deepcopy of the input problem (so that there is no mutation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant