public class SingleSolutionDetector extends SolverDecorator<ISolver>
SingleSolutionDetector problem =
new SingleSolutionDetector(SolverFactory.newMiniSAT());
// feed problem/solver as usual
if (problem.isSatisfiable()) {
if (problem.hasASingleSolution()) {
// great, the instance has a unique solution
int [] uniquesolution = problem.getModel();
} else {
// too bad, got more than one
}
}
Constructor and Description |
---|
SingleSolutionDetector(ISolver solver) |
Modifier and Type | Method and Description |
---|---|
boolean |
hasASingleSolution()
Please use that method only after a positive answer from isSatisfiable()
(else a runtime exception will be launched).
|
boolean |
hasASingleSolution(IVecInt assumptions)
Please use that method only after a positive answer from
isSatisfiable(assumptions) (else a runtime exception will be launched).
|
addAllClauses, addAtLeast, addAtMost, addBlockingClause, addClause, addExactly, clearDecorated, clearLearntClauses, decorated, expireTimeout, findModel, findModel, getLogPrefix, getSearchListener, getSolvingEngine, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, isSolverKeptHot, isVerbose, model, model, modelWithInternalVariables, nConstraints, newVar, newVar, nextFreeVarId, nVars, primeImplicant, primeImplicant, printInfos, printInfos, printStat, printStat, printStat, realNumberOfVariables, registerLiteral, removeConstr, removeSubsumedConstr, reset, setDBSimplificationAllowed, setExpectedNumberOfClauses, setKeepSolverHot, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setVerbose, toString, toString, unsatExplanation
public SingleSolutionDetector(ISolver solver)
public boolean hasASingleSolution() throws TimeoutException
TimeoutException
ISolver#removeConstr(IConstr)}
public boolean hasASingleSolution(IVecInt assumptions) throws TimeoutException
assumptions
- a set of literals (dimacs numbering) that must be satisfied.TimeoutException
Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.