Skip to main content

BoolVar

Struct BoolVar 

Source
pub struct BoolVar<'model> { /* private fields */ }
Expand description

A boolean decision variable (domain 0/1) belonging to a Model.

BoolVar is a thin wrapper over an underlying IntVar whose domain is restricted to [0, 1] and supports boolean and logical operations.

Implementations§

Source§

impl<'model> BoolVar<'model>

Source

pub fn if_then_else( &self, then_constraint: &Constraint<'model>, else_constraint: &Constraint<'model>, )

Posts a constraint ensuring that if self BoolVar is true, then then_constraint must be satisfied as well. Otherwise, else_constraint must be satisfied.

Source

pub fn if_then(&self, then_constraint: &Constraint<'model>)

Creates an if-then constraint: self BoolVar -> then_constraint.

Source

pub fn if_only_if(&self, constraint: &Constraint<'model>)

Posts an equivalence constraint stating that: self BoolVar is true <=> constraint is satisfied.

Trait Implementations§

Source§

impl<'model> BitAnd<&BoolVar<'model>> for bool

Source§

type Output = BoolVar<'model>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &BoolVar<'model>) -> Self::Output

Performs the & operation. Read more
Source§

impl<'model> BitAnd<bool> for &BoolVar<'model>

Source§

type Output = BoolVar<'model>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: bool) -> Self::Output

Performs the & operation. Read more
Source§

impl<'model> BitAnd for &BoolVar<'model>

Source§

type Output = BoolVar<'model>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl<'model> BitOr<&BoolVar<'model>> for bool

Source§

type Output = BoolVar<'model>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &BoolVar<'model>) -> Self::Output

Performs the | operation. Read more
Source§

impl<'model> BitOr<bool> for &BoolVar<'model>

Source§

type Output = BoolVar<'model>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: bool) -> Self::Output

Performs the | operation. Read more
Source§

impl<'model> BitOr for &BoolVar<'model>

Source§

type Output = BoolVar<'model>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl<'model> Borrow<IntVar<'model>> for BoolVar<'model>

Source§

fn borrow(&self) -> &IntVar<'model>

Immutably borrows from an owned value. Read more
Source§

impl<'model> From<BoolVar<'model>> for IntVar<'model>

Source§

fn from(bool_var: BoolVar<'model>) -> Self

Converts to this type from the input type.
Source§

impl<'model> Not for &BoolVar<'model>

Source§

type Output = BoolVar<'model>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<'model> TryFrom<IntVar<'model>> for BoolVar<'model>

Source§

type Error = SolverError

The type returned in the event of a conversion error.
Source§

fn try_from(int_var: IntVar<'model>) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'model> Freeze for BoolVar<'model>

§

impl<'model> RefUnwindSafe for BoolVar<'model>

§

impl<'model> !Send for BoolVar<'model>

§

impl<'model> !Sync for BoolVar<'model>

§

impl<'model> Unpin for BoolVar<'model>

§

impl<'model> UnsafeUnpin for BoolVar<'model>

§

impl<'model> UnwindSafe for BoolVar<'model>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.