pub struct Threshold {
weighted_parameters: WeightedSum<Parameter>,
constant: Fraction,
}Expand description
WeightedSum of Parameters with additional constant summand
This struct represents a sum over Parameter of the form
c_1 * p_1 + ... + c_n * p_n + c
where p_1, …, p_n are Parameter and c_1,..,c_n, c are rational numbers
represented by Fractions.
Fields§
§weighted_parameters: WeightedSum<Parameter>§constant: FractionImplementations§
Source§impl Threshold
impl Threshold
Sourcepub fn from_integer_comp_expr<T: Atomic>(
lhs: IntegerExpression<T>,
rhs: IntegerExpression<T>,
) -> Result<(HashMap<T, Fraction>, Threshold), ConstraintRewriteError>
pub fn from_integer_comp_expr<T: Atomic>( lhs: IntegerExpression<T>, rhs: IntegerExpression<T>, ) -> Result<(HashMap<T, Fraction>, Threshold), ConstraintRewriteError>
This function is designed to rewrite an comparison expression into a form
where the returned HashMap<T, Fraction> forms the new lhs of the equation
and the returned threshold is the right hand side of the equation
Sourcepub fn from_const<T: Into<Fraction>>(c: T) -> Self
pub fn from_const<T: Into<Fraction>>(c: T) -> Self
Create a new Threshold from a constant without any parameters
Sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Check whether the Threshold only contains a constant
Trait Implementations§
Source§impl<T> IntoNoDivBooleanExpr<T> for Threshold
impl<T> IntoNoDivBooleanExpr<T> for Threshold
Source§fn get_scaled_integer_expression(
&self,
scaling_factor: u32,
) -> IntegerExpression<T>
fn get_scaled_integer_expression( &self, scaling_factor: u32, ) -> IntegerExpression<T>
Encode the object into an
IntegerExpression without divisions
appearing Read moreSource§fn get_lcm_of_denominators(&self) -> u32
fn get_lcm_of_denominators(&self) -> u32
Get the lcm across all denominators in the object Read more
Source§fn encode_comparison_to_boolean_expression<Q>(
&self,
comparison_op: ComparisonOp,
other: &Q,
) -> BooleanExpression<T>where
Q: IntoNoDivBooleanExpr<T>,
fn encode_comparison_to_boolean_expression<Q>(
&self,
comparison_op: ComparisonOp,
other: &Q,
) -> BooleanExpression<T>where
Q: IntoNoDivBooleanExpr<T>,
Encode the comparison of two expressions into a boolean expression with a
that does not contain any real numbers. Read more
Source§impl Ord for Threshold
impl Ord for Threshold
Source§impl PartialOrd for Threshold
impl PartialOrd for Threshold
impl Eq for Threshold
impl StructuralPartialEq for Threshold
Auto Trait Implementations§
impl Freeze for Threshold
impl RefUnwindSafe for Threshold
impl Send for Threshold
impl Sync for Threshold
impl Unpin for Threshold
impl UnwindSafe for Threshold
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