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

ProblemReferenceFD schemeObtained precisionSuite tierSource
1D Laplace\(u(x) = x\)Stationary direct solve\(10^{-6}\) reldefaultelliptic_benchmarks.rs
1D Poisson\(u(x) = x(1-x)/2\)Stationary direct solve\(10^{-4}\) reldefaultelliptic_benchmarks.rs
2D separable Poisson\(\sin(\pi x)\sin(\pi y)\)Stationary SOR\(2\%\) reldefaultelliptic_benchmarks.rs
1D reaction-diffusion\(\sinh(\sqrt{a}\,x)\)Stationary direct solve\(10^{-4}\) reldefaultelliptic_benchmarks.rs
1D Neumann Laplace\(u(x) = 1\)Stationary direct solve\(10^{-4}\) reldefaultelliptic_benchmarks.rs
1D Robin Laplace\(u(x) = (x+1)/2\)Stationary direct solve\(10^{-4}\) reldefaultelliptic_benchmarks.rs
1D heat\(\cos(\pi x)e^{-D\pi^2\tau}\)Explicit / Implicit / CN\(2\%\)-\(5\%\) reldefaultpde_benchmarks.rs
2D separable heat\(\cos(\pi x)\cos(\pi y)e^{-2D\pi^2\tau}\)Strang ADI vs fine explicit\(1\%\) reldefaultpde_schemes.rs
1D convection-diffusiontraveling GaussianImplicit / CN\(5\%\) reldefaultpde_benchmarks.rs
Black-Scholes callBlack-Scholes formulaImplicit / CN\(5\%\) reldefaultpde_benchmarks.rs
American put (\(r=0\))Black-Scholes putImplicit / CN / Explicit\(5\%\) reldefaultamerican_put_fd.rs, pde_schemes.rs
Merton portfolioclosed-form value and policyExplicit\(5\%\) reldefaultmerton_fd.rs
Finite-horizon LQRiccati value and feedbackExplicit\(10\%\) reldefaultlq_regulator_fd.rs
Correlated 2D LQRiccati value (full covariance)Explicit\(10\%\) reldefaultlq_correlated_fd.rs
Stationary LQalgebraic RiccatiPolicy iteration\(10^{-3}\) reldefaultelliptic_control.rs
Avellaneda-Stoikovmatrix-exponential spreadsExplicit / Implicit / CN / ADI\(0.05\) spreaddefaultavellaneda_control_fd.rs, pde_schemes.rs, policy_iteration.rs
Avellaneda driftspectral exact spreadsExplicit\(0.05\) spreaddefaultavellaneda_drift_control_fd.rs
Avellaneda impactspectral exact spreadsExplicit\(0.05\) spreaddefaultavellaneda_impact_control_fd.rs
Stationary AvellanedaGueant eigenvector and spreadsPerron power iteration\(10^{-4}\)defaultelliptic_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.

ProblemReferenceStandard toleranceHigh-precision targetSuite tierSource
Merton portfolioclosed-form policy/valuepolicy machine, value \(15\%\) rel\(\leq 0.1\%\) reldefaultmerton_bsde.rs
Finite-horizon LQRiccati policy/valuepolicy machine, value \(15\%\) rel\(\leq 0.1\%\) reldefaultlq_regulator_bsde.rs
Avellaneda-Stoikovmatrix-exponential spreadswell-formed, symmetric\(\leq 0.1\%\) reldefaultavellaneda_control_bsde.rs
Avellaneda-Stoikovmatrix-exponential spreads\(10^{-4}\) total over \(q\)\(\leq 0.1\%\) relslow-testsexact_vs_bsde/base.rs
Avellaneda driftspectral exact spreadsfinite error\(\leq 0.1\%\) relslow-testsexact_vs_bsde/drift.rs
Avellaneda impactspectral exact spreads\(10^{-3}\) total over \(q\)\(\leq 0.1\%\) relslow-testsexact_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.

