org.sat4j.pb.reader
Class OPBReader2007

java.lang.Object
  extended by org.sat4j.reader.Reader
      extended by org.sat4j.pb.reader.OPBReader2005
          extended by org.sat4j.pb.reader.OPBReader2006
              extended by org.sat4j.pb.reader.OPBReader2007
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
OPBEclipseReader2007

public class OPBReader2007
extends OPBReader2006

Reader complying with the PB07 input format. Non-linear to linear translation adapted from the PB07 readers provided by Olivier Roussel and Vasco Manquinho (was available in C++, not in Java) http://www.cril.univ-artois.fr/PB07/parser/SimpleParser.java http://www.cril.univ-artois.fr/PB07/parser/SimpleParser.cc

Author:
parrain, daniel
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.sat4j.pb.reader.OPBReader2005
hasVariablesExplanation, nbConstr, nbConstraintsRead, nbVars, solver
 
Constructor Summary
OPBReader2007(IPBSolver solver)
           
 
Method Summary
protected  void checkId(java.lang.StringBuffer s)
           
protected  boolean isGoodFirstCharacter(char c)
           
protected  void literalInAProduct(java.lang.String var, IVecInt lits)
          callback called when we read a term of a constraint
protected  void negateLiteralInAProduct(java.lang.String var, IVecInt lits)
          callback called when we read a term of a constraint
protected  void readMetaData()
          read the first comment line to get the number of variables and the number of constraints in the file calls metaData with the data that was read
protected  void readTerm(java.lang.StringBuffer coeff, java.lang.StringBuffer var)
          read a term into coeff and var
protected  int translateVarToId(java.lang.String var)
           
 
Methods inherited from class org.sat4j.pb.reader.OPBReader2005
beginConstraint, beginObjective, constraintRelOp, constraintRightTerm, decode, decode, endConstraint, endObjective, eof, eol, get, getCoeffs, getListOfVariables, getObjectiveFunction, getVars, isGoodFollowingCharacter, metaData, parse, parseInstance, putback, readIdentifier, readInteger, readVariablesExplanation, readWord, skipSpaces
 
Methods inherited from class org.sat4j.reader.Reader
isVerbose, parseInstance, parseInstance, setVerbosity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OPBReader2007

public OPBReader2007(IPBSolver solver)
Parameters:
solver -
Method Detail

isGoodFirstCharacter

protected boolean isGoodFirstCharacter(char c)
Overrides:
isGoodFirstCharacter in class OPBReader2005

checkId

protected void checkId(java.lang.StringBuffer s)
                throws ParseFormatException
Overrides:
checkId in class OPBReader2005
Throws:
ParseFormatException

readTerm

protected void readTerm(java.lang.StringBuffer coeff,
                        java.lang.StringBuffer var)
                 throws java.io.IOException,
                        ParseFormatException,
                        ContradictionException
Description copied from class: OPBReader2006
read a term into coeff and var

Overrides:
readTerm in class OPBReader2006
Parameters:
coeff - the coefficient of the variable
var - the indentifier we read
Throws:
java.io.IOException
ParseFormatException
ContradictionException

literalInAProduct

protected void literalInAProduct(java.lang.String var,
                                 IVecInt lits)
callback called when we read a term of a constraint

Parameters:
var - the identifier of the variable
lits - a set of literals in DIMACS format in which var once translated will be added.

negateLiteralInAProduct

protected void negateLiteralInAProduct(java.lang.String var,
                                       IVecInt lits)
callback called when we read a term of a constraint

Parameters:
var - the identifier of the variable
lits - a set of literals in DIMACS format in which var once translated will be added.

readMetaData

protected void readMetaData()
                     throws java.io.IOException,
                            ParseFormatException
read the first comment line to get the number of variables and the number of constraints in the file calls metaData with the data that was read

Overrides:
readMetaData in class OPBReader2005
Throws:
java.io.IOException
ParseException
ParseFormatException

translateVarToId

protected int translateVarToId(java.lang.String var)
Overrides:
translateVarToId in class OPBReader2005


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