pub struct SoftLambdaConstraint<D: Domain> { /* private fields */ }Expand description
A soft constraint backed by a closure, analogous to LambdaConstraint.
When the checker returns false, the constraint is “violated” and its
penalty is added to the objective during optimization search.
Implementations§
Source§impl<D: Domain> SoftLambdaConstraint<D>
impl<D: Domain> SoftLambdaConstraint<D>
Source§impl<D: Domain> SoftLambdaConstraint<D>
impl<D: Domain> SoftLambdaConstraint<D>
Sourcepub fn is_satisfied(&self, assignment: &[Option<D::Value>]) -> bool
pub fn is_satisfied(&self, assignment: &[Option<D::Value>]) -> bool
Check whether the underlying predicate is satisfied.
This is separate from Constraint::check (which always returns true
so that soft constraints don’t prune) — use this to compute penalty costs.
Trait Implementations§
Source§impl<D: Domain> Constraint<D> for SoftLambdaConstraint<D>
impl<D: Domain> Constraint<D> for SoftLambdaConstraint<D>
Source§impl<D: Domain> Debug for SoftLambdaConstraint<D>
impl<D: Domain> Debug for SoftLambdaConstraint<D>
Source§impl<D: Domain> SoftConstraint<D> for SoftLambdaConstraint<D>
impl<D: Domain> SoftConstraint<D> for SoftLambdaConstraint<D>
Auto Trait Implementations§
impl<D> Freeze for SoftLambdaConstraint<D>
impl<D> !RefUnwindSafe for SoftLambdaConstraint<D>
impl<D> !Send for SoftLambdaConstraint<D>
impl<D> !Sync for SoftLambdaConstraint<D>
impl<D> Unpin for SoftLambdaConstraint<D>
impl<D> UnsafeUnpin for SoftLambdaConstraint<D>
impl<D> !UnwindSafe for SoftLambdaConstraint<D>
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