Skip to main content

ConstrainedMadsState

Struct ConstrainedMadsState 

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

Solver state for the constrained MADS variant (Mads<Constrained>), which handles nonlinear inequality constraints c(x) ≤ 0 by the progressive barrier (see Mads::constrained).

It carries the same poll/mesh bookkeeping as MadsState plus the aggregate constraint violation h(x) = Σⱼ max(cⱼ(x), 0)² at the reported incumbent (constraint_violation; 0 ⇔ feasible). Construct it with new from the starting point — an infeasible start is allowed (the progressive barrier relaxes its way to feasibility).

§Current vs best

Unlike the unconstrained MadsState, the reported objective is not monotone — a newly found feasible point can have a higher f than a prior infeasible incumbent. The solver’s progressive-barrier driver owns the incumbent selection, so update_best mirrors the current iterate unconditionally (the same rule CobylaState uses), rather than ranking by cost.

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

Implementations§

Source§

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

Source

pub fn new(x0: V) -> Self

Build an initial constrained-MADS state at the starting point x0 (which may be infeasible). The solver evaluates x0’s cost and violation and fills the poll size in Solver::init.

Source

pub fn constraint_violation(&self) -> F

The aggregate constraint violation h = Σⱼ max(cⱼ, 0)² at the reported incumbent. 0 once the incumbent is feasible; +∞ before Solver::init.

Source

pub fn poll_size(&self) -> F

The current poll size Δᵖ.

Source

pub fn mesh_index(&self) -> i32

The current mesh index (OrthoMADS eq. (1)).

Trait Implementations§

Source§

impl<V, F> CountsMirror for ConstrainedMadsState<V, F>

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> MeshState for ConstrainedMadsState<V, F>

Source§

fn poll_size(&self) -> F

The current poll size Δᵖ (bounds the distance from the incumbent to the poll trial points).
Source§

fn mesh_index(&self) -> i32

The current mesh index (OrthoMADS eq. (1)).
Source§

impl<P, V, F> Solver<P, ConstrainedMadsState<V, F>> for Mads<Constrained, F>
where F: Scalar, P: CostFunction<Param = V, Output = F> + NonlinearInequalityConstraints, V: Clone + VectorLen + Index<usize, Output = F> + IndexMut<usize, Output = F>,

Source§

type Error = <P as CostFunction>::Error

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

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

One-time setup before the iteration loop. Read more
Source§

fn next_iter( &mut self, problem: &mut Problem<P>, state: ConstrainedMadsState<V, F>, ) -> Result<(ConstrainedMadsState<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 ConstrainedMadsState<V, F>

Source§

fn cost(&self) -> F

Cost at the current param.

§Panics

Panics if read before Solver::init has evaluated the starting point.

Source§

fn update_best(&mut self)

Mirror the current incumbent unconditionally — the progressive-barrier driver owns incumbent selection, and the reported cost is not monotone across the feasibility transition, so a cost-ranked best would be wrong.

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 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 ConstrainedMadsState<V, F>
where V: Freeze, F: Freeze,

§

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

§

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

§

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

§

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

§

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

§

impl<V, F> UnwindSafe for ConstrainedMadsState<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