pub struct ExactlyOne { /* private fields */ }Expand description
Global constraint enforcing that exactly one variable in scope takes target_value.
Implementations§
Source§impl ExactlyOne
impl ExactlyOne
Sourcepub fn new(
variables: impl IntoIterator<Item = VariableId>,
target_value: i64,
) -> Self
pub fn new( variables: impl IntoIterator<Item = VariableId>, target_value: i64, ) -> Self
Creates an ExactlyOne constraint over variables for target_value.
§Complexity
Time & Space: O(N) where N is number of variables.
Trait Implementations§
Source§impl Clone for ExactlyOne
impl Clone for ExactlyOne
Source§fn clone(&self) -> ExactlyOne
fn clone(&self) -> ExactlyOne
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Constraint for ExactlyOne
impl Constraint for ExactlyOne
Source§fn scope(&self) -> &[VariableId]
fn scope(&self) -> &[VariableId]
Returns the slice of variable IDs involved in this constraint. Read more
Source§fn is_satisfied(&self, assignment: &HashMap<VariableId, i64>) -> bool
fn is_satisfied(&self, assignment: &HashMap<VariableId, i64>) -> bool
Evaluates if the constraint is satisfied under a complete or partial variable assignment. Read more
Source§fn is_satisfiable(
&self,
domains: &HashMap<VariableId, Domain>,
_assignment: &HashMap<VariableId, i64>,
) -> bool
fn is_satisfiable( &self, domains: &HashMap<VariableId, Domain>, _assignment: &HashMap<VariableId, i64>, ) -> bool
Returns
false only if this constraint can provably never be satisfied by any
completion consistent with the current domains, regardless of how the as-yet-unassigned
variables in its scope are eventually assigned. Read moreSource§fn propagate(&self, domains: &mut TrailedDomains) -> PropagationResult
fn propagate(&self, domains: &mut TrailedDomains) -> PropagationResult
Enforces arc/bounds consistency by pruning inconsistent values from variable domains. Read more
Source§fn violations(&self, assignment: &HashMap<VariableId, i64>) -> u32
fn violations(&self, assignment: &HashMap<VariableId, i64>) -> u32
How many ways this constraint is broken under
assignment, not merely whether it is. Read moreSource§fn explain(&self, assignment: &Assignment) -> Option<Explanation>
fn explain(&self, assignment: &Assignment) -> Option<Explanation>
Explains a concrete violation, or returns
None when the assignment does not violate
this constraint or the implementation has no specialized explanation. Read moreAuto Trait Implementations§
impl Freeze for ExactlyOne
impl RefUnwindSafe for ExactlyOne
impl Send for ExactlyOne
impl Sync for ExactlyOne
impl Unpin for ExactlyOne
impl UnsafeUnpin for ExactlyOne
impl UnwindSafe for ExactlyOne
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more