ConstraintSatisfactionProblem

Trait ConstraintSatisfactionProblem 

Source
pub trait ConstraintSatisfactionProblem: Problem {
    // Required methods
    fn constraints(&self) -> Vec<LocalConstraint>;
    fn objectives(&self) -> Vec<LocalSolutionSize<Self::Size>>;
    fn weights(&self) -> Vec<Self::Size>;
    fn set_weights(&mut self, weights: Vec<Self::Size>);
    fn is_weighted(&self) -> bool;

    // Provided methods
    fn is_satisfied(&self, config: &[usize]) -> bool { ... }
    fn compute_objective(&self, config: &[usize]) -> Self::Size { ... }
}
Expand description

Trait for constraint satisfaction problems.

These problems have explicit constraints that must be satisfied, and objectives that contribute to the solution size.

Required Methods§

Source

fn constraints(&self) -> Vec<LocalConstraint>

Returns the hard constraints that must be satisfied.

Source

fn objectives(&self) -> Vec<LocalSolutionSize<Self::Size>>

Returns the local objectives that contribute to solution size.

Source

fn weights(&self) -> Vec<Self::Size>

Returns the weights for the problem (e.g., vertex weights).

Source

fn set_weights(&mut self, weights: Vec<Self::Size>)

Set new weights for the problem.

Source

fn is_weighted(&self) -> bool

Returns whether the problem has non-uniform weights.

Provided Methods§

Source

fn is_satisfied(&self, config: &[usize]) -> bool

Check if all constraints are satisfied by a configuration.

Source

fn compute_objective(&self, config: &[usize]) -> Self::Size

Compute the total objective value from all local objectives.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§