SciML / SciML/JumpProcesses.jl

Better documentation of `remake` mutating original problems

Open
#416 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
150
Forks
41
Avg merge
1d 9h
Merged PRs (30d)
28

Description

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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the remake entry point and the JumpProblem handling, then run the Julia reproduction in the issue to observe mutation of massaction_jump.scaled_rates. Done means documenting the current behavior and adding a keyword option that prevents mutation by deep-copying the input problem.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.