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>
impl<V, F> SolisWetsState<V, F>
Sourcepub fn new(x: V, rho: F) -> Self
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>
impl<V, F: Scalar> SolisWetsState<V, F>
Sourcepub fn rho(&self) -> F
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.
Sourcepub fn success_count(&self) -> u32
pub fn success_count(&self) -> u32
Successive successes recorded since the last failure or step-size expansion.
Sourcepub fn failure_count(&self) -> u32
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,
impl<V, F> CountsMirror for SolisWetsState<V, F>where
SolisWetsState<V, F>: State,
Source§fn mirror(&mut self, delta: &EvalCounts)
fn mirror(&mut self, delta: &EvalCounts)
Solver::init /
Solver::next_iter.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>,
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>
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
type Error = <P as CostFunction>::Error
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>
fn next_iter( &mut self, problem: &mut Problem<P>, state: SolisWetsState<V, F>, ) -> Result<(SolisWetsState<V, F>, Option<TerminationReason>), Self::Error>
Source§impl<V: Clone, F: Scalar> State for SolisWetsState<V, F>
impl<V: Clone, F: Scalar> State for SolisWetsState<V, F>
Source§fn cost(&self) -> F
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
type Param = V
Vec<f64>,
nalgebra::DVector<f64>).Source§type Float = F
type Float = F
f64 (see
the module docs).Source§fn iter(&self) -> u64
fn iter(&self) -> u64
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)
fn increment_iter(&mut self)
iter by one. Called by the executor
after a successful Solver::next_iter.Source§fn cost_evals(&self) -> u64
fn cost_evals(&self) -> u64
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 moreSource§fn param(&self) -> &V
fn param(&self) -> &V
Solver::next_iter
calls; safe to read at any iteration including iter 0.Source§fn best_param(&self) -> &V
fn best_param(&self) -> &V
Source§fn best_cost(&self) -> F
fn best_cost(&self) -> F
best_param: the lowest cost ever
observed on this state.Source§fn best_iter(&self) -> u64
fn best_iter(&self) -> u64
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
fn best_cost_evals(&self) -> u64
Source§fn update_best(&mut self)
fn update_best(&mut self)
Source§fn reset_best(&mut self)
fn reset_best(&mut self)
best_cost = +∞, all best counters zero). Read moreAuto Trait Implementations§
impl<V, F> Freeze for SolisWetsState<V, F>
impl<V, F> RefUnwindSafe for SolisWetsState<V, F>where
V: RefUnwindSafe,
F: RefUnwindSafe,
impl<V, F> Send for SolisWetsState<V, F>
impl<V, F> Sync for SolisWetsState<V, F>
impl<V, F> Unpin for SolisWetsState<V, F>
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> 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T, U> Imply<T> for U
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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.