choco.integer.constraints
Class TimesXYZ

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.AbstractConstraint
          extended by choco.integer.constraints.AbstractIntConstraint
              extended by choco.integer.constraints.AbstractTernIntConstraint
                  extended by choco.integer.constraints.TimesXYZ
All Implemented Interfaces:
Constraint, Entity, IntConstraint, IntVarEventListener, VarEventListener, Propagator, java.lang.Cloneable, java.util.EventListener

public class TimesXYZ
extends AbstractTernIntConstraint

a constraint modelling X * Y = Z


Field Summary
 
Fields inherited from class choco.integer.constraints.AbstractTernIntConstraint
cIdx0, cIdx1, cIdx2, v0, v1, v2
 
Fields inherited from class choco.integer.constraints.AbstractIntConstraint
logger
 
Fields inherited from class choco.AbstractConstraint
active, constAwakeEvent, hook, priority
 
Fields inherited from class choco.AbstractEntity
problem
 
Constructor Summary
TimesXYZ(IntDomainVar x, IntDomainVar y, IntDomainVar z)
           
 
Method Summary
 void awakeOnInf(int idx)
          Default propagation on improved lower bound: propagation on domain revision.
 void awakeOnInst(int vIdx)
          Default propagation on instantiation: full constraint re-propagation.
 void awakeOnSup(int idx)
          Default propagation on improved upper bound: propagation on domain revision.
 void awakeOnVar(int idx)
          Default propagation on variable revision: full constraint re-propagation.
protected  void awakeOnX()
          reaction when X (v0) is updated
protected  void awakeOnY()
           
protected  void awakeOnZ()
           
protected  int getXmaxIfNonZero()
           
protected  int getXminIfNonZero()
           
protected  int getYmaxIfNonZero()
           
protected  int getYminIfNonZero()
           
protected  int getZmax()
           
protected  int getZmin()
           
 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 for the constraint awake var.
 void propagateZero()
          propagate the fact that v2 (Z) is instantiated to 0
protected  boolean shaveOnX()
          Updating X and Y when Z can be 0
protected  void shaveOnXandY()
           
protected  boolean shaveOnY()
           
protected  void shaveOnYandX()
           
protected  boolean updateX()
          Updating X and Y when Z cannot be 0
protected  void updateXandY()
          loop until a fix point is reach (see testProd14)
protected  boolean updateY()
           
protected  void updateYandX()
           
 
Methods inherited from class choco.integer.constraints.AbstractTernIntConstraint
assignIndices, getConstraintIdx, getIntVar, getNbVars, getVar, isCompletelyInstantiated, setConstraintIndex, setVar
 
Methods inherited from class choco.integer.constraints.AbstractIntConstraint
awakeOnBounds, awakeOnRem, awakeOnRemovals, getSelfIndex, isConsistent
 
Methods inherited from class choco.AbstractConstraint
addListener, awake, clone, 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
awake, 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
 

Constructor Detail

TimesXYZ

public TimesXYZ(IntDomainVar x,
                IntDomainVar y,
                IntDomainVar z)
Method Detail

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.


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

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

awakeOnVar

public void awakeOnVar(int idx)
                throws ContradictionException
Description copied from class: AbstractConstraint
Default propagation on variable revision: full constraint re-propagation.

Specified by:
awakeOnVar in interface VarEventListener
Specified by:
awakeOnVar in interface Propagator
Overrides:
awakeOnVar in class AbstractConstraint
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int vIdx)
                 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

awakeOnX

protected void awakeOnX()
                 throws ContradictionException
reaction when X (v0) is updated

Throws:
ContradictionException

awakeOnY

protected void awakeOnY()
                 throws ContradictionException
Throws:
ContradictionException

awakeOnZ

protected void awakeOnZ()
                 throws ContradictionException
Throws:
ContradictionException

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

getXminIfNonZero

protected int getXminIfNonZero()

getXmaxIfNonZero

protected int getXmaxIfNonZero()

getYminIfNonZero

protected int getYminIfNonZero()

getYmaxIfNonZero

protected int getYmaxIfNonZero()

getZmin

protected int getZmin()

getZmax

protected int getZmax()

propagate

public void propagate()
               throws ContradictionException
Description copied from class: AbstractTernIntConstraint
Propagation for the constraint awake var.

Specified by:
propagate in interface Propagator
Overrides:
propagate in class AbstractTernIntConstraint
Throws:
ContradictionException - if a domain becomes empty or the filtering algorithm infers a contradiction

propagateZero

public void propagateZero()
                   throws ContradictionException
propagate the fact that v2 (Z) is instantiated to 0

Throws:
ContradictionException

updateX

protected boolean updateX()
                   throws ContradictionException
Updating X and Y when Z cannot be 0

Throws:
ContradictionException

updateY

protected boolean updateY()
                   throws ContradictionException
Throws:
ContradictionException

updateXandY

protected void updateXandY()
                    throws ContradictionException
loop until a fix point is reach (see testProd14)

Throws:
ContradictionException

updateYandX

protected void updateYandX()
                    throws ContradictionException
Throws:
ContradictionException

shaveOnX

protected boolean shaveOnX()
                    throws ContradictionException
Updating X and Y when Z can be 0

Throws:
ContradictionException

shaveOnY

protected boolean shaveOnY()
                    throws ContradictionException
Throws:
ContradictionException

shaveOnXandY

protected void shaveOnXandY()
                     throws ContradictionException
Throws:
ContradictionException

shaveOnYandX

protected void shaveOnYandX()
                     throws ContradictionException
Throws:
ContradictionException