Skip to content

JumpProblemLibrary v2.0: drop stored DiscreteProblem; add build_jump_problem (OrdinaryDiffEq v7 stack)#184

Open
ChrisRackauckas-Claude wants to merge 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:jumpproblemlibrary-v7-stack
Open

JumpProblemLibrary v2.0: drop stored DiscreteProblem; add build_jump_problem (OrdinaryDiffEq v7 stack)#184
ChrisRackauckas-Claude wants to merge 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:jumpproblemlibrary-v7-stack

Conversation

@ChrisRackauckas-Claude
Copy link
Copy Markdown
Contributor

Summary

  • Drops the discrete_prob field's stored DiscreteProblem value across every example (set to nothing) — required because SciMLBase v3 / Catalyst v16 made the v1.x design unbuildable.
  • Adds a build_jump_problem(jpn, aggregator; kwargs...) helper for the new v2.0 consumer entry point.
  • Major version bump to 2.0.0. Adds JumpProcesses as a direct dep; widens Catalyst compat to "16" and DiffEqBase to "6, 7".

Why

SciMLBenchmarks.jl's Jumps benchmark cannot resolve under the OrdinaryDiffEq v7 stack because v1.x JumpProblemLibrary uses two APIs that no longer exist:

  1. DiscreteProblem(::ReactionSystem, u0, tspan, p; eval_module=...) was removed in Catalyst v16. Lowering via complete(jump_model(rs)) and then calling DiscreteProblem(jsys, u0, tspan, p) does not work either: SciMLBase v3 explicitly throws

    A system with jumps cannot be used to construct a SciMLBase.DiscreteProblem. Consider a JumpProblem instead.

    (ModelingToolkitBase/src/problems/compatibility.jl:125).

  2. The new idiom for ReactionSystem→stochastic-jump simulation is JumpProblem(rs, u0, tspan, p; aggregator=...) directly — no separate DiscreteProblem step.

Migration for consumers

# v1.x
rn = jpn.network
prob = jpn.discrete_prob
JumpProblem(rn, prob, Direct())

# v2.0
build_jump_problem(jpn, Direct())
# or directly:
JumpProblem(jpn.network, jpn.u0, (0.0, jpn.tstop), jpn.rates; aggregator = Direct())

The JumpProblemNetwork struct shape is preserved (so jpn.discrete_prob === nothing still pattern-matches without an UndefRefError); the major version bump signals the semantic change.

Test plan

  • Aqua.test_all passes locally on Julia 1.11 with the v7 stack: SciMLBase 3.7.1, DiffEqBase 7.1.0, Catalyst 16.1.1, JumpProcesses 9.28.0
  • CI green on master + this PR
  • Downstream SciMLBenchmarks.jl/benchmarks/Jumps resolves the v7 stack once consumers are migrated to build_jump_problem (separate downstream PR)

🤖 Generated with Claude Code

…problem

SciMLBase v3 + Catalyst v16 broke the v1.x design of JumpProblemLibrary in
two independent ways:

1. The `DiscreteProblem(::ReactionSystem, u0, tspan, p; eval_module=...)`
   constructor was removed. Lowering via `complete(jump_model(rs))` and
   then calling `DiscreteProblem(jsys, u0, tspan, p)` does not work either:
   SciMLBase v3 explicitly throws "A system with jumps cannot be used to
   construct a `SciMLBase.DiscreteProblem`. Consider a `JumpProblem`
   instead." (lib/ModelingToolkitBase/src/problems/compatibility.jl:125).

2. The new idiom for going from a `ReactionSystem` to a stochastic-jump
   simulation is `JumpProblem(rs, u0, tspan, p; aggregator=...)` directly —
   no separate `DiscreteProblem` step.

This commit redesigns the library around the new idiom:

- `JumpProblemNetwork.discrete_prob` is now `nothing` for every problem.
  The struct shape is preserved so consumers can still pattern-match on
  the field, but a v2.0 major bump signals the semantic change.
- Adds `build_jump_problem(jpn, aggregator; kwargs...)` which constructs a
  `JumpProcesses.JumpProblem` from a `JumpProblemNetwork` with the
  supplied aggregator. Preferred consumer entry point in v2.0+.
- Adds `JumpProcesses` as a direct dep (was transitive via Catalyst).
- Bumps `Catalyst` compat from `15` to `16` and `DiffEqBase` to `6, 7`
  to allow the OrdinaryDiffEq v7 stack.

Migration for downstream consumers (e.g. SciMLBenchmarks Jumps benchmark):

```julia
# v1.x
rn = jpn.network; prob = jpn.discrete_prob
JumpProblem(rn, prob, Direct())

# v2.0
build_jump_problem(jpn, Direct())
# or directly:
JumpProblem(jpn.network, jpn.u0, (0.0, jpn.tstop), jpn.rates;
            aggregator = Direct())
```

`Aqua.test_all` passes locally on Julia 1.11 with the v7 stack
(SciMLBase 3.7.1 / DiffEqBase 7.1.0 / Catalyst 16.1.1 / JumpProcesses 9.28.0).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
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

Successfully merging this pull request may close these issues.

2 participants