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>
impl<Cb: Callbacks> Solver<Cb>
sourcepub fn batsat_ref(&self) -> &Solver<Cb>
pub fn batsat_ref(&self) -> &Solver<Cb>
Gets a reference to the internal BasicSolver
sourcepub fn batsat_mut(&mut self) -> &mut Solver<Cb>
pub fn batsat_mut(&mut self) -> &mut Solver<Cb>
Gets a mutable reference to the internal BasicSolver
Trait Implementations§
source§impl<'a, C, Cb> Extend<&'a C> for Solver<Cb>
impl<'a, C, Cb> Extend<&'a C> for Solver<Cb>
source§fn extend<T: IntoIterator<Item = &'a C>>(&mut self, iter: T)
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)
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)
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>
impl<Cb: Callbacks> Extend<Clause> for Solver<Cb>
source§fn extend<T: IntoIterator<Item = Clause>>(&mut self, iter: T)
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)
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)
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>
impl<Cb: Callbacks> Solve for Solver<Cb>
source§fn solve(&mut self) -> Result<SolverResult>
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>
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<()>
fn add_clause_ref<C>(&mut self, clause: &C) -> Result<()>
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>
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>
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,
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>
fn var_val(&self, var: Var) -> Result<TernaryVal, Error>
Same as
Solve::lit_val
, but for variables. Read moresource§fn add_clause(&mut self, clause: Clause) -> Result<(), Error>
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>
fn add_unit(&mut self, lit: Lit) -> Result<(), Error>
Like
Solve::add_clause
but for unit clauses (clauses with one literal). Read moresource§fn add_binary(&mut self, lit1: Lit, lit2: Lit) -> Result<(), Error>
fn add_binary(&mut self, lit1: Lit, lit2: Lit) -> Result<(), Error>
Like
Solve::add_clause
but for clauses with two literals. Read moresource§fn add_ternary(&mut self, lit1: Lit, lit2: Lit, lit3: Lit) -> Result<(), Error>
fn add_ternary(&mut self, lit1: Lit, lit2: Lit, lit3: Lit) -> Result<(), Error>
Like
Solve::add_clause
but for clauses with three literals. Read moresource§impl<Cb: Callbacks> SolveIncremental for Solver<Cb>
impl<Cb: Callbacks> SolveIncremental for Solver<Cb>
source§fn solve_assumps(&mut self, assumps: &[Lit]) -> Result<SolverResult>
fn solve_assumps(&mut self, assumps: &[Lit]) -> Result<SolverResult>
Solves the internal CNF formula under assumptions. Read more
source§impl<Cb: Callbacks> SolveStats for Solver<Cb>
impl<Cb: Callbacks> SolveStats for Solver<Cb>
source§fn stats(&self) -> SolverStats
fn stats(&self) -> SolverStats
Gets the available statistics from the solver
source§fn n_sat_solves(&self) -> usize
fn n_sat_solves(&self) -> usize
Gets the number of satisfiable queries executed.
source§fn n_unsat_solves(&self) -> usize
fn n_unsat_solves(&self) -> usize
Gets the number of unsatisfiable queries executed.
source§fn n_terminated(&self) -> usize
fn n_terminated(&self) -> usize
Gets the number of queries that were prematurely terminated.
source§fn max_var(&self) -> Option<Var>
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
fn avg_clause_len(&self) -> f32
Gets the average length of all clauses in the solver.
source§fn cpu_solve_time(&self) -> Duration
fn cpu_solve_time(&self) -> Duration
Gets the total CPU time spent solving.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<S> CollectClauses for Swhere
S: Solve + SolveStats,
impl<S> CollectClauses for Swhere
S: Solve + SolveStats,
source§fn extend_clauses<T>(&mut self, cl_iter: T) -> Result<(), OutOfMemory>where
T: IntoIterator<Item = Clause>,
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>
fn add_clause(&mut self, cl: Clause) -> Result<(), OutOfMemory>
Adds one clause to the collector Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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