Skip to main content

Backend

Trait Backend 

Source
pub trait Backend: Debug + Send {
    // Required methods
    fn new_var(&mut self) -> Var;
    fn add_clause(&mut self, lits: &[Lit]);
    fn solve_assuming(&mut self, assumptions: &[Lit], limits: Limits) -> Answer;
    fn failed_assumptions(&self) -> Vec<Lit>;
    fn conflicts(&self) -> u64;
    fn propagations(&self) -> u64;

    // Provided methods
    fn add_clause_watching(&mut self, lits: &[Lit], watches: [Lit; 2]) { ... }
    fn exact_conflicts(&self) -> bool { ... }
}
Expand description

A SAT search behind a circuit that grows (Incremental): bitwright’s own Solver, or another one a host links in (CaDiCaL, through the bitwright-cadical crate). Variables are numbered from 0 in the order they are made. A backend can be sent to another thread, so that what holds one can.

Required Methods§

Source

fn new_var(&mut self) -> Var

A new variable.

Source

fn add_clause(&mut self, lits: &[Lit])

Adds a clause.

Source

fn solve_assuming(&mut self, assumptions: &[Lit], limits: Limits) -> Answer

Whether the clauses and assumptions hold together, within limits of search counted from this call (a search that counts otherwise honours them as it can). The assumptions are of this call only; what the search learned stays.

Source

fn failed_assumptions(&self) -> Vec<Lit>

After solve_assuming answered Unsat: assumptions of that call that conflict with the clauses (none when the clauses alone are contradictory).

Source

fn conflicts(&self) -> u64

Conflicts of every search so far.

Source

fn propagations(&self) -> u64

Propagations of every search so far (0 from a search that does not count them).

Provided Methods§

Source

fn add_clause_watching(&mut self, lits: &[Lit], watches: [Lit; 2])

Adds a clause, with two of its literals to watch first if the search can use the hint. The default ignores it.

Source

fn exact_conflicts(&self) -> bool

Whether conflicts is an exact count of search conflicts (false for a backend that does not expose its conflict counter).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<B: Backend + ?Sized> Backend for Box<B>

Source§

fn new_var(&mut self) -> Var

Source§

fn add_clause(&mut self, lits: &[Lit])

Source§

fn add_clause_watching(&mut self, lits: &[Lit], watches: [Lit; 2])

Source§

fn solve_assuming(&mut self, assumptions: &[Lit], limits: Limits) -> Answer

Source§

fn failed_assumptions(&self) -> Vec<Lit>

Source§

fn conflicts(&self) -> u64

Source§

fn propagations(&self) -> u64

Source§

fn exact_conflicts(&self) -> bool

Implementors§