Classical Methods
This page records how the classical solver results are validated: the
finite-difference (FD) and least-squares Monte Carlo (BSDE) paths in the Rust
solver crate. For every benchmark problem it lists the reference used, the
numerical method checked against it, and the tolerance at which the check
currently passes. It complements the narrative solver pages
(PDE Solving Methods and
Elliptic PDE Solving Methods) by compressing
the same information into machine-checkable tables. The neural methods are
validated separately on the neural network methods page.
Validation policy
The solver has two kinds of validation problems:
- Exact-solution problems have a closed-form or semi-analytical reference. They are validated numerical-versus-exact. Both the finite-difference (FD) and least-squares Monte Carlo (BSDE) paths are checked against the same reference where the method is applicable.
- No-exact-solution problems (Hawkes, Heston, and higher-dimensional market-making models) have no reduced closed form. They are validated numerical-versus-numerical: FD against BSDE, plus degeneracy tests that reduce the model to a model with an exact solution.
Tolerances are recorded as obtained, not as goals. They reflect the assertions currently present in the tests. Every entry states whether the check is deterministic (FD, closed-form consistency) or stochastic (BSDE).
BSDE precision policy
BSDE is Monte Carlo and does not converge to high precision cheaply. Its
standard-suite assertions therefore bound coarse, smoke-level error, not a
tight tolerance. High-precision BSDE runs (targeting relative error at or
below \(0.1\%\)) are a one-time exercise, not part of cargo test. They are
run on demand and their results are recorded in the BSDE table below; they
are not re-run on every build.
The standard BSDE checks divide into:
- Tier 1 (default suite): fast smoke tests and zero-time-step consistency. These assert well-formedness, symmetry, and agreement at the terminal boundary, not tight finite-horizon accuracy.
- Tier 2 (
slow-tests): finite-horizon BSDE checks with bounded, generous tolerances driven by Monte Carlo noise. - Tier 3 (one-time exercise): high-precision BSDE runs targeting \(\leq 0.1\%\) relative error. Run explicitly, never in the default suite.
Reading the tolerance column
- A percentage is a relative error bound.
- An absolute figure is a spread or value error bound.
- "Machine" means the check is at or near floating-point round-off.
- "Finite/well-formed" means the assertion is qualitative (finite, positive, symmetric), not a numerical tolerance.
Canonical error metric
All numerical-versus-reference comparisons use the canonical error metric defined on the Validation page.
Exact-solution benchmarks: FD path
| Problem | Reference | FD scheme | Obtained precision | Suite tier | Source |
|---|---|---|---|---|---|
| 1D Laplace | \(u(x) = x\) | Stationary direct solve | \(10^{-6}\) rel | default | elliptic_benchmarks.rs |
| 1D Poisson | \(u(x) = x(1-x)/2\) | Stationary direct solve | \(10^{-4}\) rel | default | elliptic_benchmarks.rs |
| 2D separable Poisson | \(\sin(\pi x)\sin(\pi y)\) | Stationary SOR | \(2\%\) rel | default | elliptic_benchmarks.rs |
| 1D reaction-diffusion | \(\sinh(\sqrt{a}\,x)\) | Stationary direct solve | \(10^{-4}\) rel | default | elliptic_benchmarks.rs |
| 1D Neumann Laplace | \(u(x) = 1\) | Stationary direct solve | \(10^{-4}\) rel | default | elliptic_benchmarks.rs |
| 1D Robin Laplace | \(u(x) = (x+1)/2\) | Stationary direct solve | \(10^{-4}\) rel | default | elliptic_benchmarks.rs |
| 1D heat | \(\cos(\pi x)e^{-D\pi^2\tau}\) | Explicit / Implicit / CN | \(2\%\)-\(5\%\) rel | default | pde_benchmarks.rs |
| 2D separable heat | \(\cos(\pi x)\cos(\pi y)e^{-2D\pi^2\tau}\) | Strang ADI vs fine explicit | \(1\%\) rel | default | pde_schemes.rs |
| 1D convection-diffusion | traveling Gaussian | Implicit / CN | \(5\%\) rel | default | pde_benchmarks.rs |
| Black-Scholes call | Black-Scholes formula | Implicit / CN | \(5\%\) rel | default | pde_benchmarks.rs |
| American put (\(r=0\)) | Black-Scholes put | Implicit / CN / Explicit | \(5\%\) rel | default | american_put_fd.rs, pde_schemes.rs |
| Merton portfolio | closed-form value and policy | Explicit | \(5\%\) rel | default | merton_fd.rs |
| Finite-horizon LQ | Riccati value and feedback | Explicit | \(10\%\) rel | default | lq_regulator_fd.rs |
| Correlated 2D LQ | Riccati value (full covariance) | Explicit | \(10\%\) rel | default | lq_correlated_fd.rs |
| Stationary LQ | algebraic Riccati | Policy iteration | \(10^{-3}\) rel | default | elliptic_control.rs |
| Avellaneda-Stoikov | matrix-exponential spreads | Explicit / Implicit / CN / ADI | \(0.05\) spread | default | avellaneda_control_fd.rs, pde_schemes.rs, policy_iteration.rs |
| Avellaneda drift | spectral exact spreads | Explicit | \(0.05\) spread | default | avellaneda_drift_control_fd.rs |
| Avellaneda impact | spectral exact spreads | Explicit | \(0.05\) spread | default | avellaneda_impact_control_fd.rs |
| Stationary Avellaneda | Gueant eigenvector and spreads | Perron power iteration | \(10^{-4}\) | default | elliptic_avellaneda.rs |
Exact-solution benchmarks: BSDE path
BSDE is Monte Carlo. The standard assertions are smoke-level; the high-precision target is a one-time exercise whose obtained results are documented in BSDE Precision.
| Problem | Reference | Standard tolerance | High-precision target | Suite tier | Source |
|---|---|---|---|---|---|
| Merton portfolio | closed-form policy/value | policy machine, value \(15\%\) rel | \(\leq 0.1\%\) rel | default | merton_bsde.rs |
| Finite-horizon LQ | Riccati policy/value | policy machine, value \(15\%\) rel | \(\leq 0.1\%\) rel | default | lq_regulator_bsde.rs |
| Avellaneda-Stoikov | matrix-exponential spreads | well-formed, symmetric | \(\leq 0.1\%\) rel | default | avellaneda_control_bsde.rs |
| Avellaneda-Stoikov | matrix-exponential spreads | \(10^{-4}\) total over \(q\) | \(\leq 0.1\%\) rel | slow-tests | exact_vs_bsde/base.rs |
| Avellaneda drift | spectral exact spreads | finite error | \(\leq 0.1\%\) rel | slow-tests | exact_vs_bsde/drift.rs |
| Avellaneda impact | spectral exact spreads | \(10^{-3}\) total over \(q\) | \(\leq 0.1\%\) rel | slow-tests | exact_vs_bsde/impact.rs |
The BSDE high-precision target is not asserted in the default suite. The one-time high-precision verification and its obtained precision are recorded in BSDE Precision.
No-exact-solution benchmarks: numerical vs numerical
These models have no reduced closed form. FD and BSDE are checked against
each other, and degeneracy limits reduce each model to an exact-solution
reference. The expanded models (Heston, AvellanedaHawkes, HestonHawkes,
BilateralHawkes, BilateralHawkesOrderFlowImbalance) are full-value
problems: their bsde_driver is running_reward + local_source (factor
transport excluded, reward rate bounded at 1/dt per fill side) and their
next_step_controlled simulates inventory fills under the optimal control.
Because their inventory dynamics depend on the control, finite-horizon BSDE
checks run in coupled (Picard) mode; the decoupled mode is correct only at
the terminal boundary.
| Model | N | Cross-check | Obtained precision | Suite tier | Source |
|---|---|---|---|---|---|
| Heston | 2 | FD vs BSDE, zero time steps | \(10^{-5}\) spread | default | bsde_vs_fdm/consistency.rs |
| Heston | 2 | FD vs BSDE, finite horizon | \(0.05\) spread | slow-tests | bsde_vs_fdm/consistency.rs |
| Heston (\(v_{\xi}=0\)) | 2 | FD vs AS exact, BSDE vs AS exact | FD \(10^{-3}\) spread, BSDE \(0.15\) spread | slow-tests | bsde_heston/degenerate.rs |
| Heston (\(v_{\xi}=0\), high \(a=140\)) | 2 | BSDE vs AS exact, per-component bid/ask | \(0.02\) spread | slow-tests | bsde_heston/exact_reduction.rs |
| Hawkes | 2 | FD vs BSDE, zero time steps | \(10^{-5}\) spread | default | bsde_vs_fdm/consistency.rs |
| Hawkes | 2 | FD vs BSDE, finite horizon | \(0.15\) spread | slow-tests | bsde_vs_fdm/consistency.rs |
| Hawkes (\(\alpha=0\)) | 2 | FD vs AS exact, BSDE vs AS exact | FD \(10^{-3}\) spread, BSDE \(0.10\) spread | slow-tests | bsde_hawkes/degenerate.rs |
| Hawkes (\(\alpha=0\), high \(\mu=140\)) | 2 | BSDE vs AS exact, per-component bid/ask | \(0.02\) spread | slow-tests | bsde_hawkes/exact_reduction.rs |
| Bilateral Hawkes | 3 | FD vs BSDE, zero time steps | \(10^{-5}\) spread | default | bsde_vs_fdm/bilateral_hawkes.rs |
| Bilateral Hawkes | 3 | FD vs BSDE, finite horizon | \(5\%\) of base spread | slow-tests | bsde_vs_fdm/bilateral_hawkes.rs |
| Bilateral Hawkes (\(\alpha=0\), symmetric, high \(\mu=140\)) | 3 | BSDE vs AS exact, per-component bid/ask | \(0.02\) spread | slow-tests | bsde_bilateral_hawkes/exact_reduction.rs |
| OFI (\(\eta_{\text{ofi}}=0\), \(\alpha=0\), symmetric, high \(\mu=140\)) | 3 | BSDE vs AS exact, per-component bid/ask | \(0.02\) spread | slow-tests | bsde_bilateral_hawkes/exact_reduction.rs |
| Heston-Hawkes | 3 | degeneracy well-formedness | finite and positive | slow-tests | bsde_heston_hawkes/degenerate.rs |
| Heston-Hawkes (\(v_{\xi}=0\), \(\alpha=0\), high \(\mu=140\)) | 3 | BSDE vs AS exact, per-component bid/ask | \(0.02\) spread | slow-tests | bsde_heston_hawkes/exact_reduction.rs |
| Manufactured reduced market-making | 2 | FD vs manufactured value, BSDE vs manufactured value | FD \(10^{-12}\) value, BSDE \(0.0025\) value | slow-tests | manufactured_solution.rs |
Consistency and convergence checks
Beyond exact-vs-numerical and numerical-vs-numerical comparisons, the following checks pin down the analytical layer and solver convergence.
| Check | Reference | Obtained precision | Suite tier | Source |
|---|---|---|---|---|
| Drift \(\mu=0\) reduces to base AS | AvellanedaExact | \(10^{-10}\) spread | default | exact_vs_exact/consistency.rs |
| Impact \(\xi=0\) reduces to base AS | AvellanedaExact | \(10^{-10}\) spread | default | exact_vs_exact/consistency.rs |
| Lot size \(=1\) reduces to base AS | AvellanedaExact | \(10^{-2}\) spread | default | avellaneda_lot_size.rs |
| Base FD time-refinement convergence | AvellanedaExact | monotone L2 decrease | default | exact_vs_finite_diff/convergence_base.rs |
| Drift FD time-refinement convergence | AvellanedaDriftExact | monotone L2 decrease | default | exact_vs_finite_diff/convergence_drift.rs |
| Impact FD time-refinement convergence | AvellanedaImpactExact | monotone L2 decrease | default | exact_vs_finite_diff/convergence_market_impact.rs |
| Policy iteration vs exact (implicit/explicit) | AvellanedaExact | \(0.1\%\) | default | convergence/policy_iteration.rs |
| Drift \(\mu=0\) vs exact | AvellanedaExact | \(2\%\) | default | convergence/drift_zero.rs |
| Impact \(\xi=0\) vs exact | AvellanedaExact | \(2\%\) | default | convergence/impact_zero.rs |
| American put convergence | Black-Scholes put | \(10\%\) | default | convergence/american_put.rs |
Test suite tiers
| Tier | Trigger | Contents | Approximate scope |
|---|---|---|---|
| Unit | cargo test --lib -p solver | Pure functions, no grids or solvers | always run |
| Default integration | cargo test -p solver | FD grid solves, analytical comparisons, smoke tests | always run |
| Slow | cargo test -p solver --features slow-tests | BSDE Monte Carlo, convergence sweeps, degeneracy | on demand |
| BSDE precision | manual, one-time | high-precision BSDE vs exact, \(\leq 0.1\%\) | never in CI |