Interface IndexedSatSolverState
- All Superinterfaces:
AutoCloseable
The
IndexedSatSolverState interface represents a state of a SAT solver with indexed literals.
It provides methods for querying satisfiability, retrieving the truth values of literals, and managing
clauses within the solver state. This interface extends AutoCloseable to ensure proper
resource management.- Author:
- Matthias Thimm
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int[] clause) Adds a clause to the current SAT solver state.voidclose()Closes the SAT solver state and releases any resources associated with it.booleanChecks whether the current SAT solver state is satisfiable with the current set of clauses.booleansatisfiable(int[] assumptions) Checks whether the current SAT solver state is satisfiable given a set of assumptions.int[]witness(int[] literals) Retrieves the truth values of the given literals in the current SAT solver state.int[]witness(int[] literals, int[] assumptions) Retrieves the truth values of the given literals in the current SAT solver state, considering the specified assumptions.
-
Method Details
-
satisfiable
boolean satisfiable()Checks whether the current SAT solver state is satisfiable with the current set of clauses.- Returns:
trueif the current state is satisfiable,falseotherwise
-
satisfiable
boolean satisfiable(int[] assumptions) Checks whether the current SAT solver state is satisfiable given a set of assumptions.- Parameters:
assumptions- an array of literals representing assumptions; literals should be indexed and in the form of positive (true) or negative (false) integers- Returns:
trueif the state is satisfiable with the given assumptions,falseotherwise
-
witness
int[] witness(int[] literals) Retrieves the truth values of the given literals in the current SAT solver state.The returned array contains values where 0 represents
falseand 1 representstrue.- Parameters:
literals- an array of literals whose truth values are to be retrieved- Returns:
- an array of integers where each entry corresponds to the truth value of the given literals (0 for false, 1 for true)
-
witness
int[] witness(int[] literals, int[] assumptions) Retrieves the truth values of the given literals in the current SAT solver state, considering the specified assumptions.The returned array contains values where 0 represents
falseand 1 representstrue.- Parameters:
literals- an array of literals whose truth values are to be retrievedassumptions- an array of literals representing assumptions to be considered during retrieval- Returns:
- an array of integers where each entry corresponds to the truth value of the given literals (0 for false, 1 for true), considering the assumptions
-
add
void add(int[] clause) Adds a clause to the current SAT solver state. A clause is represented as an array of literals, where each literal is an integer (positive for true, negative for false).- Parameters:
clause- an array of literals representing the clause to be added
-
close
void close()Closes the SAT solver state and releases any resources associated with it. This method should be called when the solver state is no longer needed to ensure proper resource management.- Specified by:
closein interfaceAutoCloseable
-