pub struct GridSolution<const N: usize, C> {
pub value: f64,
pub control: C,
pub value_grid: Option<Vec<f64>>,
}Expand description
Output from a numerical HJB solver, parameterized by the control type.
Contains the value function and the optimal control at a query state. The optional grid stores the full value function when the solver works on a finite-difference grid.
Fields§
§value: f64Value function V(t, x) at the query state.
control: COptimal control at the query state.
value_grid: Option<Vec<f64>>Full value function on the grid (Some for FD solvers, None for
grid-free solvers such as BSDE).
Implementations§
Source§impl<const N: usize, C> GridSolution<N, C>
impl<const N: usize, C> GridSolution<N, C>
Sourcepub fn new(value: f64, control: C, value_grid: Option<Vec<f64>>) -> Self
pub fn new(value: f64, control: C, value_grid: Option<Vec<f64>>) -> Self
Creates a GridSolution from raw components.
§Examples
use solver::numeric::result::GridSolution;
let solution = GridSolution::<1, f64>::new(1.5, 0.25, None);
assert_eq!(solution.value, 1.5);
assert_eq!(solution.control, 0.25);
assert!(solution.value_grid.is_none());Trait Implementations§
Auto Trait Implementations§
impl<const N: usize, C> Freeze for GridSolution<N, C>where
C: Freeze,
impl<const N: usize, C> RefUnwindSafe for GridSolution<N, C>where
C: RefUnwindSafe,
impl<const N: usize, C> Send for GridSolution<N, C>where
C: Send,
impl<const N: usize, C> Sync for GridSolution<N, C>where
C: Sync,
impl<const N: usize, C> Unpin for GridSolution<N, C>where
C: Unpin,
impl<const N: usize, C> UnsafeUnpin for GridSolution<N, C>where
C: UnsafeUnpin,
impl<const N: usize, C> UnwindSafe for GridSolution<N, C>where
C: UnwindSafe,
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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