Skip to main content

SolisWetsState

Struct SolisWetsState 

Source
pub struct SolisWetsState<V, F = f64> { /* private fields */ }
Expand description

Solver state for SolisWets.

Construct with new (bias b = 0, zeroed streak counters). The solver evaluates the start point’s cost once in Solver::init.

The Solis-Wets iteration only ever accepts improvements, so the current iterate is also the best evaluated point: State::param/State::cost and State::best_param/State::best_cost coincide at all times.

The scalar F defaults to f64 so call sites resolve unchanged.

Implementations§

Source§

impl<V, F> SolisWetsState<V, F>
where V: Clone + VectorLen + ScaleInPlace<F>, F: Scalar,

Source

pub fn new(x: V, rho: F) -> Self

Build an initial Solis-Wets state at x with step size rho. The bias starts at 0 and both streak counters at zero; the solver evaluates f(x) in Solver::init.

§Panics

Panics if rho ≤ 0 or x is empty.

Source§

impl<V, F: Scalar> SolisWetsState<V, F>

Source

pub fn rho(&self) -> F

The current step size ρ (per-coordinate standard deviation of the sampling noise). Same value the RhoTolerance criterion reads through RhoState.

Source

pub fn bias(&self) -> &V

The current bias vector b (search momentum).

Source

pub fn success_count(&self) -> u32

Successive successes recorded since the last failure or step-size expansion.

Source

pub fn failure_count(&self) -> u32

Successive failures recorded since the last success or step-size contraction.

Trait Implementations§

Source§

impl<V, F> CountsMirror for SolisWetsState<V, F>
where SolisWetsState<V, F>: State,

Source§

fn mirror(&mut self, delta: &EvalCounts)

Overwrite the state’s counters from the per-run wrapper delta. Called by the executor after every successful Solver::init / Solver::next_iter.
Source§

impl<V: Clone, F: Scalar> RhoState for SolisWetsState<V, F>

Source§

fn rho(&self) -> F

For Solis-Wets, ρ is the mutation standard deviation rather than a trust-region radius; the criterion semantics are the same (ρ at its floor ⇒ converged at that resolution).

Source§

impl<P, V, F> Solver<P, SolisWetsState<V, F>> for SolisWets<F>
where F: Scalar, P: CostFunction<Param = V, Output = F>, V: Clone + SampleStandardNormal + ScaledAdd<F> + ScaleInPlace<F>,

Source§

fn init( &mut self, problem: &mut Problem<P>, state: SolisWetsState<V, F>, ) -> Result<SolisWetsState<V, F>, Self::Error>

Evaluate the start point once. Resume-idempotent: a resumed chain state arrives with cost already populated and passes through untouched (bias, ρ, and counters are never reset here).

Source§

type Error = <P as CostFunction>::Error

Hard-abort error type, mirroring the underlying problem’s type Error. See the trait docs.
Source§

fn next_iter( &mut self, problem: &mut Problem<P>, state: SolisWetsState<V, F>, ) -> Result<(SolisWetsState<V, F>, Option<TerminationReason>), Self::Error>

Advance one iteration. Read more
Source§

fn terminate(&self, _state: &S) -> Option<TerminationReason>

Optional pre-iteration solver-specific termination test. Read more
Source§

impl<V: Clone, F: Scalar> State for SolisWetsState<V, F>

Source§

fn cost(&self) -> F

Cost at the current iterate, f(x).

§Panics

Panics if read before Solver::init has evaluated the start point. By contract the executor calls init before any termination check, so reads from criteria and from OptimizationResult are safe.

Source§

type Param = V

The parameter type the solver iterates over (e.g. Vec<f64>, nalgebra::DVector<f64>).
Source§

type Float = F

The scalar type of the objective. In practice always f64 (see the module docs).
Source§

fn iter(&self) -> u64

Number of fully completed iterations. A Solver::next_iter that bails mid-iteration with Some(reason) does not increment this counter; see the executor module for the exact ordering.
Source§

fn increment_iter(&mut self)

Increment iter by one. Called by the executor after a successful Solver::next_iter.
Source§

fn cost_evals(&self) -> u64

Cumulative count of cost-function evaluations performed so far. Diverges from iter() whenever a single iteration evaluates the cost more than once (line searches, Nelder-Mead shrinks, etc.); this is what users actually budget against. Read more
Source§

fn param(&self) -> &V

Current iterate. Stable between Solver::next_iter calls; safe to read at any iteration including iter 0.
Source§

fn best_param(&self) -> &V

Best param ever observed by the executor’s best-tracking on this state. Read more
Source§

fn best_cost(&self) -> F

Cost at best_param: the lowest cost ever observed on this state.
Source§

fn best_iter(&self) -> u64

Iteration at which the current best was found. 0 before the first update_best call; thereafter, the value of iter at the moment of the last strict improvement in best_cost().
Source§

fn best_cost_evals(&self) -> u64

Cumulative cost evaluations at the moment the current best was found; useful for benchmarking (“how many evals until the solver hit its best?”).
Source§

fn update_best(&mut self)

Refresh the best-so-far slots from the current iterate, if cost strictly improves on best_cost. Read more
Source§

fn reset_best(&mut self)

Reset the best-so-far slots to their pre-init defaults (best_cost = +∞, all best counters zero). Read more

Auto Trait Implementations§

§

impl<V, F> Freeze for SolisWetsState<V, F>
where V: Freeze, F: Freeze,

§

impl<V, F> RefUnwindSafe for SolisWetsState<V, F>

§

impl<V, F> Send for SolisWetsState<V, F>
where V: Send, F: Send,

§

impl<V, F> Sync for SolisWetsState<V, F>
where V: Sync, F: Sync,

§

impl<V, F> Unpin for SolisWetsState<V, F>
where V: Unpin, F: Unpin,

§

impl<V, F> UnsafeUnpin for SolisWetsState<V, F>
where V: UnsafeUnpin, F: UnsafeUnpin,

§

impl<V, F> UnwindSafe for SolisWetsState<V, F>
where V: UnwindSafe, F: UnwindSafe,

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> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V