pub struct Interval {
lb: IntervalBoundary,
lb_open: bool,
ub: IntervalBoundary,
ub_open: bool,
}Expand description
Interval
Fields§
§lb: IntervalBoundaryLower / left boundary of the interval
lb_open: boolLower / left boundary of the interval is open / closed
ub: IntervalBoundaryUpper / right boundary of the interval
ub_open: boolUpper / right boundary of the interval is open / closed
Implementations§
Source§impl Interval
impl Interval
Sourcepub fn new(
lb: IntervalBoundary,
lb_open: bool,
ub: IntervalBoundary,
ub_open: bool,
) -> Self
pub fn new( lb: IntervalBoundary, lb_open: bool, ub: IntervalBoundary, ub_open: bool, ) -> Self
Create a new interval
Sourcepub fn is_left_open(&self) -> bool
pub fn is_left_open(&self) -> bool
Check if the interval is left open, i.e., the lower boundary is not included
Sourcepub fn is_right_open(&self) -> bool
pub fn is_right_open(&self) -> bool
Check if the interval is right open, i.e., the upper boundary is not included
Sourcepub fn lb(&self) -> &IntervalBoundary
pub fn lb(&self) -> &IntervalBoundary
Returns the left IntervalBoundary
Sourcepub fn ub(&self) -> &IntervalBoundary
pub fn ub(&self) -> &IntervalBoundary
Returns the right IntervalBoundary
Sourcepub fn new_constant<T: Into<Fraction>, U: Into<Fraction>>(
c_lower_bound: T,
c_upper_bound: U,
) -> Self
pub fn new_constant<T: Into<Fraction>, U: Into<Fraction>>( c_lower_bound: T, c_upper_bound: U, ) -> Self
Create a new interval of the form [ c_lower_bound, c_upper_bound [ where c_lower_bound and c_upper_bound
are constants
Sourcepub fn check_is_contained(&self, ib: &IntervalBoundary) -> bool
pub fn check_is_contained(&self, ib: &IntervalBoundary) -> bool
Check if the given interval boundary is contained in the interval
This method does not do any mathematical / symbolical checks to determine if the interval boundary is contained in the interval. It only checks if the one of the boundaries of the interval is equal to the given interval boundary and that this boundary is not open.
Sourcepub fn check_add_always_out_of_interval(&self, c: u32) -> bool
pub fn check_add_always_out_of_interval(&self, c: u32) -> bool
Checks whether an addition of c to the interval must always leave the
interval
This function will first check whether both intervals are constants, if
this is not the case, it returns false, as we cannot statically
determine the size of the interval.
If both are constant, it will check whether adding c to the lower
bound will be sufficient to move past the upper bound.
Sourcepub fn check_sub_always_out_of_interval(&self, c: u32) -> bool
pub fn check_sub_always_out_of_interval(&self, c: u32) -> bool
Checks whether an addition of c from the interval must always leave
the interval
This function will first check whether both intervals are constants, if
this is not the case, it returns false, as we cannot statically
determine the size of the interval.
If both are constant, it will check whether subtracting c from the
upper bound will be sufficient to move below the lower bound.
Sourcepub fn encode_into_boolean_expr<S, T>(&self, var: &S) -> BooleanExpression<T>where
S: IntoNoDivBooleanExpr<T> + Clone,
T: Atomic,
pub fn encode_into_boolean_expr<S, T>(&self, var: &S) -> BooleanExpression<T>where
S: IntoNoDivBooleanExpr<T> + Clone,
T: Atomic,
Encode the interval as a boolean expression on a variable
This method encodes the interval as a boolean expression on a variable
var. The boolean expression is true if the variable is in the interval
and false otherwise.
Trait Implementations§
Source§impl Ord for Interval
impl Ord for Interval
Source§impl PartialOrd for Interval
impl PartialOrd for Interval
impl Eq for Interval
impl StructuralPartialEq for Interval
Auto Trait Implementations§
impl Freeze for Interval
impl RefUnwindSafe for Interval
impl Send for Interval
impl Sync for Interval
impl Unpin for Interval
impl UnwindSafe for Interval
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