Struct nyx_space::mc::MonteCarlo
source · [−]pub struct MonteCarlo<S: InterpState, Distr: Distribution<f64> + Copy> where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<usize, S::Size, S::Size>, {
pub seed: u64,
pub generator: Generator<S, Distr>,
pub scenario: String,
}
Expand description
A Monte Carlo framework, automatically running on all threads via a thread pool. This framework is targeted toward analysis of time-continuous variables. One caveat of the design is that the trajectory is used for post processing, not each individual state. This may prevent some event switching from being shown in GNC simulations.
Fields
seed: u64
Seed of the 64bit PCG random number generator
generator: Generator<S, Distr>
Generator of states for the Monte Carlo run
scenario: String
Name of this run, will be reflected in the progress bar and in the output structure
Implementations
sourceimpl<S: InterpState, Distr: Distribution<f64> + Copy> MonteCarlo<S, Distr> where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<usize, S::Size, S::Size>,
impl<S: InterpState, Distr: Distribution<f64> + Copy> MonteCarlo<S, Distr> where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<usize, S::Size, S::Size>,
sourcepub fn run_until_nth_event<'a, D, E, F>(
self,
prop: Propagator<'a, D, E>,
max_duration: Duration,
event: &F,
trigger: usize,
num_runs: usize
) -> Results<S, PropResult<S>> where
D: Dynamics<StateType = S>,
E: ErrorCtrl,
F: EventEvaluator<S>,
DefaultAllocator: Allocator<f64, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<usize, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::VecLength>,
<DefaultAllocator as Allocator<f64, <D::StateType as State>::VecLength>>::Buffer: Send,
pub fn run_until_nth_event<'a, D, E, F>(
self,
prop: Propagator<'a, D, E>,
max_duration: Duration,
event: &F,
trigger: usize,
num_runs: usize
) -> Results<S, PropResult<S>> where
D: Dynamics<StateType = S>,
E: ErrorCtrl,
F: EventEvaluator<S>,
DefaultAllocator: Allocator<f64, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<usize, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::VecLength>,
<DefaultAllocator as Allocator<f64, <D::StateType as State>::VecLength>>::Buffer: Send,
Generate states and propagate each independently until a specific event is found trigger
times.
sourcepub fn resume_run_until_nth_event<'a, D, E, F>(
&self,
prop: Propagator<'a, D, E>,
skip: usize,
max_duration: Duration,
event: &F,
trigger: usize,
num_runs: usize
) -> Results<S, PropResult<S>> where
D: Dynamics<StateType = S>,
E: ErrorCtrl,
F: EventEvaluator<S>,
DefaultAllocator: Allocator<f64, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<usize, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::VecLength>,
<DefaultAllocator as Allocator<f64, <D::StateType as State>::VecLength>>::Buffer: Send,
pub fn resume_run_until_nth_event<'a, D, E, F>(
&self,
prop: Propagator<'a, D, E>,
skip: usize,
max_duration: Duration,
event: &F,
trigger: usize,
num_runs: usize
) -> Results<S, PropResult<S>> where
D: Dynamics<StateType = S>,
E: ErrorCtrl,
F: EventEvaluator<S>,
DefaultAllocator: Allocator<f64, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<usize, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::VecLength>,
<DefaultAllocator as Allocator<f64, <D::StateType as State>::VecLength>>::Buffer: Send,
Generate states and propagate each independently until a specific event is found trigger
times.
sourcepub fn run_until_epoch<'a, D, E>(
self,
prop: Propagator<'a, D, E>,
end_epoch: Epoch,
num_runs: usize
) -> Results<S, PropResult<S>> where
D: Dynamics<StateType = S>,
E: ErrorCtrl,
DefaultAllocator: Allocator<f64, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<usize, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::VecLength>,
<DefaultAllocator as Allocator<f64, <D::StateType as State>::VecLength>>::Buffer: Send,
pub fn run_until_epoch<'a, D, E>(
self,
prop: Propagator<'a, D, E>,
end_epoch: Epoch,
num_runs: usize
) -> Results<S, PropResult<S>> where
D: Dynamics<StateType = S>,
E: ErrorCtrl,
DefaultAllocator: Allocator<f64, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<usize, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::VecLength>,
<DefaultAllocator as Allocator<f64, <D::StateType as State>::VecLength>>::Buffer: Send,
Generate states and propagate each independently until a specific event is found trigger
times.
sourcepub fn resume_run_until_epoch<'a, D, E>(
&self,
prop: Propagator<'a, D, E>,
skip: usize,
end_epoch: Epoch,
num_runs: usize
) -> Results<S, PropResult<S>> where
D: Dynamics<StateType = S>,
E: ErrorCtrl,
DefaultAllocator: Allocator<f64, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<usize, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::VecLength>,
<DefaultAllocator as Allocator<f64, <D::StateType as State>::VecLength>>::Buffer: Send,
pub fn resume_run_until_epoch<'a, D, E>(
&self,
prop: Propagator<'a, D, E>,
skip: usize,
end_epoch: Epoch,
num_runs: usize
) -> Results<S, PropResult<S>> where
D: Dynamics<StateType = S>,
E: ErrorCtrl,
DefaultAllocator: Allocator<f64, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<usize, <D::StateType as State>::Size, <D::StateType as State>::Size> + Allocator<f64, <D::StateType as State>::VecLength>,
<DefaultAllocator as Allocator<f64, <D::StateType as State>::VecLength>>::Buffer: Send,
Resumes a Monte Carlo run by skipping the first skip
items, generating states only after that, and propagate each independently until the specified epoch.
sourcepub fn generate_states(
&self,
skip: usize,
num_runs: usize
) -> Vec<(usize, DispersedState<S>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn generate_states(
&self,
skip: usize,
num_runs: usize
) -> Vec<(usize, DispersedState<S>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Set up the seed and generate the states. This is useful for checking the generated states before running a large scale Monte Carlo.
Trait Implementations
sourceimpl<S: InterpState, Distr: Distribution<f64> + Copy> Display for MonteCarlo<S, Distr> where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<usize, S::Size, S::Size>,
impl<S: InterpState, Distr: Distribution<f64> + Copy> Display for MonteCarlo<S, Distr> where
DefaultAllocator: Allocator<f64, S::Size> + Allocator<f64, S::Size, S::Size> + Allocator<f64, S::VecLength> + Allocator<usize, S::Size, S::Size>,
Auto Trait Implementations
impl<S, Distr> RefUnwindSafe for MonteCarlo<S, Distr> where
Distr: RefUnwindSafe,
S: RefUnwindSafe,
impl<S, Distr> Send for MonteCarlo<S, Distr> where
Distr: Send,
impl<S, Distr> Sync for MonteCarlo<S, Distr> where
Distr: Sync,
impl<S, Distr> Unpin for MonteCarlo<S, Distr> where
Distr: Unpin,
S: Unpin,
impl<S, Distr> UnwindSafe for MonteCarlo<S, Distr> where
Distr: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Printing<T> for T where
T: Display,
impl<T> Printing<T> for T where
T: Display,
fn to_str(self) -> String
fn to_str(self) -> String
Method to serialize generic items, slices, and slices of Vecs. Can be also implemented on any other types. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.