Skip to content

Simulator Configurations

Simulator configurations control how continuous-time trajectories are solved. Use ODESimulatorConfig for deterministic continuous-time dynamics and SDESimulatorConfig for stochastic continuous-time dynamics. Discrete-time simulation samples the transition distribution directly and does not accept a simulator configuration.

SimulatorConfig

ODESimulatorConfig

Configuration object for ODE simulators.

Attributes:

Name Type Description
solver AbstractSolver

Diffrax solver used for integration. Defaults to diffrax.Tsit5(). See Diffrax's solver guide when selecting an alternative.

adjoint AbstractAdjoint

Strategy used to differentiate through the solve. Defaults to diffrax.RecursiveCheckpointAdjoint().

stepsize_controller AbstractStepSizeController

Step-size policy used by Diffrax. Defaults to diffrax.ConstantStepSize(); supply an adaptive controller when error-controlled stepping is required.

dt0 float | int | Array

Initial step size passed to diffrax.diffeqsolve. With the default constant-step controller, this is the fixed integration step. Defaults to 1e-3.

max_steps int

Maximum number of integration steps permitted by diffrax.diffeqsolve. Defaults to 100_000.

Properties

diffeqsolve_settings (dict[str, Any]): Normalized keyword arguments passed to diffrax.diffeqsolve; scalar time values are converted to JAX arrays.

diffeqsolve_settings: dict[str, Any] property

Return normalized Diffrax settings for diffeqsolve.

SDESimulatorConfig

SDE Solver Settings for SDE Simulation. Supports diffrax-based solvers or a faster, hand-rolled Euler-Maruyama scan backend.

!! Note: The choice of solver can imply convergence to different paths for the same model. For example, the default diffrax.Heun() converges to the Stratonovich SDE, while diffrax.EulerMaruyama() converges to the Ito SDE. This likely doesn't matter for most models, but can cause issues with state-dependent diffusions.

Attributes:

Name Type Description
solver AbstractSolver

Diffrax SDE solver. Defaults to diffrax.Heun(). This setting is used only when source="diffrax".

stepsize_controller AbstractStepSizeController

Diffrax step-size policy. Defaults to diffrax.ConstantStepSize() and is used only when source="diffrax".

adjoint AbstractAdjoint

Strategy used to differentiate through the Diffrax solve. Defaults to diffrax.RecursiveCheckpointAdjoint() and is used only when source="diffrax".

dt0 float | int | Array

Integration step size. It is passed to Diffrax as the initial step size and used as the fixed Euler-Maruyama step by the "em_scan" backend. Defaults to 1e-4.

tol_vbt float | int | Array | None

Tolerance for Diffrax's VirtualBrownianTree. When source="diffrax", None resolves to dt0 / 2; an explicit value must be smaller than dt0 for statistically correct simulation. Ignored by "em_scan".

max_steps int | None

Maximum number of Diffrax integration steps. None leaves the Diffrax default in effect. The "em_scan" backend does not use this setting.

source Literal['diffrax', 'em_scan']

Simulation backend. "diffrax" uses the configured Diffrax solver and a virtual Brownian tree. "em_scan" uses a fixed-step Euler-Maruyama jax.lax.scan and is the default for speed.

Properties

diffeqsolve_settings (dict[str, Any]): Normalized Diffrax keyword arguments derived from the config; scalar time values are converted to JAX arrays. resolved_tol_vbt (jax.Array | None): Effective virtual-Brownian-tree tolerance for the selected backend. Returns None for "em_scan" and validates the tolerance for "diffrax".

diffeqsolve_settings: dict[str, Any] property

Return normalized Diffrax-style backend settings.

resolved_tol_vbt: Real[Array, ''] | None property

Return the resolved Brownian-tree tolerance for the active backend.