public interface SATSolver
variables: set [1..)
clauses: set Clause
all i: [2..) | i in variables => i-1 in variables
all c: clauses | all lit: c.literals | lit in variables || -lit in variables
all c: clauses | all disj i,j: c.literals | abs(i) != abs(j)
Modifier and Type | Method and Description |
---|---|
boolean |
addClause(int[] lits)
Ensures that this solver logically contains the given
clause, and returns true if this.clauses changed as a
result of the call.
|
void |
addVariables(int numVars)
Adds the specified number of new variables
to the solver's vocabulary.
|
void |
free()
Frees the memory used by this solver.
|
int |
numberOfClauses()
Returns the number of clauses in this solver.
|
int |
numberOfVariables()
Returns the size of this solver's vocabulary.
|
boolean |
solve()
Returns true if there is a satisfying assignment for this.clauses.
|
boolean |
valueOf(int variable)
Returns the boolean value assigned to the given variable by the
last successful call to
solve() . |
boolean addClause(int[] lits)
all i: [0..lits.length) | abs(lits[i]) in this.variables
all disj i,j: [0..lits.length) | abs(lits[i]) != abs(lits[j])
[[this.clauses']] = ([[this.clauses]] and [[lits]])
NullPointerException
- lits = nullvoid addVariables(int numVars)
numVars >= 0
this.variables' = [1..#this.variables + numVars]
IllegalArgumentException
- numVars < 0void free()
frees the memory used by this solver
int numberOfClauses()
int numberOfVariables()
boolean solve() throws SATAbortedException
valueOf(int)
.
If the satisfiability of this.clauses cannot be determined within
the given number of seconds, a TimeoutException is thrown.SATAbortedException
- - the call to solve was cancelled or
could not terminate normally.boolean valueOf(int variable)
solve()
.solve()
has been called and the
outcome of the last call was true
.
solve()
.IllegalArgumentException
- variable !in this.variablesIllegalStateException
- solve()
has not been called or the
outcome of the last call was not true
.
© Emina Torlak 2005-present