pub struct MiniSatExecutor;Expand description
Executor for the MiniSat SAT solver.
MiniSat is one of the most widely used and studied SAT solvers. It provides a clean, efficient implementation of the CDCL algorithm and serves as the foundation for many other solvers including Glucose.
§Output Format
Unlike other solvers, MiniSat outputs results to a file rather than stdout. The executor handles this automatically by creating a temporary output file.
§Example
use sat_solvers::solvers::minisat::MiniSatExecutor;
use sat_solvers::solvers::SolverExecutor;
use sat_solvers::SATResult;
use std::time::Duration;
let executor = MiniSatExecutor;
// Simple satisfiable formula: (x1 OR NOT x2) AND (x2 OR x3)
let dimacs = "p cnf 3 2\n1 -2 0\n2 3 0\n";
match executor.execute(dimacs, Some(Duration::from_secs(60))) {
Ok(SATResult::Satisfiable(assignment)) => {
println!("SAT! Assignment: {:?}", assignment);
}
Ok(SATResult::Unsatisfiable) => println!("UNSAT"),
Ok(SATResult::Unknown) => println!("Unknown"),
Err(e) => eprintln!("Error: {}", e),
}Trait Implementations§
Source§impl SolverExecutor for MiniSatExecutor
impl SolverExecutor for MiniSatExecutor
Source§fn get_solver_path(&self) -> PathBuf
fn get_solver_path(&self) -> PathBuf
Returns the path to the solver binary. Read more
Source§fn execute(
&self,
dimacs: &str,
timeout: Option<Duration>,
) -> Result<SATResult, SATSolverError>
fn execute( &self, dimacs: &str, timeout: Option<Duration>, ) -> Result<SATResult, SATSolverError>
Executes the SAT solver with the given DIMACS input. Read more
Source§fn get_args(&self, input_file: &Path) -> Vec<String>
fn get_args(&self, input_file: &Path) -> Vec<String>
Returns solver-specific command-line arguments. Read more
Source§fn parse_output(
&self,
stdout: &str,
stderr: &str,
) -> Result<SATResult, SATSolverError>
fn parse_output( &self, stdout: &str, stderr: &str, ) -> Result<SATResult, SATSolverError>
Parses the solver’s output to extract the result. Read more
Auto Trait Implementations§
impl Freeze for MiniSatExecutor
impl RefUnwindSafe for MiniSatExecutor
impl Send for MiniSatExecutor
impl Sync for MiniSatExecutor
impl Unpin for MiniSatExecutor
impl UnwindSafe for MiniSatExecutor
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