pub struct ValueSubset { /* private fields */ }Expand description
k values that only k variables of an all-different group can still take must go to
those variables, so those variables can take no other value.
Only sound where every value must be used: groups whose variables together can take
exactly as many values as there are variables (a permutation), as in a Sudoku row or a
logic-grid attribute. Other groups are skipped. In x ∈ {1, 2, 3}, y ∈ {1, 2} only x
can take 3, yet x = 1, y = 2 is a solution. Card-location and hidden-identity problems
are often not permutations; model them so that they are, or rely on VariableSubset.
Default names are “value single”, “value pair”, “value triple”, “value quad” and “value
subset”; ValueSubset::with_name sets a domain’s own term. Sudoku players call these
hidden singles, pairs, triples and quads.
Implementations§
Source§impl ValueSubset
impl ValueSubset
Sourcepub fn new<G: IntoIterator<Item = Var>>(
size: usize,
cost: u32,
groups: impl IntoIterator<Item = G>,
) -> Self
pub fn new<G: IntoIterator<Item = Var>>( size: usize, cost: u32, groups: impl IntoIterator<Item = G>, ) -> Self
Trait Implementations§
Source§impl Clone for ValueSubset
impl Clone for ValueSubset
Source§impl Debug for ValueSubset
impl Debug for ValueSubset
impl Eq for ValueSubset
Source§impl PartialEq for ValueSubset
impl PartialEq for ValueSubset
Source§impl<D: Domain> Rule<D> for ValueSubset
impl<D: Domain> Rule<D> for ValueSubset
Source§fn cost(&self) -> u32
fn cost(&self) -> u32
Source§fn apply(&self, domains: &mut Domains<D>) -> Result<(), Inconsistent>
fn apply(&self, domains: &mut Domains<D>) -> Result<(), Inconsistent>
domains. Read moreSource§fn assumes_unique(&self) -> bool
fn assumes_unique(&self) -> bool
true if the rule is sound only for puzzles with exactly one solution, such as
Sudoku’s unique rectangle. Rules skips these unless asked to assume uniqueness.