pub struct SumAtomConstraint<T: Atomic>(ThresholdConstraintOver<WeightedSum<T>>);Expand description
Constraint over the evaluation over a sum of multiple atoms
This struct represents a guard over the values of a sum of atoms, i.e., it
represents a constraint formula 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
variables, p_1, ..., p_m are parameters, and c is a rational constant.
Additionally, all variable coefficients, i.e., cv_1, ..., cv_n, must be
greater than zero.
Tuple Fields§
§0: ThresholdConstraintOver<WeightedSum<T>>Implementations§
Source§impl<T: Atomic> SumAtomConstraint<T>
impl<T: Atomic> SumAtomConstraint<T>
Sourcepub fn try_new<F: Into<Fraction>, I: IntoIterator<Item = (T, F)> + Clone>(
atoms: I,
thr: ThresholdConstraint,
) -> Result<Self, SumVarConstraintCreationError>
pub fn try_new<F: Into<Fraction>, I: IntoIterator<Item = (T, F)> + Clone>( atoms: I, thr: ThresholdConstraint, ) -> Result<Self, SumVarConstraintCreationError>
Try to create a new SumAtomConstraint
A SumAtomConstraint constraints a (weighted) sum of multiple
variables, where all variable weights are positive (or all negative, in
this case the constraint is transformed such that all variable are
positive). Any other form would result in a ComparisonConstraint or
if there is only a single variable a SingleAtomConstraint.
Returns an SumVarConstraintCreationError if the coefficients are
mixed or only a single variable is present.
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 get_atoms(&self) -> &WeightedSum<T>
pub fn get_atoms(&self) -> &WeightedSum<T>
Get the variable
Sourcepub fn to_boolean_expr<S>(&self) -> BooleanExpression<S>
pub fn to_boolean_expr<S>(&self) -> BooleanExpression<S>
Get boolean expression of the guard
Sourcepub fn get_threshold(&self) -> &Threshold
pub fn get_threshold(&self) -> &Threshold
Get the threshold of the guard
Sourcepub fn get_threshold_constraint(&self) -> &ThresholdConstraint
pub fn get_threshold_constraint(&self) -> &ThresholdConstraint
Get the threshold constraint of the guard
Trait Implementations§
Source§impl<T: Clone + Atomic> Clone for SumAtomConstraint<T>
impl<T: Clone + Atomic> Clone for SumAtomConstraint<T>
Source§fn clone(&self) -> SumAtomConstraint<T>
fn clone(&self) -> SumAtomConstraint<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more