|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sat4j.tools.SolverDecorator<ISolver>
org.sat4j.tools.ModelIterator
public class ModelIterator
That class allows to iterate through all the models (implicants) of a formula.
ISolver solver = new ModelIterator(SolverFactory.OneSolver());
boolean unsat = true;
while (solver.isSatisfiable()) {
unsat = false;
int[] model = solver.model();
// do something with model
}
if (unsat) {
// UNSAT case
}
It is also possible to limit the number of models returned:
ISolver solver = new ModelIterator(SolverFactory.OneSolver(), 10);will return at most 10 models.
| Constructor Summary | |
|---|---|
ModelIterator(ISolver solver)
|
|
ModelIterator(ISolver solver,
int bound)
|
|
| Method Summary | |
|---|---|
boolean |
isSatisfiable()
Check the satisfiability of the set of constraints contained inside the solver. |
boolean |
isSatisfiable(IVecInt assumps)
Check the satisfiability of the set of constraints contained inside the solver. |
int[] |
model()
Provide a model (if any) for a satisfiable formula. |
void |
reset()
Clean up the internal state of the solver. |
| Methods inherited from class org.sat4j.tools.SolverDecorator |
|---|
addAllClauses, addAtLeast, addAtMost, addBlockingClause, addClause, clearDecorated, clearLearntClauses, decorated, expireTimeout, findModel, findModel, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSatisfiable, isSatisfiable, model, nConstraints, newVar, newVar, nextFreeVarId, nVars, printInfos, printStat, printStat, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setExpectedNumberOfClauses, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ModelIterator(ISolver solver)
solver -
public ModelIterator(ISolver solver,
int bound)
solver - bound - | Method Detail |
|---|
public int[] model()
IProblem
model in interface IProblemmodel in class SolverDecorator<ISolver>IProblem.isSatisfiable(),
IProblem.isSatisfiable(IVecInt)
public boolean isSatisfiable()
throws TimeoutException
IProblem
isSatisfiable in interface IProblemisSatisfiable in class SolverDecorator<ISolver>TimeoutException
public boolean isSatisfiable(IVecInt assumps)
throws TimeoutException
IProblem
isSatisfiable in interface IProblemisSatisfiable in class SolverDecorator<ISolver>assumps - a set of literals (represented by usual non null integers
in Dimacs format).
TimeoutExceptionpublic void reset()
ISolver
reset in interface ISolverreset in class SolverDecorator<ISolver>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||