pub struct BsdeSolution<const N: usize> {
pub coefficients: Vec<Vec<f64>>,
pub basis_type: BasisFunctionType,
pub dt: f64,
pub steps: usize,
pub x_init: [f64; N],
pub feature_scale: Vec<f64>,
pub clamp_range: Option<(f64, f64)>,
pub gradient_steps: [f64; N],
pub v0: f64,
pub control_t0: ControlOutput<N>,
}Expand description
Complete BSDE solution storing regression coefficients for all time steps.
Enables point evaluation of the value function and optimal controls at any (time_index, state) pair without re-running the solver.
Fields§
§coefficients: Vec<Vec<f64>>Regression coefficients at each backward time step.
coefficients[t] contains the basis weights at time index t.
basis_type: BasisFunctionTypeBasis function configuration.
dt: f64Time step size.
steps: usizeNumber of backward time steps.
x_init: [f64; N]Initial state used for centering.
feature_scale: Vec<f64>Feature scaling per dimension.
clamp_range: Option<(f64, f64)>Clamping range for basis inputs.
gradient_steps: [f64; N]Gradient step sizes per dimension.
v0: f64Value function at t=0 and x_init.
control_t0: ControlOutput<N>Optimal control at t=0 and x_init.
Implementations§
Source§impl<const N: usize> BsdeSolution<N>
impl<const N: usize> BsdeSolution<N>
Sourcepub fn evaluate(&self, time_index: usize, state: &[f64; N]) -> f64
pub fn evaluate(&self, time_index: usize, state: &[f64; N]) -> f64
Evaluate the value function at a given time index and state.
time_index ranges from 0 (start) to self.steps (terminal).
Sourcepub fn evaluate_control<M: Model<N>>(
&self,
time_index: usize,
state: &[f64; N],
model: &M,
) -> ControlOutput<N>
pub fn evaluate_control<M: Model<N>>( &self, time_index: usize, state: &[f64; N], model: &M, ) -> ControlOutput<N>
Evaluate optimal control at a given time index and state.
Sourcepub fn evaluate_spread_trajectory<M: Model<N>>(
&self,
state: &[f64; N],
model: &M,
a: f64,
kappa: f64,
) -> Vec<(f64, f64)>
pub fn evaluate_spread_trajectory<M: Model<N>>( &self, state: &[f64; N], model: &M, a: f64, kappa: f64, ) -> Vec<(f64, f64)>
Evaluate optimal spreads across all time steps for a given state.
Returns vectors of (bid_spread, ask_spread) for each time step from 0 to steps-1.
Sourcepub fn time_to_index(&self, t: f64) -> usize
pub fn time_to_index(&self, t: f64) -> usize
Convert a time value to the nearest time index.
t is time elapsed from 0 (start of horizon).
Auto Trait Implementations§
impl<const N: usize> Freeze for BsdeSolution<N>
impl<const N: usize> RefUnwindSafe for BsdeSolution<N>
impl<const N: usize> Send for BsdeSolution<N>
impl<const N: usize> Sync for BsdeSolution<N>
impl<const N: usize> Unpin for BsdeSolution<N>
impl<const N: usize> UnsafeUnpin for BsdeSolution<N>
impl<const N: usize> UnwindSafe for BsdeSolution<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more