S
- the type of solver to feed.public class JSONReader<S extends ISolver> extends Reader
[[-1,-2,-3],[[1,-2,3],'>',2],[4,-3,6]]
for instance represents
three constraints, two clauses and the cardinality constraint x1 + not x2 +
x3 > 2.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CARD |
static java.lang.String |
CLAUSE |
java.lang.String |
constraint |
java.lang.String |
formula |
protected S |
solver |
Constructor and Description |
---|
JSONReader(S solver) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
constraintRegexp() |
java.lang.String |
decode(int[] model)
Deprecated.
|
void |
decode(int[] model,
java.io.PrintWriter out)
Produce a model using the reader format on a provided printwriter.
|
protected IVecInt |
getLiterals(java.lang.String constraint) |
protected void |
handleCard(java.lang.String constraint) |
protected void |
handleNotHandled(java.lang.String constraint) |
IProblem |
parseInstance(java.io.InputStream in)
Read a file from a stream.
|
ISolver |
parseString(java.lang.String json) |
isVerbose, parseInstance, parseInstance, setVerbosity
public static final java.lang.String CLAUSE
public static final java.lang.String CARD
public final java.lang.String constraint
public final java.lang.String formula
public JSONReader(S solver)
protected java.lang.String constraintRegexp()
protected void handleNotHandled(java.lang.String constraint) throws ParseFormatException, ContradictionException
protected IVecInt getLiterals(java.lang.String constraint) throws ParseFormatException
ParseFormatException
protected void handleCard(java.lang.String constraint) throws ParseFormatException, ContradictionException
public IProblem parseInstance(java.io.InputStream in) throws ParseFormatException, ContradictionException, java.io.IOException
Reader
parseInstance
in class Reader
in
- a stream containing the benchmark.ParseFormatException
- if an error occurs during parsing.ContradictionException
- if the problem is found trivially inconsistent.java.io.IOException
- if an I/O error occurs.public ISolver parseString(java.lang.String json) throws ParseFormatException, ContradictionException
@Deprecated public java.lang.String decode(int[] model)
Reader
public void decode(int[] model, java.io.PrintWriter out)
Reader