choco.cp.solver.constraints.set
Class SetCard

java.lang.Object
  extended by choco.kernel.solver.propagation.Propagator
      extended by choco.kernel.solver.constraints.AbstractSConstraint<Var>
          extended by choco.kernel.solver.constraints.set.AbstractMixedSetIntSConstraint
              extended by choco.kernel.solver.constraints.set.AbstractBinSetIntSConstraint
                  extended by choco.cp.solver.constraints.set.SetCard
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<Var>, IntPropagator, SetPropagator, Cloneable, EventListener

public final class SetCard
extends AbstractBinSetIntSConstraint


Field Summary
protected  boolean inf
           
protected  boolean sup
           
 
Fields inherited from class choco.kernel.solver.constraints.set.AbstractBinSetIntSConstraint
v0, v1
 
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
SetCard(SetVar sv, IntDomainVar iv, boolean inf, boolean sup)
           
 
Method Summary
 void awake()
          Propagation: Propagating the constraint for the very first time until local consistency is reached.
 void awakeOnEnvRemovals(int idx, DisposableIntIterator deltaDomain)
          BEWARE: No need to dipose the iterator, this done in the calling methode
 void awakeOnInf(int idx)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnInst(int varIdx)
          Default propagation on instantiation.
 void awakeOnkerAdditions(int idx, DisposableIntIterator deltaDomain)
          BEWARE: No need to dipose the iterator, this done in the calling methode
 void awakeOnRemovals(int idx, DisposableIntIterator 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.
 Object clone()
          Clone the constraint
 void filter()
           
 int getFilteredEventMask(int idx)
           
 boolean isConsistent()
          tests if the constraint is consistent with respect to the current state of domains
 Boolean isEntailed()
          Indicates if the constraint is entailed, from now on will be always satisfied
 boolean isSatisfied()
          Semantic: Testing if the constraint is satisfied.
 String pretty()
          pretty printing of the object.
 void propagate()
          Propagation: Propagating the constraint until local consistency is reached.
 void reactOnInfAndEnvEvents(int envSize)
           
 void reactOnSupAndKerEvents(int kerSize)
           
 String toString()
           
 
Methods inherited from class choco.kernel.solver.constraints.set.AbstractBinSetIntSConstraint
getIntVar, getSetVar
 
Methods inherited from class choco.kernel.solver.constraints.set.AbstractMixedSetIntSConstraint
awakeOnBounds, awakeOnEnv, awakeOnKer, awakeOnRem, getConstraintType, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, opposite, setConstraintIndex, setExtension, setVar
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, constAwake, fail, getEvent, getPriority, isActive, setActive, setActiveSilently, setEntailed, setPassive, setPropagationEngine
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

getFilteredEventMask

public int getFilteredEventMask(int idx)
Overrides:
getFilteredEventMask in class Propagator

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from class: AbstractSConstraint
Clone the constraint

Overrides:
clone in class AbstractSConstraint<Var>
Returns:
the clone of the constraint
Throws:
CloneNotSupportedException - Clone not supported exception

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: AbstractMixedSetIntSConstraint
Default propagation on improved lower bound: propagation on domain revision.

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class AbstractMixedSetIntSConstraint
Throws:
ContradictionException

awakeOnSup

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

Specified by:
awakeOnSup in interface IntPropagator
Overrides:
awakeOnSup in class AbstractMixedSetIntSConstraint
Throws:
ContradictionException

awakeOnRemovals

public void awakeOnRemovals(int idx,
                            DisposableIntIterator deltaDomain)
                     throws ContradictionException
Description copied from class: AbstractMixedSetIntSConstraint
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 IntPropagator
Overrides:
awakeOnRemovals in class AbstractMixedSetIntSConstraint
Throws:
ContradictionException

awakeOnkerAdditions

public void awakeOnkerAdditions(int idx,
                                DisposableIntIterator deltaDomain)
                         throws ContradictionException
Description copied from interface: SetPropagator
BEWARE: No need to dipose the iterator, this done in the calling methode

Specified by:
awakeOnkerAdditions in interface SetPropagator
Overrides:
awakeOnkerAdditions in class AbstractMixedSetIntSConstraint
Throws:
ContradictionException

awakeOnEnvRemovals

public void awakeOnEnvRemovals(int idx,
                               DisposableIntIterator deltaDomain)
                        throws ContradictionException
Description copied from interface: SetPropagator
BEWARE: No need to dipose the iterator, this done in the calling methode

Specified by:
awakeOnEnvRemovals in interface SetPropagator
Overrides:
awakeOnEnvRemovals in class AbstractMixedSetIntSConstraint
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int varIdx)
                 throws ContradictionException
Description copied from interface: SetPropagator
Default propagation on instantiation.

Specified by:
awakeOnInst in interface IntPropagator
Specified by:
awakeOnInst in interface SetPropagator
Overrides:
awakeOnInst in class AbstractMixedSetIntSConstraint
Throws:
ContradictionException

isSatisfied

public boolean isSatisfied()
Description copied from interface: SConstraint
Semantic: Testing if the constraint is satisfied. Note that all variables involved in the constraint must be instantiated when this method is called.

Returns:
true if the constraint is satisfied

toString

public String toString()
Overrides:
toString in class AbstractSConstraint<Var>

pretty

public String pretty()
Description copied from interface: IPretty
pretty printing of the object. This String is not constant and may depend on the context.

Specified by:
pretty in interface IPretty
Overrides:
pretty in class AbstractSConstraint<Var>
Returns:
a readable string representation of the object

awake

public void awake()
           throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint for the very first time until local consistency is reached.

Overrides:
awake in class Propagator
Throws:
ContradictionException - contradiction exception

propagate

public void propagate()
               throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint until local consistency is reached.

Specified by:
propagate in class Propagator
Throws:
ContradictionException - contradiction exception

isConsistent

public boolean isConsistent()
Description copied from class: AbstractMixedSetIntSConstraint
tests if the constraint is consistent with respect to the current state of domains

Overrides:
isConsistent in class AbstractMixedSetIntSConstraint
Returns:
wether the constraint is consistent

isEntailed

public Boolean isEntailed()
Description copied from class: AbstractSConstraint
Indicates if the constraint is entailed, from now on will be always satisfied

Overrides:
isEntailed in class AbstractSConstraint<Var>
Returns:
wether the constraint is entailed


Copyright © 2012. All Rights Reserved.