org.sat4j.reader
Class DimacsReader

java.lang.Object
  extended by org.sat4j.reader.Reader
      extended by org.sat4j.reader.DimacsReader
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CardDimacsReader, ExtendedDimacsReader

public class DimacsReader
extends Reader
implements java.io.Serializable

Very simple Dimacs file parser. Allow solvers to read the constraints from a Dimacs formatted file. It should be used that way:

 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.

Version:
1.0
Author:
dlb, or
See Also:
Serialized Form

Constructor Summary
DimacsReader(ISolver solver)
           
DimacsReader(ISolver solver, java.lang.String format)
           
 
Method Summary
 java.lang.String decode(int[] model)
          Produce a model using the reader format.
 void disableNumberOfConstraintCheck()
           
 IProblem parseInstance(java.io.Reader in)
           
 
Methods inherited from class org.sat4j.reader.Reader
parseInstance, parseInstance
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DimacsReader

public DimacsReader(ISolver solver)

DimacsReader

public DimacsReader(ISolver solver,
                    java.lang.String format)
Method Detail

disableNumberOfConstraintCheck

public void disableNumberOfConstraintCheck()

parseInstance

public final IProblem parseInstance(java.io.Reader in)
                             throws ParseFormatException,
                                    ContradictionException,
                                    java.io.IOException
Specified by:
parseInstance in class Reader
Throws:
ParseFormatException
ContradictionException
java.io.IOException

decode

public java.lang.String decode(int[] model)
Description copied from class: Reader
Produce a model using the reader format.

Specified by:
decode in class Reader
Parameters:
model - a model using the Dimacs format.
Returns:
a human readable view of the model.