JumpProblemLibrary v2.0: drop stored DiscreteProblem; add build_jump_problem (OrdinaryDiffEq v7 stack)#184
Open
ChrisRackauckas-Claude wants to merge 1 commit intoSciML:masterfrom
Conversation
…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>
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
discrete_probfield's storedDiscreteProblemvalue across every example (set tonothing) — required because SciMLBase v3 / Catalyst v16 made the v1.x design unbuildable.build_jump_problem(jpn, aggregator; kwargs...)helper for the new v2.0 consumer entry point.2.0.0. AddsJumpProcessesas a direct dep; widensCatalystcompat to"16"andDiffEqBaseto"6, 7".Why
SciMLBenchmarks.jl's
Jumpsbenchmark cannot resolve under the OrdinaryDiffEq v7 stack because v1.x JumpProblemLibrary uses two APIs that no longer exist:DiscreteProblem(::ReactionSystem, u0, tspan, p; eval_module=...)was removed in Catalyst v16. Lowering viacomplete(jump_model(rs))and then callingDiscreteProblem(jsys, u0, tspan, p)does not work either: SciMLBase v3 explicitly throws(
ModelingToolkitBase/src/problems/compatibility.jl:125).The new idiom for
ReactionSystem→stochastic-jump simulation isJumpProblem(rs, u0, tspan, p; aggregator=...)directly — no separateDiscreteProblemstep.Migration for consumers
The
JumpProblemNetworkstruct shape is preserved (sojpn.discrete_prob === nothingstill pattern-matches without anUndefRefError); the major version bump signals the semantic change.Test plan
Aqua.test_allpasses locally on Julia 1.11 with the v7 stack: SciMLBase 3.7.1, DiffEqBase 7.1.0, Catalyst 16.1.1, JumpProcesses 9.28.0SciMLBenchmarks.jl/benchmarks/Jumpsresolves the v7 stack once consumers are migrated tobuild_jump_problem(separate downstream PR)🤖 Generated with Claude Code