|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.kernel.solver.propagation.Propagator
choco.kernel.solver.constraints.AbstractSConstraint<IntDomainVar>
choco.kernel.solver.constraints.integer.AbstractIntSConstraint
choco.kernel.solver.constraints.integer.AbstractLargeIntSConstraint
choco.cp.solver.constraints.global.BoundGccVar
public class BoundGccVar
User: hcambaza Bound Global cardinality : Given an array of variables vars, an array of variables card to represent the cardinalities, the constraint ensures that the number of occurences of the value i among the variables is equal to card[i]. this constraint enforces : - Bound Consistency over vars regarding the lower and upper bounds of cards - maintain the upperbound of card by counting the number of variables in which each value can occur - maintain the lowerbound of card by counting the number of variables instantiated to a value - enforce card[0] + ... + card[m] = n (n = the number of variables, m = number of values)
Nested Class Summary | |
---|---|
protected static class |
BoundGccVar.Interval
|
Field Summary |
---|
Fields inherited from class choco.kernel.solver.constraints.AbstractSConstraint |
---|
cIndices, constraintType, extensions, vars |
Fields inherited from class choco.kernel.solver.propagation.Propagator |
---|
active, constAwakeEvent, priority, propagationEngine |
Fields inherited from interface choco.kernel.solver.constraints.SConstraint |
---|
LOGGER |
Constructor Summary | |
---|---|
BoundGccVar(IntDomainVar[] vars,
IntDomainVar[] card,
int firstCardValue,
int lastCardValue,
IEnvironment environment)
Bound Global cardinality : Given an array of variables vars, min the minimal value over all variables, and max the maximal value over all variables (or a table IntDomainVar to represent the cardinalities), the constraint ensures that the number of occurences of the value i among the variables is between low[i - min] and up[i - min]. |
Method Summary | |
---|---|
void |
awake()
Propagation: Propagating the constraint for the very first time until local consistency is reached. |
void |
awakeOnInf(int i)
Default propagation on improved lower bound: propagation on domain revision. |
void |
awakeOnInst(int i)
Default propagation on instantiation: full constraint re-propagation. |
void |
awakeOnRem(int idx,
int i)
Only maintain the data structure and update upperbounds of card |
void |
awakeOnSup(int i)
Default propagation on improved upper bound: propagation on domain revision. |
boolean |
directInconsistentCount()
|
void |
dynamicInitOfPartialSum()
|
void |
filterBCOnInf(int i)
|
void |
filterBCOnInst(int val)
Enforce simple occurrences reasonnings on value val no need to reason on the number of possible (instead of sure) values as this will be done as part of the BC on vars |
void |
filterBCOnRem(int val)
|
void |
filterBCOnSup(int i)
|
protected void |
filterLowerMax()
Shrink the lower bounds for the max occurences |
void |
filterLowerMin()
|
protected void |
filterUpperMax()
Shrink the upper bounds for the max occurences |
void |
filterUpperMin()
|
int |
getMaxOcc(int i)
|
int |
getMinOcc(int i)
|
protected void |
init()
|
void |
initBackDataStruct()
|
Boolean |
isEntailed()
Indicates if the constraint is entailed, from now on will be always satisfied |
boolean |
isSatisfied(int[] tuple)
TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet ! |
static IntDomainVar[] |
makeVarTable(IntDomainVar[] vars,
IntDomainVar[] card)
|
protected int |
pathmax(int[] tab,
int i)
|
protected int |
pathmin(int[] tab,
int i)
|
protected void |
pathset(int[] tab,
int start,
int end,
int to)
|
String |
pretty()
pretty printing of the object. |
void |
propagate()
Propagation: Propagating the constraint until local consistency is reached. |
void |
propagateSumCard()
Enforce sum of the cardinalities = nbVariable |
protected void |
sortIt()
|
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint |
---|
awakeOnBounds, awakeOnRemovals, getConstraintType, isConsistent, isSatisfied |
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint |
---|
addExtension, addListener, clone, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, opposite, setConstraintIndex, setExtension, setVar, toString |
Methods inherited from class choco.kernel.solver.propagation.Propagator |
---|
activate, constAwake, fail, getEvent, getFilteredEventMask, getPriority, isActive, setActive, setActiveSilently, setEntailed, setPassive, setPropagationEngine |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BoundGccVar(IntDomainVar[] vars, IntDomainVar[] card, int firstCardValue, int lastCardValue, IEnvironment environment)
Method Detail |
---|
public static IntDomainVar[] makeVarTable(IntDomainVar[] vars, IntDomainVar[] card)
public int getMaxOcc(int i)
public int getMinOcc(int i)
protected void init()
protected final void sortIt()
protected final void pathset(int[] tab, int start, int end, int to)
protected final int pathmin(int[] tab, int i)
protected final int pathmax(int[] tab, int i)
protected final void filterLowerMax() throws ContradictionException
ContradictionException
protected final void filterUpperMax() throws ContradictionException
ContradictionException
public final void filterLowerMin() throws ContradictionException
ContradictionException
public final void filterUpperMin() throws ContradictionException
ContradictionException
public final void initBackDataStruct() throws ContradictionException
ContradictionException
public void awake() throws ContradictionException
Propagator
awake
in class Propagator
ContradictionException
- contradiction exceptionpublic boolean directInconsistentCount()
public final void dynamicInitOfPartialSum()
public void propagate() throws ContradictionException
Propagator
propagate
in class Propagator
ContradictionException
- contradiction exceptionpublic void awakeOnInf(int i) throws ContradictionException
AbstractIntSConstraint
awakeOnInf
in interface IntPropagator
awakeOnInf
in class AbstractIntSConstraint
ContradictionException
public final void filterBCOnInf(int i) throws ContradictionException
ContradictionException
public void awakeOnSup(int i) throws ContradictionException
AbstractIntSConstraint
awakeOnSup
in interface IntPropagator
awakeOnSup
in class AbstractIntSConstraint
ContradictionException
public final void filterBCOnSup(int i) throws ContradictionException
ContradictionException
public void awakeOnInst(int i) throws ContradictionException
AbstractIntSConstraint
awakeOnInst
in interface IntPropagator
awakeOnInst
in class AbstractIntSConstraint
ContradictionException
public final void filterBCOnInst(int val) throws ContradictionException
val
-
ContradictionException
public final void filterBCOnRem(int val) throws ContradictionException
ContradictionException
public void awakeOnRem(int idx, int i) throws ContradictionException
awakeOnRem
in interface IntPropagator
awakeOnRem
in class AbstractIntSConstraint
ContradictionException
public final void propagateSumCard() throws ContradictionException
ContradictionException
public boolean isSatisfied(int[] tuple)
AbstractIntSConstraint
isSatisfied
in interface IntPropagator
isSatisfied
in class AbstractIntSConstraint
public String pretty()
IPretty
pretty
in interface IPretty
pretty
in class AbstractSConstraint<IntDomainVar>
public Boolean isEntailed()
AbstractSConstraint
isEntailed
in class AbstractSConstraint<IntDomainVar>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |