org.sat4j.reader
Class CSPReader
java.lang.Object
org.sat4j.reader.Reader
org.sat4j.reader.CSPReader
- All Implemented Interfaces:
- ICSPCallback
- Direct Known Subclasses:
- CSPExtSupportReader, CSPSupportReader
public class CSPReader
- extends Reader
- implements ICSPCallback
This class is a CSP to SAT translator that is able to read a CSP problem
using the First CSP solver competition input format and that translates it
into clausal and cardinality (equality) constraints.
That code has not been tested very thoroughly yet and was written very
quickly to meet the competition deadline :=)) There is plenty of room for
improvement.
- Author:
- leberre
Method Summary |
void |
addConstantParameter(java.lang.String arg0,
int arg1)
|
void |
addDomainValue(int arg0)
|
void |
addDomainValue(int begin,
int end)
|
void |
addEffectiveParameter(int arg0)
|
void |
addEffectiveParameter(java.lang.String arg0)
|
void |
addFormalParameter(java.lang.String name,
java.lang.String type)
|
void |
addIntegerItem(int arg0)
|
void |
addRelationTuple(int[] tuple)
|
void |
addVariable(java.lang.String idvar,
java.lang.String iddomain)
|
void |
addVariableItem(java.lang.String arg0)
|
void |
addVariableToConstraint(java.lang.String arg0)
|
void |
beginConstraint(java.lang.String name,
int arity)
|
void |
beginConstraintsSection(int arg0)
|
void |
beginDomain(java.lang.String id,
int size)
|
void |
beginDomainsSection(int nbdomain)
|
void |
beginInstance(java.lang.String arg0)
|
void |
beginParameterList()
|
void |
beginPredicate(java.lang.String name)
|
void |
beginPredicatesSection(int arg0)
|
void |
beginRelation(java.lang.String name,
int arity,
int nbTuples,
boolean isSupport)
|
void |
beginRelationsSection(int nbrel)
|
void |
beginVariablesSection(int expectedNumberOfVariables)
|
void |
constraintExpression(java.lang.String arg0)
|
void |
constraintReference(java.lang.String ref)
|
java.lang.String |
decode(int[] model)
|
void |
decode(int[] model,
java.io.PrintWriter out)
|
void |
endConstraint()
|
void |
endConstraintsSection()
|
void |
endDomain()
|
void |
endDomainsSection()
|
void |
endInstance()
|
void |
endParamaterList()
|
void |
endPredicate()
|
void |
endPredicatesSection()
|
void |
endRelation()
|
void |
endRelationsSection()
|
void |
endVariablesSection()
|
protected void |
manageAllowedTuples(int relnum,
int arity,
int nbtuples)
|
IProblem |
parseInstance(java.io.Reader in)
|
void |
predicateExpression(java.lang.String expr)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
relations
protected Relation[] relations
CSPReader
public CSPReader(ISolver solver)
parseInstance
public final IProblem parseInstance(java.io.Reader in)
throws ParseFormatException,
ContradictionException,
java.io.IOException
- Specified by:
parseInstance
in class Reader
- Throws:
ParseFormatException
ContradictionException
java.io.IOException
decode
public void decode(int[] model,
java.io.PrintWriter out)
- Specified by:
decode
in class Reader
decode
public java.lang.String decode(int[] model)
- Specified by:
decode
in class Reader
manageAllowedTuples
protected void manageAllowedTuples(int relnum,
int arity,
int nbtuples)
beginInstance
public void beginInstance(java.lang.String arg0)
- Specified by:
beginInstance
in interface ICSPCallback
beginDomainsSection
public void beginDomainsSection(int nbdomain)
- Specified by:
beginDomainsSection
in interface ICSPCallback
beginDomain
public void beginDomain(java.lang.String id,
int size)
- Specified by:
beginDomain
in interface ICSPCallback
addDomainValue
public void addDomainValue(int arg0)
- Specified by:
addDomainValue
in interface ICSPCallback
addDomainValue
public void addDomainValue(int begin,
int end)
- Specified by:
addDomainValue
in interface ICSPCallback
endDomain
public void endDomain()
- Specified by:
endDomain
in interface ICSPCallback
endDomainsSection
public void endDomainsSection()
- Specified by:
endDomainsSection
in interface ICSPCallback
beginVariablesSection
public void beginVariablesSection(int expectedNumberOfVariables)
- Specified by:
beginVariablesSection
in interface ICSPCallback
addVariable
public void addVariable(java.lang.String idvar,
java.lang.String iddomain)
- Specified by:
addVariable
in interface ICSPCallback
endVariablesSection
public void endVariablesSection()
- Specified by:
endVariablesSection
in interface ICSPCallback
beginRelationsSection
public void beginRelationsSection(int nbrel)
- Specified by:
beginRelationsSection
in interface ICSPCallback
beginRelation
public void beginRelation(java.lang.String name,
int arity,
int nbTuples,
boolean isSupport)
- Specified by:
beginRelation
in interface ICSPCallback
addRelationTuple
public void addRelationTuple(int[] tuple)
- Specified by:
addRelationTuple
in interface ICSPCallback
endRelation
public void endRelation()
- Specified by:
endRelation
in interface ICSPCallback
endRelationsSection
public void endRelationsSection()
- Specified by:
endRelationsSection
in interface ICSPCallback
beginPredicatesSection
public void beginPredicatesSection(int arg0)
- Specified by:
beginPredicatesSection
in interface ICSPCallback
beginPredicate
public void beginPredicate(java.lang.String name)
- Specified by:
beginPredicate
in interface ICSPCallback
addFormalParameter
public void addFormalParameter(java.lang.String name,
java.lang.String type)
- Specified by:
addFormalParameter
in interface ICSPCallback
predicateExpression
public void predicateExpression(java.lang.String expr)
- Specified by:
predicateExpression
in interface ICSPCallback
endPredicate
public void endPredicate()
- Specified by:
endPredicate
in interface ICSPCallback
endPredicatesSection
public void endPredicatesSection()
- Specified by:
endPredicatesSection
in interface ICSPCallback
beginConstraintsSection
public void beginConstraintsSection(int arg0)
- Specified by:
beginConstraintsSection
in interface ICSPCallback
beginConstraint
public void beginConstraint(java.lang.String name,
int arity)
- Specified by:
beginConstraint
in interface ICSPCallback
constraintReference
public void constraintReference(java.lang.String ref)
- Specified by:
constraintReference
in interface ICSPCallback
addVariableToConstraint
public void addVariableToConstraint(java.lang.String arg0)
- Specified by:
addVariableToConstraint
in interface ICSPCallback
addEffectiveParameter
public void addEffectiveParameter(java.lang.String arg0)
- Specified by:
addEffectiveParameter
in interface ICSPCallback
addEffectiveParameter
public void addEffectiveParameter(int arg0)
- Specified by:
addEffectiveParameter
in interface ICSPCallback
beginParameterList
public void beginParameterList()
- Specified by:
beginParameterList
in interface ICSPCallback
addIntegerItem
public void addIntegerItem(int arg0)
- Specified by:
addIntegerItem
in interface ICSPCallback
addVariableItem
public void addVariableItem(java.lang.String arg0)
- Specified by:
addVariableItem
in interface ICSPCallback
endParamaterList
public void endParamaterList()
- Specified by:
endParamaterList
in interface ICSPCallback
addConstantParameter
public void addConstantParameter(java.lang.String arg0,
int arg1)
- Specified by:
addConstantParameter
in interface ICSPCallback
constraintExpression
public void constraintExpression(java.lang.String arg0)
- Specified by:
constraintExpression
in interface ICSPCallback
endConstraint
public void endConstraint()
- Specified by:
endConstraint
in interface ICSPCallback
endConstraintsSection
public void endConstraintsSection()
- Specified by:
endConstraintsSection
in interface ICSPCallback
endInstance
public void endInstance()
- Specified by:
endInstance
in interface ICSPCallback
Copyright © 2009 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.