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>
impl<'model> IntVar<'model>
pub fn lb(&self) -> i32
pub fn ub(&self) -> i32
pub fn value(&self) -> Option<i32>
pub fn has_enumerated_domain(&self) -> bool
pub fn get_domain_values(&self) -> Option<Vec<i32>>
Sourcepub fn eq_view(&self, value: i32) -> BoolVar<'model>
pub fn eq_view(&self, value: i32) -> BoolVar<'model>
Creates a boolean view representing the equality of the integer variable to a given value.
Sourcepub fn ge_view(&self, value: i32) -> BoolVar<'model>
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.
Sourcepub fn le_view(&self, value: i32) -> BoolVar<'model>
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.
Sourcepub fn ne_view(&self, value: i32) -> BoolVar<'model>
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.
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,
Sourcepub 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>,
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.
Sourcepub fn reify_eq_y<'a>(
&self,
y: impl Into<IntOrIntVar<'a, 'model>>,
b: &BoolVar<'model>,
)where
'model: 'a,
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.
Sourcepub fn reify_ne_y<'a>(
&self,
y: impl Into<IntOrIntVar<'a, 'model>>,
b: &BoolVar<'model>,
)where
'model: 'a,
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.
Sourcepub fn reify_lt_y<'a>(
&self,
y: impl Into<IntOrIntVar<'a, 'model>>,
b: &BoolVar<'model>,
)where
'model: 'a,
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.
Sourcepub fn reify_gt_y<'a>(
&self,
y: impl Into<IntOrIntVar<'a, 'model>>,
b: &BoolVar<'model>,
)where
'model: 'a,
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.
Sourcepub fn reify_le_y<'a>(
&self,
y: impl Into<IntOrIntVar<'a, 'model>>,
b: &BoolVar<'model>,
)where
'model: 'a,
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.
Sourcepub fn reify_ge_y<'a>(
&self,
y: impl Into<IntOrIntVar<'a, 'model>>,
b: &BoolVar<'model>,
)where
'model: 'a,
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.
Sourcepub fn reify_eq_yc(&self, y: &IntVar<'model>, c: i32, b: &BoolVar<'model>)
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.
Sourcepub fn reify_ne_yc(&self, y: &IntVar<'model>, c: i32, b: &BoolVar<'model>)
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.
Sourcepub fn reify_lt_yc(&self, y: &IntVar<'model>, c: i32, b: &BoolVar<'model>)
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.
Sourcepub fn reify_gt_yc(&self, y: &IntVar<'model>, c: i32, b: &BoolVar<'model>)
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.
Sourcepub fn member_table(&self, table: &[i32]) -> Constraint<'model>
pub fn member_table(&self, table: &[i32]) -> Constraint<'model>
Creates a member constraint. Ensures self takes its values in table.
Sourcepub fn member_bounds(&self, lb: i32, ub: i32) -> Constraint<'model>
pub fn member_bounds(&self, lb: i32, ub: i32) -> Constraint<'model>
Creates a member constraint. Ensures self takes its values in [lb, ub].
Sourcepub fn not_member_table(&self, table: &[i32]) -> Constraint<'model>
pub fn not_member_table(&self, table: &[i32]) -> Constraint<'model>
Create not a member constraint. Ensures self does not take its values in table.
Sourcepub fn not_member_bounds(&self, lb: i32, ub: i32) -> Constraint<'model>
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].
Sourcepub fn abs(&self, y: &IntVar<'model>) -> Constraint<'model>
pub fn abs(&self, y: &IntVar<'model>) -> Constraint<'model>
Creates an absolute value constraint: self = | y |
Sourcepub fn square(&self, y: &IntVar<'model>) -> Constraint<'model>
pub fn square(&self, y: &IntVar<'model>) -> Constraint<'model>
Creates a square constraint: self = y^2.
Sourcepub fn pow(&self, c: i32, y: &IntVar<'model>) -> Constraint<'model>
pub fn pow(&self, c: i32, y: &IntVar<'model>) -> Constraint<'model>
Creates a power constraint: self^c = y
Sourcepub fn max(&self, intvars: &[&IntVar<'model>]) -> Constraint<'model>
pub fn max(&self, intvars: &[&IntVar<'model>]) -> Constraint<'model>
Creates a maximum constraint, self is the maximum value among IntVars in intvars.
Sourcepub fn min(&self, intvars: &[&IntVar<'model>]) -> Constraint<'model>
pub fn min(&self, intvars: &[&IntVar<'model>]) -> Constraint<'model>
Creates a minimum constraint, self is the minimum value among IntVars in intvars.
Sourcepub fn among(
&self,
intvars: &[&IntVar<'model>],
values: &[i32],
) -> Constraint<'model>
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