Skip to main content

IntVar

Struct IntVar 

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

An integer decision variable belonging to a Model.

IntVar represents a domain of possible integer values and provides accessors, views, arithmetic constraints, and reification helpers. Instances are tied to the lifetime of their owning model.

Implementations§

Source§

impl<'model> IntVar<'model>

Source

pub fn lb(&self) -> i32

Source

pub fn ub(&self) -> i32

Source

pub fn value(&self) -> Option<i32>

Source

pub fn has_enumerated_domain(&self) -> bool

Source

pub fn get_domain_values(&self) -> Option<Vec<i32>>

Source

pub fn eq_view(&self, value: i32) -> BoolVar<'model>

Creates a boolean view representing the equality of the integer variable to a given value.

Source

pub fn ge_view(&self, value: i32) -> BoolVar<'model>

Creates a boolean view representing the “greater than or equal to” relation of the integer variable to a given value.

Source

pub fn le_view(&self, value: i32) -> BoolVar<'model>

Creates a boolean view representing the “less than or equal to” relation of the integer variable to a given value.

Source

pub fn ne_view(&self, value: i32) -> BoolVar<'model>

Creates a boolean view representing the “not equal to” relation of the integer variable to a given value.

Source

pub fn arithm<'a, 'b, OP, Y>(&'b self, op: OP, y: Y) -> Constraint<'model>
where (&'a IntVar<'model>, OP, Y): ConstraintArithmT<'model>, Y: 'b, 'model: 'a + 'b, 'b: 'a,

Source

pub fn arithm2<OP, Y, OP2, Z>( &self, op: OP, y: Y, op2: OP2, z: Z, ) -> Constraint<'model>
where for<'a> (&'a IntVar<'model>, OP, Y, OP2, Z): ConstraintArithmT<'model>,

Creates a two-operator arithmetic constraint associated with this model.

Source

pub fn reify_eq_y<'a>( &self, y: impl Into<IntOrIntVar<'a, 'model>>, b: &BoolVar<'model>, )
where 'model: 'a,

Posts a constraint that expresses: (self = y) <=> (b = true) This bypass reification system.

Source

pub fn reify_ne_y<'a>( &self, y: impl Into<IntOrIntVar<'a, 'model>>, b: &BoolVar<'model>, )
where 'model: 'a,

Posts a constraint that expresses: (self != y) <=> (b = true) This bypass reification system.

Source

pub fn reify_lt_y<'a>( &self, y: impl Into<IntOrIntVar<'a, 'model>>, b: &BoolVar<'model>, )
where 'model: 'a,

Posts a constraint that expresses: (self < y) <=> (b = true) This bypass reification system.

Source

pub fn reify_gt_y<'a>( &self, y: impl Into<IntOrIntVar<'a, 'model>>, b: &BoolVar<'model>, )
where 'model: 'a,

Posts a constraint that expresses: (self > y) <=> (b = true) This bypass reification system.

Source

pub fn reify_le_y<'a>( &self, y: impl Into<IntOrIntVar<'a, 'model>>, b: &BoolVar<'model>, )
where 'model: 'a,

Posts a constraint that expresses: (self <= y) <=> (b = true) This bypass reification system.

Source

pub fn reify_ge_y<'a>( &self, y: impl Into<IntOrIntVar<'a, 'model>>, b: &BoolVar<'model>, )
where 'model: 'a,

Posts a constraint that expresses: (self >= y) <=> (b = true) This bypass reification system.

Source

pub fn reify_eq_yc(&self, y: &IntVar<'model>, c: i32, b: &BoolVar<'model>)

Posts a constraint that expresses : (self = y + c) <=> (b is true). This bypass reification system.

Source

pub fn reify_ne_yc(&self, y: &IntVar<'model>, c: i32, b: &BoolVar<'model>)

Posts a constraint that expresses : (self != y + c) <=> (b is true). This bypass reification system.

Source

pub fn reify_lt_yc(&self, y: &IntVar<'model>, c: i32, b: &BoolVar<'model>)

Posts a constraint that expresses : (self < y + c) <=> b. This bypass reification system.

Source

pub fn reify_gt_yc(&self, y: &IntVar<'model>, c: i32, b: &BoolVar<'model>)

Posts a constraint that expresses : (self > y + c) <=> b. This bypass reification system.

Source

