Add ode integrator rng#3064
Merged
Merged
Conversation
Implement Phase 1 Step 2 of the SciML RNG design: add an `rng::RNGType` field to `ODEIntegrator` so callbacks (e.g. JumpProcesses aggregations) can access a per-integrator RNG via `get_rng(integrator)`. - Add `RNGType` type parameter and `rng` field to ODEIntegrator struct - Implement `has_rng`, `get_rng`, `set_rng!` for ODEIntegrator - Accept `rng` kwarg in `__init` (defaults to `Random.default_rng()`) - Accept `rng` kwarg in `reinit!`, applied before callback initialization - Add `Random` as a runtime dependency of OrdinaryDiffEqCore - Add `set_rng!` type check with clear ArgumentError on mismatch - Add comprehensive tests including StableRNG reproducibility checks Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move has_rng/get_rng/set_rng! implementations to group with other SciMLBase interface methods (has_reinit/reinit!) for consistency. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Member
Author
|
@ChrisRackauckas this should be done if the tests pass now. The 1.10 integrator II failure is expected due to how sources work. |
Member
|
Yes, and Rosenbrock because of a functionwrapping bug I was working through this morning in #3069 when it expanded to mass matrices. So if it's just that then we should be good to go. |
Member
|
I'll merge and rebase on this |
Member
Author
|
Thanks! I'll move on to StochasticDiffEq next. Now it will start getting a bit messier due to the coupling with JumpProcesses, so that may require a StochasticDiffEq update, then JumpProcesses, then another StochasticDiffEq to get everything in the right shape. |
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.
Needs SciML/SciMLBase.jl#1240 and a SciMLBase release before merging.
Implement Phase 1 Step 2 of the SciML RNG design: add an
rng::RNGTypefield toODEIntegratorso callbacks can access a per-integrator RNG viaget_rng(integrator).RNGTypetype parameter andrngfield to ODEIntegrator structhas_rng,get_rng,set_rng!for ODEIntegratorrngkwarg in__init(defaults toRandom.default_rng())rngkwarg inreinit!, applied before callback initializationRandomas a runtime dependency of OrdinaryDiffEqCoreset_rng!type check with clear ArgumentError on mismatch