public class OPBReader2005 extends Reader implements Serializable
Modifier and Type | Field and Description |
---|---|
protected IVec<BigInteger> |
coeffs |
protected BigInteger |
d |
protected boolean |
hasObjFunc |
protected boolean |
hasVariablesExplanation |
protected IVecInt |
lits |
protected int |
nbConstr |
protected int |
nbConstraintsRead |
protected int |
nbVars |
protected String |
operator |
protected IPBSolver |
solver |
Constructor and Description |
---|
OPBReader2005(IPBSolver solver) |
Modifier and Type | Method and Description |
---|---|
protected void |
beginConstraint()
callback called before we read a constraint
|
protected void |
beginObjective()
callback called before we read the objective function
|
protected void |
checkId(StringBuffer s) |
protected void |
constraintRelOp(String relop)
callback called when we read the relational operator of a constraint
|
protected void |
constraintRightTerm(BigInteger val)
callback called when we read the right term of a constraint (also known
as the degree)
|
String |
decode(int[] model) |
void |
decode(int[] model,
PrintWriter out) |
protected void |
endConstraint() |
protected void |
endObjective()
callback called after we've read the objective function
|
protected boolean |
eof()
return true iff we've reached EOF
|
protected boolean |
eol() |
protected char |
get()
get the next character from the stream
|
IVec<BigInteger> |
getCoeffs() |
IVecInt |
getListOfVariables() |
ObjectiveFunction |
getObjectiveFunction() |
IVecInt |
getVars() |
protected boolean |
isGoodFirstCharacter(char c) |
protected boolean |
isGoodFollowingCharacter(char c) |
protected void |
metaData(int nbvar,
int nbconstr)
callback called when we get the number of variables and the expected
number of constraints
|
void |
parse()
parses the file and uses the callbacks to send to send the data back to
the program
|
IProblem |
parseInstance(InputStream in) |
protected IProblem |
parseInstance(LineNumberReader input) |
IProblem |
parseInstance(Reader input) |
protected void |
putback(char c)
put back a character into the stream (only one chr can be put back)
|
protected void |
readConstraint()
read a constraint calls beginConstraint, constraintTerm and endConstraint
|
protected boolean |
readIdentifier(StringBuffer s)
read an identifier from stream and store it in s
|
void |
readInteger(StringBuffer s)
read a integer from file
|
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 |
readObjective()
read the objective line (if any) calls beginObjective, objectiveTerm and
endObjective
|
protected void |
readTerm(StringBuffer coeff,
StringBuffer var)
read a term into coeff and var
|
protected void |
readVariablesExplanation() |
String |
readWord()
read a word from file
|
protected void |
skipSpaces()
skip white spaces
|
protected int |
translateVarToId(String var) |
isVerbose, parseInstance, setVerbosity
protected final IPBSolver solver
protected final IVecInt lits
protected final IVec<BigInteger> coeffs
protected BigInteger d
protected String operator
protected boolean hasObjFunc
protected boolean hasVariablesExplanation
protected int nbVars
protected int nbConstr
protected int nbConstraintsRead
public OPBReader2005(IPBSolver solver)
protected void metaData(int nbvar, int nbconstr)
nbvar
- the number of variablesnbconstr
- the number of contraintsprotected void beginObjective()
protected void endObjective()
protected void beginConstraint()
protected void endConstraint() throws ContradictionException
ContradictionException
protected int translateVarToId(String var) throws ParseFormatException
ParseFormatException
protected void constraintRelOp(String relop)
relop
- the relational oerator (>= or =)protected void constraintRightTerm(BigInteger val)
val
- the degree of the constraintprotected char get() throws IOException
IOException
public IVecInt getVars()
public IVec<BigInteger> getCoeffs()
protected void putback(char c)
protected boolean eof()
protected boolean eol()
protected void skipSpaces() throws IOException
IOException
public String readWord() throws IOException
IOException
public void readInteger(StringBuffer s) throws IOException
s
- a StringBuffer to store the integer that was readIOException
protected boolean readIdentifier(StringBuffer s) throws IOException, ParseFormatException
IOException
ParseFormatException
protected boolean isGoodFirstCharacter(char c)
protected boolean isGoodFollowingCharacter(char c)
protected void checkId(StringBuffer s) throws ParseFormatException
ParseFormatException
protected void readMetaData() throws IOException, ParseFormatException
IOException
ParseException
ParseFormatException
protected void readTerm(StringBuffer coeff, StringBuffer var) throws IOException, ParseFormatException
coeff
- the coefficient of the variablevar
- the identifier we readIOException
ParseException
ParseFormatException
protected void readVariablesExplanation() throws IOException, ParseFormatException
IOException
ParseFormatException
protected void readObjective() throws IOException, ParseFormatException
IOException
ParseException
ParseFormatException
protected void readConstraint() throws IOException, ParseFormatException, ContradictionException
ParseException
IOException
ContradictionException
ParseFormatException
public void parse() throws IOException, ParseFormatException, ContradictionException
IOException
ParseException
ContradictionException
ParseFormatException
public IProblem parseInstance(Reader input) throws ParseFormatException, ContradictionException
parseInstance
in class Reader
ParseFormatException
ContradictionException
protected IProblem parseInstance(LineNumberReader input) throws ParseFormatException, ContradictionException
public void decode(int[] model, PrintWriter out)
public ObjectiveFunction getObjectiveFunction()
public IVecInt getListOfVariables()
public IProblem parseInstance(InputStream in) throws ParseFormatException, ContradictionException, IOException
parseInstance
in class Reader
ParseFormatException
ContradictionException
IOException
Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.