Skip to main content

Constraint

Trait Constraint 

Source
pub trait Constraint<D: Domain>: Debug {
    // Required methods
    fn scope(&self) -> &[VarId] ;
    fn check(&self, assignment: &[Option<D::Value>]) -> bool;

    // Provided method
    fn revise(&self, vars: &mut [Variable<D>], depth: usize) -> Revision { ... }
}
Expand description

A constraint over one or more CSP variables.

Required Methods§

Source

fn scope(&self) -> &[VarId]

The variables this constraint involves (its “scope”).

Source

fn check(&self, assignment: &[Option<D::Value>]) -> bool

Check whether a full or partial assignment satisfies this constraint.

Provided Methods§

Source

fn revise(&self, vars: &mut [Variable<D>], depth: usize) -> Revision

AC-3 style revision: prune unsupported values from domains.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§