Constraint

Trait Constraint 

Source
pub trait Constraint {
    // Required methods
    fn post(self, solver: &mut Solver) -> Result<(), ConstraintOperationError>;
    fn implied_by(
        self,
        solver: &mut Solver,
        reification_literal: Literal,
    ) -> Result<(), ConstraintOperationError>;
}
Expand description

A Constraint is a relation over variables. It disqualifies certain partial assignments of making it into a solution of the problem.

For example, the constraint a = b over two variables a and b only allows assignments to a and b of the same value, and rejects any assignment where a and b differ.

Required Methods§

Source

fn post(self, solver: &mut Solver) -> Result<(), ConstraintOperationError>

Add the Constraint to the Solver.

This method returns a ConstraintOperationError if the addition of the Constraint led to a root-level conflict.

The tag allows inferences to be traced to the constraint that implies them. They will show up in the proof log.

Source

fn implied_by( self, solver: &mut Solver, reification_literal: Literal, ) -> Result<(), ConstraintOperationError>

Add the half-reified version of the Constraint to the Solver; i.e. post the constraint r -> constraint where r is a reification literal.

This method returns a ConstraintOperationError if the addition of the Constraint led to a root-level conflict.

The tag allows inferences to be traced to the constraint that implies them. They will show up in the proof log.

Implementations on Foreign Types§

Source§

impl<C> Constraint for Vec<C>
where C: Constraint,

Source§

fn post(self, solver: &mut Solver) -> Result<(), ConstraintOperationError>

Source§

fn implied_by( self, solver: &mut Solver, reification_literal: Literal, ) -> Result<(), ConstraintOperationError>

Implementors§

Source§

impl<ConcretePropagator> Constraint for ConcretePropagator
where ConcretePropagator: PropagatorConstructor + 'static,