public class DimacsReader extends Reader implements java.io.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 java.lang.String |
formatString |
protected IVecInt |
literals |
protected EfficientScanner |
scanner |
protected ISolver |
solver |
Constructor and Description |
---|
DimacsReader(ISolver solver) |
DimacsReader(ISolver solver,
java.lang.String format) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
decode(int[] model)
Produce a model using the reader format.
|
void |
decode(int[] model,
java.io.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(java.io.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, setVerbosity
protected int expectedNbOfConstr
protected final ISolver solver
protected final java.lang.String formatString
protected EfficientScanner scanner
protected IVecInt literals
public DimacsReader(ISolver solver)
public DimacsReader(ISolver solver, java.lang.String format)
public void disableNumberOfConstraintCheck()
protected void skipComments() throws java.io.IOException
in
- the input streamjava.io.IOException
- if an IO problem occurs.protected void readProblemLine() throws java.io.IOException, ParseFormatException
in
- the input streamjava.io.IOException
- iff an IO occursParseFormatException
- if the input stream does not comply with the DIMACS format.protected void readConstrs() throws java.io.IOException, ParseFormatException, ContradictionException
in
- the input streamjava.io.IOException
- 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
ContradictionException
protected boolean handleLine() throws ContradictionException, java.io.IOException, ParseFormatException
ContradictionException
java.io.IOException
ParseFormatException
public IProblem parseInstance(java.io.InputStream in) throws ParseFormatException, ContradictionException, java.io.IOException
Reader
parseInstance
in class Reader
in
- a stream containing the benchmark.ParseFormatException
- if an error occurs during parsing.ContradictionException
- if the problem is found trivially inconsistent.java.io.IOException
- if an I/O error occurs.public java.lang.String decode(int[] model)
Reader
public void decode(int[] model, java.io.PrintWriter out)
Reader
protected ISolver getSolver()