pub struct MonteCarloEngine {
pub n_simulations: usize,
pub seed: u64,
pub variance_reduction: VarianceReduction,
pub target_precision: f64,
pub max_simulations: usize,
}Expand description
Monte Carlo simulation engine
Fields§
§n_simulations: usizeNumber of simulation paths
seed: u64Random seed for reproducibility
variance_reduction: VarianceReductionVariance reduction technique
target_precision: f64Target relative precision for convergence
max_simulations: usizeMaximum simulations before stopping
Implementations§
Source§impl MonteCarloEngine
impl MonteCarloEngine
Sourcepub fn new(seed: u64) -> MonteCarloEngine
pub fn new(seed: u64) -> MonteCarloEngine
Create a new engine with specified seed
Sourcepub fn reproducible(seed: u64) -> MonteCarloEngine
pub fn reproducible(seed: u64) -> MonteCarloEngine
Create a reproducible engine with specific seed
Sourcepub fn with_n_simulations(self, n: usize) -> MonteCarloEngine
pub fn with_n_simulations(self, n: usize) -> MonteCarloEngine
Set number of simulations
Sourcepub fn with_variance_reduction(self, vr: VarianceReduction) -> MonteCarloEngine
pub fn with_variance_reduction(self, vr: VarianceReduction) -> MonteCarloEngine
Set variance reduction technique
Sourcepub fn with_target_precision(self, precision: f64) -> MonteCarloEngine
pub fn with_target_precision(self, precision: f64) -> MonteCarloEngine
Set target precision
Sourcepub fn with_max_simulations(self, max: usize) -> MonteCarloEngine
pub fn with_max_simulations(self, max: usize) -> MonteCarloEngine
Set maximum simulations
Sourcepub fn simulate<M>(
&self,
model: &M,
time_horizon: &TimeHorizon,
) -> SimulationResultwhere
M: SimulationModel,
pub fn simulate<M>(
&self,
model: &M,
time_horizon: &TimeHorizon,
) -> SimulationResultwhere
M: SimulationModel,
Run simulation with given model
Sourcepub fn simulate_with_budget<M>(
&self,
model: &M,
time_horizon: &TimeHorizon,
budget: &Budget,
) -> SimulationResultwhere
M: SimulationModel,
pub fn simulate_with_budget<M>(
&self,
model: &M,
time_horizon: &TimeHorizon,
budget: &Budget,
) -> SimulationResultwhere
M: SimulationModel,
Run simulation with custom budget
Trait Implementations§
Source§impl Clone for MonteCarloEngine
impl Clone for MonteCarloEngine
Source§fn clone(&self) -> MonteCarloEngine
fn clone(&self) -> MonteCarloEngine
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MonteCarloEngine
impl Debug for MonteCarloEngine
Source§impl Default for MonteCarloEngine
impl Default for MonteCarloEngine
Source§fn default() -> MonteCarloEngine
fn default() -> MonteCarloEngine
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MonteCarloEngine
impl RefUnwindSafe for MonteCarloEngine
impl Send for MonteCarloEngine
impl Sync for MonteCarloEngine
impl Unpin for MonteCarloEngine
impl UnsafeUnpin for MonteCarloEngine
impl UnwindSafe for MonteCarloEngine
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