public class SolutionCounter extends SolverDecorator<ISolver>
SolutionCounter counter = new SolverCounter(SolverFactory.newDefault()); try { int nbSol = counter.countSolutions(); // the exact number of solutions is nbSol ... } catch (TimeoutException te) { int lowerBound = counter.lowerBound(); // the solver found lowerBound solutions so far. ... }
Constructor and Description |
---|
SolutionCounter(ISolver solver) |
Modifier and Type | Method and Description |
---|---|
long |
countSolutions()
Naive approach to count the solutions available in a boolean formula:
each time a solution is found, a new clause is added to prevent it to be
found again.
|
int |
lowerBound()
Get the number of solutions found before the timeout occurs.
|
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, setUnitClauseProvider, setVerbose, toString, toString, unsatExplanation
public SolutionCounter(ISolver solver)
public int lowerBound()
public long countSolutions() throws TimeoutException
TimeoutException
- if the timeout given to the solver is reached.Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.