public class CSPReader extends Reader implements ICSPCallback
| Constructor and Description |
|---|
CSPReader(ISolver solver,
boolean allDiffCard) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConstantParameter(String arg0,
int arg1)
provides a constant value
|
void |
addDomainValue(int arg0)
add a single value to the current domain
|
void |
addDomainValue(int begin,
int end)
add the range of values [first..last] to the current domain
|
void |
addEffectiveParameter(int arg0)
add an effective parameter which is a simple integer
|
void |
addEffectiveParameter(String arg0)
add an effective parameter which is a simple variable to the current
constraint
|
void |
addFormalParameter(String name,
String type)
add a formal parameter to the current predicate
|
void |
addIntegerItem(int arg0)
provides an integer value in a parameter list of a constraint
|
void |
addRelationTuple(int[] tuple)
add a single tuple to the current relation
|
void |
addVariable(String idvar,
String iddomain)
callback called to define a new variable
|
void |
addVariableItem(String arg0)
provides the name of a variable in a parameter list of a constraint
|
void |
addVariableToConstraint(String arg0)
declares that a variable is in the constraint scope
|
void |
beginConstraint(String name,
int arity)
callback called at the beginning of the declaration of one constraint
|
void |
beginConstraintsSection(int arg0)
callback called at the beginning of the constraints declarations
|
void |
beginDomain(String id,
int size)
callback called at the beginning of the declaration of one domain
|
void |
beginDomainsSection(int nbdomain)
callback called at the beginning of the domains declarations
|
void |
beginInstance(String arg0)
signal the beginning of parsing
|
void |
beginParameterList()
begins the list tag for parameters of a constraint
|
void |
beginPredicate(String name)
callback called at the beginning of the declaration of one predicate
|
void |
beginPredicatesSection(int arg0)
callback called at the beginning of the predicates declarations
|
void |
beginRelation(String name,
int arity,
int nbTuples,
boolean isSupport)
callback called at the beginning of the declaration of one relation
|
void |
beginRelationsSection(int nbrel)
callback called at the beginning of the relations declarations
|
void |
beginVariablesSection(int expectedNumberOfVariables)
callback called at the beginning of the variables declarations
|
void |
constraintExpression(String arg0)
provide the expression of the current constraint as an expression in a
syntac chosen by the solver
|
void |
constraintReference(String ref)
provide the definition of the current constraint
|
String |
decode(int[] model)
Produce a model using the reader format.
|
void |
decode(int[] model,
PrintWriter out)
Produce a model using the reader format on a provided printwriter.
|
void |
endConstraint()
ends the definition of the current constraint
|
void |
endConstraintsSection()
end the definition of all constraints
|
void |
endDomain()
ends the definition of the current domain
|
void |
endDomainsSection()
end the definition of all domains
|
void |
endInstance()
signal the end of parsing
|
void |
endParamaterList()
ends the list tag for parameters of a constraint
|
void |
endPredicate()
ends the definition of the current predicate
|
void |
endPredicatesSection()
end the definition of all predicates
|
void |
endRelation()
ends the definition of the current relation
|
void |
endRelationsSection()
end the definition of all relations
|
void |
endVariablesSection()
end the definition of all variables
|
protected void |
manageAllowedTuples(int relnum,
int arity,
int nbtuples) |
IProblem |
parseInstance(InputStream in)
Read a file from a stream.
|
IProblem |
parseInstance(Reader in)
Read a file from a reader.
|
void |
predicateExpression(String expr)
provide the expression of the current predicate
|
isVerbose, parseInstance, setVerbosityprotected Relation[] relations
public CSPReader(ISolver solver, boolean allDiffCard)
public final IProblem parseInstance(Reader in) throws ParseFormatException, ContradictionException, IOException
ReaderparseInstance in class Readerin - a stream containing the benchmark.ParseFormatException - if an error occurs during parsing.ContradictionException - if the problem is found trivially inconsistent.IOException - if an I/O error occurs.Reader.parseInstance(InputStream)public void decode(int[] model,
PrintWriter out)
Readerpublic String decode(int[] model)
Readerprotected void manageAllowedTuples(int relnum,
int arity,
int nbtuples)
public void beginInstance(String arg0)
ICSPCallbackbeginInstance in interface ICSPCallbackarg0 - name of the instancepublic void beginDomainsSection(int nbdomain)
ICSPCallbackbeginDomainsSection in interface ICSPCallbacknbdomain - number of domains that will be declaredpublic void beginDomain(String id, int size)
ICSPCallbackbeginDomain in interface ICSPCallbackid - identifier of the domainsize - number of values in the domainpublic void addDomainValue(int arg0)
ICSPCallbackaddDomainValue in interface ICSPCallbackarg0 - value to add to the domainpublic void addDomainValue(int begin,
int end)
ICSPCallbackaddDomainValue in interface ICSPCallbackbegin - first value to add to the domainend - last value to add to the domainpublic void endDomain()
ICSPCallbackendDomain in interface ICSPCallbackpublic void endDomainsSection()
ICSPCallbackendDomainsSection in interface ICSPCallbackpublic void beginVariablesSection(int expectedNumberOfVariables)
ICSPCallbackbeginVariablesSection in interface ICSPCallbackexpectedNumberOfVariables - number of variables that will be declaredpublic void addVariable(String idvar, String iddomain)
ICSPCallbackaddVariable in interface ICSPCallbackidvar - identifier of the variableiddomain - identifier of the variable domainpublic void endVariablesSection()
ICSPCallbackendVariablesSection in interface ICSPCallbackpublic void beginRelationsSection(int nbrel)
ICSPCallbackbeginRelationsSection in interface ICSPCallbacknbrel - number of relations that will be declaredpublic void beginRelation(String name, int arity, int nbTuples, boolean isSupport)
ICSPCallbackbeginRelation in interface ICSPCallbackname - identifier of the relationarity - arity of the relationnbTuples - number of tuples in the relationisSupport - true if tuples represent support, false if tuples represent
conflictspublic void addRelationTuple(int[] tuple)
ICSPCallbackaddRelationTuple in interface ICSPCallbacktuple - tuple to add to the relation (contains arity elements)public void endRelation()
ICSPCallbackendRelation in interface ICSPCallbackpublic void endRelationsSection()
ICSPCallbackendRelationsSection in interface ICSPCallbackpublic void beginPredicatesSection(int arg0)
ICSPCallbackbeginPredicatesSection in interface ICSPCallbackarg0 - number of predicates that will be declaredpublic void beginPredicate(String name)
ICSPCallbackbeginPredicate in interface ICSPCallbackname - identifier of the predicatepublic void addFormalParameter(String name, String type)
ICSPCallbackaddFormalParameter in interface ICSPCallbackname - name of the parametertype - type of the parameterpublic void predicateExpression(String expr)
ICSPCallbackpredicateExpression in interface ICSPCallbackexpr - the abstract syntax tree representing the expressionpublic void endPredicate()
ICSPCallbackendPredicate in interface ICSPCallbackpublic void endPredicatesSection()
ICSPCallbackendPredicatesSection in interface ICSPCallbackpublic void beginConstraintsSection(int arg0)
ICSPCallbackbeginConstraintsSection in interface ICSPCallbackarg0 - number of constraints that will be declaredpublic void beginConstraint(String name, int arity)
ICSPCallbackbeginConstraint in interface ICSPCallbackname - identifier of the constraintarity - arity of the constraintpublic void constraintReference(String ref)
ICSPCallbackconstraintReference in interface ICSPCallbackref - the refererence to the definition of this constraint. May be a
relation, a predicate or the name of a global constraintpublic void addVariableToConstraint(String arg0)
ICSPCallbackaddVariableToConstraint in interface ICSPCallbackarg0 - name of the variablepublic void addEffectiveParameter(String arg0)
ICSPCallbackaddEffectiveParameter in interface ICSPCallbackarg0 - name of the variable passed as parameterpublic void addEffectiveParameter(int arg0)
ICSPCallbackaddEffectiveParameter in interface ICSPCallbackarg0 - value of the parameterpublic void beginParameterList()
ICSPCallbackbeginParameterList in interface ICSPCallbackpublic void addIntegerItem(int arg0)
ICSPCallbackaddIntegerItem in interface ICSPCallbackarg0 - value of current list itempublic void addVariableItem(String arg0)
ICSPCallbackaddVariableItem in interface ICSPCallbackarg0 - name of the current list itempublic void endParamaterList()
ICSPCallbackendParamaterList in interface ICSPCallbackpublic void addConstantParameter(String arg0, int arg1)
ICSPCallbackaddConstantParameter in interface ICSPCallbackpublic void constraintExpression(String arg0)
ICSPCallbackconstraintExpression in interface ICSPCallbackarg0 - the expressionpublic void endConstraint()
ICSPCallbackendConstraint in interface ICSPCallbackpublic void endConstraintsSection()
ICSPCallbackendConstraintsSection in interface ICSPCallbackpublic void endInstance()
ICSPCallbackendInstance in interface ICSPCallbackpublic IProblem parseInstance(InputStream in) throws ParseFormatException, ContradictionException, IOException
ReaderparseInstance in class Readerin - a stream containing the benchmark.ParseFormatException - if an error occurs during parsing.ContradictionException - if the problem is found trivially inconsistent.IOException - if an I/O error occurs.Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.