public class DimacsOutputSolver extends AbstractOutputSolver
firstConstr, fixedNbClauses, nbclauses, nbvars| Constructor and Description |
|---|
DimacsOutputSolver() |
DimacsOutputSolver(PrintWriter pw) |
| Modifier and Type | Method and Description |
|---|---|
IConstr |
addAtLeast(IVecInt literals,
int degree)
Create a cardinality constraint of the type "at least n of those literals
must be satisfied"
|
IConstr |
addAtMost(IVecInt literals,
int degree)
Create a cardinality constraint of the type "at most n of those literals
must be satisfied"
|
IConstr |
addClause(IVecInt literals)
Create a clause from a set of literals The literals are represented by
non null integers such that opposite literals a represented by opposite
values.
|
IConstr |
addExactly(IVecInt literals,
int n)
Create a cardinality constraint of the type
"exactly n of those literals must be satisfied".
|
int[] |
modelWithInternalVariables()
That method is designed to be used to retrieve the real model of the
current set of constraints, i.e. to provide the truth value of boolean
variables used internally in the solver (for encoding purposes for
instance).
|
int |
nConstraints()
To know the number of constraints currently available in the solver.
|
int |
newVar()
Create a new variable in the solver (and thus in the vocabulary).
|
int |
newVar(int howmany)
Declare
howmany variables in the problem (and thus in the
vocabulary), that will be represented using the Dimacs format by integers
ranging from 1 to howmany. |
int |
nextFreeVarId(boolean reserve)
Ask the solver for a free variable identifier, in Dimacs format (i.e. a
positive number).
|
int |
nVars()
To know the number of variables used in the solver as declared by
newVar()
In case the method newVar() has not been used, the method returns the
number of variables used in the solver.
|
boolean |
primeImplicant(int p)
Check if a given literal is part of the prime implicant computed by the
IProblem.primeImplicant() method. |
void |
printInfos(PrintWriter out)
To print additional informations regarding the problem.
|
void |
printStat(PrintWriter out)
Display statistics to the given output writer
|
int |
realNumberOfVariables()
Retrieve the real number of variables used in the solver.
|
void |
registerLiteral(int p)
Tell the solver to consider that the literal is in the CNF.
|
void |
reset()
Clean up the internal state of the solver.
|
void |
setExpectedNumberOfClauses(int nb)
To inform the solver of the expected number of clauses to read.
|
String |
toString(String prefix)
Display a textual representation of the solver configuration.
|
addAllClauses, addBlockingClause, clearLearntClauses, expireTimeout, findModel, findModel, getLogPrefix, getSearchListener, getSolvingEngine, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, isSolverKeptHot, isVerbose, model, model, primeImplicant, printInfos, printStat, printStat, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setKeepSolverHot, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setVerbose, unsatExplanationpublic DimacsOutputSolver()
public DimacsOutputSolver(PrintWriter pw)
public int newVar()
ISolverpublic int newVar(int howmany)
IProblemhowmany variables in the problem (and thus in the
vocabulary), that will be represented using the Dimacs format by integers
ranging from 1 to howmany. That feature allows encodings to create
additional variables with identifier starting at howmany+1.newVar in interface IProblemnewVar in class AbstractOutputSolverhowmany - number of variables to createIProblem.nVars()public void setExpectedNumberOfClauses(int nb)
ISolverp cnf line is
read in dimacs formatted input file.
Note that this method is supposed to be called AFTER a call to
newVar(int)nb - the expected number of clauses.IProblem.newVar(int)public IConstr addClause(IVecInt literals) throws ContradictionException
ISolverliterals - a set of literalsContradictionException - iff the vector of literals is empty or if it contains only
falsified literals after unit propagationISolver.removeConstr(IConstr)public IConstr addAtMost(IVecInt literals, int degree) throws ContradictionException
ISolverliterals - a set of literals The vector can be reused since the solver is
not supposed to keep a reference to that vector.degree - the degree (n) of the cardinality constraintContradictionException - iff the vector of literals is empty or if it contains more
than degree satisfied literals after unit propagationISolver.removeConstr(IConstr)public IConstr addAtLeast(IVecInt literals, int degree) throws ContradictionException
ISolverliterals - a set of literals. The vector can be reused since the solver
is not supposed to keep a reference to that vector.degree - the degree (n) of the cardinality constraintContradictionException - iff the vector of literals is empty or if degree literals are
not remaining unfalsified after unit propagationISolver.removeConstr(IConstr)public IConstr addExactly(IVecInt literals, int n) throws ContradictionException
ISolverliterals - a set of literals. The vector can be reused since the solver
is not supposed to keep a reference to that vector.n - the number of literals that must be satisfiedContradictionException - iff the constraint is trivially unsatisfiable.public void reset()
ISolverpublic String toString(String prefix)
ISolverprefix - the prefix to use on each line.public int nConstraints()
IProblemnConstraints in interface IProblemnConstraints in class AbstractOutputSolverpublic int nVars()
IProblemnVars in interface IProblemnVars in class AbstractOutputSolverIProblem.newVar(int)public int nextFreeVarId(boolean reserve)
ISolverISolver.realNumberOfVariables() method.reserve - if true, the maxVarId is updated in the solver, i.e.
successive calls to nextFreeVarId(true) will return increasing
variable id while successive calls to nextFreeVarId(false)
will always answer the same.ISolver.realNumberOfVariables()public int[] modelWithInternalVariables()
ISolverIProblem.model(),
ModelIteratorpublic int realNumberOfVariables()
ISolverISolver.nextFreeVarId(boolean) method.ISolver.nextFreeVarId(boolean)public void registerLiteral(int p)
ISolverp - the literal in Dimacs format that should appear in the model.public boolean primeImplicant(int p)
IProblemIProblem.primeImplicant() method.p - a literal in Dimacs formatIProblem.primeImplicant()public void printStat(PrintWriter out)
ISolverISolver.setLogPrefix(String)public void printInfos(PrintWriter out)
IProblemout - the place to print the information#setLogPrefix(String)Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.