pub struct Assignment<V> {
pub assignment: Vec<V>,
}Fields§
§assignment: Vec<V>Implementations§
Source§impl<V> Assignment<V>where
V: VarType,
impl<V> Assignment<V>where
V: VarType,
Sourcepub fn with_size(size: usize) -> Self
pub fn with_size(size: usize) -> Self
Initialize a new Assignment with specific size where all entries are set to the default value of VarType.
Sourcepub fn resize(&mut self, new_len: usize)
pub fn resize(&mut self, new_len: usize)
Resizes the Assignment to the given new_len.
If new_len is smaller than the current len of Assignment, the Assignment is truncated to new_len. If new_len is larger than the current len of Assignment, then Assignment is increased up to new_len and filled with the default values for VarType, but the entries up to the current length are left unchanged.
Sourcepub fn set_lit_value(&mut self, lit: Lit, value: V::Value)
pub fn set_lit_value(&mut self, lit: Lit, value: V::Value)
Sourcepub unsafe fn set_lit_value_unchecked(&mut self, lit: Lit, value: V::Value)
pub unsafe fn set_lit_value_unchecked(&mut self, lit: Lit, value: V::Value)
Set a value by literal. Hence, if the literal is negated, then value assigned to its variable is negated.
§Safety
The caller must ensure that the Assignment has a large enough size, so that the variable index of lit is at most that size.
Using a lit with variable index of at least the size of Assignment is undefined behaviour.
Sourcepub fn get_lit_value(&self, lit: Lit) -> V::Value
pub fn get_lit_value(&self, lit: Lit) -> V::Value
Sourcepub unsafe fn get_lit_value_unchecked(&self, lit: Lit) -> V::Value
pub unsafe fn get_lit_value_unchecked(&self, lit: Lit) -> V::Value
Same as get_lit_value but without bounds check.
§Safety
The caller must ensure that the Assignment has a large enough size, so that the variable index of lit is at most that size.
Using a lit with variable index of at least the size of Assignment is undefined behaviour.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the Assignment to its default values.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of variables in the Assignment no matter their value.
Source§impl Assignment<BooleanVar>
impl Assignment<BooleanVar>
Sourcepub fn from(literals: &Vec<Lit>) -> Option<Self>
pub fn from(literals: &Vec<Lit>) -> Option<Self>
Create an Assignment from a Vec<Lit>.
Returns Some(assignment) if the literals are consistent, i.e., Vec<Lit> does not contain a literal and its negation. If literals is not consistent, then None is returned.
Sourcepub fn is_unassigned(&self, var: VarIdx) -> bool
pub fn is_unassigned(&self, var: VarIdx) -> bool
Test if the variable is unassigned.
Returns true if the variable matches BoolValue::Unassigned.
Sourcepub fn is_assigned(&self, var: VarIdx) -> bool
pub fn is_assigned(&self, var: VarIdx) -> bool
Test if the variable is assigned to some value.
Returns true if the variable matches BoolValue::Assigned(_).
Trait Implementations§
Source§impl<V: Clone> Clone for Assignment<V>
impl<V: Clone> Clone for Assignment<V>
Source§fn clone(&self) -> Assignment<V>
fn clone(&self) -> Assignment<V>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<V: Debug> Debug for Assignment<V>
impl<V: Debug> Debug for Assignment<V>
Source§impl<V: Default> Default for Assignment<V>
impl<V: Default> Default for Assignment<V>
Source§fn default() -> Assignment<V>
fn default() -> Assignment<V>
Source§impl Display for Assignment<BooleanVar>
impl Display for Assignment<BooleanVar>
Source§impl Substitutable for Assignment<BooleanVar>
impl Substitutable for Assignment<BooleanVar>
Source§impl ToPrettyString for Assignment<BooleanVar>
impl ToPrettyString for Assignment<BooleanVar>
Source§fn to_pretty_string(&self, var_names: &VarNameManager) -> String
fn to_pretty_string(&self, var_names: &VarNameManager) -> String
Auto Trait Implementations§
impl<V> Freeze for Assignment<V>
impl<V> RefUnwindSafe for Assignment<V>where
V: RefUnwindSafe,
impl<V> Send for Assignment<V>where
V: Send,
impl<V> Sync for Assignment<V>where
V: Sync,
impl<V> Unpin for Assignment<V>where
V: Unpin,
impl<V> UnsafeUnpin for Assignment<V>
impl<V> UnwindSafe for Assignment<V>where
V: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Enum> FromEnumMut<Enum> for Enum
impl<Enum> FromEnumMut<Enum> for Enum
Source§fn from_enum_mut(e: &mut Enum) -> Option<&mut Enum>
fn from_enum_mut(e: &mut Enum) -> Option<&mut Enum>
EnumExtensions::try_mut_var, see that method’s documentation for more. Read moreSource§impl<Enum> FromEnumRef<Enum> for Enum
impl<Enum> FromEnumRef<Enum> for Enum
Source§fn from_enum_ref(e: &Enum) -> Option<&Enum>
fn from_enum_ref(e: &Enum) -> Option<&Enum>
EnumExtensions::try_ref_var, see that method’s documentation for more. Read moreSource§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more