choco.set.constraint
Class SetCard

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.set.constraint.AbstractMixedConstraint
              extended by choco.set.constraint.AbstractBinSetIntConstraint
                  extended by choco.set.constraint.SetCard
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, SetConstraint, SetVarEventListener, java.lang.Cloneable, java.util.EventListener

public class SetCard
extends AbstractBinSetIntConstraint


Field Summary
protected  boolean inf
           
protected  boolean sup
           
 
Fields inherited from class choco.set.constraint.AbstractBinSetIntConstraint
cIdx0, cIdx1, v0, v1
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
SetCard(SetVar sv, IntDomainVar iv, boolean inf, boolean sup)
           
 
Method Summary
 void awake()
          Default initial propagation: full constraint re-propagation.
 void awakeOnEnvRemovals(int idx, IntIterator deltaDomain)
           
 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 awakeOnkerAdditions(int idx, IntIterator deltaDomain)
           
 void awakeOnRemovals(int idx, IntIterator deltaDomain)
          The default implementation of propagation when a variable has been modified consists in iterating all values that have been removed (the delta domain) and propagate them one after another, incrementally.
 void awakeOnSup(int idx)
          Default propagation on improved upper bound: propagation on domain revision.
 java.lang.Object clone()
          returns a copy of the constraint.
 void filter()
           
 boolean isConsistent()
          tests if the constraint is consistent with respect to the current state of domains
 java.lang.Boolean isEntailed()
          Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.
 boolean isSatisfied()
          Semantic: Testing if the constraint is satisfied.
 void propagate()
          Propagation: Propagating the constraint until local consistency is reached.
 void reactOnInfAndEnvEvents(int envSize)
           
 void reactOnSupAndKerEvents(int kerSize)
           
 
Methods inherited from class choco.set.constraint.AbstractBinSetIntConstraint
assignIndices, getConstraintIdx, getIntVar, getNbVars, getSetVar, getVar, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.set.constraint.AbstractMixedConstraint
awakeOnBounds, awakeOnEnv, awakeOnKer, awakeOnRem, getSelfIndex
 
Methods inherited from class choco.AbstractConstraint
addListener, awakeOnVar, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, isEquivalentTo, opposite, setActive, setEntailed, setPassive, setPlugIn, substituteVar
 
Methods inherited from class choco.AbstractEntity
pretty
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface choco.Propagator
awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.Propagator
awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Field Detail

inf

protected boolean inf

sup

protected boolean sup
Constructor Detail

SetCard

public SetCard(SetVar sv,
               IntDomainVar iv,
               boolean inf,
               boolean sup)
Method Detail

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 AbstractConstraint
Returns:
Throws:
java.lang.CloneNotSupportedException

reactOnInfAndEnvEvents

public void reactOnInfAndEnvEvents(int envSize)
                            throws ContradictionException
Throws:
ContradictionException

reactOnSupAndKerEvents

public void reactOnSupAndKerEvents(int kerSize)
                            throws ContradictionException
Throws:
ContradictionException

filter

public void filter()
            throws ContradictionException
Throws:
ContradictionException

awakeOnInf

public void awakeOnInf(int idx)
                throws ContradictionException
Description copied from class: AbstractMixedConstraint
Default propagation on improved lower bound: propagation on domain revision.

Specified by:
awakeOnInf in interface IntVarEventListener
Overrides:
awakeOnInf in class AbstractMixedConstraint
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
Description copied from class: AbstractMixedConstraint
Default propagation on improved upper bound: propagation on domain revision.

Specified by:
awakeOnSup in interface IntVarEventListener
Overrides:
awakeOnSup in class AbstractMixedConstraint
Throws:
ContradictionException

awakeOnRemovals

public void awakeOnRemovals(int idx,
                            IntIterator deltaDomain)
                     throws ContradictionException
Description copied from class: AbstractMixedConstraint
The default implementation of propagation when a variable has been modified consists in iterating all values that have been removed (the delta domain) and propagate them one after another, incrementally.

Specified by:
awakeOnRemovals in interface IntConstraint
Overrides:
awakeOnRemovals in class AbstractMixedConstraint
Throws:
ContradictionException

awakeOnkerAdditions

public void awakeOnkerAdditions(int idx,
                                IntIterator deltaDomain)
                         throws ContradictionException
Specified by:
awakeOnkerAdditions in interface SetConstraint
Overrides:
awakeOnkerAdditions in class AbstractMixedConstraint
Throws:
ContradictionException

awakeOnEnvRemovals

public void awakeOnEnvRemovals(int idx,
                               IntIterator deltaDomain)
                        throws ContradictionException
Specified by:
awakeOnEnvRemovals in interface SetConstraint
Overrides:
awakeOnEnvRemovals in class AbstractMixedConstraint
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
Specified by:
awakeOnInst in interface SetVarEventListener
Overrides:
awakeOnInst in class AbstractMixedConstraint
Throws:
ContradictionException

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.


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.

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


isEntailed

public java.lang.Boolean isEntailed()
Description copied from interface: Propagator
Checks whether the constraint is definitely satisfied, no matter what further restrictions occur to the domain of its variables.

Specified by:
isEntailed in interface Propagator
Overrides:
isEntailed in class AbstractConstraint