org.sat4j.reader
Class InstanceReader

java.lang.Object
  extended by org.sat4j.reader.Reader
      extended by org.sat4j.reader.InstanceReader

public class InstanceReader
extends Reader

An reader having the responsability to choose the right reader according to the input.

Author:
leberre

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

Constructor Detail

InstanceReader

public InstanceReader(ISolver solver)
Method Detail

parseInstance

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

Overrides:
parseInstance in class Reader
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.

decode

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

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.

decode

public void decode(int[] model,
                   PrintWriter out)
Description copied from class: Reader
Produce a model using the reader format on a provided printwriter.

Specified by:
decode in class Reader
Parameters:
model - a model using the Dimacs format.
out - the place where to display the model

parseInstance

public IProblem parseInstance(InputStream in)
                       throws ParseFormatException,
                              ContradictionException,
                              IOException
Description copied from class: Reader
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.

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


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