pub struct Run { /* private fields */ }Expand description
A run in progress: its distribution, the current generation’s candidates, and the best point so far.
Implementations§
Source§impl Run
impl Run
Sourcepub fn parameters(&self) -> &Parameters
pub fn parameters(&self) -> &Parameters
The strategy’s parameters.
Sourcepub fn candidates(&self) -> &[Vec<f64>]
pub fn candidates(&self) -> &[Vec<f64>]
The current generation’s candidates, λ points, each one value per variable, as the model
is to be given them: an integer variable’s value is encoded, a whole number within its
bounds. Empty once the run has stopped.
Sourcepub fn generation(&self) -> usize
pub fn generation(&self) -> usize
The generations finished so far.
Sourcepub fn mean(&self) -> &[f64]
pub fn mean(&self) -> &[f64]
The distribution’s mean. An integer variable’s is a real number, not encoded, and may lie outside its bounds.
Sourcepub fn covariance(&self) -> &[f64]
pub fn covariance(&self) -> &[f64]
The covariance C, row-major, of the variables divided by their steps: the distribution
of draws about the mean has covariance σ² S A C A S, with S the steps and A
Run::margin_scale on diagonals.
Sourcepub fn margin_scale(&self) -> &[f64]
pub fn margin_scale(&self) -> &[f64]
The margin’s diagonal A, one entry per variable: an integer variable’s draws spread
A times as far as σ and C alone would spread them (Variable::integer). 1 for
every continuous variable.
Sourcepub fn integer_margin(&self) -> f64
pub fn integer_margin(&self) -> f64
The margin α = 1/(n λ): the least chance, each generation, that an integer variable’s
draw falls on a value other than the one its mean is nearest (at least α/2 on each side
when the mean’s value has neighbours on both).
Sourcepub fn tell(&mut self, values: &[f64]) -> Result<Option<Optimum>, AnalysisError>
pub fn tell(&mut self, values: &[f64]) -> Result<Option<Optimum>, AnalysisError>
Takes the model’s values at Run::candidates, in their order, and moves the
distribution. Returns what the run found once it stops, and None while it goes on, with
the next generation’s candidates drawn.
A value may be +∞, for a candidate the model can’t evaluate (a flight that fails, say):
it ranks below every finite one.
§Errors
AnalysisError::Length for a number of values other than the candidates’, and
AnalysisError::Output for a NaN or −∞, with the index of its evaluation in the run.
Telling a stopped run is AnalysisError::Length too, as it has no candidates.
Sourcepub fn tell_constrained(
&mut self,
evaluations: &[Evaluation],
) -> Result<Option<Optimum>, AnalysisError>
pub fn tell_constrained( &mut self, evaluations: &[Evaluation], ) -> Result<Option<Optimum>, AnalysisError>
Run::tell with each candidate’s constraint violation: candidates are ranked by Deb’s
feasibility rules (Evaluation::rank), the best point is the best by the same rules,
and a target counts only for a point that keeps every constraint. The stop on values
(Stop::TolFun) looks only at generations whose best keeps them, and at the values of
this generation’s candidates that keep them.
Told only violations of zero, a run is bit for bit Run::tell’s.
§Errors
Run::tell’s, and AnalysisError::Domain for a violation that is negative or NaN
(+∞ is a failed candidate’s, Evaluation::failed).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Run
impl RefUnwindSafe for Run
impl Send for Run
impl Sync for Run
impl Unpin for Run
impl UnsafeUnpin for Run
impl UnwindSafe for Run
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<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