Class SampleAssignment¶
- Defined in File model_sampler.h
Class Documentation¶
-
class
SampleAssignment¶ Public Functions
-
SampleAssignment(SampleSize sample_count)¶ Creates a blank assignment with all variables unset.
- Parameters
sample_count: Number of samples this sample will represent.
-
SampleAssignment()¶ Empty constructor with zero samples. It is not valid for general use.
-
std::string
ToString() const¶ Converts the sample to a string,
- Return
- String representation of the sample.
-
const AssignmentEncoding
var_assignment(const VariableIndex &var) const¶ Variable Assignment Accessor.
Extracts the value of a single variable from the partial assignment
- Return
- Value of the specified value number
- Parameters
var: Identification number of the variable from 1 to num_var
-
void
GetPartialAssignment(PartialAssignment &all_vars) const¶ Extracts the current assignment in vector form.
- Return
- Assignment as a vector
-
void
setVarAssignment(const VariableIndex var, const AssignmentEncoding &val)¶ Variable Value Setter
Modifies the bit values for a specific variable.
-
const bool
IsComplete() const¶ Complete Assignment Checker
Determines whether the sample model is partial or complete.
- Return
- true if the sample model is a complete assignment.
-
const SampleSize
sample_count() const¶ Complete Assignment Checker
Determines whether the sample model is partial or complete.
- Return
- true if the sample model is a complete assignment. Accessor for the number of cached component IDs in this object.
- Return
- Number of cached component IDs in this object Accessor for the number of samples in this object.
- Return
- Number of samples represented by the object.
-
const VariableIndex
num_set_vars()¶ Accesor for the number of variables set in this assignment. Note that this does not include any emancipated variables since those are free and not set.
- Return
- Number of variables set in this assignment.
-
const VariableIndex
num_set_vars_const() const¶ Accessor for the number of variables set in this assignment. Note that this does not include any emancipated variables since those are free and not set.
- Return
- Number of variables set in this assignment.
-
const VariableIndex
num_unset_vars()¶ Updates the assignment of the implicit assignment with that of the specified one. It does NOT update the sample count
- Return
- Number of unset unemancipated variables.
- Parameters
other: Another SampleAssignment. Gets the number of remaining variables that are unset. This does NOT include emancipated variables.
-
const bool
IsVarEmancipated(VariableIndex var) const¶ Builds and returns the set of unconstrained variables in this sample.
- Return
- Identification number of the unset variables. Checks if the specified variable is emancipated.
- Return
- True if the variable is emancipated.
- Parameters
var: Variable identification number
-
const std::vector<CacheEntryID> &
cache_comp_ids() const¶ Cached component ID accessor.
- Return
- All cached components identification numbers in this object.
-
void
clear_cache_comp_ids()¶ Clears all stored cached component IDs. There is generally not a reason to call this function outside of when filling a partial assignment. Care should be taken when using this function.
Public Static Functions
-
static void
set_num_var(const VariableIndex num_var)¶ Defines the number of variables in the Boolean formula. This is used to encode the recipe.
The number of variables dictates the size of the
- Parameters
num_var: Number of variables in the equation.
-