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:
Serializable
Direct Known Subclasses:
OPBEclipseReader2007, OPBReader2010

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
protected  int nbNewSymbols
          contains the number of new symbols generated to linearize products
 
Fields inherited from class org.sat4j.pb.reader.OPBReader2005
coeffs, d, hasObjFunc, hasVariablesExplanation, lits, nbConstr, nbConstraintsRead, nbVars, operator, solver
 
Constructor Summary
OPBReader2007(IPBSolver solver)
           
 
Method Summary
protected  void checkId(StringBuffer s)
           
 String decode(int[] model)
           
 void decode(int[] model, PrintWriter out)
           
protected  boolean isGoodFirstCharacter(char c)
           
protected  void literalInAProduct(String var, IVecInt lits)
          callback called when we read a term of a constraint
protected  void negateLiteralInAProduct(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(StringBuffer coeff, StringBuffer var)
          read a term into coeff and var
protected  int translateVarToId(String var)
           
 
Methods inherited from class org.sat4j.pb.reader.OPBReader2005
beginConstraint, beginObjective, constraintRelOp, constraintRightTerm, endConstraint, endObjective, eof, eol, get, getCoeffs, getListOfVariables, getObjectiveFunction, getVars, isGoodFollowingCharacter, metaData, parse, parseInstance, parseInstance, putback, readConstraint, readIdentifier, readInteger, readObjective, readVariablesExplanation, readWord, skipSpaces
 
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
 

Field Detail

nbNewSymbols

protected int nbNewSymbols
contains the number of new symbols generated to linearize products

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(StringBuffer s)
                throws ParseFormatException
Overrides:
checkId in class OPBReader2005
Throws:
ParseFormatException

readTerm

protected void readTerm(StringBuffer coeff,
                        StringBuffer var)
                 throws IOException,
                        ParseFormatException
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:
IOException
ParseFormatException

literalInAProduct

protected void literalInAProduct(String var,
                                 IVecInt lits)
                          throws ParseFormatException
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.
Throws:
ParseFormatException

negateLiteralInAProduct

protected void negateLiteralInAProduct(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 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:
IOException
ParseException
ParseFormatException

translateVarToId

protected int translateVarToId(String var)
                        throws ParseFormatException
Overrides:
translateVarToId in class OPBReader2005
Throws:
ParseFormatException

decode

public String decode(int[] model)
Overrides:
decode in class OPBReader2005

decode

public void decode(int[] model,
                   PrintWriter out)
Overrides:
decode in class OPBReader2005


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