pub trait ArrayEqualityConstraints<'model>: Sealed {
// Required methods
fn all_different(self) -> Constraint<'model>;
fn all_different_except_0(self) -> Constraint<'model>;
fn all_equal(self) -> Constraint<'model>;
fn not_all_equal(self) -> Constraint<'model>;
fn at_least_n_value<'a>(
self,
n_values: &'a IntVar<'model>,
ac: bool,
) -> Constraint<'model>
where 'model: 'a;
fn at_most_n_value<'a>(
self,
n_values: &IntVar<'model>,
strong: bool,
) -> Constraint<'model>
where 'model: 'a;
}Expand description
Trait for creating global constraints over arrays of variables.
Provides methods for constraints that operate on collections of variables, such as all-different, all-equal, and cardinality constraints.
Required Methods§
Sourcefn all_different(self) -> Constraint<'model>
fn all_different(self) -> Constraint<'model>
Creates an allDifferent constraint, which ensures that all variables from vars take a different value. /// # Panic: if slice is empty
§Panic:
if slice is empty
Sourcefn all_different_except_0(self) -> Constraint<'model>
fn all_different_except_0(self) -> Constraint<'model>
Creates an allDifferent constraint for variables that are not equal to 0. There can be multiple variables equal to 0.
§Panic:
if slice is empty
Sourcefn all_equal(self) -> Constraint<'model>
fn all_equal(self) -> Constraint<'model>
Creates an all_equal constraint. Ensures that all variables from vars take the same value.
§Panic:
if slice is empty
Sourcefn not_all_equal(self) -> Constraint<'model>
fn not_all_equal(self) -> Constraint<'model>
Creates a not_all_equal constraint. Ensures that not all variables from vars take the same value.
§Panic:
if slice is empty
Sourcefn at_least_n_value<'a>(
self,
n_values: &'a IntVar<'model>,
ac: bool,
) -> Constraint<'model>where
'model: 'a,
fn at_least_n_value<'a>(
self,
n_values: &'a IntVar<'model>,
ac: bool,
) -> Constraint<'model>where
'model: 'a,
Creates an at_least_n_value constraint. Let N be the number of distinct values assigned to the variables of the intvars collection. Enforce condition N >= n_values to hold. This embeds a light propagator by default. Additional filtering algorithms can be added.
§Arguments
n_values- IntVar (limit variable).ac- If True, add additional filtering algorithm, domain filtering algorithm derivated from (Soft) AllDifferent.
§Panic:
if slice is empty
Sourcefn at_most_n_value<'a>(
self,
n_values: &IntVar<'model>,
strong: bool,
) -> Constraint<'model>where
'model: 'a,
fn at_most_n_value<'a>(
self,
n_values: &IntVar<'model>,
strong: bool,
) -> Constraint<'model>where
'model: 'a,
Creates an at_mostn_value constraint. Let N be the number of distinct values assigned to the variables of the intvars collection. Enforce condition N <= n_values to hold. This embeds a light propagator by default. Additional filtering algorithms can be added.
§Arguments
n_values- IntVar (limit variable).strong- “AMNV<Gci | MDRk | R13>” Filters the conjunction of AtMostNValue and inequalities (see Fages and Lapègue Artificial Intelligence 2014) automatically detects inequalities and allDifferent constraints. Presumably useful when nValues must be minimized.
Implementations on Foreign Types§
Source§impl<'model, Q: Borrow<IntVar<'model>> + Sealed> ArrayEqualityConstraints<'model> for &[Q]
impl<'model, Q: Borrow<IntVar<'model>> + Sealed> ArrayEqualityConstraints<'model> for &[Q]
Source§fn all_different(self) -> Constraint<'model>
fn all_different(self) -> Constraint<'model>
Creates an all different constraint over a slice of integer variables.