pub struct StationaryLqRegulator {
pub a: f64,
pub b: f64,
pub q: f64,
pub r: f64,
pub c: f64,
pub rho: f64,
pub h: f64,
pub p: f64,
pub d: f64,
pub boundary_conditions: BoundaryConditions<1>,
}Expand description
Infinite-horizon scalar linear-quadratic regulator with constant coefficients.
See the module-level documentation for the formulation and exact solution.
Fields§
§a: f64State-drift coefficient a.
b: f64Control-input coefficient b.
q: f64Running state cost q.
r: f64Running control cost r.
c: f64Diffusion coefficient c.
rho: f64Discount rate rho.
h: f64Grid spacing h used by the finite-difference transport stencil.
p: f64Positive algebraic Riccati solution P.
d: f64Noise-induced additive correction d = c^2 P / rho.
boundary_conditions: BoundaryConditions<1>Boundary conditions for the stationary solve.
Implementations§
Source§impl StationaryLqRegulator
impl StationaryLqRegulator
Sourcepub fn new(a: f64, b: f64, q: f64, r: f64, c: f64, rho: f64, h: f64) -> Self
pub fn new(a: f64, b: f64, q: f64, r: f64, c: f64, rho: f64, h: f64) -> Self
Creates a stationary LQ regulator.
§Panics
Panics if r, q, rho, or h is not positive, or if the scalar
algebraic Riccati equation has no positive real root.
§Examples
use solver::models::stationary_lq::StationaryLqRegulator;
let lq = StationaryLqRegulator::new(-1.0, 1.0, 1.0, 1.0, 0.0, 0.1, 0.1);
assert!(lq.p > 0.0);Sourcepub fn with_h(self, h: f64) -> Self
pub fn with_h(self, h: f64) -> Self
Sets the grid spacing used by the transport stencil.
§Examples
use solver::models::stationary_lq::StationaryLqRegulator;
let lq = StationaryLqRegulator::new(-1.0, 1.0, 1.0, 1.0, 0.0, 0.1, 0.1).with_h(0.05);
assert_eq!(lq.h, 0.05);Sourcepub fn with_boundary_conditions(
self,
boundary_conditions: BoundaryConditions<1>,
) -> Self
pub fn with_boundary_conditions( self, boundary_conditions: BoundaryConditions<1>, ) -> Self
Sets the boundary conditions used by the stationary solve.
§Examples
use solver::models::stationary_lq::StationaryLqRegulator;
use solver::numeric::finite_difference::discretization::{
BoundaryCondition, BoundaryConditions,
};
let lq = StationaryLqRegulator::new(-1.0, 1.0, 1.0, 1.0, 0.0, 0.1, 0.1)
.with_boundary_conditions(BoundaryConditions::new(
[BoundaryCondition::Dirichlet(0.0)],
[BoundaryCondition::Dirichlet(0.0)],
));
assert!(matches!(lq.boundary_conditions.lower[0], BoundaryCondition::Dirichlet(_)));Sourcepub fn exact_value(&self, state: &[f64; 1]) -> f64
pub fn exact_value(&self, state: &[f64; 1]) -> f64
Exact stationary value V(x) = -P x^2 - d.
Sourcepub fn exact_control(&self, state: &[f64; 1]) -> f64
pub fn exact_control(&self, state: &[f64; 1]) -> f64
Exact stationary control u*(x) = -(b / r) P x.
Sourcepub fn exact_boundary_conditions(&self, grid: &Grid<1>) -> BoundaryConditions<1>
pub fn exact_boundary_conditions(&self, grid: &Grid<1>) -> BoundaryConditions<1>
Dirichlet boundary conditions matching the exact value at the grid endpoints.
Trait Implementations§
Source§impl Clone for StationaryLqRegulator
impl Clone for StationaryLqRegulator
Source§fn clone(&self) -> StationaryLqRegulator
fn clone(&self) -> StationaryLqRegulator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ControlProblem<1> for StationaryLqRegulator
impl ControlProblem<1> for StationaryLqRegulator
Source§type Control = f64
type Control = f64
Source§fn optimize(
&self,
_t: f64,
state: &[f64; 1],
_derivs: &StateDerivatives<1>,
) -> Self::Control
fn optimize( &self, _t: f64, state: &[f64; 1], _derivs: &StateDerivatives<1>, ) -> Self::Control
(t, state).Source§fn running_reward(
&self,
_t: f64,
state: &[f64; 1],
control: &Self::Control,
) -> f64
fn running_reward( &self, _t: f64, state: &[f64; 1], control: &Self::Control, ) -> f64
f(t,x,u).Source§fn generator(
&self,
_t: f64,
state: &[f64; 1],
control: &Self::Control,
derivs: &StateDerivatives<1>,
) -> f64
fn generator( &self, _t: f64, state: &[f64; 1], control: &Self::Control, derivs: &StateDerivatives<1>, ) -> f64
L^u V for the given control and
derivative bundle.Source§fn next_step(
&self,
_t: f64,
state: &[f64; 1],
dt: f64,
noise: &[f64; 1],
) -> [f64; 1]
fn next_step( &self, _t: f64, state: &[f64; 1], dt: f64, noise: &[f64; 1], ) -> [f64; 1]
t.Source§fn is_diffusion_dimension(&self, _dim: usize) -> bool
fn is_diffusion_dimension(&self, _dim: usize) -> bool
Source§fn gradient_step(&self, _dim: usize) -> f64
fn gradient_step(&self, _dim: usize) -> f64
Source§fn driver(
&self,
t: f64,
state: &[f64; N],
control: &Self::Control,
derivs: &StateDerivatives<N>,
) -> f64
fn driver( &self, t: f64, state: &[f64; N], control: &Self::Control, derivs: &StateDerivatives<N>, ) -> f64
f(t,x,u) + L^u V. Read moreSource§fn bsde_driver(
&self,
t: f64,
state: &[f64; N],
control: &Self::Control,
_derivs: &StateDerivatives<N>,
_dt: f64,
) -> f64
fn bsde_driver( &self, t: f64, state: &[f64; N], control: &Self::Control, _derivs: &StateDerivatives<N>, _dt: f64, ) -> f64
Source§fn apply_constraint(&self, _state: &[f64; N], value: f64) -> f64
fn apply_constraint(&self, _state: &[f64; N], value: f64) -> f64
V >= payoff for an American option. Read moreSource§fn constant_discount_rate(&self) -> Option<f64>
fn constant_discount_rate(&self) -> Option<f64>
None (state dependent).Source§fn next_step_controlled(
&self,
t: f64,
state: &[f64; N],
_control: &Self::Control,
dt: f64,
noise: &[f64; N],
) -> [f64; N]
fn next_step_controlled( &self, t: f64, state: &[f64; N], _control: &Self::Control, dt: f64, noise: &[f64; N], ) -> [f64; N]
Source§fn is_reduced_value(&self) -> bool
fn is_reduced_value(&self) -> bool
Source§impl Debug for StationaryLqRegulator
impl Debug for StationaryLqRegulator
Source§impl EllipticControlProblem<1> for StationaryLqRegulator
impl EllipticControlProblem<1> for StationaryLqRegulator
Source§fn dimension_kind(&self, _dim: usize) -> DimensionKind
fn dimension_kind(&self, _dim: usize) -> DimensionKind
dim.Source§fn transport(
&self,
state: &[f64; 1],
control: &Self::Control,
derivs: &StateDerivatives<1>,
) -> Transport<1>
fn transport( &self, state: &[f64; 1], control: &Self::Control, derivs: &StateDerivatives<1>, ) -> Transport<1>
Source§fn boundary_conditions(&self) -> BoundaryConditions<1>
fn boundary_conditions(&self) -> BoundaryConditions<1>
Auto Trait Implementations§
impl Freeze for StationaryLqRegulator
impl RefUnwindSafe for StationaryLqRegulator
impl Send for StationaryLqRegulator
impl Sync for StationaryLqRegulator
impl Unpin for StationaryLqRegulator
impl UnsafeUnpin for StationaryLqRegulator
impl UnwindSafe for StationaryLqRegulator
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> 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> ⓘ
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