pub struct ConstraintHints {
pub one_hot_constraints: Vec<OneHot>,
pub sos1_constraints: Vec<Sos1>,
}Expand description
Constraint hints provide additional information about active constraints to help solvers optimize more efficiently.
§Important
Constraint hints can only reference active constraints, not removed constraints.
When a constraint is relaxed (moved to removed_constraints), any associated hints
are automatically invalidated. When adding hints via crate::Instance::add_constraint_hints,
referencing a removed constraint will result in an error.
When parsing an instance from bytes, hints that reference removed or unknown constraints are discarded (with debug-level logging) for backward compatibility with legacy artifacts.
Fields§
§one_hot_constraints: Vec<OneHot>§sos1_constraints: Vec<Sos1>Implementations§
Source§impl ConstraintHints
impl ConstraintHints
pub fn is_empty(&self) -> bool
Sourcepub fn partial_evaluate(
&mut self,
state: State,
atol: ATol,
) -> Result<State, ConstraintHintsError>
pub fn partial_evaluate( &mut self, state: State, atol: ATol, ) -> Result<State, ConstraintHintsError>
Partially evaluate all constraint hints with the given state.
This method modifies the constraint hints in-place by:
- Removing constraints that are satisfied or cannot be satisfied
- Updating constraints by removing variables fixed to 0
Returns a new State containing the original state plus any additional variable fixings discovered through constraint propagation.
The process iterates until no more variable fixings are discovered, ensuring all constraint propagations are applied.
Trait Implementations§
Source§impl Clone for ConstraintHints
impl Clone for ConstraintHints
Source§fn clone(&self) -> ConstraintHints
fn clone(&self) -> ConstraintHints
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ConstraintHints
impl Debug for ConstraintHints
Source§impl Default for ConstraintHints
impl Default for ConstraintHints
Source§fn default() -> ConstraintHints
fn default() -> ConstraintHints
Source§impl From<ConstraintHints> for ConstraintHints
impl From<ConstraintHints> for ConstraintHints
Source§fn from(value: ConstraintHints) -> Self
fn from(value: ConstraintHints) -> Self
Source§impl LogicalMemoryProfile for ConstraintHints
impl LogicalMemoryProfile for ConstraintHints
Source§fn visit_logical_memory<V: LogicalMemoryVisitor>(
&self,
path: &mut Path,
visitor: &mut V,
)
fn visit_logical_memory<V: LogicalMemoryVisitor>( &self, path: &mut Path, visitor: &mut V, )
Source§impl PartialEq for ConstraintHints
impl PartialEq for ConstraintHints
impl Eq for ConstraintHints
impl StructuralPartialEq for ConstraintHints
Auto Trait Implementations§
impl Freeze for ConstraintHints
impl RefUnwindSafe for ConstraintHints
impl Send for ConstraintHints
impl Sync for ConstraintHints
impl Unpin for ConstraintHints
impl UnsafeUnpin for ConstraintHints
impl UnwindSafe for ConstraintHints
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§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