rustsat_batsat

Struct Solver

source
pub struct Solver<Cb: Callbacks> { /* private fields */ }
Expand description

RustSAT wrapper for a batsat::Solver Solver from BatSat

Implementations§

source§

impl<Cb: Callbacks> Solver<Cb>

source

pub fn batsat_ref(&self) -> &Solver<Cb>

Gets a reference to the internal BasicSolver

source

pub fn batsat_mut(&mut self) -> &mut Solver<Cb>

Gets a mutable reference to the internal BasicSolver

Trait Implementations§

source§

impl<Cb: Default + Callbacks> Default for Solver<Cb>

source§

fn default() -> Solver<Cb>

Returns the “default value” for a type. Read more
source§

impl<'a, C, Cb> Extend<&'a C> for Solver<Cb>
where C: AsRef<Cl> + ?Sized, Cb: Callbacks,

source§

fn extend<T: IntoIterator<Item = &'a C>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<Cb: Callbacks> Extend<Clause> for Solver<Cb>

source§

fn extend<T: IntoIterator<Item = Clause>>(&mut self, iter: T)

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl<Cb: Callbacks> Solve for Solver<Cb>

source§

fn signature(&self) -> &'static str

Gets a signature of the solver implementation
source§

fn solve(&mut self) -> Result<SolverResult>

Solves the internal CNF formula without any assumptions. Read more
source§

fn lit_val(&self, lit: Lit) -> Result<TernaryVal>

Gets an assignment of a variable in the solver. Read more
source§

fn add_clause_ref<C>(&mut self, clause: &C) -> Result<()>
where C: AsRef<Cl> + ?Sized,

Adds a clause to the solver by reference. If the solver is in the satisfied or unsatisfied state before, it is in the input state afterwards. Read more
source§

fn reserve(&mut self, _max_var: Var) -> Result<(), Error>

Reserves memory in the solver until a maximum variables, if the solver supports it Read more
source§

fn solution(&self, high_var: Var) -> Result<Assignment, Error>

Gets a solution found by the solver up to a specified highest variable. Read more
source§

fn full_solution(&self) -> Result<Assignment, Error>
where Self: SolveStats,

Gets a solution found by the solver up to the highest variable known to the solver. Read more
source§

fn var_val(&self, var: Var) -> Result<TernaryVal, Error>

Same as Solve::lit_val, but for variables. Read more
source§

fn add_clause(&mut self, clause: Clause) -> Result<(), Error>

Adds a clause to the solver. If the solver is in the satisfied or unsatisfied state before, it is in the input state afterwards. Read more
source§

fn add_unit(&mut self, lit: Lit) -> Result<(), Error>

Like Solve::add_clause but for unit clauses (clauses with one literal). Read more
source§

fn add_binary(&mut self, lit1: Lit, lit2: Lit) -> Result<(), Error>

Like Solve::add_clause but for clauses with two literals. Read more
source§

fn add_ternary(&mut self, lit1: Lit, lit2: Lit, lit3: Lit) -> Result<(), Error>

Like Solve::add_clause but for clauses with three literals. Read more
source§

fn add_cnf(&mut self, cnf: Cnf) -> Result<(), Error>

Adds all clauses from a Cnf instance. Read more
source§

fn add_cnf_ref(&mut self, cnf: &Cnf) -> Result<(), Error>

Adds all clauses from a Cnf instance by reference. Read more
source§

impl<Cb: Callbacks> SolveIncremental for Solver<Cb>

source§

fn solve_assumps(&mut self, assumps: &[Lit]) -> Result<SolverResult>

Solves the internal CNF formula under assumptions. Read more
source§

fn core(&mut self) -> Result<Vec<Lit>>

Gets a core found by an unsatisfiable query. A core is a clause entailed by the formula that contains only inverted literals of the assumptions. Read more
source§

impl<Cb: Callbacks> SolveStats for Solver<Cb>

source§

fn stats(&self) -> SolverStats

Gets the available statistics from the solver
source§

fn n_sat_solves(&self) -> usize

Gets the number of satisfiable queries executed.
source§

fn n_unsat_solves(&self) -> usize

Gets the number of unsatisfiable queries executed.
source§

fn n_terminated(&self) -> usize

Gets the number of queries that were prematurely terminated.
source§

fn n_clauses(&self) -> usize

Gets the number of clauses in the solver.
source§

fn max_var(&self) -> Option<Var>

Gets the variable with the highest index in the solver, if any. If all variables below have been used, the index of this variable +1 is the number of variables in the solver.
source§

fn avg_clause_len(&self) -> f32

Gets the average length of all clauses in the solver.
source§

fn cpu_solve_time(&self) -> Duration

Gets the total CPU time spent solving.
source§

fn n_solves(&self) -> usize

Gets the total number of queries executed.
source§

fn n_vars(&self) -> usize

Get number of variables. Note: this is only correct if all variables are used in order!

Auto Trait Implementations§

§

impl<Cb> !Freeze for Solver<Cb>

§

impl<Cb> RefUnwindSafe for Solver<Cb>
where Cb: RefUnwindSafe,

§

impl<Cb> Send for Solver<Cb>
where Cb: Send,

§

impl<Cb> Sync for Solver<Cb>
where Cb: Sync,

§

impl<Cb> Unpin for Solver<Cb>
where Cb: Unpin,

§

impl<Cb> UnwindSafe for Solver<Cb>
where Cb: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<S> CollectClauses for S
where S: Solve + SolveStats,

source§

fn n_clauses(&self) -> usize

Gets the number of clauses in the collection
source§

fn extend_clauses<T>(&mut self, cl_iter: T) -> Result<(), OutOfMemory>
where T: IntoIterator<Item = Clause>,

Extends the clause collector with an iterator of clauses Read more
source§

fn add_clause(&mut self, cl: Clause) -> Result<(), OutOfMemory>

Adds one clause to the collector Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.