ModelNCross-checkObtained precisionSuite tierSource
Heston2FD vs BSDE, zero time steps\(10^{-5}\) spreaddefaultbsde_vs_fdm/consistency.rs
Heston2FD vs BSDE, finite horizon\(0.05\) spreadslow-testsbsde_vs_fdm/consistency.rs
Heston (\(v_{\xi}=0\))2FD vs AS exact, BSDE vs AS exactFD \(10^{-3}\) spread, BSDE \(0.15\) spreadslow-testsbsde_heston/degenerate.rs
Heston (\(v_{\xi}=0\), high \(a=140\))2BSDE vs AS exact, per-component bid/ask\(0.02\) spreadslow-testsbsde_heston/exact_reduction.rs
Hawkes2FD vs BSDE, zero time steps\(10^{-5}\) spreaddefaultbsde_vs_fdm/consistency.rs
Hawkes2FD vs BSDE, finite horizon\(0.15\) spreadslow-testsbsde_vs_fdm/consistency.rs
Hawkes (\(\alpha=0\))2FD vs AS exact, BSDE vs AS exactFD \(10^{-3}\) spread, BSDE \(0.10\) spreadslow-testsbsde_hawkes/degenerate.rs
Hawkes (\(\alpha=0\), high \(\mu=140\))2BSDE vs AS exact, per-component bid/ask\(0.02\) spreadslow-testsbsde_hawkes/exact_reduction.rs
Bilateral Hawkes3FD vs BSDE, zero time steps\(10^{-5}\) spreaddefaultbsde_vs_fdm/bilateral_hawkes.rs
Bilateral Hawkes3FD vs BSDE, finite horizon\(5\%\) of base spreadslow-testsbsde_vs_fdm/bilateral_hawkes.rs
Bilateral Hawkes (\(\alpha=0\), symmetric, high \(\mu=140\))3BSDE vs AS exact, per-component bid/ask\(0.02\) spreadslow-testsbsde_bilateral_hawkes/exact_reduction.rs
OFI (\(\eta_{\text{ofi}}=0\), \(\alpha=0\), symmetric, high \(\mu=140\))3BSDE vs AS exact, per-component bid/ask\(0.02\) spreadslow-testsbsde_bilateral_hawkes/exact_reduction.rs
Heston-Hawkes3degeneracy well-formednessfinite and positiveslow-testsbsde_heston_hawkes/degenerate.rs
Heston-Hawkes (\(v_{\xi}=0\), \(\alpha=0\), high \(\mu=140\))3BSDE vs AS exact, per-component bid/ask\(0.02\) spreadslow-testsbsde_heston_hawkes/exact_reduction.rs
Manufactured reduced market-making2FD vs manufactured value, BSDE vs manufactured valueFD \(10^{-12}\) value, BSDE \(0.0025\) valueslow-testsmanufactured_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.

CheckReferenceObtained precisionSuite tierSource
Drift \(\mu=0\) reduces to base ASAvellanedaExact\(10^{-10}\) spreaddefaultexact_vs_exact/consistency.rs
Impact \(\xi=0\) reduces to base ASAvellanedaExact\(10^{-10}\) spreaddefaultexact_vs_exact/consistency.rs
Lot size \(=1\) reduces to base ASAvellanedaExact\(10^{-2}\) spreaddefaultavellaneda_lot_size.rs
Base FD time-refinement convergenceAvellanedaExactmonotone L2 decreasedefaultexact_vs_finite_diff/convergence_base.rs
Drift FD time-refinement convergenceAvellanedaDriftExactmonotone L2 decreasedefaultexact_vs_finite_diff/convergence_drift.rs
Impact FD time-refinement convergenceAvellanedaImpactExactmonotone L2 decreasedefaultexact_vs_finite_diff/convergence_market_impact.rs
Policy iteration vs exact (implicit/explicit)AvellanedaExact\(0.1\%\)defaultconvergence/policy_iteration.rs
Drift \(\mu=0\) vs exactAvellanedaExact\(2\%\)defaultconvergence/drift_zero.rs
Impact \(\xi=0\) vs exactAvellanedaExact\(2\%\)defaultconvergence/impact_zero.rs
American put convergenceBlack-Scholes put\(10\%\)defaultconvergence/american_put.rs

Test suite tiers

TierTriggerContentsApproximate scope
Unitcargo test --lib -p solverPure functions, no grids or solversalways run
Default integrationcargo test -p solverFD grid solves, analytical comparisons, smoke testsalways run
Slowcargo test -p solver --features slow-testsBSDE Monte Carlo, convergence sweeps, degeneracyon demand
BSDE precisionmanual, one-timehigh-precision BSDE vs exact, \(\leq 0.1\%\)never in CI