pub struct ComparisonConstraint<T: Atomic>(ThresholdConstraintOver<WeightedSum<T>>);Expand description
Constraint over the difference between atoms / comparing atoms
This struct represents a comparison guard, i.e., it represents a guard of
the form
cv_1 * v_1 + ... + cv_n * v_n <COMPOP> cp_1 * p_1 + ... + cp_n * p_m + c
where cv_1, ..., cv_n, cp_1, ..., cp_m are rational factors, <COMPOP> is
a comparison operator (i.e.,<, >, <=, >=, ==, !=), v_1, ..., v_n are
atoms, p_1, ..., p_m are parameters, and c is a rational constant.
Additionally, at least one of the atom coefficients, i.e.,
cv_1, ..., cv_n, must be smaller than zero and at least one greater than
zero. Otherwise the guard would be a SumAtomConstraint.
Tuple Fields§
§0: ThresholdConstraintOver<WeightedSum<T>>Implementations§
Source§impl<T: Atomic> ComparisonConstraint<T>
impl<T: Atomic> ComparisonConstraint<T>
Sourcepub fn try_new<I: IntoIterator<Item = (T, Fraction)> + Clone>(
atoms: I,
thr: ThresholdConstraint,
) -> Result<Self, ComparisonConstraintCreationError>
pub fn try_new<I: IntoIterator<Item = (T, Fraction)> + Clone>( atoms: I, thr: ThresholdConstraint, ) -> Result<Self, ComparisonConstraintCreationError>
Create a ComparisonConstraint
A comparison constraint constrains a weighted sum over multiple
variables where at least one has a negative and at least one has a
positive coefficient.
In any other case the guard would be a SingleAtomConstraint or a
SumAtomConstraint. In this case a
ComparisonConstraintCreationError is returned.
Sourcepub fn is_upper_guard(&self) -> bool
pub fn is_upper_guard(&self) -> bool
Check if the guard is an upper guard
Sourcepub fn is_lower_guard(&self) -> bool
pub fn is_lower_guard(&self) -> bool
Check if the guard is a lower guard
Sourcepub fn to_boolean_expr<S>(&self) -> BooleanExpression<S>
pub fn to_boolean_expr<S>(&self) -> BooleanExpression<S>
Get the boolean expression representing the threshold
Sourcepub fn get_threshold(&self) -> &Threshold
pub fn get_threshold(&self) -> &Threshold
Get the threshold of the constraint
Sourcepub fn get_threshold_constraint(&self) -> &ThresholdConstraint
pub fn get_threshold_constraint(&self) -> &ThresholdConstraint
Get the threshold constraint of the constraint
Trait Implementations§
Source§impl<T: Clone + Atomic> Clone for ComparisonConstraint<T>
impl<T: Clone + Atomic> Clone for ComparisonConstraint<T>
Source§fn clone(&self) -> ComparisonConstraint<T>
fn clone(&self) -> ComparisonConstraint<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more