pub struct McConvergence {
pub level: ConfidenceLevel,
pub target_half_width: f64,
pub min_samples: u64,
pub max_samples: u64,
pub batch_size: u64,
}Expand description
How precise the hit probability has to get, and how much sampling may be spent getting there.
Default reproduces the legacy fixed-count run’s sample size as the floor
(min_samples: 1_000, which is MonteCarloParams::default’s num_simulations) and then
keeps going, in batches, until the interval is tight enough or the ceiling is hit.
Fields§
§level: ConfidenceLevelConfidence level of the reported interval.
target_half_width: f64Stop once the confidence sequence’s half-width is at or below this, in probability
units. 0.02 means “the hit probability is known to about +-2 percentage points”.
min_samples: u64Never stop before this many trials, even if the interval is already tight. Guards against an early run of all-hits or all-misses producing a narrow interval off a handful of trials.
max_samples: u64Never run more than this many trials, even if the interval is still wide. This is what
bounds the wall time of an unreachable target_half_width.
batch_size: u64How many trials to run between convergence checks. Larger batches check less often (a
bounds() call is two 200-step bisections); smaller batches can stop sooner.
Implementations§
Source§impl McConvergence
impl McConvergence
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Rejects a configuration that cannot produce a meaningful run, naming the offending field.
Checked once up front rather than defended against inside the loop: a zero
batch_size would spin forever making no progress, and a non-positive or NaN
target_half_width can never be met, so both would surface as a hang or a silent
max-samples cap instead of an error the caller can read. NaN is caught by the
is_finite test – NaN <= 0.0 is false, so a bare comparison would let it through.
Trait Implementations§
Source§impl Clone for McConvergence
impl Clone for McConvergence
Source§fn clone(&self) -> McConvergence
fn clone(&self) -> McConvergence
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for McConvergence
impl Debug for McConvergence
Auto Trait Implementations§
impl Freeze for McConvergence
impl RefUnwindSafe for McConvergence
impl Send for McConvergence
impl Sync for McConvergence
impl Unpin for McConvergence
impl UnsafeUnpin for McConvergence
impl UnwindSafe for McConvergence
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.