Skip to main content

Run

Struct Run 

Source
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

Source

pub fn parameters(&self) -> &Parameters

The strategy’s parameters.

Source

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.

Source

pub fn generation(&self) -> usize

The generations finished so far.

Source

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.

Source

pub fn sigma(&self) -> f64

The step size σ.

Source

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.

Source

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.

Source

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).

Source

pub fn stopped(&self) -> Option<Stop>

Why the run stopped, or None while it runs.

Source

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.

Source

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§

Source§

impl Clone for Run

Source§

fn clone(&self) -> Run

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Run

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.