org.sat4j.reader
Class Reader

java.lang.Object
  extended by org.sat4j.reader.Reader
Direct Known Subclasses:
AAGReader, AIGReader, CSPReader, DimacsReader, InstanceReader, LecteurDimacs, OPBReader2005, XMLCSPReader

public abstract class Reader
extends Object

A reader is responsible to feed an ISolver from a text file and to convert the model found by the solver to a textual representation.

Author:
leberre

Constructor Summary
Reader()
           
 
Method Summary
abstract  String decode(int[] model)
          Deprecated. 
abstract  void decode(int[] model, PrintWriter out)
          Produce a model using the reader format on a provided printwriter.
 boolean isVerbose()
           
abstract  IProblem parseInstance(InputStream in)
          Read a file from a stream.
 IProblem parseInstance(Reader in)
          Deprecated. 
 IProblem parseInstance(String filename)
          This is the usual method to feed a solver with a benchmark.
 void setVerbosity(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reader

public Reader()
Method Detail

parseInstance

public IProblem parseInstance(String filename)
                       throws FileNotFoundException,
                              ParseFormatException,
                              IOException,
                              ContradictionException
This is the usual method to feed a solver with a benchmark.

Parameters:
filename - the fully qualified name of the benchmark. The filename extension may by used to detect which type of benchmarks it is (SAT, OPB, MAXSAT, etc).
Returns:
the problem to solve (an ISolver in fact).
Throws:
FileNotFoundException - if the file cannot be found.
ParseFormatException - if an error occurs during parsing.
IOException - if an I/O error occurs.
ContradictionException - if the problem is found trivially inconsistent.

parseInstance

public abstract IProblem parseInstance(InputStream in)
                                throws ParseFormatException,
                                       ContradictionException,
                                       IOException
Read a file from a stream. It is important to note that benchmarks are usually encoded in ASCII, not UTF8. As such, the only reasonable way to feed a solver from a stream is to use a stream.

Parameters:
in - a stream containing the benchmark.
Returns:
the problem to solve (an ISolver in fact).
Throws:
ParseFormatException - if an error occurs during parsing.
IOException - if an I/O error occurs.
ContradictionException - if the problem is found trivially inconsistent.

parseInstance

@Deprecated
public IProblem parseInstance(Reader in)
                       throws ParseFormatException,
                              ContradictionException,
                              IOException
Deprecated. 

Read a file from a reader. Do not use that method, it is no longer supported.

Parameters:
in - a stream containing the benchmark.
Returns:
the problem to solve (an ISolver in fact).
Throws:
ParseFormatException - if an error occurs during parsing.
IOException - if an I/O error occurs.
ContradictionException - if the problem is found trivially inconsistent.
See Also:
parseInstance(InputStream)

decode

@Deprecated
public abstract String decode(int[] model)
Deprecated. 

Produce a model using the reader format.

Parameters:
model - a model using the Dimacs format.
Returns:
a human readable view of the model.

decode

public abstract void decode(int[] model,
                            PrintWriter out)
Produce a model using the reader format on a provided printwriter.

Parameters:
model - a model using the Dimacs format.
out - the place where to display the model

isVerbose

public boolean isVerbose()

setVerbosity

public void setVerbosity(boolean b)


Copyright © 2011 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.