pub struct ThresholdConstraint(ThresholdCompOp, Threshold);Expand description
Threshold in combination with a comparison operator
A ThresholdConstraint represents a Threshold in combination with a
comparison operator. Thus it can be used to represent equations of the form
<COMPOP> c_1 * p_1 + ... + c_n * p_n + c
where <COMPOP> is one of the comparison operators ==, !=, <, >,
<=, >= (represented by ComparisonOp).
Most importantly, this struct implements operations like scaling by a negative number faithfully. Thus it can be useful when transforming threshold guards.
Tuple Fields§
§0: ThresholdCompOp§1: ThresholdImplementations§
Source§impl ThresholdConstraint
impl ThresholdConstraint
Sourcepub fn new<S, T>(
op: ThresholdCompOp,
weighted_parameters: S,
constant: T,
) -> Self
pub fn new<S, T>( op: ThresholdCompOp, weighted_parameters: S, constant: T, ) -> Self
Create a new threshold constraint
Sourcepub fn new_from_thr(op: ThresholdCompOp, thr: Threshold) -> Self
pub fn new_from_thr(op: ThresholdCompOp, thr: Threshold) -> Self
Create a new threshold constraint
Sourcepub fn scale<T: Into<Fraction>>(&mut self, factor: T)
pub fn scale<T: Into<Fraction>>(&mut self, factor: T)
Scale the threshold constraint by a fraction
Sourcepub fn get_op(&self) -> ThresholdCompOp
pub fn get_op(&self) -> ThresholdCompOp
Get the ComparisonOp used in the threshold
Sourcepub fn get_threshold(&self) -> &Threshold
pub fn get_threshold(&self) -> &Threshold
Get the Threshold of the threshold constraint
Trait Implementations§
Source§impl Clone for ThresholdConstraint
impl Clone for ThresholdConstraint
Source§fn clone(&self) -> ThresholdConstraint
fn clone(&self) -> ThresholdConstraint
Returns a duplicate of the value. Read more
1.0.0 · 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 ThresholdConstraint
impl Debug for ThresholdConstraint
Source§impl Display for ThresholdConstraint
impl Display for ThresholdConstraint
Source§impl Hash for ThresholdConstraint
impl Hash for ThresholdConstraint
Source§impl Ord for ThresholdConstraint
impl Ord for ThresholdConstraint
Source§fn cmp(&self, other: &ThresholdConstraint) -> Ordering
fn cmp(&self, other: &ThresholdConstraint) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ThresholdConstraint
impl PartialEq for ThresholdConstraint
Source§impl PartialOrd for ThresholdConstraint
impl PartialOrd for ThresholdConstraint
impl Eq for ThresholdConstraint
impl StructuralPartialEq for ThresholdConstraint
Auto Trait Implementations§
impl Freeze for ThresholdConstraint
impl RefUnwindSafe for ThresholdConstraint
impl Send for ThresholdConstraint
impl Sync for ThresholdConstraint
impl Unpin for ThresholdConstraint
impl UnwindSafe for ThresholdConstraint
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