choco.real.constraint
Class MixedCstElt
java.lang.Object
choco.AbstractEntity
choco.AbstractConstraint
choco.real.constraint.AbstractBinRealIntConstraint
choco.real.constraint.MixedCstElt
- All Implemented Interfaces:
- Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, MixedConstraint, RealListener, java.lang.Cloneable, java.util.EventListener
- Direct Known Subclasses:
- PalmMixedCstElt
public class MixedCstElt
- extends AbstractBinRealIntConstraint
- implements MixedConstraint
Let x be an integer variable with n values and v be a real variable. Given n constant values a1 to an,
this constraint ensures that:
x = i iff v = ai
a1... an sequence is supposed to be ordered (a1<a2<... an)
Field Summary |
protected double[] |
values
|
Method Summary |
int |
assignIndices(AbstractCompositeConstraint root,
int i,
boolean dynamicAddition)
performs the global numbering (wrt root) of the variables contained in the subtree this, starting from i |
void |
awake()
Default initial propagation: full constraint re-propagation. |
void |
awakeOnBounds(int idx)
|
void |
awakeOnInf(int idx)
Default propagation on improved lower bound: propagation on domain revision. |
void |
awakeOnInst(int varIdx)
Default propagation on instantiation: full constraint re-propagation. |
void |
awakeOnRem(int varIdx,
int val)
Default propagation on one value removal: propagation on domain revision. |
void |
awakeOnRemovals(int varIdx,
IntIterator deltaDomain)
|
void |
awakeOnSup(int idx)
Default propagation on improved upper bound: propagation on domain revision. |
java.lang.Object |
clone()
returns a copy of the constraint. |
boolean |
isConsistent()
tests if the constraint is consistent with respect to the current state of domains |
boolean |
isSatisfied()
Semantic:
Testing if the constraint is satisfied. |
void |
propagate()
Propagation:
Propagating the constraint until local consistency is reached. |
void |
updateIInf()
|
void |
updateISup()
|
void |
updateReal()
|
Methods inherited from class choco.AbstractConstraint |
addListener, awakeOnVar, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEntailed, isEquivalentTo, opposite, setActive, setEntailed, setPassive, setPlugIn, substituteVar |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
values
protected double[] values
MixedCstElt
public MixedCstElt(RealVar v0,
IntDomainVar v1,
double[] values)
clone
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
- Description copied from interface:
Constraint
- returns a copy of the constraint. This copy is a new object, may be a recursive copy in case
of composite constraints. The original and the copy share the same variables & plugins
- Specified by:
clone
in interface Constraint
- Overrides:
clone
in class AbstractBinRealIntConstraint
- Returns:
-
- Throws:
java.lang.CloneNotSupportedException
awake
public void awake()
throws ContradictionException
- Description copied from class:
AbstractConstraint
- Default initial propagation: full constraint re-propagation.
- Specified by:
awake
in interface Propagator
- Overrides:
awake
in class AbstractConstraint
- Throws:
ContradictionException
propagate
public void propagate()
throws ContradictionException
- Description copied from interface:
Propagator
- Propagation:
Propagating the constraint until local consistency is reached.
- Specified by:
propagate
in interface Propagator
- Throws:
ContradictionException
awakeOnInf
public void awakeOnInf(int idx)
throws ContradictionException
- Description copied from interface:
IntVarEventListener
- Default propagation on improved lower bound: propagation on domain revision.
- Specified by:
awakeOnInf
in interface IntVarEventListener
- Specified by:
awakeOnInf
in interface RealListener
- Throws:
ContradictionException
awakeOnSup
public void awakeOnSup(int idx)
throws ContradictionException
- Description copied from interface:
IntVarEventListener
- Default propagation on improved upper bound: propagation on domain revision.
- Specified by:
awakeOnSup
in interface IntVarEventListener
- Specified by:
awakeOnSup
in interface RealListener
- Throws:
ContradictionException
awakeOnBounds
public void awakeOnBounds(int idx)
throws ContradictionException
- Specified by:
awakeOnBounds
in interface IntConstraint
- Throws:
ContradictionException
awakeOnInst
public void awakeOnInst(int varIdx)
throws ContradictionException
- Description copied from interface:
IntVarEventListener
- Default propagation on instantiation: full constraint re-propagation.
- Specified by:
awakeOnInst
in interface IntVarEventListener
- Throws:
ContradictionException
awakeOnRem
public void awakeOnRem(int varIdx,
int val)
throws ContradictionException
- Description copied from interface:
IntVarEventListener
- Default propagation on one value removal: propagation on domain revision.
- Specified by:
awakeOnRem
in interface IntVarEventListener
- Throws:
ContradictionException
awakeOnRemovals
public void awakeOnRemovals(int varIdx,
IntIterator deltaDomain)
throws ContradictionException
- Specified by:
awakeOnRemovals
in interface IntConstraint
- Throws:
ContradictionException
updateIInf
public void updateIInf()
throws ContradictionException
- Throws:
ContradictionException
updateISup
public void updateISup()
throws ContradictionException
- Throws:
ContradictionException
updateReal
public void updateReal()
throws ContradictionException
- Throws:
ContradictionException
isConsistent
public boolean isConsistent()
- Description copied from interface:
Propagator
- tests if the constraint is consistent with respect to the current state of domains
- Specified by:
isConsistent
in interface Propagator
isSatisfied
public boolean isSatisfied()
- Description copied from interface:
Constraint
- Semantic:
Testing if the constraint is satisfied.
Note that all variables involved in the constraint must be
instantiated when this method is called.
- Specified by:
isSatisfied
in interface Constraint
assignIndices
public int assignIndices(AbstractCompositeConstraint root,
int i,
boolean dynamicAddition)
- Description copied from interface:
Propagator
- performs the global numbering (wrt root) of the variables contained in the subtree this, starting from i
- Specified by:
assignIndices
in interface Propagator
- Parameters:
root
- the overall root constraint, for which the variables are numberedi
- the index that will assigned to the first variable in the subtree this (originally 0)dynamicAddition
- whether the addition is undone automatically on backtracking
- Returns:
- the index of the last variable in the subtree