pub struct VariableSubset { /* private fields */ }Expand description
k variables of an all-different group whose domains together hold only k values use
up those values, so no other variable of the group can take them.
Size 1 is a fixed variable whose value leaves the rest of its group. The rule considers
only variables with at most size values left, and for sizes above 1 only unfixed ones,
so each size reports its own technique. It is sound for every all-different group,
whether or not the group must use all its values.
Default names are “variable single”, “variable pair”, “variable triple”, “variable quad”
and “variable subset”; VariableSubset::with_name sets a domain’s own term. Sudoku
players call these naked singles, pairs, triples and quads; in a logic-grid puzzle it is
“these two people own the only two remaining pets”.
Implementations§
Source§impl VariableSubset
impl VariableSubset
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 VariableSubset
impl Clone for VariableSubset
Source§impl Debug for VariableSubset
impl Debug for VariableSubset
impl Eq for VariableSubset
Source§impl PartialEq for VariableSubset
impl PartialEq for VariableSubset
Source§impl<D: Domain> Rule<D> for VariableSubset
impl<D: Domain> Rule<D> for VariableSubset
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.