choco.global
Class Occurrence

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.integer.constraints.AbstractIntConstraint
              extended by choco.integer.constraints.AbstractLargeIntConstraint
                  extended by choco.global.Occurrence
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
PalmOccurence

public class Occurrence
extends AbstractLargeIntConstraint


Field Summary
 boolean constrainOnInfNumber
           
 boolean constrainOnSupNumber
           
 StoredBitSet isPossible
          isPossible[i] is true if variable i can take the occurence value
 StoredBitSet isSure
          isSure[i] is true if variable i is instantiated to the occurence value.
 StoredInt nbPossible
          Store the number of variables which can still take the occurence value
 StoredInt nbSure
          Store the number of variables which are instantiated to the occurence value
 
Fields inherited from class choco.integer.constraints.AbstractLargeIntConstraint
cIndices, cste, vars
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
Occurrence(IntDomainVar[] vars, int occval, boolean onInf, boolean onSup)
          Constructor, API: should be used through the Problem.createOccurrence API Define an occurence constraint setting size{forall v in lvars | v = occval} <= or >= or = occVar assumes the occVar variable to be the last of the variables of the constraint: vars = [lvars | occVar] with lvars = list of variables for which the occurence of occval in their domain is constrained
 
Method Summary
 void awake()
          Default initial propagation: full constraint re-propagation.
 void awakeOnInf(int idx)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnInst(int idx)
          Default propagation on instantiation: full constraint re-propagation.
 void awakeOnRem(int idx, int x)
          Default propagation on one value removal: propagation on domain revision.
 void awakeOnSup(int idx)
          Default propagation on improved upper bound: propagation on domain revision.
 void checkNbPossible()
           
 void checkNbSure()
           
 java.lang.Object clone()
          returns a copy of the constraint.
 void filter()
           
 void init(int occval, boolean onInf, boolean onSup)
           
 boolean isSatisfied()
          Semantic: Testing if the constraint is satisfied.
 java.lang.String pretty()
          pretty printing of the object.
 void propagate()
          Propagates the constraint awake events.
 
Methods inherited from class choco.integer.constraints.AbstractLargeIntConstraint
assignIndices, getConstraintIdx, getIntVar, getNbVars, getVar, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.integer.constraints.AbstractIntConstraint
awakeOnBounds, awakeOnRemovals, getSelfIndex, isConsistent
 
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
 
Methods inherited from interface choco.Propagator
awakeOnVar, constAwake, delete, getEvent, getPlugIn, getPriority, isEntailed
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 
Methods inherited from interface choco.prop.VarEventListener
addListener, isActive, setActive, setPassive
 

Field Detail

isPossible

public StoredBitSet isPossible
isPossible[i] is true if variable i can take the occurence value


isSure

public StoredBitSet isSure
isSure[i] is true if variable i is instantiated to the occurence value.


nbPossible

public StoredInt nbPossible
Store the number of variables which can still take the occurence value


nbSure

public StoredInt nbSure
Store the number of variables which are instantiated to the occurence value


constrainOnInfNumber

public boolean constrainOnInfNumber

constrainOnSupNumber

public boolean constrainOnSupNumber
Constructor Detail

Occurrence

public Occurrence(IntDomainVar[] vars,
                  int occval,
                  boolean onInf,
                  boolean onSup)
Constructor, API: should be used through the Problem.createOccurrence API Define an occurence constraint setting size{forall v in lvars | v = occval} <= or >= or = occVar assumes the occVar variable to be the last of the variables of the constraint: vars = [lvars | occVar] with lvars = list of variables for which the occurence of occval in their domain is constrained

Parameters:
occval - checking value
onInf - if true, constraint insures size{forall v in lvars | v = occval} <= occVar
onSup - if true, constraint insure size{forall v in lvars | v = occval} >= occVar
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 AbstractLargeIntConstraint
Returns:
Throws:
java.lang.CloneNotSupportedException

init

public void init(int occval,
                 boolean onInf,
                 boolean onSup)

awakeOnInf

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

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

awakeOnSup

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

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

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
Description copied from class: AbstractIntConstraint
Default propagation on instantiation: full constraint re-propagation.

Specified by:
awakeOnInst in interface IntVarEventListener
Overrides:
awakeOnInst in class AbstractIntConstraint
Throws:
ContradictionException

awakeOnRem

public void awakeOnRem(int idx,
                       int x)
                throws ContradictionException
Description copied from class: AbstractIntConstraint
Default propagation on one value removal: propagation on domain revision.

Specified by:
awakeOnRem in interface IntVarEventListener
Overrides:
awakeOnRem in class AbstractIntConstraint
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.


checkNbPossible

public void checkNbPossible()
                     throws ContradictionException
Throws:
ContradictionException

checkNbSure

public void checkNbSure()
                 throws ContradictionException
Throws:
ContradictionException

filter

public void filter()
            throws ContradictionException
Throws:
ContradictionException

propagate

public void propagate()
               throws ContradictionException
Description copied from class: AbstractLargeIntConstraint
Propagates the constraint awake events.

Specified by:
propagate in interface Propagator
Overrides:
propagate in class AbstractLargeIntConstraint
Throws:
ContradictionException

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

pretty

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

Specified by:
pretty in interface Entity
Overrides:
pretty in class AbstractEntity
Returns:
a readable string representation of the object