pub fn member_table(&self, table: &[i32]) -> Constraint<'model>

Creates a member constraint. Ensures self takes its values in table.

Source

pub fn member_bounds(&self, lb: i32, ub: i32) -> Constraint<'model>

Creates a member constraint. Ensures self takes its values in [lb, ub].

Source

pub fn not_member_table(&self, table: &[i32]) -> Constraint<'model>

Create not a member constraint. Ensures self does not take its values in table.

Source

pub fn not_member_bounds(&self, lb: i32, ub: i32) -> Constraint<'model>

Create not a member constraint. Ensures self does not take its values in [lb, ub].

Source

pub fn abs(&self, y: &IntVar<'model>) -> Constraint<'model>

Creates an absolute value constraint: self = | y |

Source

pub fn square(&self, y: &IntVar<'model>) -> Constraint<'model>

Creates a square constraint: self = y^2.

Source

pub fn pow(&self, c: i32, y: &IntVar<'model>) -> Constraint<'model>

Creates a power constraint: self^c = y

Source

pub fn max(&self, intvars: &[&IntVar<'model>]) -> Constraint<'model>

Creates a maximum constraint, self is the maximum value among IntVars in intvars.

Source

pub fn min(&self, intvars: &[&IntVar<'model>]) -> Constraint<'model>

Creates a minimum constraint, self is the minimum value among IntVars in intvars.

Source

pub fn among( &self, intvars: &[&IntVar<'model>], values: &[i32], ) -> Constraint<'model>

Creates an among constraint. self is the number of variables of the collection intvars that take their value in values.

Propagator :

C. Bessiere, E. Hebrard, B. Hnich, Z. Kiziltan, T. Walsh, Among, common and disjoint Constraints CP-2005

Trait Implementations§

Source§

impl<'model> Add<&IntVar<'model>> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &IntVar<'model>) -> IntVar<'model>

Performs the + operation. Read more
Source§

impl<'model> Add<i32> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: i32) -> IntVar<'model>

Performs the + operation. Read more
Source§

impl<'model> ArithmConstraint<'model, &IntVar<'model>, &IntVar<'model>> for IntVar<'model>

Source§

fn modulo( &'model self, modulo: &IntVar<'model>, res: &IntVar<'model>, ) -> Constraint<'model>

Creates a modulo constraint: self % modulo = res.
Source§

impl<'model> ArithmConstraint<'model, i32, &IntVar<'model>> for IntVar<'model>

Source§

fn modulo(&'model self, modulo: i32, res: &IntVar<'model>) -> Constraint<'model>

Creates a modulo constraint: self % modulo = res.
Source§

impl<'model> ArithmConstraint<'model, i32, i32> for IntVar<'model>

Source§

fn modulo(&'model self, modulo: i32, res: i32) -> Constraint<'model>

Creates a modulo constraint: self % modulo = res.
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 Debug for IntVar<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for IntVar<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'model> Div<&IntVar<'model>> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &IntVar<'model>) -> IntVar<'model>

Performs the / operation. Read more
Source§

impl<'model> Div<i32> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i32) -> IntVar<'model>

Performs the / operation. 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> Mul<&IntVar<'model>> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &IntVar<'model>) -> IntVar<'model>

Performs the * operation. Read more
Source§

impl<'model> Mul<i32> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i32) -> IntVar<'model>

Performs the * operation. Read more
Source§

impl<'model> Neg for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the - operator.
Source§

fn neg(self) -> IntVar<'model>

Performs the unary - operation. Read more
Source§

impl<'model> Rem<&IntVar<'model>> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &IntVar<'model>) -> IntVar<'model>

Performs the % operation. Read more
Source§

impl<'model> Rem<i32> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: i32) -> IntVar<'model>

Performs the % operation. Read more
Source§

impl<'model> Sub<&IntVar<'model>> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &IntVar<'model>) -> IntVar<'model>

Performs the - operation. Read more
Source§

impl<'model> Sub<i32> for &IntVar<'model>

Source§

type Output = IntVar<'model>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: i32) -> IntVar<'model>

Performs the - 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 IntVar<'model>

§

impl<'model> RefUnwindSafe for IntVar<'model>

§

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

§

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

§

impl<'model> Unpin for IntVar<'model>

§

impl<'model> UnsafeUnpin for IntVar<'model>

§

impl<'model> UnwindSafe for IntVar<'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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.