Skip to main content

Module bsde

Module bsde 

Source
Expand description

§BSDE Solver

A probabilistic method based on the Feynman-Kac theorem and Backward Stochastic Differential Equations (BSDEs). Uses a regression-based Monte Carlo approach (similar to Longstaff-Schwartz for American options) with enhanced numerical stability features.

Source: src/numeric/bsde/


§BSDE Formulation

The value function $V(t, X_t)$ corresponds to the solution $Y_t$ of the BSDE:

$$ -dY_t = \sup_{u} { f(t, X_t, u) + \mathcal{L}^u V(t, X_t) - \mathcal{L}^{diff} V(t, X_t) } dt - Z_t dW_t $$

where $Y_t = V(t, X_t)$ and $Z_t = \nabla V(t, X_t) \sigma$.


§Algorithm

§1. Forward Pass (Exploration)

Simulate $M$ sample paths for the state variables (Inventory $q_t$) using a diffusive proxy process to explore the state space:

$$ dq_t = \sigma_{explore} dW_t $$

§2. Backward Pass (Induction)

Iterate backward from $t = T$ to $0$. Initialize $Y_T = \text{Terminal}(X_T)$.

At each step $t$:

§a. Regression (Projection)
  • Regress the future values $Y_{t+1}$ onto a set of basis functions $\phi_k(q_t)$.
  • Input Scaling: State variables are mapped to a canonical domain $[-2, 2]$ via a scaling factor $s \approx \frac{2}{R}$. This prevents the condition number of the regression matrix $A^T A$ from exploding for high-order polynomials.
  • Basis Functions:
    • Hermite Polynomials ($He_n(x)$) — the default. Orthogonal with respect to the normal distribution weight function; superior conditioning for centralized data.
    • Power Series — available, but less stable for degree $> 5$.
  • Estimate: $\hat{V}(t, q) \approx \sum_k \beta_k \phi_k(s \cdot q)$.
§b. Gradient Estimation

Compute derivatives analytically from the regression coefficients and basis derivatives:

$$ \partial_q V \approx s \cdot \sum_k \beta_k \phi’_k(s \cdot q) $$

Compute discrete jump values (e.g., $V(q+1) - V(q)$) using the regression model.

§c. Control Optimization
  • Compute optimal controls $\pi^*$ using the estimated gradients.
  • Calculate the driver (Hamiltonian) value $H(t, q, \nabla V, \pi^*)$.
§d. Update

Update path values:

$$ Y_t = \mathbb{E}[Y_{t+1} \mid \mathcal{F}_t] + H \Delta t $$

Uses the regression prediction $\hat{V}(t, q)$ as the conditional expectation to reduce variance.


§Stability

  • Conditioning: The solver automatically monitors the condition number of the regression matrix.
  • Scaling: Adaptive domain scaling prevents “exploding features” where terms like $q^{10}$ exceed floating point limits.
  • Hermite Basis: Mitigates multicollinearity issues common in polynomial regression on finite domains.

§Trade-offs

  • Pros: Mesh-free, scales to high dimensions, robust to high-degree approximations with correct scaling.
  • Cons: Noisy (Monte Carlo error), requires tuning exploration range ($R \approx 1.5 , q_{max}$).
Dimension ScaleBSDE ApproachFBSDE ApproachPrimary Bottleneck
Low (d <= 3)PDE / Finite Diff.Four-Step SchemeMemory (Grid grows as $N^d$)
Medium (d <= 10)LSMCPicard + LSMCBasis explosion / Matrix inv.
High (d > 10)Deep BSDEDeep FBSNN / DGMTraining stability / Minima

§Configuration

Solver parameters live in src/numeric/bsde/config.rs. Key fields:

FieldDescription
num_pathsNumber of Monte Carlo paths ($M$)
basis_degreePolynomial degree for regression
basis_typeHermite (default) or Power
explore_range$R$ — controls the forward diffusion spread
scale_factorOverride for $s$ (auto-computed if None)

Re-exports§

pub use config::BasisFunctionType;
pub use config::BsdeMode;
pub use config::InitializationMode;
pub use solution::BsdeSolution;
pub use solver::BsdeSolver;

Modules§

config
solution
solver