pub struct Constraint {
pub name: SmolStr,
pub lhs: ExprId,
pub lower: f64,
pub upper: f64,
pub active: bool,
}Expand description
A single algebraic constraint, canonicalized as the interval
lower <= lhs <= upper with numeric bounds. RHS expressions are folded into
lhs during construction, so backends only ever see this canonical shape.
The single-sided senses map onto the interval as Le(rhs) => [-inf, rhs],
Ge(rhs) => [rhs, +inf], Eq(rhs) => [rhs, rhs]. A two-sided range with
constant bounds is [lo, hi]. Use Constraint::as_single to recover the
single-sided sense (for backends without native two-sided rows) and
Constraint::is_range to detect a genuine range.
Fields§
§name: SmolStr§lhs: ExprId§lower: f64§upper: f64§active: boolImplementations§
Source§impl Constraint
impl Constraint
Sourcepub fn is_range(&self) -> bool
pub fn is_range(&self) -> bool
Whether this is a genuine two-sided range (both bounds finite and not an
equality), as opposed to a single-sided Le/Ge/Eq row. An inverted
[hi, lo] (lo > hi, an infeasible user range) is also a range, so the
solver reports the infeasibility rather than it collapsing to an equality.
Trait Implementations§
Source§impl Clone for Constraint
impl Clone for Constraint
Source§fn clone(&self) -> Constraint
fn clone(&self) -> Constraint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for Constraint
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnsafeUnpin for Constraint
impl UnwindSafe for Constraint
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more