public class DimacsReader extends Reader implements Serializable
DimacsReader solver = new DimacsReader(SolverFactory.OneSolver());
solver.readInstance("mybench.cnf");
if (solver.isSatisfiable()) {
// SAT case
} else {
// UNSAT case
}
That parser is not used for efficiency reasons. It will be updated with Java
1.5 scanner feature.| Modifier and Type | Field and Description |
|---|---|
protected int |
expectedNbOfConstr |
protected String |
formatString |
protected IVecInt |
literals |
protected EfficientScanner |
scanner |
protected ISolver |
solver |
| Constructor and Description |
|---|
DimacsReader(ISolver solver) |
DimacsReader(ISolver solver,
String format) |
| Modifier and Type | Method and Description |
|---|---|
String |
decode(int[] model)
Produce a model using the reader format.
|
void |
decode(int[] model,
PrintWriter out)
Produce a model using the reader format on a provided printwriter.
|
void |
disableNumberOfConstraintCheck() |
protected void |
flushConstraint() |
protected ISolver |
getSolver() |
protected boolean |
handleLine() |
IProblem |
parseInstance(InputStream in)
Read a file from a stream.
|
protected void |
readConstrs() |
protected void |
readProblemLine() |
protected void |
skipComments()
Skip comments at the beginning of the input stream.
|
isVerbose, parseInstance, parseInstance, setVerbosityprotected int expectedNbOfConstr
protected final ISolver solver
protected final String formatString
protected EfficientScanner scanner
protected IVecInt literals
public DimacsReader(ISolver solver)
public void disableNumberOfConstraintCheck()
protected void skipComments()
throws IOException
in - the input streamIOException - if an IO problem occurs.protected void readProblemLine()
throws IOException,
ParseFormatException
in - the input streamIOException - iff an IO occursParseFormatException - if the input stream does not comply with the DIMACS format.protected void readConstrs()
throws IOException,
ParseFormatException,
ContradictionException
in - the input streamIOException - iff an IO problems occursParseFormatException - if the input stream does not comply with the DIMACS format.ContradictionException - si le probl?me est trivialement inconsistant.protected void flushConstraint()
throws ContradictionException
ContradictionExceptionprotected boolean handleLine()
throws ContradictionException,
IOException,
ParseFormatException
ContradictionExceptionIOExceptionParseFormatExceptionpublic IProblem parseInstance(InputStream in) throws ParseFormatException, ContradictionException, IOException
ReaderparseInstance in class Readerin - a stream containing the benchmark.ParseFormatException - if an error occurs during parsing.ContradictionException - if the problem is found trivially inconsistent.IOException - if an I/O error occurs.public String decode(int[] model)
Readerpublic void decode(int[] model,
PrintWriter out)
Readerprotected ISolver getSolver()
Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.