|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.kernel.solver.constraints.integer.extension.ConsistencyRelation
choco.kernel.solver.constraints.integer.extension.TuplesTest
choco.cp.solver.constraints.reified.ExpressionSConstraint
public final class ExpressionSConstraint
User: hcambaza A constraint to deal with complex expression of variables involving a wide range of operators
Nested Class Summary | |
---|---|
static class |
ExpressionSConstraint.VarMinDomComparator
Sort variables from the biggest domain to the smallest |
Field Summary | |
---|---|
protected int[] |
bint
|
protected Boolean |
decomposeExp
Tell the solver if this expression should be decomposed or not (dealt as an extensional constraint if not) if null, the solver will make a decision by itself |
protected INode |
expr
A reference to the Expression itself |
protected SConstraint |
knownIntensionalConstraint
|
protected int |
levelAc
Enforce the level of consistency if the expression is posted as an extentionnal constraint. 0: AC 1: FC |
protected IntDomainVar[] |
vars
The scope of the predicat |
Fields inherited from class choco.kernel.solver.constraints.integer.extension.ConsistencyRelation |
---|
feasible, LOGGER |
Fields inherited from interface choco.kernel.solver.constraints.SConstraint |
---|
LOGGER |
Constructor Summary | |
---|---|
ExpressionSConstraint(BoolNode expr)
Construct an Expression from a root Node |
|
ExpressionSConstraint(BoolNode expr,
Boolean decomp)
Construct an Expression from a root Node |
Method Summary | |
---|---|
void |
addExtension(int extensionNumber)
Adds a new extension. |
double |
cardProd()
|
boolean |
checkCouple(int a,
int b)
Api to check a couple for binary AC |
boolean |
checkDecompositionIsPossible()
|
boolean |
checkIsReified()
|
boolean |
checkTuple(int[] tuple)
Api to check a tuple |
static int[] |
copy(int[] tab)
|
int |
getConstraintIdx(int idx)
Network management: Among all listeners linked to the idx-th variable of c, find the index of constraint c. |
SConstraintType |
getConstraintType()
Return the type of constraint, ie the type of variable involved in the constraint |
SConstraint |
getDecomposition(Solver s)
Perform the decomposition of the Expression into elementary constraints. |
Extension |
getExtension(int extensionNumber)
Returns the queried extension |
SConstraint |
getExtensionnal(Solver s)
return the extensional propagator intended to propagate the expression |
int |
getFineDegree(int idx)
Some global constraint might be able to provide some fine grained information about the "real" degree of a variables. |
SConstraint |
getKnownIntensionalConstraint()
|
int |
getLevelAc()
|
int |
getNbVars()
Network management: Get the number of variables involved in the constraint. |
ExpressionSConstraint |
getOpposite()
return the opposite relation of itself |
INode |
getRootNode()
|
List<int[]> |
getTuples(Solver s)
Generate the list of tuples corresponding to this predicat |
Var |
getVar(int i)
Network management: Accessing the ith variable of a constraint. |
Iterator<IntegerVariable> |
getVariableIterator()
|
Var |
getVarQuick(int i)
Network management: Accessing the ith variable of a constraint. |
IntDomainVar[] |
getVars()
|
boolean |
isConsistent(int x,
int y)
Test whether the couple (x,y) is consistent |
Boolean |
isDecomposeExp()
|
boolean |
isSatisfied()
Semantic: Testing if the constraint is satisfied. |
AbstractSConstraint |
opposite(Solver solver)
computes the constraint modelling the counter-opposite condition of this |
String |
pretty()
pretty printing of the object. |
void |
setConstraintIndex(int i,
int idx)
Network management: Storing that among all listeners linked to the i-th variable of c, this (the current constraint) is found at index idx. |
void |
setDecomposeExp(Boolean decomposeExp)
|
void |
setKnownIntensionalConstraint(SConstraint knownIntensionalConstraint)
|
void |
setLevelAc(int levelAc)
Set the level of AC in case the expression is not decomposed 0 gives AC, 1 gives FC, -1 let the expression choose automatically |
void |
setScope(Solver s)
compute the scope of this predicat as the union of the scopes of all the leaves and set the indexes of each variable of each leave regarding its position in the scope "vars" This is called once when posting the propagator |
void |
setVar(int i,
Var v)
Network management: Setting (or overwriting) the ith variable of a constraint. |
Methods inherited from class choco.kernel.solver.constraints.integer.extension.TuplesTest |
---|
isConsistent |
Methods inherited from class choco.kernel.solver.constraints.integer.extension.ConsistencyRelation |
---|
isDefinedByFeasability, switchToOppositeRelation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IntDomainVar[] vars
protected INode expr
protected Boolean decomposeExp
protected int levelAc
protected SConstraint knownIntensionalConstraint
protected int[] bint
Constructor Detail |
---|
public ExpressionSConstraint(BoolNode expr, Boolean decomp)
expr
- public ExpressionSConstraint(BoolNode expr)
expr
- Method Detail |
---|
public INode getRootNode()
public Boolean isDecomposeExp()
public void setDecomposeExp(Boolean decomposeExp)
public void setScope(Solver s)
public IntDomainVar[] getVars()
public int getNbVars()
SConstraint
getNbVars
in interface SConstraint
public Var getVar(int i)
SConstraint
getVar
in interface SConstraint
i
- index of the variable in the constraint
public Var getVarQuick(int i)
SConstraint
getVarQuick
in interface SConstraint
i
- index of the variable in the constraint
public void setVar(int i, Var v)
SConstraint
setVar
in interface SConstraint
i
- index of the variable in the constraintv
- the variable (may be an IntDomainVar, SetVar, RealVar, ...public int getLevelAc()
public void setLevelAc(int levelAc)
levelAc
- public boolean checkDecompositionIsPossible()
public boolean checkIsReified()
public ExpressionSConstraint getOpposite()
ConsistencyRelation
getOpposite
in class TuplesTest
public SConstraint getKnownIntensionalConstraint()
public void setKnownIntensionalConstraint(SConstraint knownIntensionalConstraint)
public boolean checkCouple(int a, int b)
checkCouple
in interface BinRelation
a
- b
-
public boolean isConsistent(int x, int y)
BinRelation
isConsistent
in interface BinRelation
public boolean checkTuple(int[] tuple)
checkTuple
in interface LargeRelation
tuple
-
public SConstraint getExtensionnal(Solver s)
s
- public SConstraint getDecomposition(Solver s)
s
- public double cardProd()
public List<int[]> getTuples(Solver s)
public String pretty()
IPretty
pretty
in interface IPretty
public SConstraintType getConstraintType()
SConstraint
getConstraintType
in interface SConstraint
public Iterator<IntegerVariable> getVariableIterator()
public void setConstraintIndex(int i, int idx)
SConstraint
setConstraintIndex
in interface SConstraint
i
- index of the variable in the constraintidx
- index of the constraint in the among all listeners linked to that variablepublic int getConstraintIdx(int idx)
SConstraint
getConstraintIdx
in interface SConstraint
idx
- index of the variable in the constraint
public boolean isSatisfied()
SConstraint
isSatisfied
in interface SConstraint
public AbstractSConstraint opposite(Solver solver)
SConstraint
opposite
in interface SConstraint
solver
- the current solver
public static int[] copy(int[] tab)
public Extension getExtension(int extensionNumber)
IExtensionnable
getExtension
in interface IExtensionnable
extensionNumber
- should use the number returned by getAbstractSConstraintExtensionNumber
public void addExtension(int extensionNumber)
addExtension
in interface IExtensionnable
extensionNumber
- should use the number returned by getAbstractSConstraintExtensionNumberpublic int getFineDegree(int idx)
SConstraint
getFineDegree
in interface SConstraint
idx
- index of the variable in the constraint
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |