Skip to main content

MiniSatExecutor

Struct MiniSatExecutor 

Source
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

Source§

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>

Executes the SAT solver with the given DIMACS input. Read more
Source§

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>

Parses the solver’s output to extract the result. Read more

Auto Trait Implementations§

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<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, 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.