pub struct ViolationSummary {
pub total_violation: f64,
pub max_violation: f64,
pub n_violated: usize,
pub violations: Vec<f64>,
}Expand description
Summary of constraint violations for a single candidate solution.
Violations are computed as max(0, g_i(x)) for inequality constraints
(g_i(x) <= 0) and |h_j(x)| for equality constraints.
Fields§
§total_violation: f64L1 sum of constraint violations.
max_violation: f64Maximum single-constraint violation.
n_violated: usizeNumber of violated constraints.
violations: Vec<f64>Per-constraint violations (non-negative).
Implementations§
Source§impl ViolationSummary
impl ViolationSummary
Sourcepub fn new(violations: Vec<f64>) -> Self
pub fn new(violations: Vec<f64>) -> Self
Create a ViolationSummary from a vector of violation amounts.
§Arguments
violations— Non-negative violation per constraint. For inequalityg_i(x) <= 0: passmax(0, g_i(x)). For equalityh_j(x) = 0: pass|h_j(x)|.
Sourcepub fn is_feasible(&self) -> bool
pub fn is_feasible(&self) -> bool
Returns true if the solution is strictly feasible (all violations zero).
Sourcepub fn is_approximately_feasible(&self, tol: f64) -> bool
pub fn is_approximately_feasible(&self, tol: f64) -> bool
Returns true if the solution is approximately feasible within tol.
Trait Implementations§
Source§impl Clone for ViolationSummary
impl Clone for ViolationSummary
Source§fn clone(&self) -> ViolationSummary
fn clone(&self) -> ViolationSummary
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ViolationSummary
impl Debug for ViolationSummary
Source§impl PartialEq for ViolationSummary
impl PartialEq for ViolationSummary
Source§fn eq(&self, other: &ViolationSummary) -> bool
fn eq(&self, other: &ViolationSummary) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ViolationSummary
Auto Trait Implementations§
impl Freeze for ViolationSummary
impl RefUnwindSafe for ViolationSummary
impl Send for ViolationSummary
impl Sync for ViolationSummary
impl Unpin for ViolationSummary
impl UnsafeUnpin for ViolationSummary
impl UnwindSafe for ViolationSummary
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.